cCollisionSpheresNode Class Reference

cCollisionSpheresNode defines internal nodes of the collision sphere tree and provides methods for constructing the nodes and using them to determine collisions. More...

#include <CCollisionSpheres.h>

Inheritance diagram for cCollisionSpheresNode:

cCollisionSpheresSphere List of all members.

Public Member Functions

 cCollisionSpheresNode (Plist &a_primList, cCollisionSpheresSphere *a_parent=NULL)
 Constructor of cCollisionSpheresNode.
 cCollisionSpheresNode (std::vector< cTriangle > *a_tris, cCollisionSpheresSphere *a_parent=NULL)
 Constructor of cCollisionSpheresNode.
 cCollisionSpheresNode ()
 Default constructor of cCollisionSpheresNode.
virtual ~cCollisionSpheresNode ()
 Destructor of cCollisionSpheseNode.
void ConstructChildren (Plist &a_primList)
 Create subtrees by splitting primitives into left and right lists.
int isLeaf ()
 Return whether the node is a leaf node. (In this class, it is not.).
void draw (int a_depth)
 Draw the collision sphere if at the given depth.

Static Public Member Functions

static bool computeCollision (cCollisionSpheresNode *a_sa, cGenericObject *&a_colObject, cTriangle *&a_colTriangle, cVector3d &a_colPoint, double &a_colSquareDistance, cCollisionSpheresSphere *a_sb)
 Check for intersection between given nodes, the first an internal node.
static void swapptr (void **a_a, void **a_b)
 Exchange the two given pointers.

Public Attributes

cCollisionSpheresSpherem_left
 Pointer to the left child in the sphere tree.
cCollisionSpheresSpherem_right
 Pointer to the right child in the sphere tree.

Detailed Description

cCollisionSpheresNode defines internal nodes of the collision sphere tree and provides methods for constructing the nodes and using them to determine collisions.


Constructor & Destructor Documentation

cCollisionSpheresNode::cCollisionSpheresNode ( Plist a_primList,
cCollisionSpheresSphere a_parent = NULL 
)

Constructor of cCollisionSpheresNode.

Constructor of cCollisionSpheresNode.

Parameters:
a_primList List of shape primitives to be enclosed in the subtree rooted at this internal node.
a_parent Pointer to the parent of this node in the tree.

cCollisionSpheresNode::cCollisionSpheresNode ( std::vector< cTriangle > *  a_tris,
cCollisionSpheresSphere a_parent = NULL 
)

Constructor of cCollisionSpheresNode.

Constructor of cCollisionSpheresNode.

Parameters:
a_tris Pointer to vector of triangles to use for collision detection.
a_parent Pointer to the parent of this node in sphere tree.


Member Function Documentation

void cCollisionSpheresNode::ConstructChildren ( Plist a_primList  ) 

Create subtrees by splitting primitives into left and right lists.

Create subtrees by splitting primitives into left and right lists.

Parameters:
a_primList List of shape primitives to be split into left and right subtrees.

void cCollisionSpheresNode::draw ( int  a_depth  )  [virtual]

Draw the collision sphere if at the given depth.

Draw the collision sphere if at the given depth.

Parameters:
a_depth Only draw nodes at this depth in the tree. a_depth = -1 renders the complete tree.

Implements cCollisionSpheresSphere.

bool cCollisionSpheresNode::computeCollision ( cCollisionSpheresNode a_sa,
cGenericObject *&  a_colObject,
cTriangle *&  a_colTriangle,
cVector3d a_colPoint,
double &  a_colSquareDistance,
cCollisionSpheresSphere a_sb 
) [static]

Check for intersection between given nodes, the first an internal node.

Determine whether there is any intersection between the primitives (line and triangles) in the collision subtrees rooted at the two given collision spheres. If so, return (in the output parameters) information about the intersected triangle of the mesh closest to the segment origin.

Parameters:
a_sa The root of one sphere tree to check for collision.
a_colObject Returns pointer to nearest collided object.
a_colTriangle Returns pointer to nearest collided triangle.
a_colPoint Returns position of nearest collision.
a_colSquareDistance Returns distance between ray origin and collision point.
a_sb Root of other sphere tree to check for collision.
Returns:
Return whether any primitives within the two sphere trees collide.

void cCollisionSpheresNode::swapptr ( void **  a_a,
void **  a_b 
) [static]

Exchange the two given pointers.

Exchange the two given pointers.

Parameters:
a_a First pointer to be swapped.
a_b Second pointer to be swapped.


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 09:41:47 2007 for CHAI 3D by  doxygen 1.5.2