1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
//##########################################################################
//# #
//# CCLIB #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU Library General Public License as #
//# published by the Free Software Foundation; version 2 or later of the #
//# License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
//# #
//##########################################################################
#ifndef CC_MISC_TOOLS_HEADER
#define CC_MISC_TOOLS_HEADER
//Local
#include "CCGeom.h"
#include "CCToolbox.h"
namespace CCLib
{
//! Miscellaneous useful functions (geometrical elements handling)
class CC_CORE_LIB_API CCMiscTools : public CCToolbox
{
public:
//! Proportionally enlarges a 3D box
/** \param dimMin the upper-left corner of the box
\param dimMax the lower-right corner of the box
\param coef the enlargement coefficient (1.1 <-> +10%)
**/
static void EnlargeBox( CCVector3& dimMin,
CCVector3& dimMax,
double coef);
//! Transforms a 3D box into a 3D cube
/** The cube dimensions will be equal to the largest box dimension.
\param dimMin the upper-left corner of the rectangle
\param dimMax the lower-right corner of the rectangle
\param enlargeFactor the resulting box can be automatically enlarged if this parameter is greater than 0
**/
static void MakeMinAndMaxCubical( CCVector3& dimMin,
CCVector3& dimMax,
double enlargeFactor = 0.01);
//! Computes base vectors for a given 3D plane
/** Determines at least two orthogonal vectors perpendicular to a third one
\param[in] N a non null vector
\param[out] X the first vector (a 3 coordinates array to be updated by the algorithm)
\param[out] Y the second vector (a 3 coordinates array to be updated by the algorithm)
**/
static void ComputeBaseVectors( const CCVector3 &N,
CCVector3& X,
CCVector3& Y);
//! Computes base vectors for a given 3D plane - double version
/** Determines at least two orthogonal vectors perpendicular to a third one
\param[in] N a non null vector
\param[out] X the first vector (a 3 coordinates array to be updated by the algorithm)
\param[out] Y the second vector (a 3 coordinates array to be updated by the algorithm)
**/
static void ComputeBaseVectors( const CCVector3d &N,
CCVector3d& X,
CCVector3d& Y);
//! Ovelap test between a 3D box and a triangle
/** \param boxcenter the box center
\param boxhalfsize the box half dimensions
\param triverts the 3 triangle vertices
\return true if the input box and triangle overlap, false otherwise
**/
static bool TriBoxOverlap(const CCVector3& boxcenter,
const CCVector3& boxhalfsize,
const CCVector3* triverts[3]);
//! Ovelap test between a 3D box and a triangle (double version)
/** \param boxcenter the box center
\param boxhalfsize the box half dimensions
\param triverts the 3 triangle vertices
\return true if the input box and triangle overlap, false otherwise
**/
static bool TriBoxOverlapd(const CCVector3d& boxcenter,
const CCVector3d& boxhalfsize,
const CCVector3d triverts[3]);
};
}
#endif //CC_MISC_TOOLS_HEADER
|