Contact between rigid bodies.
The Contact class is the base class for all types of contacts between rigid bodies in the simulation system. Contacts between rigid bodies are classified depending on the relative velocity between the touching rigid bodies:
#include <Contact.h>
Public Types | |
enum | ContactType { colliding = 0, resting = 1, separating = 2 } |
Classification of contacts. More... | |
Public Member Functions | |
Constructors | |
Contact (GeomID g1, GeomID g2, const Vec3 &gpos, const Vec3 &normal, real_t dist) | |
Contact constructor for a vertex/face contact. More... | |
Get functions | |
bool | isPenetrating () const |
Checks if the two contacting rigid bodies are penetrating each other. More... | |
bool | isContacting (ConstBodyID body) const |
Returns whether the given rigid body is involved in this contact. More... | |
id_t | getID () const |
Returns the ID of the contact. More... | |
size_t | getIndex () const |
GeomID | getBody1 () const |
Returns the first constrained rigid body. More... | |
GeomID | getBody2 () const |
Returns the second constrained rigid body. More... | |
const Vec3 & | getPosition () const |
Returns the global position of the contact. More... | |
const Vec3 & | getNormal () const |
Returns the global normal of the contact. More... | |
real_t | getDistance () const |
Returns the derivative of the normal vector. More... | |
ContactType | getType () const |
Returns the type of the contact. More... | |
real_t | getNormalRelVel () const |
Calculation of the normal relative velocity between the two contacting rigid bodies. More... | |
const Vec3 | getRelVel () const |
Calculation of the relative velocity between the two contacting rigid bodies. More... | |
real_t | getNormalRelForce () const |
Protected Attributes | |
Member variables | |
id_t | id_ |
User-specific contact ID. More... | |
GeomID | b1_ |
The first contacting rigid body. More... | |
GeomID | b2_ |
The second contacting rigid body. More... | |
Vec3 | gpos_ |
The global position of the contact. More... | |
Vec3 | normal_ |
Normal of the contact. More... | |
Vec3 | e1_ |
Edge direction of the colliding edge of body 1. More... | |
Vec3 | e2_ |
Edge direction of the colliding edge of body 2. More... | |
real_t | dist_ |
Distance between the surfaces of the contacting rigid bodies. More... | |
Classification of contacts.
Contacts between rigid bodies are classified depending on the relative velocity between the touching rigid bodies:
Enumerator | |
---|---|
colliding | Colliding contacts (vrel < 0). |
resting | Resting contacts (vrel = 0). |
separating | Separating contacts (vrel > 0). |
walberla::pe::Contact::Contact | ( | GeomID | g1, |
GeomID | g2, | ||
const Vec3 & | gpos, | ||
const Vec3 & | normal, | ||
real_t | dist | ||
) |
Contact constructor for a vertex/face contact.
g1 | The first contacting geometric primitive. |
g2 | The second contacting geometric primitive. |
gpos | The global position of the contact. |
normal | The global normal of the contact (running from body 2 to body 1). |
dist | The distance between the surfaces of the contacting rigid bodies. |
|
inline |
Returns the first constrained rigid body.
|
inline |
Returns the second constrained rigid body.
|
inline |
Returns the derivative of the normal vector.
Returns the distance between the surfaces of the contacting rigid bodies.
|
inline |
Returns the ID of the contact.
|
inline |
|
inline |
Returns the global normal of the contact.
real_t walberla::pe::Contact::getNormalRelForce | ( | ) | const |
|
inline |
Calculation of the normal relative velocity between the two contacting rigid bodies.
|
inline |
Returns the global position of the contact.
|
inline |
Calculation of the relative velocity between the two contacting rigid bodies.
|
inline |
Returns the type of the contact.
This function returns the type of the contact: separating, resting or colliding. The contact is classified according to the relative velocity of the two touching rigid bodies in the contact:
|
inline |
Returns whether the given rigid body is involved in this contact.
|
inline |
Checks if the two contacting rigid bodies are penetrating each other.
The tolerance level of the check is pe::contactThreshold.
|
protected |
The first contacting rigid body.
|
protected |
The second contacting rigid body.
|
protected |
Distance between the surfaces of the contacting rigid bodies.
A negative distance means penetration of the two bodies.
|
protected |
Edge direction of the colliding edge of body 1.
|
protected |
Edge direction of the colliding edge of body 2.
|
protected |
The global position of the contact.
|
protected |
User-specific contact ID.
|
protected |
Normal of the contact.
The normal is defined within the global world frame and points from body 2 to body 1.