cCollisionAABB Class Reference
[Collision Detection]

cCollisionAABB provides methods to create an Axis-Aligned Bounding Box collision detection tree, and to use this tree to check for the intersection of a line segment with a mesh. More...

#include <CCollisionAABB.h>

Inheritance diagram for cCollisionAABB:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 cCollisionAABB (vector< cTriangle > *a_triangles, bool a_useNeighbors)
 Constructor of cAABBTree.
virtual ~cCollisionAABB ()
 Destructor of cAABBTree.
void initialize (double a_radius=0)
 Build the AABB Tree for the first time.
void render ()
 Draw the bounding boxes in OpenGL.
bool computeCollision (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 Return the nearest triangle intersected by the given segment, if any.
cCollisionAABBNodegetRoot ()
 Return the root node of the collision tree.

Protected Attributes

vector< cTriangle > * m_triangles
 Pointer to the list of triangles in the mesh.
cCollisionAABBLeafm_leaves
 Pointer to an array of leaf nodes for the AABB Tree.
cCollisionAABBInternalm_internalNodes
 Pointer to array of internal nodes.
cCollisionAABBNodem_root
 Pointer to the root of the AABB Tree.
unsigned int m_numTriangles
 The number of triangles in the mesh.
cTrianglem_lastCollision
 Triangle returned by last successful collision test.
bool m_useNeighbors
 Use list of triangles' neighbors to speed up collision detection?


Detailed Description

cCollisionAABB provides methods to create an Axis-Aligned Bounding Box collision detection tree, and to use this tree to check for the intersection of a line segment with a mesh.

Constructor & Destructor Documentation

cCollisionAABB::cCollisionAABB ( vector< cTriangle > *  a_triangles,
bool  a_useNeighbors 
)

Constructor of cAABBTree.

Constructor of cCollisionAABB.

Parameters:
a_triangles Pointer to array of triangles.
a_useNeighbors Use neighbor lists to speed up collision detection?

cCollisionAABB::~cCollisionAABB (  )  [virtual]

Destructor of cAABBTree.

Destructor of cCollisionAABB.


Member Function Documentation

bool cCollisionAABB::computeCollision ( cVector3d a_segmentPointA,
cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
) [virtual]

Return the nearest triangle intersected by the given segment, if any.

Check if the given line segment intersects any triangle of the mesh. If so, return true, as well as (through the output parameters) pointers to the intersected triangle, the mesh of which this triangle is a part, the point of intersection, and the distance from the origin of the segment to the collision point. If more than one triangle is intersected, return the one closest to the origin of the segment. The method uses the pre-computed AABB boxes, starting at the root and recursing through the tree, breaking the recursion along any path in which the bounding box of the line segment does not intersect the bounding box of the node. At the leafs, triangle-segment intersection testing is called.

Parameters:
a_segmentPointA Initial point of segment.
a_segmentPointB End point of segment.
a_recorder Stores all collision events
a_settings Contains collision settings information.
Returns:
Return true if a collision event has occurred.

Reimplemented from cGenericCollision.

void cCollisionAABB::initialize ( double  a_radius = 0  )  [virtual]

Build the AABB Tree for the first time.

Build the Axis-Aligned Bounding Box collision-detection tree. Each leaf is associated with one triangle and with a bounding box of minimal dimensions such that it fully encloses the triangle and is aligned with the coordinate axes (no rotations). Each internal node is associated with a bounding box of minimal dimensions such that it fully encloses the bounding boxes of its two children and is aligned with the axes.

Parameters:
a_radius radius to add around the triangles.

Reimplemented from cGenericCollision.

void cCollisionAABB::render (  )  [virtual]

Draw the bounding boxes in OpenGL.

Render the bounding boxes of the collision tree in OpenGL.

Reimplemented from cGenericCollision.


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


CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.