TAPs 0.7.7.3
TAPsBVHNodeLeafHalfEdgeAPrim.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsBVHNodeLeafHalfEdgeAPrim.hpp
00003 
00004 SUKITTI PUNAK   (03/22/2006)
00005 ******************************************************************************/
00006 #ifndef TAPs_BVH_NODE_LEAF_HALFEDGE_APRIM_HPP
00007 #define TAPs_BVH_NODE_LEAF_HALFEDGE_APRIM_HPP
00008 
00020 #include "TAPsBVHNode.hpp"
00021 
00022 #include "../GeometricDataStructure/HalfEdge/TAPsHalfEdgeDataStructure.hpp" // DEBUG
00023 #include <list> // DEBUG
00024 
00026 template <typename T> class BVHTree;
00027 
00028 BEGIN_NAMESPACE_TAPs
00029 //=============================================================================
00030 template <typename T>
00031 class BVHNodeLeafHalfEdgeAPrim : public /*virtual*/ BVHNode<T> {
00032 //=============================================================================
00033 // Data Members
00034     friend class BVHTree<T>;
00035 public:
00037     virtual HEFace<T> const *   GetPtrToPrimitive () const  { return m_primHEFace; }
00039     virtual HEFace<T>       *   GetPtrToPrimitive ()        { return m_primHEFace; }
00041     virtual void SetPtrToPrimitive ( HEFace<T> * pPrim )    { m_primHEFace = pPrim; }
00042     
00043     virtual HEFace<T> * GetAPrimitiveHalfEdgeFace () const  { return m_primHEFace; }
00044 //protected:
00045 public:
00046     HEFace<T> *     m_primHEFace;
00047 //=============================================================================
00048 // Member Functions
00049 public:
00050     //-------------------------------------------------------------------------
00051     // Output Operator <<
00052     friend std::ostream & operator<< ( std::ostream &output, BVHNodeLeafHalfEdgeAPrim<T> const &node )
00053     {
00054         output << node.StrInfo();
00055         return output;
00056     }
00057     //-------------------------------------------------------------------------
00058     // Constructor(s) and Destructor
00059     BVHNodeLeafHalfEdgeAPrim ( 
00060             Enum::CD type, 
00061             int id                 = -1, 
00062             BVHNode<T> * parent    = NULL );
00063     //-------------------------------------------------------------------------
00064 public:
00065     virtual ~BVHNodeLeafHalfEdgeAPrim ();
00066     //-------------------------------------------------------------------------
00068     virtual std::string StrInfo () const;
00069     //-------------------------------------------------------------------------
00070     // Get/Set Fn(s)
00071     inline virtual BVHNode<T> const * const Child ( int i ) const
00072         {   return NULL;    }
00073 //protected:
00074     inline virtual BVHNode<T> * Child ( int i )
00075         {   return NULL;    }
00076     //-------------------------------------------------------------------------
00077     // Node Operations
00078 public:
00079     virtual T TestOverlapWith ( BVHNode<T> const * const that ) const;
00080     virtual void Update ();
00081 protected:
00082     inline virtual void UpdateSphere ();
00083     //---------------------------------------------------------------
00084     // Get Primitive(s)
00085 protected:
00086 public:
00087     //=========================================================================
00088     // Sphere-Sphere Intersection Test
00089     //-------------------------------------------------------------------------
00105     inline virtual T TestOverlapSphereWithSphere ( 
00106                         BVHNode<T> const * const that       
00107                     ) const;
00108     inline virtual T TestOverlapSphereWithSphere ( 
00109                         BVHNode<T> const * const that,      
00110                         Matrix4x4<T> const & thatTransform  
00111                     ) const;
00112     inline virtual T TestOverlapSphereWithSphere ( 
00113                         Matrix4x4<T> const & thisTransform, 
00114                         BVHNode<T> const * const that       
00115                     ) const;
00116     inline virtual T TestOverlapSphereWithSphere ( 
00117                         Matrix4x4<T> const & thisTransform, 
00118                         BVHNode<T> const * const that,      
00119                         Matrix4x4<T> const & thatTransform  
00120                     ) const;
00121     //-------------------------------------------------------------------------
00122 
00123     //=========================================================================
00124     // Sphere-BVSphere Intersection Test (BinarySphereTree vs Sphere BV)
00125     //-------------------------------------------------------------------------
00141     inline virtual T TestOverlapSphereWithBVSphere ( 
00142                         Vector3<T> const & centerOfBVSphere,    
00143                         T radiusOfBVSphere                      
00144                     ) const;
00145     inline virtual T TestOverlapSphereWithBVSphere ( 
00146                         Matrix4x4<T> const & transformA,        
00147                         Vector3<T> const & centerOfBVSphere,    
00148                         T radiusOfBVSphere                      
00149                     ) const;
00150     //-------------------------------------------------------------------------
00151 
00152     //=========================================================================
00153     // Sphere-BVCylinder Intersection Test (BinarySphereTree vs Cylinder BV)
00154     //-------------------------------------------------------------------------
00170     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00171                         Vector3<T> const & centerOfBVCylinder,  
00172                         T radiusOfBVCylinder,                   
00173                         T heightOfBVCylinder                    
00174                     ) const;
00175     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00176                         Matrix4x4<T> const & transformA,        
00177                         Vector3<T> const & centerOfBVCylinder,  
00178                         T radiusOfBVCylinder,                   
00179                         T heightOfBVCylinder                    
00180                     ) const;
00181     //-------------------------------------------------------------------------
00182 
00183     //-------------------------------------------------------------------------
00184 #if defined(__gl_h_) || defined(__GL_H__)
00185 public:
00186     // DrawByOpenGL
00187     virtual void Draw () const  { DrawByOpenGL(); }
00188     virtual void DrawByOpenGL () const;
00189     virtual void DrawByOpenGL ( int currentLevel, int startLevel, int endLevel ) const;
00190 protected:
00191     virtual void DrawBV ( GLenum drawStyle = GLU_LINE ) const;
00192     virtual void DrawPrim ( GLenum drawStyle = GLU_LINE ) const;        // DEBUG
00193 //  static GLuint   m_uiDisplayList;    // for OpenGL (sphere) drawing
00194 #endif
00195     //-------------------------------------------------------------------------
00196 }; // END CLASS BVHNodeLeafHalfEdgeAPrim
00197 //=============================================================================
00198 END_NAMESPACE_TAPs
00199 //-----------------------------------------------------------------------------
00200 // Include definition if TAPs_USE_EXPORT is not defined
00201 //#if !defined( TAPs_USE_EXPORT )
00202     #include "TAPsBVHNodeLeafHalfEdgeAPrim.cpp"
00203 //#endif
00204 //-----------------------------------------------------------------------------
00205 #endif
00206 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00207 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines