Include :
- aggiunte funzioni di utilità per plane3d e bbox3d.
This commit is contained in:
@@ -122,9 +122,13 @@ class EGK_EXPORT BBox3d
|
||||
if ( dSqDist < EPS_ZERO)
|
||||
return 0 ;
|
||||
return sqrt( dSqDist) ; }
|
||||
std::vector<Point3d> GetVertices() const ;
|
||||
Point3d GetVertex( int nVert) const ;
|
||||
bool Overlaps( const Frame3d& frThis, const BBox3d& bbOther, const Frame3d& frOther) const ;
|
||||
|
||||
private :
|
||||
bool IsValid( void) const ;
|
||||
int ChooseVertex( const Vector3d& vtDir) const ;
|
||||
|
||||
private :
|
||||
Point3d m_ptMin ;
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
class Plane3d
|
||||
{
|
||||
public:
|
||||
enum Side { POS = + 1,
|
||||
NEG = - 1,
|
||||
ON = 0
|
||||
} ;
|
||||
|
||||
public :
|
||||
Plane3d( void) : m_vtN( V_NULL), m_dDist( 0) {}
|
||||
bool Set( double dDist, const Vector3d& vtN)
|
||||
@@ -180,3 +186,27 @@ AreSamePlaneExact( const Plane3d plPlaneA, const Plane3d& plPlaneB)
|
||||
PointInPlaneExact( plPlaneA.GetPoint(), plPlaneB)) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline int
|
||||
OnWhichSide( const Plane3d plPlane, const Point3d& pt)
|
||||
{
|
||||
Vector3d vtDir = pt - plPlane.GetPoint() ;
|
||||
if ( ! vtDir.Normalize()) {
|
||||
// cerco un punto diverso sul piano per calcolare la direzione del punto
|
||||
// mi aspetto che pt fosse troppo vicino all'origine del piano
|
||||
Vector3d vtX = plPlane.GetVersN() ^ ( pt - ORIG) ;
|
||||
Point3d ptOrig2 = plPlane.GetPoint() + vtX * 5 ;
|
||||
vtDir = pt - ptOrig2 ;
|
||||
vtDir.Normalize() ;
|
||||
}
|
||||
double dSide = vtDir * plPlane.GetVersN() ;
|
||||
int nSide ;
|
||||
if ( abs( dSide) < EPS_SMALL)
|
||||
nSide = Plane3d::Side::ON ;
|
||||
else if ( dSide > 0)
|
||||
nSide = Plane3d::Side::POS ;
|
||||
else
|
||||
nSide = Plane3d::Side::NEG ;
|
||||
|
||||
return nSide ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user