Simbody
3.5
|
Objects of this class represent collections of surface-pair interactions that are being tracked at a particular instant during a simulation. More...
Public Member Functions | |
ContactSnapshot () | |
Default constructor sets timestamp to NaN. More... | |
void | clear () |
Restore to default-constructed condition. More... | |
void | setTimestamp (Real time) |
Set the time at which this snapshot was taken. More... | |
Real | getTimestamp () const |
At what simulation time was this contact snapshot taken? More... | |
void | adoptContact (Contact &contact) |
Add this Contact object to this snapshot; this is a shallow, reference-counted copy so the Contact object is not duplicated. More... | |
bool | hasContact (ContactId id) const |
Does this snapshot contain a Contact object with the given ContactId? More... | |
bool | hasContact (ContactSurfaceIndex surf1, ContactSurfaceIndex surf2) const |
Does this snapshot contain a Contact object for the given surface pair (in either order)? More... | |
int | getNumContacts () const |
Find out how many Contacts are in this snapshot. More... | |
const Contact & | getContact (int n) const |
Get a reference to the n'th Contact in this snapshot; note that the position of a given Contact in this array is not guaranteed to remain unchanged when Contacts are removed from this snapshot. More... | |
const Contact & | getContactById (ContactId id) const |
If this snapshot contains a contact with the given id, return a reference to it; otherwise, return a reference to an empty contact handle (you can check with isEmpty()). More... | |
ContactId | getContactIdForSurfacePair (ContactSurfaceIndex surf1, ContactSurfaceIndex surf2) const |
If this snapshot contains a contact for the given pair of contact surfaces (order doesn't matter), return its ContactId; otherwise, return an invalid ContactId (you can check with isValid()). More... | |
Objects of this class represent collections of surface-pair interactions that are being tracked at a particular instant during a simulation.
These are suitable for use as state variables for remembering past contact status and as calculated cache entries containing the current contact status. Each tracked surface pair has an integer ContactId that is persistent for as long as a particular interaction is being tracked. We maintain a map providing very fast access to individual Contact entries by ContactId. There is also a map from ContactSurfaceIndex pairs to ContactId that can be used to see whether we are already tracking a Contact between those surfaces; there can be at most one Contact between a given surface pair at any given moment.
|
inline |
Default constructor sets timestamp to NaN.
|
inline |
Restore to default-constructed condition.
|
inline |
Set the time at which this snapshot was taken.
|
inline |
At what simulation time was this contact snapshot taken?
|
inline |
Add this Contact object to this snapshot; this is a shallow, reference-counted copy so the Contact object is not duplicated.
The Contact is assigned a slot in the array of Contact objects that can be used for very fast access; however, that index may change if other Contact objects are removed from the snapshot.
|
inline |
|
inline |
Does this snapshot contain a Contact object for the given surface pair (in either order)?
|
inline |
Find out how many Contacts are in this snapshot.
|
inline |
Get a reference to the n'th Contact in this snapshot; note that the position of a given Contact in this array is not guaranteed to remain unchanged when Contacts are removed from this snapshot.
When in doubt, look up the contact by ContactId instead.
If this snapshot contains a contact with the given id, return a reference to it; otherwise, return a reference to an empty contact handle (you can check with isEmpty()).
|
inline |