AGX Dynamics  2.35.0.1
agxCollide::ContactPoint Class Reference

A contact point in a contact data. More...

#include <Contacts.h>

+ Inheritance diagram for agxCollide::ContactPoint:

Public Types

enum  ContactForceComponents { NORMAL_FORCE = 0 , TANGENTIAL_FORCE_U , TANGENTIAL_FORCE_V }
 
enum  ContactPointState : agx::UInt8 { IMPACTING = 1 << 0 , NONHOLONOMIC = 1 << 1 }
 
- Public Types inherited from agx::Physics::ContactPointPtr
typedef ContactPointData DataType
 
typedef ContactPointInstance InstanceType
 
typedef ContactPointModel ModelType
 

Public Member Functions

 ContactPoint ()
 Default constructor. More...
 
 ContactPoint (agx::Physics::ContactPointPtr contact)
 
 ContactPoint (agx::Vec3 thePoint, agx::Vec3f theNormal, agx::Real theDepth)
 Construct given point, normal and depth. More...
 
void clear ()
 Clear all values in this contact. More...
 
agx::UInt8 & faceFeature (size_t ith)
 
agx::UInt8 const & faceFeature (size_t ith) const
 
agx::UInt32 & faceIndex (size_t ith)
 
agx::UInt32 const & faceIndex (size_t ith) const
 
agx::Vec3 getForce () const
 
agx::Real getForceMagnitude () const
 
agx::Vec3 getNormalForce () const
 
agx::Real getNormalForceMagnitude () const
 
agx::Vec3 getTangentialForce () const
 
agx::Real getTangentialForceMagnitude () const
 
agx::Real getTangentialForceUMagnitude () const
 
agx::Real getTangentialForceVMagnitude () const
 
agx::Vec3 getWitnessPoint (size_t ith) const
 Get witness point for ith geometry. More...
 
agx::Bool hasState (ContactPointState contactPointState) const
 
agx::Bool isHolonomic () const
 
agx::Real & localForce (size_t idx)
 
agx::Real localForce (size_t idx) const
 
void setIsHolonomic (agx::Bool isHolonomic)
 Set if contact point should be treated as a holonomic constraint ( regular contact constraint with depth ) or a non-holonomic constraint ( strictly dependent on velocity ). More...
 
agx::Physics::Geometry::ShapePtr & shape (size_t ith)
 
agx::Physics::Geometry::ShapePtr const & shape (size_t ith) const
 
- Public Member Functions inherited from agx::Physics::ContactPointPtr
AGXPHYSICS_EXPORT ContactPointPtr ()
 
AGXPHYSICS_EXPORT ContactPointPtr (agxData::EntityStorage *storage, agx::Index id)
 
AGXPHYSICS_EXPORT ContactPointPtr (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT ContactPointPtr (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agx::Real & area ()
 
AGXPHYSICS_EXPORT agx::Real const & area () const
 
AGXPHYSICS_EXPORT agx::Real & depth ()
 
AGXPHYSICS_EXPORT agx::Real const & depth () const
 
AGXPHYSICS_EXPORT agx::Real & elasticRestLengthShape1 ()
 
AGXPHYSICS_EXPORT agx::Real const & elasticRestLengthShape1 () const
 
AGXPHYSICS_EXPORT agx::Real & elasticRestLengthShape2 ()
 
AGXPHYSICS_EXPORT agx::Real const & elasticRestLengthShape2 () const
 
AGXPHYSICS_EXPORT agx::Bool & enabled ()
 
AGXPHYSICS_EXPORT agx::Bool const & enabled () const
 
AGXPHYSICS_EXPORT agx::UInt8 & faceFeature1 ()
 The face feature of shape 1 in contact (e.g. voronoi region on triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt8 const & faceFeature1 () const
 The face feature of shape 1 in contact (e.g. voronoi region on triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt8 & faceFeature2 ()
 The face feature of shape 2 in contact (e.g. voronoi region on triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt8 const & faceFeature2 () const
 The face feature of shape 2 in contact (e.g. voronoi region on triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt32 & faceIndex1 ()
 The face index of shape 1 in contact (e.g. index of triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt32 const & faceIndex1 () const
 The face index of shape 1 in contact (e.g. index of triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt32 & faceIndex2 ()
 The face index of shape 2 in contact (e.g. index of triangle for trimesh). More...
 
AGXPHYSICS_EXPORT agx::UInt32 const & faceIndex2 () const
 The face index of shape 2 in contact (e.g. index of triangle for trimesh). More...
 
ContactPointData * getData ()
 
const ContactPointData * getData () const
 
AGXPHYSICS_EXPORT agx::Vec4i8 & indexSet ()
 
AGXPHYSICS_EXPORT agx::Vec4i8 const & indexSet () const
 
AGXPHYSICS_EXPORT ContactPointInstance instance ()
 
AGXPHYSICS_EXPORT const ContactPointInstance instance () const
 
AGXPHYSICS_EXPORT agx::Vec3 & localForce ()
 
AGXPHYSICS_EXPORT agx::Vec3 const & localForce () const
 
AGXPHYSICS_EXPORT agx::Real & maxNormalForce ()
 
AGXPHYSICS_EXPORT agx::Real const & maxNormalForce () const
 
AGXPHYSICS_EXPORT agx::Vec3f & normal ()
 
AGXPHYSICS_EXPORT agx::Vec3f const & normal () const
 
AGXPHYSICS_EXPORT ContactPointSemantics * operator-> ()
 
AGXPHYSICS_EXPORT const ContactPointSemantics * operator-> () const
 
AGXPHYSICS_EXPORT ContactPointPtr & operator= (const agxData::EntityInstance &instance)
 
AGXPHYSICS_EXPORT ContactPointPtr & operator= (const agxData::EntityPtr &ptr)
 
AGXPHYSICS_EXPORT agx::Vec3 & point ()
 
AGXPHYSICS_EXPORT agx::Vec3 const & point () const
 
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr & shape1 ()
 Shape number 1 in contact. More...
 
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr const & shape1 () const
 Shape number 1 in contact. More...
 
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr & shape2 ()
 Shape number 2 in contact. More...
 
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr const & shape2 () const
 Shape number 2 in contact. More...
 
AGXPHYSICS_EXPORT agx::UInt8 & state ()
 Contact point state, such as impacting, resting etc. More...
 
AGXPHYSICS_EXPORT agx::UInt8 const & state () const
 Contact point state, such as impacting, resting etc. More...
 
AGXPHYSICS_EXPORT agx::Vec3f & tangentU ()
 
AGXPHYSICS_EXPORT agx::Vec3f const & tangentU () const
 
AGXPHYSICS_EXPORT agx::Vec3f & tangentV ()
 
AGXPHYSICS_EXPORT agx::Vec3f const & tangentV () const
 
AGXPHYSICS_EXPORT agx::Vec3f & velocity ()
 
AGXPHYSICS_EXPORT agx::Vec3f const & velocity () 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. More...
 
agxData::EntityPtr copy ()
 Create a copy instance in the same storage. More...
 
agxData::EntityPtr copy (agxData::EntityStorage *target)
 Copy instance to another storage. More...
 
void copyAttributes (agxData::EntityPtr source)
 Copy instance attributes to an existing target instance. More...
 
template<typename T >
T & dataSet ()
 
template<typename T >
const T & dataSet () const
 
void destroy ()
 Remove the entity from the active storage. More...
 
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. More...
 
agxData::EntityInstance instance ()
 
const agxData::EntityInstance instance () const
 
void invalidate ()
 Invalidate the entity pointer. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename T >
const T & operator() (const agxData::ScalarAttributeT< T > *attribute) const
 
template<typename T >
T & operator() (const agxData::SharedAttributeT< T > *attribute)
 Shared attribute. More...
 
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. More...
 
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. More...
 
void swapIndex (EntityPtr &other)
 Swap index with another instance. More...
 
void transfer (agxData::EntityStorage *target)
 Transfer instance to another storage. More...
 
void verifyIndex () const
 Check for broken ptr, by verifying that the id is active in the storage. More...
 

Additional Inherited Members

- 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 point in a contact data.

Definition at line 55 of file Contacts.h.

Member Enumeration Documentation

◆ ContactForceComponents

Enumerator
NORMAL_FORCE 

Normal force.

TANGENTIAL_FORCE_U 

Tangential force U, orthogonal to the normal force and V.

TANGENTIAL_FORCE_V 

Tangential force V, orthogonal to the normal force and U.

Definition at line 58 of file Contacts.h.

◆ ContactPointState

Enumerator
IMPACTING 

This contact point is impacting - i.e., relative speed along the normal is above some threshold.

This state is calculated by the solver and is updated in the contact point before the post/last callbacks.

NONHOLONOMIC 

This contact point is treated as a non-holonomic constraint in the normal direction - i.e.

a velocity constraint with target velocity 0 ( similar to friction ) where the contact depth is disregarded. This removes the right-hand side in the normal equation for the contact point.

Definition at line 65 of file Contacts.h.

Constructor & Destructor Documentation

◆ ContactPoint() [1/3]

agxCollide::ContactPoint::ContactPoint ( )
inline

Default constructor.

Definition at line 502 of file Contacts.h.

◆ ContactPoint() [2/3]

agxCollide::ContactPoint::ContactPoint ( agx::Physics::ContactPointPtr  contact)
inline

Definition at line 506 of file Contacts.h.

◆ ContactPoint() [3/3]

agxCollide::ContactPoint::ContactPoint ( agx::Vec3  thePoint,
agx::Vec3f  theNormal,
agx::Real  theDepth 
)

Construct given point, normal and depth.

Parameters
thePoint- point in world
theNormal- normalized normal in world
theDepth- contact point depth

Member Function Documentation

◆ clear()

◆ faceFeature() [1/2]

agx::UInt8 & agxCollide::ContactPoint::faceFeature ( size_t  ith)
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
reference to the ith face feature.

Definition at line 825 of file Contacts.h.

References agx::Physics::ContactPointPtr::faceFeature1(), and agx::Physics::ContactPointPtr::faceFeature2().

◆ faceFeature() [2/2]

agx::UInt8 const & agxCollide::ContactPoint::faceFeature ( size_t  ith) const
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
const reference to the ith face feature.

Definition at line 831 of file Contacts.h.

References agx::Physics::ContactPointPtr::faceFeature1(), and agx::Physics::ContactPointPtr::faceFeature2().

◆ faceIndex() [1/2]

agx::UInt32 & agxCollide::ContactPoint::faceIndex ( size_t  ith)
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
reference to the ith face index.

Definition at line 813 of file Contacts.h.

References agx::Physics::ContactPointPtr::faceIndex1(), and agx::Physics::ContactPointPtr::faceIndex2().

◆ faceIndex() [2/2]

agx::UInt32 const & agxCollide::ContactPoint::faceIndex ( size_t  ith) const
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
const reference to the ith face index.

Definition at line 819 of file Contacts.h.

References agx::Physics::ContactPointPtr::faceIndex1(), and agx::Physics::ContactPointPtr::faceIndex2().

◆ getForce()

agx::Vec3 agxCollide::ContactPoint::getForce ( ) const
Returns
The complete (signed) contact force, including both normal and tangential (friction), in the world coordinate system.

Definition at line 547 of file Contacts.h.

References getNormalForce(), and getTangentialForce().

◆ getForceMagnitude()

agx::Real agxCollide::ContactPoint::getForceMagnitude ( ) const
Returns
The complete (unsigned) contact force magnitude, including both normal and tangential (friction).

Definition at line 553 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), NORMAL_FORCE, TANGENTIAL_FORCE_U, and TANGENTIAL_FORCE_V.

◆ getNormalForce()

agx::Vec3 agxCollide::ContactPoint::getNormalForce ( ) const
Returns
The (signed) normal force in world coordinates.

Definition at line 563 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), agx::Physics::ContactPointPtr::normal(), and NORMAL_FORCE.

Referenced by getForce().

◆ getNormalForceMagnitude()

agx::Real agxCollide::ContactPoint::getNormalForceMagnitude ( ) const
Returns
the (unsigned) magnitude of the normal force

Definition at line 569 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), and NORMAL_FORCE.

◆ getTangentialForce()

agx::Vec3 agxCollide::ContactPoint::getTangentialForce ( ) const
Returns
The (signed) tangential force (friction force) in world coordinates.

Definition at line 575 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), TANGENTIAL_FORCE_U, TANGENTIAL_FORCE_V, agx::Physics::ContactPointPtr::tangentU(), and agx::Physics::ContactPointPtr::tangentV().

Referenced by getForce().

◆ getTangentialForceMagnitude()

agx::Real agxCollide::ContactPoint::getTangentialForceMagnitude ( ) const
Returns
the (unsigned) magnitude of the tangential force (friction force in both U and V)

Definition at line 595 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), TANGENTIAL_FORCE_U, and TANGENTIAL_FORCE_V.

◆ getTangentialForceUMagnitude()

agx::Real agxCollide::ContactPoint::getTangentialForceUMagnitude ( ) const
Returns
the (unsigned) magnitude of the tangential force in U-direction (friction force )

Definition at line 583 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), and TANGENTIAL_FORCE_U.

◆ getTangentialForceVMagnitude()

agx::Real agxCollide::ContactPoint::getTangentialForceVMagnitude ( ) const
Returns
the (unsigned) magnitude of the tangential force in U-direction (friction force )

Definition at line 589 of file Contacts.h.

References agx::Physics::ContactPointPtr::localForce(), and TANGENTIAL_FORCE_V.

◆ getWitnessPoint()

agx::Vec3 agxCollide::ContactPoint::getWitnessPoint ( size_t  ith) const

Get witness point for ith geometry.

The point is in world coordinates, and at time of collision detection. So it is valid in a PRE-StepEventListener or a ContactEventListener, but e.g. in a POST-StepEventListener the geometries will most likely have moved from the contact.

Parameters
ith- 0 for first, 1 for second, index > 1 will return value for second
Returns
witness point for ith geometry, in world coordinates at collision detection time.

Definition at line 849 of file Contacts.h.

References agx::Physics::ContactPointPtr::depth(), agx::Physics::ContactPointPtr::normal(), and agx::Physics::ContactPointPtr::point().

◆ hasState()

agx::Bool agxCollide::ContactPoint::hasState ( ContactPoint::ContactPointState  contactPointState) const
inline
Returns
true if this contact point has given state

Definition at line 601 of file Contacts.h.

References agx::Physics::ContactPointPtr::state().

Referenced by isHolonomic().

◆ isHolonomic()

agx::Bool agxCollide::ContactPoint::isHolonomic ( ) const
Returns
true if this contact point is treated as a holonomic constraint, non-holonomic ( velocity only, no depth/violation ) if false.

Definition at line 606 of file Contacts.h.

References hasState(), and NONHOLONOMIC.

Referenced by setIsHolonomic().

◆ localForce() [1/2]

agx::Real & agxCollide::ContactPoint::localForce ( size_t  idx)
Parameters
idx- Specifies which direction (see enum ContactForceComponents)
Returns
a reference to the (signed) local force (in coordinate system n, u, v) for the selected component.

Definition at line 532 of file Contacts.h.

References agxAssert, and agx::Physics::ContactPointPtr::localForce().

◆ localForce() [2/2]

agx::Real agxCollide::ContactPoint::localForce ( size_t  idx) const
Parameters
idx- Specifies which direction (see enum ContactForceComponents)
Returns
the (signed) local force (in coordinate system n, u, v) for the selected component.

Definition at line 539 of file Contacts.h.

References agxAssert, and agx::Physics::ContactPointPtr::localForce().

◆ setIsHolonomic()

void agxCollide::ContactPoint::setIsHolonomic ( agx::Bool  isHolonomic)

Set if contact point should be treated as a holonomic constraint ( regular contact constraint with depth ) or a non-holonomic constraint ( strictly dependent on velocity ).

Parameters
isHolonomic- true if contact should be treated as a holonomic constraint, false if it should be treated as a non-holonomic constraint. ( Default: true )

Definition at line 611 of file Contacts.h.

References isHolonomic(), NONHOLONOMIC, and agx::Physics::ContactPointPtr::state().

◆ shape() [1/2]

agx::Physics::Geometry::ShapePtr & agxCollide::ContactPoint::shape ( size_t  ith)
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
reference to the ith shape.

Definition at line 837 of file Contacts.h.

References agx::Physics::ContactPointPtr::shape1(), and agx::Physics::ContactPointPtr::shape2().

◆ shape() [2/2]

agx::Physics::Geometry::ShapePtr const & agxCollide::ContactPoint::shape ( size_t  ith) const
Parameters
ith- 0 for first, 1 for second, index > 1 will return reference to second
Returns
const reference to the ith shape.

Definition at line 843 of file Contacts.h.

References agx::Physics::ContactPointPtr::shape1(), and agx::Physics::ContactPointPtr::shape2().


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