TAPs 0.7.7.3
TAPsBVHNodeLeafElasticRodNode.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsBVHNodeLeafElasticRodNode.hpp
00003 ******************************************************************************/
00017 /******************************************************************************
00018 SUKITTI PUNAK   (08/21/2009)
00019 UPDATE          (08/16/2010)
00020 ******************************************************************************/
00021 #ifndef TAPs_BVH_NODE_LEAF_ELASTIC_ROD_NODE_HPP
00022 #define TAPs_BVH_NODE_LEAF_ELASTIC_ROD_NODE_HPP
00023 
00024 #include "TAPsBVHNode.hpp"
00025 
00026 #include "../Model/ElasticRodSupport/TAPsElasticRodNode.hpp"
00027 #include <list> // DEBUG
00028 
00030 template <typename T> class BVHTree;
00031 
00032 BEGIN_NAMESPACE_TAPs
00033 //=============================================================================
00034 template <typename T>
00035 class BVHNodeLeafElasticRodNode : public /*virtual*/ BVHNode<T> {
00036 //=============================================================================
00037 // Data Members
00038     friend class BVHTree<T>;
00039 public:
00041     virtual ElasticRodNode<T> const *   GetPtrToPrimitive_1 () const    { return m_pERnode_1; }
00043     virtual ElasticRodNode<T>       *   GetPtrToPrimitive_1 ()          { return m_pERnode_1; }
00045     virtual void SetPtrToPrimitive_1 ( ElasticRodNode<T> * pPrim )  { m_pERnode_1 = pPrim; }
00047     virtual ElasticRodNode<T> const *   GetPtrToPrimitive_2 () const    { return m_pERnode_2; }
00049     virtual ElasticRodNode<T>       *   GetPtrToPrimitive_2 ()          { return m_pERnode_2; }
00051     virtual void SetPtrToPrimitive_2 ( ElasticRodNode<T> * pPrim )  { m_pERnode_2 = pPrim; }
00052 protected:
00053     ElasticRodNode<T> * m_pERnode_1;    
00054     ElasticRodNode<T> * m_pERnode_2;    
00055 //=============================================================================
00056 // Member Functions
00057 public:
00058     //-------------------------------------------------------------------------
00059     // Output Operator <<
00060     friend std::ostream & operator<< ( std::ostream &output, BVHNodeLeafElasticRodNode<T> const &node )
00061     {
00062         output << node.StrInfo();
00063         return output;
00064     }
00065     //-------------------------------------------------------------------------
00066     // Constructor(s) and Destructor
00067     BVHNodeLeafElasticRodNode ( 
00068             Enum::CD type, 
00069             int id                 = -1, 
00070             BVHNode<T> * parent    = NULL );
00071 /*
00072 protected:
00073     BVHNodeLeafElasticRodNode ( Enum::CD type, 
00074               int id, 
00075               BVHNode<T> * parent, 
00076               Vector3<T> const & center, 
00077               Vector3<T> const & U, 
00078               Vector3<T> const & V, 
00079               Vector3<T> const & W );
00080 //*/
00081     //-------------------------------------------------------------------------
00082 public:
00083     virtual ~BVHNodeLeafElasticRodNode ();
00084     //-------------------------------------------------------------------------
00086     virtual std::string StrInfo () const;
00087     //-------------------------------------------------------------------------
00088     // Get/Set Fn(s)
00089     inline virtual BVHNode<T> const * const Child ( int i ) const
00090         {   return NULL;    }
00091 //protected:
00092     inline virtual BVHNode<T> * Child ( int i )
00093         {   return NULL;    }
00094     //-------------------------------------------------------------------------
00095     // Node Operations
00096 public:
00097     //virtual T TestOverlapWith ( BVHNode<T> const * const that ) const;
00098     //virtual void Update ();
00099 protected:
00100     //inline virtual void UpdateSphere ();
00101     //---------------------------------------------------------------
00102     // Get Primitive(s)
00103 protected:
00104 public:
00105     //inline virtual HEFace<T> *    GetPrimitive () const   { return m_pERnode; }
00106 
00107     //=========================================================================
00108     // Sphere-Sphere Intersection Test
00109     //-------------------------------------------------------------------------
00125     /*
00126     inline virtual T TestOverlapSphereWithSphere ( 
00127                         BVHNode<T> const * const that       //!< I/P: the center of the sphere bounding volume
00128                     ) const;
00129     inline virtual T TestOverlapSphereWithSphere ( 
00130                         BVHNode<T> const * const that,      //!< I/P: the argument node
00131                         Matrix4x4<T> const & thatTransform  //!< I/P: the transformation for the argument node
00132                     ) const;
00133     inline virtual T TestOverlapSphereWithSphere ( 
00134                         Matrix4x4<T> const & thisTransform, //!< I/P: the transformation for this node
00135                         BVHNode<T> const * const that       //!< I/P: the argument node
00136                     ) const;
00137     inline virtual T TestOverlapSphereWithSphere ( 
00138                         Matrix4x4<T> const & thisTransform, //!< I/P: the transformation for this node
00139                         BVHNode<T> const * const that,      //!< I/P: the argument node
00140                         Matrix4x4<T> const & thatTransform  //!< I/P: the transformation for the argument node
00141                     ) const;
00142     //*/
00143     //-------------------------------------------------------------------------
00144 
00145     //=========================================================================
00146     // Sphere-BVSphere Intersection Test (BinarySphereTree vs Sphere BV)
00147     //-------------------------------------------------------------------------
00163     /*
00164     inline virtual T TestOverlapSphereWithBVSphere ( 
00165                         Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the sphere bounding volume
00166                         T radiusOfBVSphere                      //!< I/P: the radius of the sphere bounding volume
00167                     ) const;
00168     inline virtual T TestOverlapSphereWithBVSphere ( 
00169                         Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the node's sphere
00170                         Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the sphere bounding volume
00171                         T radiusOfBVSphere                      //!< I/P: the radius of the sphere bounding volume
00172                     ) const;
00173     //*/
00174     //-------------------------------------------------------------------------
00175 
00176     //=========================================================================
00177     // Sphere-BVCylinder Intersection Test (BinarySphereTree vs Cylinder BV)
00178     //-------------------------------------------------------------------------
00194     /*
00195     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00196                         Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00197                         T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00198                         T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00199                     ) const;
00200     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00201                         Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the node's sphere
00202                         Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00203                         T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00204                         T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00205                     ) const;
00206     //*/
00207     //-------------------------------------------------------------------------
00208 
00209     //-------------------------------------------------------------------------
00210 #if defined(__gl_h_) || defined(__GL_H__)
00211 public:
00212     // DrawByOpenGL
00213     virtual void Draw () const  { DrawByOpenGL(); }
00214     virtual void DrawByOpenGL () const;
00215     virtual void DrawByOpenGL ( int currentLevel, int startLevel, int endLevel ) const;
00216 protected:
00217     virtual void DrawBV ( GLenum drawStyle = GLU_LINE ) const;
00218     virtual void DrawPrim ( GLenum drawStyle = GLU_LINE ) const;        // DEBUG
00219 //  static GLuint   m_uiDisplayList;    // for OpenGL (sphere) drawing
00220 #endif
00221     //-------------------------------------------------------------------------
00222 }; // END CLASS BVHNodeLeafElasticRodNode
00223 //=============================================================================
00224 END_NAMESPACE_TAPs
00225 //-----------------------------------------------------------------------------
00226 // Include definition if TAPs_USE_EXPORT is not defined
00227 //#if !defined( TAPs_USE_EXPORT )
00228     #include "TAPsBVHNodeLeafElasticRodNode.cpp"
00229 //#endif
00230 //-----------------------------------------------------------------------------
00231 #endif
00232 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00233 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines