GeneralContactSubsystem Class Reference

This class performs collision detection for use in contact modeling. More...

#include <GeneralContactSubsystem.h>

Inheritance diagram for GeneralContactSubsystem:
Subsystem

List of all members.

Public Member Functions

 GeneralContactSubsystem ()
 GeneralContactSubsystem (MultibodySystem &)
ContactSetIndex createContactSet ()
 Create a new contact set.
int getNumContactSets () const
 Get the total number of contact sets that have been created.
void addBody (ContactSetIndex index, const MobilizedBody &body, const ContactGeometry &geom, Transform transform)
 Add a body to a contact set.
int getNumBodies (ContactSetIndex set) const
 Get the number of bodies in a contact set.
const MobilizedBodygetBody (ContactSetIndex set, int index) const
 Get the MobilizedBody in whose reference frame a body is defined.
const ContactGeometrygetBodyGeometry (ContactSetIndex set, int index) const
 Get the ContactGeometry which defines the shape of a body.
ContactGeometryupdBodyGeometry (ContactSetIndex set, int index)
 Get a mutable reference to the ContactGeometry which defines the shape of a body.
const TransformgetBodyTransform (ContactSetIndex set, int index) const
 Get the location and orientation of a body.
TransformupdBodyTransform (ContactSetIndex set, int index)
 Get a mutable reference to the location and orientation of a body.
const std::vector< Contact > & getContacts (const State &state, ContactSetIndex set) const
 Get a list of all contacts between bodies in a contact set.
 SimTK_PIMPL_DOWNCAST (GeneralContactSubsystem, Subsystem)

Detailed Description

This class performs collision detection for use in contact modeling.

It manages sets of bodies that can potentially interact with each other. At each time step, it identifies all the contacts between them. It does not directly affect the behavior of the system in any way. Instead, it simply provides a service that can be used by other classes to implement forces, events, contraints, etc. that are based on contacts between bodies.

To use this class, first create a "contact set" by calling createContactSet(). A contact set is a group of bodies which can interact with each other. If you create multiple contact sets, the bodies within each one will be checked for contacts with each other, but bodies in different sets will not interact.

Next, add bodies to the contact set. Each one is represented by a ContactGeometry object that describes its shape, the MoblizedBody it is attached to, and a Transform giving the location of the geometry in the MobilizedBody's reference frame.

Finally, call getContacts() to get a list of all contacts which exist between bodies in a contact set. Each Contact specifies two bodies that overlap, along with a description of the contact point, such as its location and normal vector.


Constructor & Destructor Documentation

GeneralContactSubsystem ( MultibodySystem  )  [explicit]

Member Function Documentation

void addBody ( ContactSetIndex  index,
const MobilizedBody body,
const ContactGeometry geom,
Transform  transform 
)

Add a body to a contact set.

Parameters:
index the index of the contact set the body should be added to
body the MobilizedBody whose reference frame the body is attached to
geom a ContactGeometry describing the shape of the body
transform the location and orientation of the ContactGeometry in the MobilizedBody's reference frame
ContactSetIndex createContactSet (  ) 

Create a new contact set.

The return value is an index which can be used to refer to the contact set when calling other methods.

const MobilizedBody& getBody ( ContactSetIndex  set,
int  index 
) const

Get the MobilizedBody in whose reference frame a body is defined.

Parameters:
set the contact set the body belongs to
index the index of the body within the contact set
const ContactGeometry& getBodyGeometry ( ContactSetIndex  set,
int  index 
) const

Get the ContactGeometry which defines the shape of a body.

Parameters:
set the contact set the body belongs to
index the index of the body within the contact set
const Transform& getBodyTransform ( ContactSetIndex  set,
int  index 
) const

Get the location and orientation of a body.

Parameters:
set the contact set the body belongs to
index the index of the body within the contact set
const std::vector<Contact>& getContacts ( const State state,
ContactSetIndex  set 
) const

Get a list of all contacts between bodies in a contact set.

Contacts are calculated at Dynamics stage, so the state must have been realized to at least Dynamics stage. This subsystem is guaranteed to be realized before all ForceSubsystems, however, so a Force may still invoke it to calculate forces based on contacts.

int getNumBodies ( ContactSetIndex  set  )  const

Get the number of bodies in a contact set.

int getNumContactSets (  )  const

Get the total number of contact sets that have been created.

SimTK_PIMPL_DOWNCAST ( GeneralContactSubsystem  ,
Subsystem   
)
ContactGeometry& updBodyGeometry ( ContactSetIndex  set,
int  index 
)

Get a mutable reference to the ContactGeometry which defines the shape of a body.

Parameters:
set the contact set the body belongs to
index the index of the body within the contact set
Transform& updBodyTransform ( ContactSetIndex  set,
int  index 
)

Get a mutable reference to the location and orientation of a body.

Parameters:
set the contact set the body belongs to
index the index of the body within the contact set

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

Generated on Wed Dec 30 11:05:14 2009 for SimTKcore by  doxygen 1.6.1