Simbody  3.5
SimTK::CollisionDetectionAlgorithm Class Referenceabstract

A CollisionDetectionAlgorithm implements an algorithm for detecting overlaps between pairs of ContactGeometry objects, and creating Contact objects based on them. More...

+ Inheritance diagram for SimTK::CollisionDetectionAlgorithm:

Classes

class  ConvexConvex
 This algorithm detects contacts between two ContactGeometry::Convex objects. More...
 
class  HalfSpaceEllipsoid
 This algorithm detects contacts between a ContactGeometry::HalfSpace and a ContactGeometry::Ellipsoid. More...
 
class  HalfSpaceSphere
 This algorithm detects contacts between a ContactGeometry::HalfSpace and a ContactGeometry::Sphere. More...
 
class  HalfSpaceTriangleMesh
 This algorithm detects contacts between a ContactGeometry::HalfSpace and a ContactGeometry::TriangleMesh. More...
 
class  SphereSphere
 This algorithm detects contacts between two ContactGeometry::Sphere objects. More...
 
class  SphereTriangleMesh
 This algorithm detects contacts between a ContactGeometry::Sphere and a ContactGeometry::TriangleMesh. More...
 
class  TriangleMeshTriangleMesh
 This algorithm detects contacts between two ContactGeometry::TriangleMesh objects. More...
 

Public Member Functions

virtual ~CollisionDetectionAlgorithm ()
 
virtual void processObjects (ContactSurfaceIndex index1, const ContactGeometry &object1, const Transform &transform1, ContactSurfaceIndex index2, const ContactGeometry &object2, const Transform &transform2, Array_< Contact > &contacts) const =0
 Identify contacts between a pair of bodies. More...
 

Static Public Member Functions

static void registerAlgorithm (ContactGeometryTypeId type1, ContactGeometryTypeId type2, CollisionDetectionAlgorithm *algorithm)
 Register a CollisionDetectionAlgorithm to be used for identifying contacts between bodies of two specific types. More...
 
static CollisionDetectionAlgorithmgetAlgorithm (ContactGeometryTypeId type1, ContactGeometryTypeId type2)
 Get the CollisionDetectionAlgorithm to use for identifying contacts between bodies of two specific types. More...
 

Detailed Description

A CollisionDetectionAlgorithm implements an algorithm for detecting overlaps between pairs of ContactGeometry objects, and creating Contact objects based on them.

This class is used internally by GeneralContactSubsystem, and there usually is no reason to access it directly. The exception is if you are defining a new ContactGeometry subclass. In that case, you will also need to define one or more CollisionDetectionAlgorithms to detect collisions with your new geometry type, then register it calling registerAlgorithm().

Constructor & Destructor Documentation

virtual SimTK::CollisionDetectionAlgorithm::~CollisionDetectionAlgorithm ( )
inlinevirtual

Member Function Documentation

virtual void SimTK::CollisionDetectionAlgorithm::processObjects ( ContactSurfaceIndex  index1,
const ContactGeometry object1,
const Transform transform1,
ContactSurfaceIndex  index2,
const ContactGeometry object2,
const Transform transform2,
Array_< Contact > &  contacts 
) const
pure virtual

Identify contacts between a pair of bodies.

Parameters
index1the index of the first body within its contact set
object1the ContactGeometry for the first body
transform1the location and orientation of the first body in the ground frame
index2the index of the second body within its contact set
object2the ContactGeometry for the second body
transform2the location and orientation of the second body in the ground frame
contactsif the bodies overlap, a Contact should be added to this for each distinct contact between them. (Multiple contacts may exist if one of the bodies is concave.)

Implemented in SimTK::CollisionDetectionAlgorithm::ConvexConvex, SimTK::CollisionDetectionAlgorithm::TriangleMeshTriangleMesh, SimTK::CollisionDetectionAlgorithm::SphereTriangleMesh, SimTK::CollisionDetectionAlgorithm::HalfSpaceTriangleMesh, SimTK::CollisionDetectionAlgorithm::SphereSphere, SimTK::CollisionDetectionAlgorithm::HalfSpaceEllipsoid, and SimTK::CollisionDetectionAlgorithm::HalfSpaceSphere.

static void SimTK::CollisionDetectionAlgorithm::registerAlgorithm ( ContactGeometryTypeId  type1,
ContactGeometryTypeId  type2,
CollisionDetectionAlgorithm algorithm 
)
static

Register a CollisionDetectionAlgorithm to be used for identifying contacts between bodies of two specific types.

Parameters
type1the type identifier for the ContactGeometry subclass the algorithm expects as the first body
type2the type identifier for the ContactGeometry subclass the algorithm expects as the second body
algorithmthe algorithm to use for bodies of the specified types
static CollisionDetectionAlgorithm* SimTK::CollisionDetectionAlgorithm::getAlgorithm ( ContactGeometryTypeId  type1,
ContactGeometryTypeId  type2 
)
static

Get the CollisionDetectionAlgorithm to use for identifying contacts between bodies of two specific types.

Parameters
type1the type id of the first body's ContactGeometry
type2the type id of the second body's ContactGeometry
Returns
the CollisionDetectionAlgorithm to use, or NULL if no suitable algorithm has been registered

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