Simbody
|
This class performs collision detection for use in contact modeling. More...
#include <GeneralContactSubsystem.h>
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 MobilizedBody & | getBody (ContactSetIndex set, ContactSurfaceIndex index) const |
Get the MobilizedBody in whose reference frame a body is defined. | |
const ContactGeometry & | getBodyGeometry (ContactSetIndex set, ContactSurfaceIndex index) const |
Get the ContactGeometry which defines the shape of a body. | |
ContactGeometry & | updBodyGeometry (ContactSetIndex set, ContactSurfaceIndex index) |
Get a mutable reference to the ContactGeometry which defines the shape of a body. | |
const Transform & | getBodyTransform (ContactSetIndex set, ContactSurfaceIndex index) const |
Get the location and orientation of a body. | |
Transform & | updBodyTransform (ContactSetIndex set, ContactSurfaceIndex index) |
Get a mutable reference to the location and orientation of a body. | |
const Array_< 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) |
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.
SimTK::GeneralContactSubsystem::GeneralContactSubsystem | ( | ) |
SimTK::GeneralContactSubsystem::GeneralContactSubsystem | ( | MultibodySystem & | ) | [explicit] |
ContactSetIndex SimTK::GeneralContactSubsystem::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.
int SimTK::GeneralContactSubsystem::getNumContactSets | ( | ) | const |
Get the total number of contact sets that have been created.
void SimTK::GeneralContactSubsystem::addBody | ( | ContactSetIndex | index, |
const MobilizedBody & | body, | ||
const ContactGeometry & | geom, | ||
Transform | transform | ||
) |
Add a body to a contact set.
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 |
int SimTK::GeneralContactSubsystem::getNumBodies | ( | ContactSetIndex | set | ) | const |
Get the number of bodies in a contact set.
const MobilizedBody& SimTK::GeneralContactSubsystem::getBody | ( | ContactSetIndex | set, |
ContactSurfaceIndex | index | ||
) | const |
Get the MobilizedBody in whose reference frame a body is defined.
set | the contact set the body belongs to |
index | the index of the body within the contact set |
const ContactGeometry& SimTK::GeneralContactSubsystem::getBodyGeometry | ( | ContactSetIndex | set, |
ContactSurfaceIndex | index | ||
) | const |
Get the ContactGeometry which defines the shape of a body.
set | the contact set the body belongs to |
index | the index of the body within the contact set |
ContactGeometry& SimTK::GeneralContactSubsystem::updBodyGeometry | ( | ContactSetIndex | set, |
ContactSurfaceIndex | index | ||
) |
Get a mutable reference to the ContactGeometry which defines the shape of a body.
set | the contact set the body belongs to |
index | the index of the body within the contact set |
const Transform& SimTK::GeneralContactSubsystem::getBodyTransform | ( | ContactSetIndex | set, |
ContactSurfaceIndex | index | ||
) | const |
Get the location and orientation of a body.
set | the contact set the body belongs to |
index | the index of the body within the contact set |
Transform& SimTK::GeneralContactSubsystem::updBodyTransform | ( | ContactSetIndex | set, |
ContactSurfaceIndex | index | ||
) |
Get a mutable reference to the location and orientation of a body.
set | the contact set the body belongs to |
index | the index of the body within the contact set |
const Array_<Contact>& SimTK::GeneralContactSubsystem::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.
SimTK::GeneralContactSubsystem::SimTK_PIMPL_DOWNCAST | ( | GeneralContactSubsystem | , |
Subsystem | |||
) |