//---------------------------------------------------------------------------- // EgalTech 2013-2014 //---------------------------------------------------------------------------- // File : EGkBBox3d.h Data : 14.01.14 Versione : 1.5a4 // Contenuto : Dichiarazione della classe axis aligned bounding box BBox3d. // // // // Modifiche : 14.01.13 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGKPoint3d.h" //----------------------- Macro per import/export ---------------------------- #undef EGK_EXPORT #if defined( I_AM_EGK) // da definirsi solo nella DLL #define EGK_EXPORT __declspec( dllexport) #else #define EGK_EXPORT __declspec( dllimport) #endif //---------------------------------------------------------------------------- class EGK_EXPORT BBox3d { public : BBox3d( void) // Box vuoto (min > MAX) : m_ptMin( +INFINITO, +INFINITO, +INFINITO), m_ptMax( -INFINITO, -INFINITO, -INFINITO) {} BBox3d( const Point3d ptP) : m_ptMin( ptP), m_ptMax( ptP) {} BBox3d( double dX, double dY, double dZ) : m_ptMin( dX, dY, dZ), m_ptMax( dX, dY, dZ) {} BBox3d( const Point3d ptP1, const Point3d ptP2) ; BBox3d( double dX1, double dY1, double dZ1, double dX2, double dY2, double dZ2) ; void Reset( void) { m_ptMin = Point3d( +INFINITO, +INFINITO, +INFINITO) ; m_ptMax = Point3d( -INFINITO, -INFINITO, -INFINITO) ; } void Set( const Point3d ptP) { m_ptMin = ptP ; m_ptMax = ptP ; } void Set( double dX, double dY, double dZ) { m_ptMin = Point3d( dX, dY, dZ) ; m_ptMax = m_ptMin ; } void Set( const Point3d ptP1, const Point3d ptP2) ; void Set( double dX1, double dY1, double dZ1, double dX2, double dY2, double dZ2) ; public : bool IsEmpty( void) const { return ( ! IsValid()) ; } void Add( const Point3d& ptP) ; void Add( double dX, double dY, double dZ) ; void Add( const BBox3d& b3B) ; void Expand( double dDelta) ; void Expand( double dDeltaX, double dDeltaY, double dDeltaZ) ; const Point3d& GetMin( void) const { return m_ptMin ; } const Point3d& GetMax( void) const { return m_ptMax ; } bool GetMinMax( Point3d& ptMin, Point3d& ptMax) const ; bool GetCenterExtent( Point3d& ptCenter, Vector3d& vtExtent) const ; bool GetCenter( Point3d& ptCenter) const ; bool ToGlob( const Frame3d& frRef) ; bool ToLoc( const Frame3d& frRef) ; bool Encloses( const Point3d& ptP) const ; bool Overlaps( const BBox3d& b3B) const ; bool FindIntersection( const BBox3d& b3B, BBox3d& b3Int) const ; double SqDistFromPoint( const Point3d& ptP) const ; private : bool IsValid( void) const ; private : Point3d m_ptMin ; Point3d m_ptMax ; } ;