# cCollisionSpheresNode Class Reference
[Collision Detection]

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:

[legend]

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, double a_extendedRadius=0)
| 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, cCollisionSpheresSphere *a_sb, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
| 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
cCollisionSpheresSphere * | m_left
| Pointer to the left child in the sphere tree.
cCollisionSpheresSphere * | m_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`,
|  | double | a_extendedRadius = `0` |
| ) |  |  |

Constructor of cCollisionSpheresNode.

Constructor of cCollisionSpheresNode.

cCollisionSpheresSphere(a_parent)

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.
  | a_extendedRadius | Bounding radius.

## Member Function Documentation

bool cCollisionSpheresNode::computeCollision | ( | cCollisionSpheresNode * | a_sa,
|  | cCollisionSpheresSphere * | a_sb,
|  | cCollisionRecorder & | a_recorder,
|  | cCollisionSettings & | a_settings |
| ) |  |  | `[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 | Root of one sphere tree to check for collision.
  | a_sb | Root of other sphere tree to check for collision.
  | a_recorder | Stores all collision events
  | a_settings | Contains collision settings information.

Returns:
  Return whether any primitives within the two sphere trees collide.

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.

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:

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/collisions/CCollisionSpheres.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/collisions/CCollisionSpheres.cpp

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