Simbody  3.7
SimTK::Contact Class Reference

A Contact contains information about the spatial relationship between two surfaces that are near, or in contact with, each other. More...

+ Inheritance diagram for SimTK::Contact:

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. More...
 
 Contact (const Contact &source)
 Copy constructor is shallow and reference-counted; this handle will point to the same object as does the source. More...
 
 ~Contact ()
 Destructor clears the handle, deleting the referenced object if this was the last reference. More...
 
Contactoperator= (const Contact &source)
 Copy assignment is shallow and reference-counted; this handle will point to the same object as does the source. More...
 
void clear ()
 Clear this handle, deleting the referenced object if this was the last reference. More...
 
bool isEmpty () const
 See if this handle is empty. More...
 
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(). More...
 
Condition getCondition () const
 Find out the current condition of this Contact object. More...
 
ContactSurfaceIndex getSurface1 () const
 Get the first surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem. More...
 
ContactSurfaceIndex getSurface2 () const
 Get the second surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem. More...
 
const TransformgetTransform () 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. More...
 
ContactsetContactId (ContactId id)
 Set the ContactId for this Contact object. More...
 
ContactsetCondition (Condition condition)
 Set the current Condition. More...
 
ContactsetSurfaces (ContactSurfaceIndex surf1, ContactSurfaceIndex surf2)
 Set the surfaces tracked by this Contact object. More...
 
ContactsetTransform (const Transform &X_S1S2)
 Set the surface-to-surface relative transform X_S1S2. More...
 
ContactTypeId getTypeId () const
 Return a unique small integer corresponding to the concrete type of Contact object being referenced by this handle. More...
 
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. More...
 
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. More...
 

Protected Member Functions

 Contact (ContactImpl *impl)
 

Detailed Description

A Contact contains information about the spatial relationship between two surfaces that are near, or in contact with, each other.

It usually is created by a ContactTracker or CollisionDetectionAlgorithm, and is retrieved from a ContactTrackerSubsystem or GeneralContactSubsystem.

The base class records only the indices of the two surfaces that are in contact, and the relative Transform between them at the time the Contact was recorded. ContactTrackers or CollisionDetectionAlgorithms which characterize contacts in more complex ways will return objects that are subclasses of Contact that provide additional information.

Member Enumeration Documentation

◆ Condition

The Contact::Condition tracks the status of a Contact through its lifetime.

Enumerator
Unknown 

this is an illegal value

Untracked 

this pair not yet being tracked; might not contact

Anticipated 

we expect these to contact soon

NewContact 

first time seen; needs a ContactId assigned

Ongoing 

was new or ongoing before; still in contact now

Broken 

was new or ongoing before; no longer in contact

Constructor & Destructor Documentation

◆ Contact() [1/3]

SimTK::Contact::Contact ( )
inline

The default constructor creates an empty handle.

◆ Contact() [2/3]

SimTK::Contact::Contact ( const Contact source)

Copy constructor is shallow and reference-counted; this handle will point to the same object as does the source.

◆ ~Contact()

SimTK::Contact::~Contact ( )
inline

Destructor clears the handle, deleting the referenced object if this was the last reference.

◆ Contact() [3/3]

SimTK::Contact::Contact ( ContactImpl *  impl)
explicitprotected

Member Function Documentation

◆ nameOfCondition()

static const char* SimTK::Contact::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.

◆ operator=()

Contact& SimTK::Contact::operator= ( const Contact source)

Copy assignment is shallow and reference-counted; this handle will point to the same object as does the source.

◆ clear()

void SimTK::Contact::clear ( )

Clear this handle, deleting the referenced object if this was the last reference.

◆ isEmpty()

bool SimTK::Contact::isEmpty ( ) const
inline

See if this handle is empty.

◆ getContactId()

ContactId SimTK::Contact::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().

◆ getCondition()

Condition SimTK::Contact::getCondition ( ) const

Find out the current condition of this Contact object.

◆ getSurface1()

ContactSurfaceIndex SimTK::Contact::getSurface1 ( ) const

Get the first surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem.

◆ getSurface2()

ContactSurfaceIndex SimTK::Contact::getSurface2 ( ) const

Get the second surface involved in the contact, specified by its index within its contact set or ContactTrackerSubsystem.

◆ getTransform()

const Transform& SimTK::Contact::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.

◆ setContactId()

Contact& SimTK::Contact::setContactId ( ContactId  id)

Set the ContactId for this Contact object.

This must persist over the lifetime of a single contact event.

◆ setCondition()

Contact& SimTK::Contact::setCondition ( Condition  condition)

Set the current Condition.

◆ setSurfaces()

Contact& SimTK::Contact::setSurfaces ( ContactSurfaceIndex  surf1,
ContactSurfaceIndex  surf2 
)

Set the surfaces tracked by this Contact object.

◆ setTransform()

Contact& SimTK::Contact::setTransform ( const Transform X_S1S2)

Set the surface-to-surface relative transform X_S1S2.

◆ getTypeId()

ContactTypeId SimTK::Contact::getTypeId ( ) const

Return a unique small integer corresponding to the concrete type of Contact object being referenced by this handle.

◆ createNewContactId()

static ContactId SimTK::Contact::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.

◆ getImpl()

const ContactImpl& SimTK::Contact::getImpl ( ) const
inline

◆ updImpl()

ContactImpl& SimTK::Contact::updImpl ( )
inline

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