TAPs 0.7.7.3
TAPsBVHNodeLeafALinkFormedByTwoPointMasses.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsBVHNodeLeafALinkFormedByTwoPointMasses.hpp
00003 ******************************************************************************/
00018 /******************************************************************************
00019 SUKITTI PUNAK   (08/16/2010)
00020 UPDATE          (08/20/2010)
00021 ******************************************************************************/
00022 #ifndef TAPs_BVH_NODE_LEAF_A_LINK_FORMED_BY_TWO_POINT_MASSES_HPP
00023 #define TAPs_BVH_NODE_LEAF_A_LINK_FORMED_BY_TWO_POINT_MASSES_HPP
00024 
00025 #include "TAPsBVHNode.hpp"
00026 
00027 #include "../Physics/TAPsPointMass.hpp"
00028 
00030 template <typename T> class BVHTree;
00031 
00032 BEGIN_NAMESPACE_TAPs
00033 //=============================================================================
00034 template <typename T>
00035 class BVHNodeLeafALinkFormedByTwoPointMasses : public /*virtual*/ BVHNode<T> {
00036 //=============================================================================
00037 // Data Members
00038     friend class BVHTree<T>;
00039 public:
00041     virtual PointMass<T> const *    GetPtrToPrimitive_1 () const    { return m_pPointMass_1; }
00043     virtual PointMass<T>        *   GetPtrToPrimitive_1 ()          { return m_pPointMass_1; }
00045     virtual void SetPtrToPrimitive_1 ( PointMass<T> * pPrim )   { m_pPointMass_1 = pPrim; }
00047     virtual PointMass<T> const *    GetPtrToPrimitive_2 () const    { return m_pPointMass_2; }
00049     virtual PointMass<T>        *   GetPtrToPrimitive_2 ()          { return m_pPointMass_2; }
00051     virtual void SetPtrToPrimitive_2 ( PointMass<T> * pPrim )   { m_pPointMass_2 = pPrim; }
00052 protected:
00053     PointMass<T> *  m_pPointMass_1; 
00054     PointMass<T> *  m_pPointMass_2; 
00055 //=============================================================================
00056 // Member Functions
00057 public:
00058     //-------------------------------------------------------------------------
00059     // Output Operator <<
00060     friend std::ostream & operator<< ( std::ostream &output, BVHNodeLeafALinkFormedByTwoPointMasses<T> const &node )
00061     {
00062         return output << node.StrInfo();
00063     }
00064     //-------------------------------------------------------------------------
00065     // Constructor(s) and Destructor
00066     BVHNodeLeafALinkFormedByTwoPointMasses ( 
00067             Enum::CD type, 
00068             int id                 = -1, 
00069             BVHNode<T> * parent    = NULL );
00070     //-------------------------------------------------------------------------
00071 public:
00072     virtual ~BVHNodeLeafALinkFormedByTwoPointMasses ();
00073     //-------------------------------------------------------------------------
00075     virtual std::string StrInfo () const;
00076     //-------------------------------------------------------------------------
00077     // Get/Set Fn(s)
00078     inline virtual BVHNode<T> const * const Child ( int i ) const
00079         {   return NULL;    }
00080 //protected:
00081     inline virtual BVHNode<T> * Child ( int i )
00082         {   return NULL;    }
00083     //-------------------------------------------------------------------------
00084     // Node Operations
00085 public:
00086     //virtual T TestOverlapWith ( BVHNode<T> const * const that ) const;
00087     virtual void Update ();
00088 protected:
00089     inline virtual void UpdateSphere ();
00090     //---------------------------------------------------------------
00091     // Get Primitive(s)
00092 protected:
00093 public:
00094 
00095     //=========================================================================
00096     // Sphere-Sphere Intersection Test
00097     //-------------------------------------------------------------------------
00113     /*
00114     inline virtual T TestOverlapSphereWithSphere ( 
00115                         BVHNode<T> const * const that       //!< I/P: the center of the sphere bounding volume
00116                     ) const;
00117     inline virtual T TestOverlapSphereWithSphere ( 
00118                         BVHNode<T> const * const that,      //!< I/P: the argument node
00119                         Matrix4x4<T> const & thatTransform  //!< I/P: the transformation for the argument node
00120                     ) const;
00121     inline virtual T TestOverlapSphereWithSphere ( 
00122                         Matrix4x4<T> const & thisTransform, //!< I/P: the transformation for this node
00123                         BVHNode<T> const * const that       //!< I/P: the argument node
00124                     ) const;
00125     inline virtual T TestOverlapSphereWithSphere ( 
00126                         Matrix4x4<T> const & thisTransform, //!< I/P: the transformation for this node
00127                         BVHNode<T> const * const that,      //!< I/P: the argument node
00128                         Matrix4x4<T> const & thatTransform  //!< I/P: the transformation for the argument node
00129                     ) const;
00130     //*/
00131     //-------------------------------------------------------------------------
00132 
00133     //=========================================================================
00134     // Sphere-BVSphere Intersection Test (BinarySphereTree vs Sphere BV)
00135     //-------------------------------------------------------------------------
00151     /*
00152     inline virtual T TestOverlapSphereWithBVSphere ( 
00153                         Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the sphere bounding volume
00154                         T radiusOfBVSphere                      //!< I/P: the radius of the sphere bounding volume
00155                     ) const;
00156     inline virtual T TestOverlapSphereWithBVSphere ( 
00157                         Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the node's sphere
00158                         Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the sphere bounding volume
00159                         T radiusOfBVSphere                      //!< I/P: the radius of the sphere bounding volume
00160                     ) const;
00161     //*/
00162     //-------------------------------------------------------------------------
00163 
00164     //=========================================================================
00165     // Sphere-BVCylinder Intersection Test (BinarySphereTree vs Cylinder BV)
00166     //-------------------------------------------------------------------------
00182     /*
00183     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00184                         Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00185                         T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00186                         T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00187                     ) const;
00188     inline virtual bool TestOverlapSphereWithBVCylinder_AtOrigin ( 
00189                         Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the node's sphere
00190                         Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00191                         T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00192                         T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00193                     ) const;
00194     //*/
00195     //-------------------------------------------------------------------------
00196 
00197     //-------------------------------------------------------------------------
00198 #if defined(__gl_h_) || defined(__GL_H__)
00199 public:
00200     // DrawByOpenGL
00201     virtual void Draw () const  { DrawByOpenGL(); }
00202     virtual void DrawByOpenGL () const;
00203     virtual void DrawByOpenGL ( int currentLevel, int startLevel, int endLevel ) const;
00204 protected:
00205     virtual void DrawBV ( GLenum drawStyle = GLU_LINE ) const;
00206     virtual void DrawPrim ( GLenum drawStyle = GLU_LINE ) const;        // DEBUG
00207 //  static GLuint   m_uiDisplayList;    // for OpenGL (sphere) drawing
00208 #endif
00209     //-------------------------------------------------------------------------
00210 }; // END CLASS BVHNodeLeafALinkFormedByTwoPointMasses
00211 //=============================================================================
00212 END_NAMESPACE_TAPs
00213 //-----------------------------------------------------------------------------
00214 // Include definition if TAPs_USE_EXPORT is not defined
00215 //#if !defined( TAPs_USE_EXPORT )
00216     #include "TAPsBVHNodeLeafALinkFormedByTwoPointMasses.cpp"
00217 //#endif
00218 //-----------------------------------------------------------------------------
00219 #endif
00220 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00221 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines