A Contact contains information about two surfaces that are in contact with each other. More...
#include <Contact.h>
Public Types | |
enum | Condition { Unknown, Untracked, Anticipated, NewContact, Ongoing, Broken } |
The Contact::Condition tracks the status of a Contact through its lifetime. More... | |
Public Member Functions | |
Contact () | |
The default constructor creates an empty handle. | |
Contact (const Contact &source) | |
Copy constructor is shallow and reference-counted; this handle will point to the same object as does the source. | |
~Contact () | |
Destructor clears the handle, deleting the referenced object if this was the last reference. | |
Contact & | operator= (const Contact &source) |
Copy assignment is shallow and reference-counted; this handle will point to the same object as does the source. | |
void | clear () |
Clear this handle, deleting the referenced object if this was the last reference. | |
bool | isEmpty () const |
See if this handle is empty. | |
ContactId | getContactId () const |
Get the persistent ContactId that has been assigned to this Contact object if there is one (otherwise this will be invalid -- you can check with isValid(). | |
Condition | getCondition () const |
Find out the current condition of this Contact object. | |
ContactSurfaceIndex | getSurface1 () const |
Get the first surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem. | |
ContactSurfaceIndex | getSurface2 () const |
Get the second surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem. | |
const Transform & | getTransform () const |
Return the transform X_S1S2 giving the pose of surface 2's frame measured and expressed in surface 1's frame, recorded at the time this Contact object was calculated. | |
Contact & | setContactId (ContactId id) |
Set the ContactId for this Contact object. | |
Contact & | setCondition (Condition condition) |
Set the current Condition. | |
Contact & | setSurfaces (ContactSurfaceIndex surf1, ContactSurfaceIndex surf2) |
Set the surfaces tracked by this Contact object. | |
Contact & | setTransform (const Transform &X_S1S2) |
Set the surface-to-surface relative transform X_S1S2. | |
ContactTypeId | getTypeId () const |
Return a unique small integer corresponding to the concrete type of Contact object being referenced by this handle. | |
const ContactImpl & | getImpl () const |
ContactImpl & | updImpl () |
Static Public Member Functions | |
static const char * | nameOfCondition (Condition) |
Returns a human-readable name corresponding to the given Condition; useful for debugging. | |
static ContactId | createNewContactId () |
This creates a new ContactId starting from 1 and increasing for a very long time (to a billion or so) before repeating. | |
Protected Member Functions | |
Contact (ContactImpl *impl) |
A Contact contains information about two surfaces that are in contact with each other.
It usually is created by a CollisionDetectionAlgorithm, and is retrieved by calling getContacts() on a GeneralContactSubsystem.
The base class records only the indices of the two surfaces that are in contact. CollisionDetectionAlgorithms which characterize contacts in more complex ways will typically define subclasses of Contact that provide additional information.
enum Condition |
The Contact::Condition tracks the status of a Contact through its lifetime.
Contact | ( | ) | [inline] |
The default constructor creates an empty handle.
Copy constructor is shallow and reference-counted; this handle will point to the same object as does the source.
~Contact | ( | ) | [inline] |
Destructor clears the handle, deleting the referenced object if this was the last reference.
Contact | ( | ContactImpl * | impl | ) | [explicit, protected] |
void clear | ( | ) |
Clear this handle, deleting the referenced object if this was the last reference.
static ContactId createNewContactId | ( | ) | [static] |
This creates a new ContactId starting from 1 and increasing for a very long time (to a billion or so) before repeating.
ContactId 0 is never returned and this call is thread-safe.
Condition getCondition | ( | ) | const |
Find out the current condition of this Contact object.
Referenced by SimTK::operator<<().
ContactId getContactId | ( | ) | const |
Get the persistent ContactId that has been assigned to this Contact object if there is one (otherwise this will be invalid -- you can check with isValid().
Referenced by ContactSnapshot::adoptContact(), and SimTK::operator<<().
const ContactImpl& getImpl | ( | ) | const [inline] |
ContactSurfaceIndex getSurface1 | ( | ) | const |
Get the first surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem.
Referenced by ContactSnapshot::adoptContact(), and SimTK::operator<<().
ContactSurfaceIndex getSurface2 | ( | ) | const |
Get the second surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem.
Referenced by ContactSnapshot::adoptContact(), and SimTK::operator<<().
const Transform& getTransform | ( | ) | const |
Return the transform X_S1S2 giving the pose of surface 2's frame measured and expressed in surface 1's frame, recorded at the time this Contact object was calculated.
ContactTypeId getTypeId | ( | ) | const |
Return a unique small integer corresponding to the concrete type of Contact object being referenced by this handle.
Referenced by SimTK::operator<<().
bool isEmpty | ( | ) | const [inline] |
See if this handle is empty.
static const char* nameOfCondition | ( | Condition | ) | [static] |
Returns a human-readable name corresponding to the given Condition; useful for debugging.
If the Condition is unrecognized the method will return some text to that effect rather than crashing.
Referenced by SimTK::operator<<().
Copy assignment is shallow and reference-counted; this handle will point to the same object as does the source.
Contact& setContactId | ( | ContactId | id | ) |
Set the ContactId for this Contact object.
This must persist over the lifetime of a single contact event.
Contact& setSurfaces | ( | ContactSurfaceIndex | surf1, | |
ContactSurfaceIndex | surf2 | |||
) |
Set the surfaces tracked by this Contact object.
Set the surface-to-surface relative transform X_S1S2.
ContactImpl& updImpl | ( | ) | [inline] |