chai3d::cCollisionAABBBox Class Reference

This structure implements the boundary nodes of an axis-aligned bounding box. More...

#include <CCollisionAABBBox.h>

Public Member Functions

 cCollisionAABBBox ()
 Default constructor of cCollisionAABBBox. More...
 
 cCollisionAABBBox (const cVector3d &a_min, const cVector3d &a_max)
 Constructor of cCollisionAABBBox. More...
 
virtual ~cCollisionAABBBox ()
 Destructor of cCollisionAABBBox. More...
 
cVector3d getCenter () const
 This method returns the center of the boundary box. More...
 
cVector3d getExtent () const
 This method returns the extent (half the width) of the boundary box. More...
 
void setCenter (const cVector3d &a_center)
 This method sets the center of the boundary box. More...
 
void setExtent (const cVector3d &a_extent)
 This method sets the extent (half the width) of the boundary box. More...
 
void setValue (const cVector3d &a_min, const cVector3d &a_max)
 This method initializes the boundary box by passing a minimum and maximum point. More...
 
bool intersect (const cCollisionAABBBox &a_box) const
 This method determines whether this box and an input box passed as argument intersect each other. More...
 
bool intersect (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB) const
 This method determines whether the given ray intersects the boundary box. More...
 
bool contains (const cVector3d &a_point) const
 This method tests whether this box contains a point passed as argument. More...
 
void enclose (const cCollisionAABBBox &a_boxA, const cCollisionAABBBox &a_boxB)
 This method initializes the boundary box to bound two given boundary boxes passed as argument. More...
 
void enclose (const cVector3d &a_point)
 This method resizes the boundary box to bound a new point passed as argument. More...
 
void enclose (const cCollisionAABBBox &a_box)
 This method resizes the boundary box to bound a new point passed as argument. More...
 
void setEmpty ()
 This method empties this boundary box. More...
 
double getLowerX () const
 This method returns the smallest coordinate along X axis. More...
 
double getUpperX () const
 This method returns the largest coordinate along X axis. More...
 
double getLowerY () const
 This method returns the smallest coordinate along Y axis. More...
 
double getUpperY () const
 This method returns the largest coordinate along Y axis. More...
 
double getLowerZ () const
 This returns the smallest coordinate along Z axis. More...
 
double getUpperZ () const
 This method return the largest coordinate along Z axis. More...
 
int getLongestAxis () const
 This method returns the index of the longest axis of the boundary box. More...
 
void render ()
 This method renders graphically the edges of the boundary box. More...
 

Public Attributes

cVector3d m_center
 The center of the boundary box. More...
 
cVector3d m_extent
 The extent (half the width) of the boundary box. More...
 
cVector3d m_min
 The minimum point (along each axis) of the boundary box. More...
 
cVector3d m_max
 The maximum point (along each axis) of the boundary box. More...
 

Detailed Description

This structure implements the data variables and methods necessary to model an axis-aligned bounding box. These methods are used by the general AABB collision detection algorithm (See class cCollisionAABB).

Constructor & Destructor Documentation

chai3d::cCollisionAABBBox::cCollisionAABBBox ( )
inline
chai3d::cCollisionAABBBox::cCollisionAABBBox ( const cVector3d a_min,
const cVector3d a_max 
)
inline
virtual chai3d::cCollisionAABBBox::~cCollisionAABBBox ( )
inlinevirtual

Member Function Documentation

cVector3d chai3d::cCollisionAABBBox::getCenter ( ) const
inline

This method returns the center of the boundary box.

Returns
Center of boundary box.
cVector3d chai3d::cCollisionAABBBox::getExtent ( ) const
inline

This method returns the extent (half the width) of the boundary box.

Returns
Extent of boundary box
void chai3d::cCollisionAABBBox::setCenter ( const cVector3d a_center)
inline

This method sets the center of the boundary box.

Parameters
a_centerCenter of boundary box.
void chai3d::cCollisionAABBBox::setExtent ( const cVector3d a_extent)
inline

This method sets the extent (half the width) of the boundary box.

Parameters
a_extentBoundary box extent.
void chai3d::cCollisionAABBBox::setValue ( const cVector3d a_min,
const cVector3d a_max 
)
inline

This method initializes the boundary box by passing a minimum and maximum point passed as arguments.

Parameters
a_minMinimum point of boundary box.
a_maxMaximum point of boundary box.
bool chai3d::cCollisionAABBBox::intersect ( const cCollisionAABBBox a_box) const
inline

This method determines whether this box and an input box passed as argument intersect each other.

Parameters
a_boxInput box.
Returns
true if the input box overlaps this box, false otherwise.
bool chai3d::cCollisionAABBBox::intersect ( const cVector3d a_segmentPointA,
const cVector3d a_segmentPointB 
) const
inline

This method determines whether the given ray intersects the boundary box. Based on code by Andrew Woo from "Graphics Gems", Academic Press, 1990.

Parameters
a_segmentPointAInitial point of segment.
a_segmentPointBEnd point of segment.
Returns
true if line segment intersects the boundary box, false otherwise.
bool chai3d::cCollisionAABBBox::contains ( const cVector3d a_point) const
inline

This method tests whether this box contains a point a_point passed as argument.

Parameters
a_pointPoint to be tested.
Returns
true if this box contains this point, false otherwise.
void chai3d::cCollisionAABBBox::enclose ( const cCollisionAABBBox a_boxA,
const cCollisionAABBBox a_boxB 
)
inline

This method initializes the boundary box to bound two given boundary boxes passed as argument.

Parameters
a_boxAThe first boundary box to be enclosed.
a_boxBThe second boundary box to be enclosed.
void chai3d::cCollisionAABBBox::enclose ( const cVector3d a_point)
inline

This method resizes the boundary box to bound a new point a_point passed as argument.

Parameters
a_pointPoint to be enclosed.
void chai3d::cCollisionAABBBox::enclose ( const cCollisionAABBBox a_box)
inline

This method resizes the boundary box to bound a new point passed as argument.

Parameters
a_boxBox to be enclosed in this boundary box.
void chai3d::cCollisionAABBBox::setEmpty ( )
inline

This method empties this boundary box.

double chai3d::cCollisionAABBBox::getLowerX ( ) const
inline

This method returns the smallest coordinate along X axis.

Returns
Smallest coordinate along X axis.
double chai3d::cCollisionAABBBox::getUpperX ( ) const
inline

This method returns the largest coordinate along X axis.

Returns
Largest coordinate along X axis.
double chai3d::cCollisionAABBBox::getLowerY ( ) const
inline

This method returns the smallest coordinate along Y axis.

Returns
Smallest coordinate along Y axis.
double chai3d::cCollisionAABBBox::getUpperY ( ) const
inline

This method returns the largest coordinate along Y axis.

Returns
Largest coordinate along Y axis.
double chai3d::cCollisionAABBBox::getLowerZ ( ) const
inline

This returns the smallest coordinate along Z axis.

Returns
Smallest coordinate along Z axis.
double chai3d::cCollisionAABBBox::getUpperZ ( ) const
inline

This method return the largest coordinate along Z axis.

Returns
Largest coordinate along Z axis.
int chai3d::cCollisionAABBBox::getLongestAxis ( ) const
inline

This method returns the index of the longest axis of the boundary box.

Returns
Index of the longest axis of the box.
void chai3d::cCollisionAABBBox::render ( )
inline

This method renders graphically using OpenGL the edges of the boundary box.

Member Data Documentation

cVector3d chai3d::cCollisionAABBBox::m_center
cVector3d chai3d::cCollisionAABBBox::m_extent
cVector3d chai3d::cCollisionAABBBox::m_min
cVector3d chai3d::cCollisionAABBBox::m_max

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