BoundingVolume< T > Class Template Reference

#include <TAPsBoundingVolume.hpp>

Inheritance diagram for BoundingVolume< T >:

Inheritance graph
[legend]
Collaboration diagram for BoundingVolume< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BoundingVolume (const BoundingVolume< T > &orig)
 Copy Constructor.
 BoundingVolume (Enum::CD type, int id)
 BoundingVolume (Enum::CD type)
 Constructor(s) and Destructor.
virtual void CalAndSetPhysicsCenterOfMass ()
virtual void GetCenter (T &x, T &y, T &z) const
virtual Vector3< T > GetCenter () const
 Get/Set Generic Bounding Volume.
virtual T GetHeight () const
int GetID () const
std::string const & GetName () const
virtual T GetRadius () const
TransformationSupport< T > & GetTransform ()
 Get Transformation.
TransformationSupport< T > const & GetTransform () const
 Get Transformation.
Enum::CD GetType () const
BoundingVolume< T > & operator= (BoundingVolume< T > const &orig)
virtual void ScaledBy (T val)=0
virtual void SetCenter (T x, T y, T z)
virtual void SetCenter (Vector3< T > const &center)
virtual void SetHeight (T height)
void SetID (int id)
void SetName (std::string const &name)
virtual void SetRadius (T radius)
void SetTransform (TransformationSupport< T > const &trx)
 Set Transformation.
virtual std::string StrInfo () const
 Return this object info as a string.
virtual T TestOverlapWith (BoundingVolume< T > const *const that) const =0
virtual bool TestPointLocation (Vector3< T > const *const pvPoint, TransformationSupport< T > const *const pTransform, Vector3< T > *const pvDistance=NULL) const =0
 Test if a point is inside this bounding volume.
virtual bool TestPointLocation (Vector3< T > const *const pvPoint, Vector3< T > *const pvDistance=NULL) const =0
 Test if a point is inside this bounding volume.
virtual ~BoundingVolume ()

Protected Attributes

Enum::CD m_eType
 type identifier (see TAPsEnumList.hpp)
int m_iID
 ID.
std::string m_strName
 name
TransformationSupport< T > m_Transform
Vector3< T > m_vCenter
 Center.

Static Protected Attributes

static int m_iTotal = 0
 total number of models

Friends

std::ostream & operator<< (std::ostream &output, BoundingVolume< T > const &obj)


Detailed Description

template<typename T>
class BoundingVolume< T >

BoundingVolume class is an abstract class for a bounding volume.

See also:
TAPsCDLib.hpp for details about Collision Detection implemented in TAPs.

Definition at line 27 of file TAPsBoundingVolume.hpp.


Constructor & Destructor Documentation

template<typename T>
BoundingVolume< T >::BoundingVolume ( Enum::CD  type  )  [inline]

Constructor(s) and Destructor.

Definition at line 23 of file TAPsBoundingVolume.cpp.

00024     : PhysicsSupport<T>(), 
00025       m_eType( type ), 
00026       m_iID( m_iTotal ), 
00027       m_strName( "" )
00028 {
00029     ++m_iTotal;
00030 }

template<typename T>
BoundingVolume< T >::BoundingVolume ( Enum::CD  type,
int  id 
) [inline]

Definition at line 33 of file TAPsBoundingVolume.cpp.

00034     : PhysicsSupport<T>(), 
00035       m_eType( type ), 
00036       m_iID( id ), 
00037       m_strName( "" )
00038 {
00039     ++m_iTotal;
00040 }

template<typename T>
BoundingVolume< T >::BoundingVolume ( const BoundingVolume< T > &  orig  )  [inline]

Copy Constructor.

Definition at line 43 of file TAPsBoundingVolume.cpp.

00044     : PhysicsSupport<T>(), 
00045       m_eType( orig.m_eType ), 
00046       m_iID( orig.m_iID ), 
00047       m_strName( orig.m_strName ),
00048       m_Transform( orig.m_Transform )
00049 {
00050     ++m_iTotal;
00051 }

template<typename T>
BoundingVolume< T >::~BoundingVolume (  )  [inline, virtual]

Definition at line 54 of file TAPsBoundingVolume.cpp.

00055 {
00056     --m_iTotal;
00057 }


Member Function Documentation

template<typename T>
virtual void BoundingVolume< T >::CalAndSetPhysicsCenterOfMass (  )  [inline, virtual]

Calculate and set the center of mass. Inherited from class TransformationSupport.

Implements PhysicsSupport< T >.

Definition at line 54 of file TAPsBoundingVolume.hpp.

template<typename T>
virtual void BoundingVolume< T >::GetCenter ( T &  x,
T &  y,
T &  z 
) const [inline, virtual]

Definition at line 66 of file TAPsBoundingVolume.hpp.

00066 { x = m_vCenter[0]; y = m_vCenter[1]; z = m_vCenter[2]; }

template<typename T>
virtual Vector3<T> BoundingVolume< T >::GetCenter (  )  const [inline, virtual]

Get/Set Generic Bounding Volume.

Definition at line 65 of file TAPsBoundingVolume.hpp.

00065 { return m_vCenter; }

template<typename T>
virtual T BoundingVolume< T >::GetHeight (  )  const [inline, virtual]

Reimplemented in BoundingCylinder< T >.

Definition at line 71 of file TAPsBoundingVolume.hpp.

00071 {return 0; }

template<typename T>
int BoundingVolume< T >::GetID (  )  const [inline]

Definition at line 128 of file TAPsBoundingVolume.cpp.

00129 {
00130     return m_iId;
00131 }

template<typename T>
std::string const & BoundingVolume< T >::GetName (  )  const [inline]

Definition at line 140 of file TAPsBoundingVolume.cpp.

00141 {
00142     return m_strName;
00143 }

template<typename T>
virtual T BoundingVolume< T >::GetRadius (  )  const [inline, virtual]

Reimplemented in BoundingCylinder< T >, and BoundingSphere< T >.

Definition at line 69 of file TAPsBoundingVolume.hpp.

00069 {return 0; }

template<typename T>
TransformationSupport<T>& BoundingVolume< T >::GetTransform (  )  [inline]

Get Transformation.

Definition at line 81 of file TAPsBoundingVolume.hpp.

00081 { return m_Transform; }

template<typename T>
TransformationSupport<T> const& BoundingVolume< T >::GetTransform (  )  const [inline]

Get Transformation.

Definition at line 79 of file TAPsBoundingVolume.hpp.

00079 { return m_Transform; }

template<typename T>
Enum::CD BoundingVolume< T >::GetType (  )  const [inline]

Definition at line 152 of file TAPsBoundingVolume.cpp.

00153 {
00154     return m_eType;
00155 }

template<typename T>
BoundingVolume<T>& BoundingVolume< T >::operator= ( BoundingVolume< T > const &  orig  )  [inline]

template<typename T>
virtual void BoundingVolume< T >::ScaledBy ( val  )  [pure virtual]

template<typename T>
virtual void BoundingVolume< T >::SetCenter ( x,
y,
z 
) [inline, virtual]

Definition at line 68 of file TAPsBoundingVolume.hpp.

00068 { m_vCenter.SetXYZ( x, y, z ); }

template<typename T>
virtual void BoundingVolume< T >::SetCenter ( Vector3< T > const &  center  )  [inline, virtual]

Definition at line 67 of file TAPsBoundingVolume.hpp.

00067 { m_vCenter = center; }

template<typename T>
virtual void BoundingVolume< T >::SetHeight ( height  )  [inline, virtual]

Reimplemented in BoundingCylinder< T >.

Definition at line 72 of file TAPsBoundingVolume.hpp.

00072 {}

template<typename T>
void BoundingVolume< T >::SetID ( int  id  )  [inline]

Definition at line 134 of file TAPsBoundingVolume.cpp.

00135 {
00136     m_iId = id;
00137 }

template<typename T>
void BoundingVolume< T >::SetName ( std::string const &  name  )  [inline]

Definition at line 146 of file TAPsBoundingVolume.cpp.

00147 {
00148     m_strName = name;
00149 }

template<typename T>
virtual void BoundingVolume< T >::SetRadius ( radius  )  [inline, virtual]

Reimplemented in BoundingCylinder< T >, and BoundingSphere< T >.

Definition at line 70 of file TAPsBoundingVolume.hpp.

00070 {}

template<typename T>
void BoundingVolume< T >::SetTransform ( TransformationSupport< T > const &  trx  )  [inline]

Set Transformation.

Definition at line 83 of file TAPsBoundingVolume.hpp.

00083 { m_Transform = trx; }

template<typename T>
std::string BoundingVolume< T >::StrInfo (  )  const [inline, virtual]

Return this object info as a string.

Reimplemented in BoundingCylinder< T >, and BoundingSphere< T >.

Definition at line 61 of file TAPsBoundingVolume.cpp.

00062 {
00063     std::string str = "The Bounding Object Type is ";
00064     switch ( m_eType ) {
00065         case Enum::UNDEFINED_TYPE:
00066             str += "\"UNDEFINED_TYPE\"";
00067             break;
00068         case Enum::BOUNDING_SPHERE:
00069             str += "\"BOUNDING_SPHERE\"";
00070             break;
00071         case Enum::BOUNDING_HALF_SPHERE:
00072             str += "\"BOUNDING_HALF_SPHERE\"";
00073             break;
00074         case Enum::BOUNDING_BOX:
00075             str += "\"BOUNDING_BOX\"";
00076             break;
00077         case Enum::BOUNDING_CYLINDER:
00078             str += "\"BOUNDING_CYLINDER\"";
00079             break;
00080         case Enum::BOUNDING_CONE:
00081             str += "\"BOUNDING_CONE\"";
00082             break;
00083         case Enum::BOUNDING_ELLIPSOID:
00084             str += "\"BOUNDING_ELLIPSOID\"";
00085             break;
00086         case Enum::BOUNDING_HALF_ELLIPSOID:
00087             str += "\"BOUNDING_HALF_ELLIPSOID\"";
00088             break;
00089         case Enum::BOUNDING_CAPSULE:
00090             str += "\"BOUNDING_CAPSULE\"";
00091             break;
00092         case Enum::BOUNDING_POLYTOPE:
00093             str += "\"BOUNDING_POLYTOPE\"";
00094             break;
00095         default:
00096             str += "\nUnrecognized Type!";
00097             break;
00098     }
00099     str += " of type " + std::string( typeid(T).name() ) + ".";
00100     //-------------------------------------------
00101     // Properties
00102     std::ostringstream ss;
00103     ss << "\n  ID:     " << m_iID;
00104     ss << "\n  Name:   \"" << m_strName << "\"";
00105     ss << "\n  Trx:    " << m_Transform;
00106     ss << "\n  Center: " << m_vCenter[0] << ", " << m_vCenter[1] << ", " << m_vCenter[2];
00107     str += ss.str();
00108 
00109     return str;
00110 }

template<typename T>
virtual T BoundingVolume< T >::TestOverlapWith ( BoundingVolume< T > const *const   that  )  const [pure virtual]

template<typename T>
virtual bool BoundingVolume< T >::TestPointLocation ( Vector3< T > const *const   pvPoint,
TransformationSupport< T > const *const   pTransform,
Vector3< T > *const   pvDistance = NULL 
) const [pure virtual]

Test if a point is inside this bounding volume.

Test Point Location Fn returns true if the input point (vPoint) location is inside the bounding volume, with TransformationSupport argument apply to the cylinder, and returns false otherwise. vDistance is for returning the shortest vector measuring from the input point to the bounding surface.

Therefore, this fn can be used to tell whether the point is inside or outside the bounding volume and how to move it to the surface of the bounding volume with the shortest distance.

Implemented in BoundingCylinder< T >, and BoundingSphere< T >.

template<typename T>
virtual bool BoundingVolume< T >::TestPointLocation ( Vector3< T > const *const   pvPoint,
Vector3< T > *const   pvDistance = NULL 
) const [pure virtual]

Test if a point is inside this bounding volume.

Test Point Location Fn returns true if the input point (vPoint) location is inside the bounding volume and returns false otherwise. vDistance is for returning the shortest vector measuring from the input point to the bounding surface.

Therefore, this fn can be used to tell whether the point is inside or outside the bounding volume and how to move it to the surface of the bounding volume with the shortest distance.

Implemented in BoundingCylinder< T >, and BoundingSphere< T >.


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
BoundingVolume< T > const &  obj 
) [friend]

Definition at line 33 of file TAPsBoundingVolume.hpp.

00034     {
00035         output << obj.StrInfo();
00036         return output;
00037     }


Member Data Documentation

template<typename T>
Enum::CD BoundingVolume< T >::m_eType [protected]

type identifier (see TAPsEnumList.hpp)

Definition at line 183 of file TAPsBoundingVolume.hpp.

template<typename T>
int BoundingVolume< T >::m_iID [protected]

ID.

Definition at line 184 of file TAPsBoundingVolume.hpp.

template<typename T>
BEGIN_NAMESPACE_TAPs int BoundingVolume< T >::m_iTotal = 0 [inline, static, protected]

total number of models

Definition at line 182 of file TAPsBoundingVolume.hpp.

template<typename T>
std::string BoundingVolume< T >::m_strName [protected]

name

Definition at line 185 of file TAPsBoundingVolume.hpp.

template<typename T>
TransformationSupport<T> BoundingVolume< T >::m_Transform [protected]

Definition at line 190 of file TAPsBoundingVolume.hpp.

template<typename T>
Vector3<T> BoundingVolume< T >::m_vCenter [protected]

Center.

Definition at line 187 of file TAPsBoundingVolume.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:44:23 2008 for TAPs by  doxygen 1.5.6