#include <CCollisionBrute.h>
Inheritance diagram for cCollisionBrute:
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. |
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.
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. |
Reimplemented from cGenericCollision.