- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cCollisionSpheresLeaf Class Reference

cCollisionSpheresLeaf defines leaf 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 cCollisionSpheresLeaf:

List of all members.

## Public Member Functions
| cCollisionSpheresLeaf (cCollisionSpheresGenericShape *a_prim, cCollisionSpheresSphere *a_parent=NULL)
| Constructor of cCollisionSpheresLeaf.
| cCollisionSpheresLeaf (cTriangle *a_tri, cCollisionSpheresSphere *a_parent=NULL)
| Constructor of cCollisionSpheresLeaf.
| cCollisionSpheresLeaf ()
| Default constructor of cCollisionSpheresLeaf.
virtual | ~cCollisionSpheresLeaf ()
| Destructor of cCollisionSpheresLeaf().
int | isLeaf ()
| Return whether the node is a leaf node. (In this class, it is.).
void | draw (int a_depth)
| Draw the collision sphere if at the given depth.
## Static Public Member Functions
static bool | computeCollision (cCollisionSpheresLeaf *a_sa, cGenericObject *&a_colObject, cTriangle *&a_colTriangle, cVector3d &a_colPoint, double &a_colSquareDistance, cCollisionSpheresLeaf *a_sb)
| Check for intersection between the two given leaf nodes.
## Public Attributes
cCollisionSpheresGenericShape * | m_prim
| The shape primitive bounded by the sphere leaf.

## Detailed Description

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

## Constructor & Destructor Documentation

cCollisionSpheresLeaf::cCollisionSpheresLeaf | ( | cCollisionSpheresGenericShape * | a_prim,
|  | cCollisionSpheresSphere * | a_parent = `NULL` |
| ) |  |  |

Constructor of cCollisionSpheresLeaf.

Constructor of cCollisionSpheresLeaf.

Parameters:

  | a_prim | Pointer to a shape primitive to be enclosed by the new sphere leaf node.
  | a_parent | Pointer to the parent of this node in sphere tree.

cCollisionSpheresLeaf::cCollisionSpheresLeaf | ( | cTriangle * | a_tri,
|  | cCollisionSpheresSphere * | a_parent = `NULL` |
| ) |  |  |

Constructor of cCollisionSpheresLeaf.

Constructor of cCollisionSpheresLeaf.

Parameters:

  | a_tri | Pointer to triangle to be enclosed by new sphere leaf.
  | a_parent | Pointer to the parent of this node in the sphere tree.

Returns:
  Return a pointer to new cCollisionSpheresLeaf instance.

## Member Function Documentation

void cCollisionSpheresLeaf::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 cCollisionSpheresLeaf::computeCollision | ( | cCollisionSpheresLeaf * | a_sa,
|  | cGenericObject *& | a_colObject,
|  | cTriangle *& | a_colTriangle,
|  | cVector3d & | a_colPoint,
|  | double & | a_colSquareDistance,
|  | cCollisionSpheresLeaf * | a_sb |
| ) |  |  | `[static]`

Check for intersection between the two given leaf nodes.

Determine whether there is any intersection between the primitives (line and triangle) of the two given collision spheres by calling the primitive's collision detection method.

Parameters:

  | a_sa | One sphere tree leaf 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 | Other sphere tree leaf to check for collision.

Returns:
  Return whether primitives of the two leaves collide.

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

- chai3d/src/collisions/CCollisionSpheres.h
- chai3d/src/collisions/CCollisionSpheres.cpp