chai3d::cGenericCollision Class Reference

This class implements a base class for collision detection. More...

#include <CGenericCollision.h>

Inheritance diagram for chai3d::cGenericCollision:

Public Member Functions

 cGenericCollision ()
 Constructor of cGenericCollision. More...
virtual ~cGenericCollision ()
 Destructor of cGenericCollision. More...
virtual void update ()
 This methods updates the collision detector and should be called if the 3D model it represents is modified. More...
virtual bool computeCollision (cGenericObject *a_object, cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes all collisions between a segment passed as argument and the attributed 3D object. More...
virtual void render (cRenderOptions &a_options)
 This method renders a visual representation of the collision tree. More...
double getBoundaryRadius () const
 This method returns the radius of the boundary shell that covers every triangles. More...
void setDisplayDepth (const int a_depth)
 This method sets the level of the collision tree to display. More...
double getDisplayDepth () const
 This method returns the level inside the collision tree being displayed. (root = 0). More...

Public Attributes

cColorf m_color
 Color property used to render the collision detector graphically. More...

Protected Attributes

int m_displayDepth
double m_radiusAroundElements

Detailed Description

This class implements a base class for programming collision-detection algorithms between objects and line segments defined by two points.

A collision detector is instantiated for a specific object (e.g. mesh) passed by reference in the constructor. The collision detector must then be initialized by calling method initialize() which computes and builds the necessary data structures for the particular object. (e.g. collision tree)

The optional initialize() method takes one argument named a_radius which defines a boundary distance around every triangle (an enclosing shell). When the collision inquiry method is called computeCollision(), collisions are searched between a segment, passed as argument, and the shells that cover every triangle. If this radius is set to zero, then the shells are equal to the triangles themselves. This option is used by the finger-proxy force rendering algorithm to compute the intersection between a sphere (haptic point) and the surface of a mesh.

If the shape of the object is modified (e.g triangles are added or removed from a mesh), then the update() command of the collision detector must be called again. The method is responsible for deallocating any previously built data structures.

Please note that this class does not support collision detection between objects themselves.

Constructor & Destructor Documentation

chai3d::cGenericCollision::cGenericCollision ( )

Constructor of cGenericCollision.

virtual chai3d::cGenericCollision::~cGenericCollision ( )

Member Function Documentation

virtual void chai3d::cGenericCollision::update ( )

Reimplemented in chai3d::cCollisionAABB.

virtual bool chai3d::cGenericCollision::computeCollision ( cGenericObject a_object,
cVector3d a_segmentPointA,
cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
virtual void chai3d::cGenericCollision::render ( cRenderOptions a_options)

Reimplemented in chai3d::cCollisionAABB.

double chai3d::cGenericCollision::getBoundaryRadius ( ) const
void chai3d::cGenericCollision::setDisplayDepth ( const int  a_depth)
double chai3d::cGenericCollision::getDisplayDepth ( ) const

Member Data Documentation

cColorf chai3d::cGenericCollision::m_color
int chai3d::cGenericCollision::m_displayDepth

Level of collision tree to render. Negative values force rendering up to and including this level, positive values render just this level.

double chai3d::cGenericCollision::m_radiusAroundElements

Radius boundary around elements. This value is must be equal or larger than the physical radius of the proxy.

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