AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agxCollide::GeometryContact Class Reference

A contact between two geometries. More...

#include <Contacts.h>

+ Inheritance diagram for agxCollide::GeometryContact:

Public Types

enum  ContactState { NO_CONTACT = 0 , IMPACT_STATE = 1 , CONTACT_STATE = 2 , SEPARATION_STATE = 3 }
 Specify the state of the contact. More...
 
typedef ContactPoint PointType
 
- Public Types inherited from agx::Physics::GeometryContactPtr
typedef GeometryContactData DataType
 
typedef GeometryContactInstance InstanceType
 
typedef GeometryContactModel ModelType
 
- Public Types inherited from agx::Physics::ContactPtr
typedef ContactData DataType
 
typedef ContactInstance InstanceType
 
typedef ContactModel ModelType
 
- Public Types inherited from agx::Physics::InteractionPtr
typedef InteractionData DataType
 
typedef InteractionInstance InstanceType
 
typedef InteractionModel ModelType
 

Public Member Functions

 GeometryContact ()
 Default constructor.
 
 GeometryContact (agx::Physics::GeometryContactPtr contact)
 Construct given geometry contact entity data.
 
agx::Vec3f calculateRelativeVelocity (size_t pointIndex=0) const
 Calculate the relative velocity in a contact point.
 
void clear ()
 Clear contact points.
 
int contains (agx::RigidBody *body) const
 Will return -1 if body does not exist in this GeometryContact, 0 if it is the first (index 0) and 1 if it is the second (index 1).
 
int contains (agxCollide::Geometry *geometry) const
 Will return -1 if geometry does not exist in this GeometryContact, 0 if it is the first (index 0) and 1 if it is the second (index 1).
 
agxCollide::Geometry * geometry (size_t ith)
 
const agxCollide::Geometry * geometry (size_t ith) const
 
void * getCustomData ()
 
const void * getCustomData () const
 
agx::ContactMaterial * getMaterial ()
 If the contact material for this geometry contact is explicit it can be accessed here.
 
const agx::ContactMaterial * getMaterial () const
 If the contact material for this geometry contact is explicit it can be accessed here.
 
const agx::ContactMaterial * getMaterial (bool) const
 It's not possible to change parameters in an implicit contact material.
 
agx::Bool hasImpactingPoints () const
 
bool isEnabled () const
 
ContactPointVector & points ()
 
const ContactPointVector & points () const
 
void removeContactPoint (ContactPoint &point)
 remove the specified ContactPoint from the set of contact points.
 
agx::RigidBody * rigidBody (size_t ith)
 Returns access to rigid body data.
 
const agx::RigidBody * rigidBody (size_t ith) const
 Returns access to rigid body data.
 
void setCustomData (void *customData)
 Store custom data for this Contact.
 
void setEnable (bool flag)
 Set to false to disable the contact.
 
agx::UInt8 state () const
 
- Public Member Functions inherited from agx::Physics::GeometryContactPtr
AGXPHYSICS_EXPORT GeometryContactPtr ()
 
AGXPHYSICS_EXPORT GeometryContactPtr (agxData::EntityStorage *storage, agx::Index id)
 
AGXPHYSICS_EXPORT GeometryContactPtr (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT GeometryContactPtr (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agx::Physics::RigidBodyPtr & body1 ()
 body1 is the rigid body of geometry1, can be assumed to be a valid rigid body.
 
AGXPHYSICS_EXPORT agx::Physics::RigidBodyPtr const & body1 () const
 body1 is the rigid body of geometry1, can be assumed to be a valid rigid body.
 
AGXPHYSICS_EXPORT agx::Physics::RigidBodyPtr & body2 ()
 body2 is the rigid body of geometry2, can be NULL.
 
AGXPHYSICS_EXPORT agx::Physics::RigidBodyPtr const & body2 () const
 body2 is the rigid body of geometry2, can be NULL.
 
AGXPHYSICS_EXPORT agx::Physics::BroadPhasePairPtr & broadPhasePair ()
 
AGXPHYSICS_EXPORT agx::Physics::BroadPhasePairPtr const & broadPhasePair () const
 
AGXPHYSICS_EXPORT void *& customData ()
 
AGXPHYSICS_EXPORT void *const & customData () const
 
AGXPHYSICS_EXPORT agx::Bool & enabled ()
 
AGXPHYSICS_EXPORT agx::Bool const & enabled () const
 
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry1 ()
 
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr const & geometry1 () const
 
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry2 ()
 
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr const & geometry2 () const
 
GeometryContactData * getData ()
 
const GeometryContactData * getData () const
 
AGXPHYSICS_EXPORT agx::Bool & hasInternalMaterial ()
 
AGXPHYSICS_EXPORT agx::Bool const & hasInternalMaterial () const
 
AGXPHYSICS_EXPORT agx::Bool & hasSurfaceVelocity ()
 
AGXPHYSICS_EXPORT agx::Bool const & hasSurfaceVelocity () const
 
AGXPHYSICS_EXPORT agx::Bool & immediately ()
 
AGXPHYSICS_EXPORT agx::Bool const & immediately () const
 
AGXPHYSICS_EXPORT GeometryContactInstance instance ()
 
AGXPHYSICS_EXPORT const GeometryContactInstance instance () const
 
AGXPHYSICS_EXPORT GeometryContactSemantics * operator-> ()
 
AGXPHYSICS_EXPORT const GeometryContactSemantics * operator-> () const
 
AGXPHYSICS_EXPORT GeometryContactPtr & operator= (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT GeometryContactPtr & operator= (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agxData::Array< agx::Physics::ContactPointPtr > & points ()
 The list of contact points.
 
AGXPHYSICS_EXPORT agxData::Array< agx::Physics::ContactPointPtr > const & points () const
 The list of contact points.
 
AGXPHYSICS_EXPORT agx::Bool & usingPPGS ()
 
AGXPHYSICS_EXPORT agx::Bool const & usingPPGS () const
 
- Public Member Functions inherited from agx::Physics::ContactPtr
AGXPHYSICS_EXPORT ContactPtr ()
 
AGXPHYSICS_EXPORT ContactPtr (agxData::EntityStorage *storage, agx::Index id)
 
AGXPHYSICS_EXPORT ContactPtr (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT ContactPtr (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agx::UInt32 & constraintIndex ()
 
AGXPHYSICS_EXPORT agx::UInt32 const & constraintIndex () const
 
AGXPHYSICS_EXPORT agx::UInt32 & contactZoneIndex ()
 
AGXPHYSICS_EXPORT agx::UInt32 const & contactZoneIndex () const
 
AGXPHYSICS_EXPORT agx::UInt16 & contactZoneSlot ()
 
AGXPHYSICS_EXPORT agx::UInt16 const & contactZoneSlot () const
 
ContactData * getData ()
 
const ContactData * getData () const
 
AGXPHYSICS_EXPORT ContactInstance instance ()
 
AGXPHYSICS_EXPORT const ContactInstance instance () const
 
AGXPHYSICS_EXPORT agx::Physics::ContactMaterialPtr & material ()
 
AGXPHYSICS_EXPORT agx::Physics::ContactMaterialPtr const & material () const
 
AGXPHYSICS_EXPORT ContactSemantics * operator-> ()
 
AGXPHYSICS_EXPORT const ContactSemantics * operator-> () const
 
AGXPHYSICS_EXPORT ContactPtr & operator= (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT ContactPtr & operator= (const agxData::EntityPtr &ptr)
 
- Public Member Functions inherited from agx::Physics::InteractionPtr
AGXPHYSICS_EXPORT InteractionPtr ()
 
AGXPHYSICS_EXPORT InteractionPtr (agxData::EntityStorage *storage, agx::Index id)
 
AGXPHYSICS_EXPORT InteractionPtr (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT InteractionPtr (const agxData::EntityPtr &ptr)
 
InteractionData * getData ()
 
const InteractionData * getData () const
 
AGXPHYSICS_EXPORT agx::Physics::GraphNodePtr & graphNode ()
 
AGXPHYSICS_EXPORT agx::Physics::GraphNodePtr const & graphNode () const
 
AGXPHYSICS_EXPORT InteractionInstance instance ()
 
AGXPHYSICS_EXPORT const InteractionInstance instance () const
 
AGXPHYSICS_EXPORT InteractionSemantics * operator-> ()
 
AGXPHYSICS_EXPORT const InteractionSemantics * operator-> () const
 
AGXPHYSICS_EXPORT InteractionPtr & operator= (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT InteractionPtr & operator= (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agx::SolveModel *& solveModel ()
 
AGXPHYSICS_EXPORT agx::SolveModel *const & solveModel () const
 
- Public Member Functions inherited from agxData::EntityPtr
 EntityPtr ()
 
 EntityPtr (agxData::EntityStorage *storage, agx::Index id)
 
 EntityPtr (const agxData::EntityInstance &instance)
 
 EntityPtr (const agxData::EntityPtr &other)=default
 
 ~EntityPtr ()=default
 
agx::Index calculateIndex () const
 Calculate the index using the indirect id.
 
agxData::EntityPtr copy ()
 Create a copy instance in the same storage.
 
agxData::EntityPtr copy (agxData::EntityStorage *target)
 Copy instance to another storage.
 
void copyAttributes (agxData::EntityPtr source)
 Copy instance attributes to an existing target instance.
 
template<typename T >
T & dataSet ()
 
template<typename T >
const T & dataSet () const
 
void destroy ()
 Remove the entity from the active storage.
 
agxData::EntityData * getData ()
 
const agxData::EntityData * getData () const
 
agx::Index getId () const
 
agxData::EntityModel * getModel ()
 
const agxData::EntityModel * getModel () const
 
agxData::EntityStorage * getStorage () const
 
agx::UInt32 hash () const
 
void init (agxData::EntityStorage *storage, agx::Index id)
 Set the target storage and id.
 
agxData::EntityInstance instance ()
 
const agxData::EntityInstance instance () const
 
void invalidate ()
 Invalidate the entity pointer.
 
bool isInstanceOf (agxData::EntityModel *model) const
 
bool isValid () const
 
 operator bool () const
 
bool operator! () const
 
bool operator!= (const EntityPtr &rhs) const
 
template<typename T >
agxData::ArrayAttributeT< T >::Type & operator() (const agxData::ArrayAttributeT< T > *attribute)
 Array attribute.
 
template<typename T >
const agxData::ArrayAttributeT< T >::Type & operator() (const agxData::ArrayAttributeT< T > *attribute) const
 
template<typename T >
agxData::HashSetAttributeT< T >::Type & operator() (const agxData::HashSetAttributeT< T > *attribute)
 HashSet attribute.
 
template<typename T >
const agxData::HashSetAttributeT< T >::Type & operator() (const agxData::HashSetAttributeT< T > *attribute) const
 
template<typename T >
T & operator() (const agxData::PointerAttributeT< T > *attribute)
 Pointer attribute.
 
template<typename T >
const T & operator() (const agxData::PointerAttributeT< T > *attribute) const
 
template<typename T >
T & operator() (const agxData::ScalarAttributeT< T > *attribute)
 Access the value of a specific attribute.
 
template<typename T >
const T & operator() (const agxData::ScalarAttributeT< T > *attribute) const
 
template<typename T >
T & operator() (const agxData::SharedAttributeT< T > *attribute)
 Shared attribute.
 
template<typename T >
const T & operator() (const agxData::SharedAttributeT< T > *attribute) const
 
template<typename T >
agxData::VectorAttributeT< T >::Type & operator() (const agxData::VectorAttributeT< T > *attribute)
 Vector attribute.
 
template<typename T >
const agxData::VectorAttributeT< T >::Type & operator() (const agxData::VectorAttributeT< T > *attribute) const
 
template<typename T >
ArrayAttributeT< T >::Type & operator() (const ArrayAttributeT< T > *attribute)
 
template<typename T >
const ArrayAttributeT< T >::Type & operator() (const ArrayAttributeT< T > *attribute) const
 
template<typename T >
HashSetAttributeT< T >::Type & operator() (const HashSetAttributeT< T > *attribute)
 
template<typename T >
const HashSetAttributeT< T >::Type & operator() (const HashSetAttributeT< T > *attribute) const
 
template<typename T >
VectorAttributeT< T >::Type & operator() (const VectorAttributeT< T > *attribute)
 
template<typename T >
const VectorAttributeT< T >::Type & operator() (const VectorAttributeT< T > *attribute) const
 
bool operator< (const EntityPtr &rhs) const
 
EntityPtr & operator= (const EntityPtr &other)=default
 
EntityPtr & operator= (EntityPtr &&)=default
 
bool operator== (const EntityPtr &rhs) const
 
bool operator> (const EntityPtr &rhs) const
 
void print () const
 
void print (std::ostream &stream) const
 
void swapId (EntityPtr &other)
 Swap id with another instance.
 
void swapIndex (EntityPtr &other)
 Swap index with another instance.
 
void transfer (agxData::EntityStorage *target)
 Transfer instance to another storage.
 
void verifyIndex () const
 Check for broken ptr, by verifying that the id is active in the storage.
 

Static Public Member Functions

static bool calculateSurfaceVelocity (const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2, ContactPoint &p)
 Calculate the relative velocity in a contact point between geometry1 and geometry2 Put result in p.
 
static bool calculateSurfaceVelocity (const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2, LocalContactPoint &p)
 Calculate the relative velocity in a contact point between geometry1 and geometry2 Put result in p.
 
- Static Public Member Functions inherited from agxData::EntityPtr
static EntityPtr createWithIndex (EntityStorage *storage, agx::Index index)
 
static void TransformToAscii (void *targetBuffer, const void *sourceBuffer, size_t numElements)
 

Detailed Description

A contact between two geometries.

Definition at line 353 of file Contacts.h.

Member Typedef Documentation

◆ PointType

Member Enumeration Documentation

◆ ContactState

Specify the state of the contact.

Enumerator
NO_CONTACT 

! No contact yet

IMPACT_STATE 

! First contact

CONTACT_STATE 

! Continuous contact

SEPARATION_STATE 

! Contact in last time step, now separated

Definition at line 360 of file Contacts.h.

Constructor & Destructor Documentation

◆ GeometryContact() [1/2]

agxCollide::GeometryContact::GeometryContact ( )

Default constructor.

Definition at line 710 of file Contacts.h.

◆ GeometryContact() [2/2]

agxCollide::GeometryContact::GeometryContact ( agx::Physics::GeometryContactPtr  contact)

Construct given geometry contact entity data.

Parameters
contact- other geometry (to copy from)

Definition at line 715 of file Contacts.h.

Member Function Documentation

◆ calculateRelativeVelocity()

agx::Vec3f agxCollide::GeometryContact::calculateRelativeVelocity ( size_t  pointIndex = 0) const

Calculate the relative velocity in a contact point.

Parameters
pointIndex- The contact point index in the points array containing all contact points for this pair of geometries.
Returns
relative velocity in world coordinate system.

Definition at line 753 of file Contacts.h.

References agx::RigidBody::getAngularVelocity(), agx::RigidBody::getCmPosition(), agx::RigidBody::getVelocity(), points(), and rigidBody().

◆ calculateSurfaceVelocity() [1/2]

bool agxCollide::GeometryContact::calculateSurfaceVelocity ( const agxCollide::Geometry *  geometry1,
const agxCollide::Geometry *  geometry2,
ContactPoint &  p 
)
inlinestatic

Calculate the relative velocity in a contact point between geometry1 and geometry2 Put result in p.

Returns
false if none of the geometries have surface velocity enabled. Returns false if the resulting velocity.equalsZero()

Definition at line 771 of file Contacts.h.

References calculateSurfaceVelocity(), agx::Physics::GeometryContactPtr::geometry1(), agx::Physics::GeometryContactPtr::geometry2(), agx::Physics::GeometryContactPtr::hasSurfaceVelocity(), agx::Physics::ContactPointPtr::point(), agxCollide::LocalContactPoint::point(), agx::Physics::ContactPointPtr::velocity(), and agxCollide::LocalContactPoint::velocity().

◆ calculateSurfaceVelocity() [2/2]

static bool agxCollide::GeometryContact::calculateSurfaceVelocity ( const agxCollide::Geometry *  geometry1,
const agxCollide::Geometry *  geometry2,
LocalContactPoint &  p 
)
static

Calculate the relative velocity in a contact point between geometry1 and geometry2 Put result in p.

Returns
false if none of the geometries have surface velocity enabled. Returns false if the resulting velocity.equalsZero()

Referenced by calculateSurfaceVelocity().

◆ clear()

void agxCollide::GeometryContact::clear ( )

Clear contact points.

◆ contains() [1/2]

int agxCollide::GeometryContact::contains ( agx::RigidBody *  body) const
inline

Will return -1 if body does not exist in this GeometryContact, 0 if it is the first (index 0) and 1 if it is the second (index 1).

This index (if > -1) can be used to get the rigid body with a call to rigidBody(idx)

Parameters
body- the rigid body that you want to look for in this geometry contact
Returns
-1 if body does not exist in this GeometryContact, 0 if it is the first and 1 if it is the second

Definition at line 565 of file Contacts.h.

◆ contains() [2/2]

int agxCollide::GeometryContact::contains ( agxCollide::Geometry *  geometry) const
inline

Will return -1 if geometry does not exist in this GeometryContact, 0 if it is the first (index 0) and 1 if it is the second (index 1).

This index (if > -1) can be used to get the geometry with a call to geometry(idx)

Parameters
geometry- The geometry that you want to look for in this geometry contact
Returns
-1 if geometry does not exist in this GeometryContact, 0 if it is the first and 1 if it is the second

Definition at line 572 of file Contacts.h.

References geometry().

◆ geometry() [1/2]

agxCollide::Geometry * agxCollide::GeometryContact::geometry ( size_t  ith)
Parameters
ith- index of geometry, 0 or 1.
Returns
pointer to the ith geometry

Definition at line 721 of file Contacts.h.

References agxAssert, agx::Physics::GeometryContactPtr::geometry1(), agx::Physics::GeometryContactPtr::geometry2(), and agx::Physics::GeometryPtr::model().

Referenced by contains(), and agxSDK::ExecuteFilter::match().

◆ geometry() [2/2]

const agxCollide::Geometry * agxCollide::GeometryContact::geometry ( size_t  ith) const
Parameters
ith- index of geometry, 0 or 1.
Returns
const pointer to the ith geometry

Definition at line 730 of file Contacts.h.

References agxAssert, agx::Physics::GeometryContactPtr::geometry1(), agx::Physics::GeometryContactPtr::geometry2(), and agx::Physics::GeometryPtr::model().

◆ getCustomData() [1/2]

void * agxCollide::GeometryContact::getCustomData ( )
Returns
pointer to custom data (with one data element for each contact point)

Definition at line 808 of file Contacts.h.

References agx::Physics::GeometryContactPtr::customData().

◆ getCustomData() [2/2]

const void * agxCollide::GeometryContact::getCustomData ( ) const
Returns
const pointer to custom data (with one data element for each contact point)

Definition at line 813 of file Contacts.h.

References agx::Physics::GeometryContactPtr::customData().

◆ getMaterial() [1/3]

agx::ContactMaterial * agxCollide::GeometryContact::getMaterial ( )

If the contact material for this geometry contact is explicit it can be accessed here.

If the contact material in this geometry contact is implicit, this method will return 0, and you have to create an explicit contact material with help of agxSDK::MaterialManager::getOrCreateContactMaterial.

Returns
the explicit contact material if present

Definition at line 846 of file Contacts.h.

References agx::Physics::ContactPtr::material(), and agx::Physics::ContactMaterialPtr::model().

Referenced by agxSDK::FrictionModelFilter::match().

◆ getMaterial() [2/3]

const agx::ContactMaterial * agxCollide::GeometryContact::getMaterial ( ) const

If the contact material for this geometry contact is explicit it can be accessed here.

If the contact material in this geometry contact is implicit, this method will return 0, and you have to create an explicit contact material with help of agxSDK::MaterialManager::getOrCreateContactMaterial.

Returns
the explicit contact material if present

Definition at line 853 of file Contacts.h.

References agx::Physics::ContactPtr::material(), and agx::Physics::ContactMaterialPtr::model().

◆ getMaterial() [3/3]

const agx::ContactMaterial * agxCollide::GeometryContact::getMaterial ( bool  ) const

It's not possible to change parameters in an implicit contact material.

This method returns any type of contact material but const. It's recommended to use the getMaterial() method, this method is used internally.

Returns
the explicit or implicit contact material if present

Definition at line 860 of file Contacts.h.

References agx::Physics::ContactPtr::material(), and agx::Physics::ContactMaterialPtr::model().

◆ hasImpactingPoints()

agx::Bool agxCollide::GeometryContact::hasImpactingPoints ( ) const
Note
This state is calculated for the points during solve so the result is only reliable after solve and before next collision detection.
Returns
true if this geometry contact contains at least one contact point with state IMPACTING - otherwise false

◆ isEnabled()

bool agxCollide::GeometryContact::isEnabled ( ) const
Returns
True if the contact is enabled.

Definition at line 835 of file Contacts.h.

References agx::Physics::GeometryContactPtr::enabled().

◆ points() [1/2]

ContactPointVector & agxCollide::GeometryContact::points ( )
Returns
a reference to the contact points

Definition at line 798 of file Contacts.h.

References agx::Physics::GeometryContactPtr::points().

Referenced by calculateRelativeVelocity().

◆ points() [2/2]

const ContactPointVector & agxCollide::GeometryContact::points ( ) const
Returns
a const reference to the contact points

Definition at line 803 of file Contacts.h.

References agx::Physics::GeometryContactPtr::points().

◆ removeContactPoint()

void agxCollide::GeometryContact::removeContactPoint ( ContactPoint &  point)

remove the specified ContactPoint from the set of contact points.

◆ rigidBody() [1/2]

agx::RigidBody * agxCollide::GeometryContact::rigidBody ( size_t  ith)

Returns access to rigid body data.

Parameters
ith- index of RigidBody, 0 or 1.
Returns
pointer to the ith RigidBody high level data

Definition at line 783 of file Contacts.h.

References agxAssert, agx::Physics::GeometryContactPtr::body1(), and agx::Physics::GeometryContactPtr::body2().

Referenced by calculateRelativeVelocity().

◆ rigidBody() [2/2]

const agx::RigidBody * agxCollide::GeometryContact::rigidBody ( size_t  ith) const

Returns access to rigid body data.

Parameters
ith- index of RigidBody, 0 or 1.
Returns
const pointer to the ith RigidBody high level data

Definition at line 790 of file Contacts.h.

References agxAssert, agx::Physics::GeometryContactPtr::body1(), and agx::Physics::GeometryContactPtr::body2().

◆ setCustomData()

void agxCollide::GeometryContact::setCustomData ( void *  customData)
inline

Store custom data for this Contact.

Parameters
customData- data to be stored

Definition at line 818 of file Contacts.h.

References agx::Physics::GeometryContactPtr::customData().

◆ setEnable()

void agxCollide::GeometryContact::setEnable ( bool  flag)

Set to false to disable the contact.

Definition at line 830 of file Contacts.h.

References agx::Physics::GeometryContactPtr::enabled().

◆ state()

agx::UInt8 agxCollide::GeometryContact::state ( ) const
Returns
the current of this geometry contact (CONTACT, IMPACT)

Definition at line 888 of file Contacts.h.

References agx::Physics::GeometryContactPtr::broadPhasePair(), NO_CONTACT, and agx::Physics::BroadPhasePairPtr::state().


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