walberla::pe::Contact Class Reference

Detailed Description

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:

  • \( v_{rel} \) > 0: separating contact
  • \( v_{rel} \) = 0: resting contact
  • \( v_{rel} \) < 0: colliding contact
    (in order to classify the contact, pe::collisionThreshold is used as tolerance level).

#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 Vec3getPosition () const
 Returns the global position of the contact. More...
 
const Vec3getNormal () 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...
 

Member Enumeration Documentation

◆ ContactType

Classification of contacts.

Contacts between rigid bodies are classified depending on the relative velocity between the touching rigid bodies:

  • \( v_{rel} \) > 0: separating contact
  • \( v_{rel} \) = 0: resting contact
  • \( v_{rel} \) < 0: colliding contact
    (in order to classify the contact, pe::collisionThreshold is used as tolerance level).
Enumerator
colliding 

Colliding contacts (vrel < 0).

resting 

Resting contacts (vrel = 0).

separating 

Separating contacts (vrel > 0).

Constructor & Destructor Documentation

◆ Contact()

walberla::pe::Contact::Contact ( GeomID  g1,
GeomID  g2,
const Vec3 gpos,
const Vec3 normal,
real_t  dist 
)

Contact constructor for a vertex/face contact.

Parameters
g1The first contacting geometric primitive.
g2The second contacting geometric primitive.
gposThe global position of the contact.
normalThe global normal of the contact (running from body 2 to body 1).
distThe distance between the surfaces of the contacting rigid bodies.

Member Function Documentation

◆ getBody1()

GeomID walberla::pe::Contact::getBody1 ( ) const
inline

Returns the first constrained rigid body.

Returns
The first constrained rigid body.

◆ getBody2()

GeomID walberla::pe::Contact::getBody2 ( ) const
inline

Returns the second constrained rigid body.

Returns
The second constrained rigid body.

◆ getDistance()

real_t walberla::pe::Contact::getDistance ( ) const
inline

Returns the derivative of the normal vector.

Returns
Derivative of the normal vector.

Returns the distance between the surfaces of the contacting rigid bodies.

Returns
Distance between the surfaces of the contacting rigid bodies.

◆ getID()

id_t walberla::pe::Contact::getID ( ) const
inline

Returns the ID of the contact.

Returns
The contact ID.

◆ getIndex()

size_t walberla::pe::Contact::getIndex ( ) const
inline

◆ getNormal()

const Vec3 & walberla::pe::Contact::getNormal ( ) const
inline

Returns the global normal of the contact.

Returns
Global normal of the contact.

◆ getNormalRelForce()

real_t walberla::pe::Contact::getNormalRelForce ( ) const

◆ getNormalRelVel()

real_t walberla::pe::Contact::getNormalRelVel ( ) const
inline

Calculation of the normal relative velocity between the two contacting rigid bodies.

Returns
The relative velocity in normal direction.

◆ getPosition()

const Vec3 & walberla::pe::Contact::getPosition ( ) const
inline

Returns the global position of the contact.

Returns
Global position of the contact.

◆ getRelVel()

const Vec3 walberla::pe::Contact::getRelVel ( ) const
inline

Calculation of the relative velocity between the two contacting rigid bodies.

Returns
The relative velocity.

◆ getType()

Contact::ContactType walberla::pe::Contact::getType ( ) const
inline

Returns the type of the contact.

Returns
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:

  • \( v_{rel} \) > 0: separating contact
  • \( v_{rel} \) = 0: resting contact
  • \( v_{rel} \) < 0: colliding contact
    (in order to classify the contact, pe::collisionThreshold is used as tolerance level).

◆ isContacting()

bool walberla::pe::Contact::isContacting ( ConstBodyID  body) const
inline

Returns whether the given rigid body is involved in this contact.

Returns
true if the rigid body is involved in this contact, false if not.

◆ isPenetrating()

bool walberla::pe::Contact::isPenetrating ( ) const
inline

Checks if the two contacting rigid bodies are penetrating each other.

Returns
true if the two rigid bodies are penetrating each other, false if not.

The tolerance level of the check is pe::contactThreshold.

Member Data Documentation

◆ b1_

GeomID walberla::pe::Contact::b1_
protected

The first contacting rigid body.

◆ b2_

GeomID walberla::pe::Contact::b2_
protected

The second contacting rigid body.

◆ dist_

real_t walberla::pe::Contact::dist_
protected

Distance between the surfaces of the contacting rigid bodies.

A negative distance means penetration of the two bodies.

◆ e1_

Vec3 walberla::pe::Contact::e1_
protected

Edge direction of the colliding edge of body 1.

◆ e2_

Vec3 walberla::pe::Contact::e2_
protected

Edge direction of the colliding edge of body 2.

◆ gpos_

Vec3 walberla::pe::Contact::gpos_
protected

The global position of the contact.

◆ id_

id_t walberla::pe::Contact::id_
protected

User-specific contact ID.

◆ normal_

Vec3 walberla::pe::Contact::normal_
protected

Normal of the contact.

The normal is defined within the global world frame and points from body 2 to body 1.


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