- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cCollisionBrute Class Reference

cCollisionBrute provides methods to check for the intersection of a line segment with a mesh by checking all triangles in the mesh. More...

`#include <CCollisionBrute.h>`

Inheritance diagram for cCollisionBrute:

List of all members.

## Public Member Functions
| cCollisionBrute (vector< cTriangle > *a_triangles)
| Constructor of cCollisionBrute.
virtual | ~cCollisionBrute ()
| Destructor of cCollisionBrute.
virtual void | initialize ()
| No initialization is necessary for the brute force method.
virtual void | render ()
| There isn't really a useful "visualization" of "check all triangles".
virtual bool | computeCollision (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cGenericObject *&a_colObject, cTriangle *&a_colTriangle, cVector3d &a_colPoint, double &a_colSquareDistance, int a_proxyCall=-1)
| Return the nearest triangle intersected by the given segment, if any.
## Protected Attributes
vector< cTriangle > * | m_triangles
| Pointer to the list of triangles in the mesh.

## Detailed Description

cCollisionBrute provides methods to check for the intersection of a line segment with a mesh by checking all triangles in the mesh.

## Member Function Documentation

bool cCollisionBrute::computeCollision | ( | cVector3d & | a_segmentPointA,
|  | cVector3d & | a_segmentPointB,
|  | cGenericObject *& | a_colObject,
|  | cTriangle *& | a_colTriangle,
|  | cVector3d & | a_colPoint,
|  | double & | a_colSquareDistance,
|  | int | a_proxyCall = `-1` |
| ) |  |  | `[virtual]`

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

Check if the given line segment intersects any triangle of the mesh. This method is called "brute force" because all triangles are checked by invoking their collision-detection methods. This method is simple but very inefficient.

Parameters:

  | a_segmentPointA | Initial point of segment.
  | a_segmentPointB | End point of segment.
  | 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_proxyCall | If this is > 0, this is a call from a proxy, and the value of a_proxyCall specifies which call this is. When checking for the second and third constraint planes, only the neighbors of the triangle intersected in the first call need be checked, not the whole tree. Call with a_proxyCall = -1 for non-proxy calls.

Returns:
  Return true if the line segment intersects a triangle.

Reimplemented from cGenericCollision.

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

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