AGXDynamics  2.31.1.0
agxCollide::Geometry Class Reference

The geometry representation used by the collision detection engine. More...

#include <Geometry.h>

+ Inheritance diagram for agxCollide::Geometry:

Classes

class  MergeSplitProperties
 Specify MergeSplit properties for a Geometry. More...
 

Public Types

typedef agx::Event1< Geometry * > ShapeChangeEvent
 

Public Member Functions

 Geometry (const agx::Name &name="")
 Constructor. More...
 
 Geometry (Shape *shape)
 Constructor. More...
 
 Geometry (Shape *shape, const agx::AffineMatrix4x4 &localShapeTransform)
 Constructor. More...
 
void addGroup (agx::UInt32 id, bool forceContactUpdate=false)
 Add the specified id to a vector of group id, this will make a geometry part of the group id. More...
 
void addGroup (const agx::Name &name, bool forceContactUpdate=false)
 Add the specified name to a vector of named group id, this will make a geometry part of the group name. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
agx::Vec3 calculateCenterOfMassOffset () const
 
agx::SPDMatrix3x3 calculateInertia (agx::Real mass) const
 
agx::Real calculateMass () const
 
agx::Real calculateVolume () const
 
Geometry * clone () const
 This method will make a deep copy of the geometry, excluding membership in any RigidBody. More...
 
bool getEnable () const
 Return whether the geometry should be used in intersection tests. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::Int64 getId () const
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Material * getMaterial ()
 
const agx::Material * getMaterial () const
 
const agx::Name & getName () const
 Get the name. More...
 
int getReferenceCount () const
 
agx::RigidBody * getRigidBody ()
 
const agx::RigidBody * getRigidBody () const
 
agx::Uuid getUuid () const
 
bool hasGroup (agx::UInt32 id) const
 This is performing a linear search among the collision group id for this Geometry. More...
 
template<typename T >
bool is () const
 Subclass test. More...
 
bool isEnabled () const
 Alias for getEnable Return whether the geometry should be used in intersection tests. More...
 
bool isFinished () const
 
bool isSensor () const
 Return true if geometry is a sensor. More...
 
bool isSensorGeneratingContactData () const
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void removeAllGroups (bool forceContactUpdate=false)
 Remove all collision group ids. More...
 
void removeGroup (agx::UInt32 id, bool forceContactUpdate=false)
 Remove a collision group id from the vector of group ids. More...
 
void removeGroup (const agx::Name &name, bool forceContactUpdate=false)
 Remove a named collision group from the vector of named group ids. More...
 
void removeMaterial ()
 Remove the material from the geometry. More...
 
void setEnable (bool flag)
 Enable/disable collision testing for geometry. More...
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setMaterial (agx::Material *material)
 Set the material of the geometry. More...
 
void setName (const agx::Name &name)
 Set the name of this Geometry. More...
 
void setSensor (bool flag, bool generateContactData=true)
 Sets if the geometry should be a sensor. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Public Attributes

ShapeChangeEvent shapeChangeEvent
 

Protected Member Functions

void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void generateUuid ()
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

for this geometry and return true if it can be found.

Searches for the named group

Parameters
name- The group id we are looking for.
Returns
true if the Geometry is part of the named group name
typedef CollisionGroupManager::GroupIdHash GroupSet
 Deprecated: Only for backward compatibility. More...
 
bool hasGroup (const agx::Name &name) const
 
const agx::Physics::CollisionGroupSetPtr & getGroupSet () const
 
const GroupSet & getGroupIDs () const
 
void setEnableCollisions (const Geometry *otherGeometry, bool flag)
 Specify whether otherGeometry is allowed to collide with this geometry. More...
 
bool getEnableCollisions (const Geometry *otherGeometry) const
 
void setEnableCollisions (bool collide)
 Should this geometry collide with any other geometries. More...
 
bool getEnableCollisions () const
 
bool canCollide (const Geometry *otherGeometry) const
 
virtual agx::Vec3f calculateSurfaceVelocity (const agxCollide::LocalContactPoint &point, size_t index) const
 Implement this method to get access to different surface velocities on the geometry:s surface. More...
 
virtual const BoundingAABB * getBoundingVolume () const
 The bounding volume for the geometry is made large enough to fit all shape bounds. More...
 
agx::PropertyContainer * getPropertyContainer ()
 
const agx::PropertyContainer * getPropertyContainer () const
 
bool hasPropertyContainer () const
 
void setPropertyContainer (agx::PropertyContainer *container)
 Give this a new PropertyContainer. More...
 
Space * getSpace ()
 
const Space * getSpace () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
const char * getClassName () const override
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual void restore (agxStream::InputArchive &in) override
 
agx::Referenced * getCustomData ()
 
const agx::Referenced * getCustomData () const
 
void setCustomData (agx::Referenced *data)
 Store a ref_ptr to a user custom data class, which must be inherited from Referenced. More...
 
agx::RigidBody * getOriginalBody ()
 This method is guaranteed to always return the same value as getRigidBody() if MergeSplit is not in use. More...
 
const agx::RigidBody * getOriginalBody () const
 This method is guaranteed to always return the same value as getRigidBody() if MergeSplit is not in use. More...
 
void setSurfaceVelocity (const agx::Vec3f &surfaceVelocity)
 Set the velocity of this geometry's surface in the geometry's local coordinate frame. More...
 
const agx::Vec3f & getSurfaceVelocity () const
 
agx::UInt32 getSweepAndPruneIndex () const
 
virtual void updateBoundingVolume ()
 
agx::Physics::GeometryPtr getEntity () const
 
virtual void shapeUpdated ()
 
agxCollide::GroupIdCollection findGroupIdCollection () const
 
agx::Frame * getFrame ()
 
const agx::Frame * getFrame () const
 
void setTransform (const agx::AffineMatrix4x4 &matrix)
 Set the transform of the geometry. More...
 
const agx::AffineMatrix4x4 & getLocalTransform () const
 
void setLocalTransform (const agx::AffineMatrix4x4 &matrix)
 Assign the local transformation matrix for this geometry, ignoring any eventual parent transformation. More...
 
agx::Vec3 getLocalPosition () const
 
void setLocalPosition (const agx::Vec3 &p)
 Set the position of the geometry relative to its frame's parent frame. More...
 
void setLocalPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the geometry relative to its frame's parent frame. More...
 
void setRotation (const agx::Quat &q)
 Set the rotation of the geometry relative to world frame. More...
 
void setRotation (const agx::EulerAngles &e)
 Set the rotation of the geometry relative to world frame. More...
 
void setRotation (const agx::OrthoMatrix3x3 &m)
 Set the rotation of the geometry relative to world frame. More...
 
agx::Quat getLocalRotation () const
 
void setLocalRotation (const agx::Quat &q)
 Set the rotation of the geometry relative to its frame's parent frame. More...
 
void setLocalRotation (const agx::EulerAngles &e)
 Set the rotation of the geometry relative to its frame's parent frame. More...
 
agx::Frame * getParentFrame ()
 
const agx::Frame * getParentFrame () const
 
bool setParentFrame (agx::Frame *frame)
 Set the parent frame of this geometry's frame. More...
 
void setPosition (const agx::Vec3 &p)
 Set the position of the frame in world coordinates. More...
 
void setPosition (agx::Real x, agx::Real y, agx::Real z)
 Set the position of the frame in world coordinates. More...
 
agx::AffineMatrix4x4 getTransform () const
 
agx::Vec3 getPosition () const
 
agx::Quat getRotation () const
 
bool add (Shape *shape, const agx::AffineMatrix4x4 &localTransform=agx::AffineMatrix4x4())
 Add a shape to the geometry. More...
 
bool remove (Shape *shape)
 Remove a shape from the geometry. More...
 
bool remove (size_t index)
 Remove the i:th shape from the Geometry. More...
 
const ShapeRefVector & getShapes () const
 
bool replace (size_t shapeIndex, Shape *newShape, const agx::AffineMatrix4x4 &localTransform=agx::AffineMatrix4x4())
 Replace a shape in the geometry. More...
 
bool replace (Shape *oldShape, Shape *newShape, const agx::AffineMatrix4x4 &localTransform=agx::AffineMatrix4x4())
 
bool replaceShapeTransform (size_t shapeIndex, const agx::AffineMatrix4x4 &newTransform)
 Replace the shape transform for the specified shapeIndex. More...
 
bool replaceShapeTransform (Shape *shape, const agx::AffineMatrix4x4 &newTransform)
 Replace the shape transform for the specified shape. More...
 
MergeSplitProperties & getMergeSplitProperties ()
 
const MergeSplitProperties & getMergeSplitProperties () const
 
static const char * getConstructClassId ()
 
static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
virtual ~Geometry ()
 Destructor. More...
 

Detailed Description

The geometry representation used by the collision detection engine.

A geometry may be a composite of multiple shapes with local transformations.

Internal to the physics engine, the only geometry considered is that used for interference detection. Because of the namespace, there should be no collision with any other name.

Definition at line 88 of file Geometry.h.

Member Typedef Documentation

◆ GroupSet

Deprecated: Only for backward compatibility.

Definition at line 311 of file Geometry.h.

◆ ShapeChangeEvent

Constructor & Destructor Documentation

◆ Geometry() [1/3]

agxCollide::Geometry::Geometry ( const agx::Name &  name = "")

Constructor.

Parameters
name- name of the geometry

◆ Geometry() [2/3]

agxCollide::Geometry::Geometry ( Shape *  shape)

Constructor.

Parameters
shape- pointer to a shape that will be part of this Geometry

◆ Geometry() [3/3]

agxCollide::Geometry::Geometry ( Shape *  shape,
const agx::AffineMatrix4x4 &  localShapeTransform 
)

Constructor.

Parameters
shape- pointer to a shape that will be part of this Geometry
localShapeTransform- Transformation of the shape relative to the Geometry

◆ ~Geometry()

virtual agxCollide::Geometry::~Geometry ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ add()

bool agxCollide::Geometry::add ( Shape *  shape,
const agx::AffineMatrix4x4 &  localTransform = agx::AffineMatrix4x4() 
)

Add a shape to the geometry.

Will create an implicit shape group if needed.

Parameters
shapeThe shape to add.
localTransformThe shape transformation in local geometry coordinates.
Returns
true if the shape was added. False if shape==null.

◆ addGroup() [1/2]

void agxCollide::Geometry::addGroup ( agx::UInt32  id,
bool  forceContactUpdate = false 
)

Add the specified id to a vector of group id, this will make a geometry part of the group id.

By default a geometry is not part of any group.

This can be used to partition the simulation where some groups cannot collide with other groups. Which groups can collide or not is determined by Space and can be set using the method agxCollide::Space::setEnablePair(id1,id2);

This does not remove current contacts. To do this, forceContactUpdate should be set to true. This can be an expensive operation, so if repeated many times and issues might occur, it could be better to do this manually using Space::enableForContacts and Space::disableForContacts.

◆ addGroup() [2/2]

void agxCollide::Geometry::addGroup ( const agx::Name &  name,
bool  forceContactUpdate = false 
)

Add the specified name to a vector of named group id, this will make a geometry part of the group name.

By default a geometry is not part of any group.

This can be used to partition the simulation where some groups cannot collide with other groups. Which groups can collide or not is determined by Space and can be set using the method agxCollide::Space::setEnablePair(name1,name2);

This does not remove current contacts. To do this, forceContactUpdate should be set to true. This can be an expensive operation, so if repeated many times and issues might occur, it could be better to do this manually using Space::enableForContacts and Space::disableForContacts.

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ calculateCenterOfMassOffset()

agx::Vec3 agxCollide::Geometry::calculateCenterOfMassOffset ( ) const
Note
: This will give wrong results if the geometry contains overlapping shapes.
Returns
The center of mass offset

◆ calculateInertia()

agx::SPDMatrix3x3 agxCollide::Geometry::calculateInertia ( agx::Real  mass) const
Note
: This will give wrong results if the geometry contains overlapping shapes.
Returns
The inertia tensor locally in center of mass.

◆ calculateMass()

agx::Real agxCollide::Geometry::calculateMass ( ) const
Note
: This will give wrong results if the geometry contains overlapping shapes.
Returns
The mass of the geometry.

◆ calculateSurfaceVelocity()

agx::Vec3f agxCollide::Geometry::calculateSurfaceVelocity ( const agxCollide::LocalContactPoint &  point,
size_t  index 
) const
virtual

Implement this method to get access to different surface velocities on the geometry:s surface.

One example would be to have a texture specifying a velocity field of the geometry

Parameters
point- ContactPoint in world coordinates that can be used to calculate the surface velocity.
index- Which geometry in the contact is this one? Valid values: 0 or 1. The normal in 'point' points in the direction that 0 has to move to leave the contact with 0.
Returns
the calculated velocity.

Reimplemented in agxModel::SurfaceVelocityConveyorBelt.

Definition at line 967 of file Geometry.h.

◆ calculateVolume()

agx::Real agxCollide::Geometry::calculateVolume ( ) const
Note
: This will give wrong results if the geometry contains overlapping shapes.
Returns
The volume of the geometry.

◆ canCollide()

bool agxCollide::Geometry::canCollide ( const Geometry *  otherGeometry) const
Returns
true if this geometry CAN collide with otherGeometry.

Following has to be true to make this method return true.

if they belong to a group pair that is not disabled g1 != g2. collisions for g1 is not disabled against g2 (g1->setEnableCollisions(g2, false) if they both have a body, that it is not the same body.

◆ clone()

Geometry* agxCollide::Geometry::clone ( ) const

This method will make a deep copy of the geometry, excluding membership in any RigidBody.

Returns
a deep copy of the geometry

◆ create() [1/2]

static agxStream::Serializable* agxCollide::Geometry::create ( )
inlinestatic

Definition at line 392 of file Geometry.h.

◆ create() [2/2]

static agxStream::Serializable* agxCollide::Geometry::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 392 of file Geometry.h.

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ findGroupIdCollection()

agxCollide::GroupIdCollection agxCollide::Geometry::findGroupIdCollection ( ) const
Returns
collection of group names and id's that has been added to this geometry

◆ generateUuid()

void agxStream::Serializable::generateUuid ( )
protectedinherited

◆ getBoundingVolume()

const BoundingAABB * agxCollide::Geometry::getBoundingVolume ( ) const
virtual

The bounding volume for the geometry is made large enough to fit all shape bounds.

Definition at line 941 of file Geometry.h.

◆ getClassName()

const char* agxCollide::Geometry::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Reimplemented in agxModel::SurfaceVelocityConveyorBelt.

Definition at line 392 of file Geometry.h.

◆ getConstructClassId()

static const char* agxCollide::Geometry::getConstructClassId ( )
inlinestatic

Definition at line 392 of file Geometry.h.

◆ getCustomData() [1/2]

agx::Referenced* agxCollide::Geometry::getCustomData ( )
Returns
a pointer to a user defined data inherited from agx::Referenced class

◆ getCustomData() [2/2]

const agx::Referenced* agxCollide::Geometry::getCustomData ( ) const
Returns
a const pointer to a user defined data inherited from agx::Referenced class

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getEnable()

bool agxCollide::Geometry::getEnable ( ) const

Return whether the geometry should be used in intersection tests.

This can be set using the setEnable() method.

Returns
true if the geometry is used in intersection tests, false if not.

Definition at line 917 of file Geometry.h.

◆ getEnableCollisions() [1/2]

bool agxCollide::Geometry::getEnableCollisions ( const Geometry *  otherGeometry) const
Returns
true if this geometry is allowed to collide with geometry.

◆ getEnableCollisions() [2/2]

bool agxCollide::Geometry::getEnableCollisions ( ) const
Returns
true if this geometry is allowed to collide with any other geometry

◆ getEnableSerialization()

bool agxStream::Serializable::getEnableSerialization ( ) const
inherited
Returns
true if serialization is enabled for this object

Definition at line 273 of file Serializable.h.

◆ getEnableUuidGeneration()

bool agxStream::Serializable::getEnableUuidGeneration ( )
inherited
Returns
true if Uuid:s should be generated for each new Serializable object

◆ getEntity()

agx::Physics::GeometryPtr agxCollide::Geometry::getEntity ( ) const
inline

Definition at line 828 of file Geometry.h.

Referenced by agxCollide::GeometryContact::geometry().

◆ getFrame() [1/2]

agx::Frame * agxCollide::Geometry::getFrame ( )
Returns
the frame of the geometry.

Definition at line 931 of file Geometry.h.

◆ getFrame() [2/2]

const agx::Frame * agxCollide::Geometry::getFrame ( ) const
Returns
the frame of the geometry.

Definition at line 936 of file Geometry.h.

◆ getGroupIDs()

const GroupSet& agxCollide::Geometry::getGroupIDs ( ) const

◆ getGroupSet()

const agx::Physics::CollisionGroupSetPtr & agxCollide::Geometry::getGroupSet ( ) const
Returns
The current group set.

Definition at line 877 of file Geometry.h.

◆ getId()

agx::Int64 agxCollide::Geometry::getId ( ) const
Returns
The geometry id.

Definition at line 842 of file Geometry.h.

◆ getIndex()

agx::UInt32 agxStream::Serializable::getIndex ( ) const
inherited

This index is given at creation of this object.

It is guaranteed to be unique for the lifetime of this library instance. As long as the application is running. This value is not serialized or restored. A new object will always get a new index no matter how it is created.

Returns
an instance index of this object. This is unique for the lifetime of this library instance.

Definition at line 247 of file Serializable.h.

◆ getLocalPosition()

agx::Vec3 agxCollide::Geometry::getLocalPosition ( ) const
Returns
- the relative translate to the parent frame of the geometry's frame.

◆ getLocalRotation()

agx::Quat agxCollide::Geometry::getLocalRotation ( ) const
Returns
- the geometry's rotation relative to its frame's parent frame.

◆ getLocalTransform()

const agx::AffineMatrix4x4& agxCollide::Geometry::getLocalTransform ( ) const
Returns
- the local transformation matrix of the geometry's frame, relative to the parent's frame.

◆ getMaterial() [1/2]

agx::Material * agxCollide::Geometry::getMaterial ( )
Returns
the material of the geometry.

Definition at line 887 of file Geometry.h.

◆ getMaterial() [2/2]

const agx::Material * agxCollide::Geometry::getMaterial ( ) const
Returns
the material of the geometry.

Definition at line 882 of file Geometry.h.

◆ getMergeSplitProperties() [1/2]

Geometry::MergeSplitProperties & agxCollide::Geometry::getMergeSplitProperties ( )
Returns
a reference to the MergeSplit properties

Definition at line 972 of file Geometry.h.

◆ getMergeSplitProperties() [2/2]

const Geometry::MergeSplitProperties & agxCollide::Geometry::getMergeSplitProperties ( ) const
Returns
a reference to the MergeSplit properties

Definition at line 976 of file Geometry.h.

◆ getName()

const agx::Name& agxCollide::Geometry::getName ( ) const

Get the name.

Returns
the name string of this Geometry.

◆ getOriginalBody() [1/2]

agx::RigidBody * agxCollide::Geometry::getOriginalBody ( )

This method is guaranteed to always return the same value as getRigidBody() if MergeSplit is not in use.

Returns
a pointer to the RigidBody this geometry was assigned to before that body was merged into another body.

Definition at line 907 of file Geometry.h.

◆ getOriginalBody() [2/2]

const agx::RigidBody * agxCollide::Geometry::getOriginalBody ( ) const

This method is guaranteed to always return the same value as getRigidBody() if MergeSplit is not in use.

Returns
a const pointer to the RigidBody this geometry was assigned to before that body was merged with another body.

Definition at line 912 of file Geometry.h.

◆ getParentFrame() [1/2]

agx::Frame* agxCollide::Geometry::getParentFrame ( )
Returns
- the parent frame of the geometry's frame, or 0 if this frame has no parent

◆ getParentFrame() [2/2]

const agx::Frame* agxCollide::Geometry::getParentFrame ( ) const
Returns
- the parent frame of the geometry's frame, or 0 if this frame has no parent

◆ getPosition()

agx::Vec3 agxCollide::Geometry::getPosition ( ) const
Returns
the current position/translation of the geometry in world coordinate space

Definition at line 1020 of file Geometry.h.

◆ getPropertyContainer() [1/2]

agx::PropertyContainer * agxCollide::Geometry::getPropertyContainer ( )
Returns
a pointer to the PropertyContainer

Definition at line 947 of file Geometry.h.

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

◆ getPropertyContainer() [2/2]

const agx::PropertyContainer * agxCollide::Geometry::getPropertyContainer ( ) const
Returns
a pointer to the PropertyContainer

Definition at line 959 of file Geometry.h.

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ getRigidBody() [1/2]

◆ getRigidBody() [2/2]

const agx::RigidBody * agxCollide::Geometry::getRigidBody ( ) const
Returns
The body which the geometry is part of.

Definition at line 837 of file Geometry.h.

◆ getRotation()

agx::Quat agxCollide::Geometry::getRotation ( ) const
Returns
the current rotation of the geometry in world coordinate space

Definition at line 1028 of file Geometry.h.

References AGX_FORCE_INLINE, agxData::getEntity(), agx::QuatT< T >::getRotate(), agx::Physics::GeometryModel::localTransformAttribute, and agx::Physics::GeometryModel::transformAttribute.

◆ getShapes()

const ShapeRefVector& agxCollide::Geometry::getShapes ( ) const

◆ getSpace() [1/2]

Space * agxCollide::Geometry::getSpace ( )
Returns
The space where the geometry is placed.

Definition at line 922 of file Geometry.h.

◆ getSpace() [2/2]

const Space * agxCollide::Geometry::getSpace ( ) const
Returns
The space where the geometry is placed.

Definition at line 926 of file Geometry.h.

◆ getStorageAgent()

agxStream::StorageAgent* agxCollide::Geometry::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Reimplemented in agxModel::SurfaceVelocityConveyorBelt.

Definition at line 392 of file Geometry.h.

◆ getSurfaceVelocity()

const agx::Vec3f & agxCollide::Geometry::getSurfaceVelocity ( ) const
Returns
the surface velocity of this geometry in geometry's local coordinate frame as stored by the method setSurfaceVelocity()

Definition at line 897 of file Geometry.h.

References AGX_FORCE_INLINE.

◆ getSweepAndPruneIndex()

agx::UInt32 agxCollide::Geometry::getSweepAndPruneIndex ( ) const

Definition at line 862 of file Geometry.h.

◆ getTransform()

agx::AffineMatrix4x4 agxCollide::Geometry::getTransform ( ) const
Returns
the current transformation of the geometry in world coordinate space

Definition at line 1011 of file Geometry.h.

◆ getUuid()

agx::Uuid agxStream::Serializable::getUuid ( ) const
inherited
Returns
a unique id for this instance.

Definition at line 268 of file Serializable.h.

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

◆ hasGroup() [1/2]

bool agxCollide::Geometry::hasGroup ( agx::UInt32  id) const

This is performing a linear search among the collision group id for this Geometry.

Parameters
id- The group id we are looking for.
Returns
true if the Geometry is part of the group id

Definition at line 867 of file Geometry.h.

Referenced by agxSDK::CollisionGroupFilter::hasMemberGroup().

◆ hasGroup() [2/2]

bool agxCollide::Geometry::hasGroup ( const agx::Name &  name) const

Definition at line 872 of file Geometry.h.

◆ hasPropertyContainer()

bool agxCollide::Geometry::hasPropertyContainer ( ) const
Returns
true if it has an initialized PropertyContainer

Definition at line 954 of file Geometry.h.

References agx::ref_ptr< T >::isValid().

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

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ isEnabled()

bool agxCollide::Geometry::isEnabled ( ) const

Alias for getEnable Return whether the geometry should be used in intersection tests.

This can be set using the setEnable() method.

Returns
true if the geometry is used in intersection tests, false if not.

Definition at line 847 of file Geometry.h.

Referenced by agxCollide::Space::reportOverlap().

◆ isFinished()

bool agxStream::Serializable::isFinished ( ) const
inherited
Returns
true if this class is restored correctly and should not be deleted during destruction of an Archive.

Definition at line 252 of file Serializable.h.

References AGX_FORCE_INLINE.

◆ isSensor()

bool agxCollide::Geometry::isSensor ( ) const

Return true if geometry is a sensor.

Definition at line 852 of file Geometry.h.

◆ isSensorGeneratingContactData()

bool agxCollide::Geometry::isSensorGeneratingContactData ( ) const
inline
Returns
True if collision data will be omitted from contacts while this geometry is a sensor.
See also
setSensor

Definition at line 857 of file Geometry.h.

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ remove() [1/2]

bool agxCollide::Geometry::remove ( Shape *  shape)

Remove a shape from the geometry.

Returns
true if shape was removed. False if shape == null or Geometry does not contain the shape

◆ remove() [2/2]

bool agxCollide::Geometry::remove ( size_t  index)

Remove the i:th shape from the Geometry.

Returns
true if shape was removed. False if shape == null or Geometry does not contain the shape

◆ removeAllGroups()

void agxCollide::Geometry::removeAllGroups ( bool  forceContactUpdate = false)

Remove all collision group ids.

Parameters
forceContactUpdate- Should current overlaps between disabled groups be found and create impacts.

◆ removeGroup() [1/2]

void agxCollide::Geometry::removeGroup ( agx::UInt32  id,
bool  forceContactUpdate = false 
)

Remove a collision group id from the vector of group ids.

Parameters
id- The group id to be removed
forceContactUpdate- Should current overlaps between disabled groups be found and create impacts.

◆ removeGroup() [2/2]

void agxCollide::Geometry::removeGroup ( const agx::Name &  name,
bool  forceContactUpdate = false 
)

Remove a named collision group from the vector of named group ids.

Parameters
name- The group id to be removed
forceContactUpdate- Should current overlaps between disabled groups be found and create impacts.

◆ removeMaterial()

void agxCollide::Geometry::removeMaterial ( )

Remove the material from the geometry.

◆ replace() [1/2]

bool agxCollide::Geometry::replace ( size_t  shapeIndex,
Shape *  newShape,
const agx::AffineMatrix4x4 &  localTransform = agx::AffineMatrix4x4() 
)

Replace a shape in the geometry.

◆ replace() [2/2]

bool agxCollide::Geometry::replace ( Shape *  oldShape,
Shape *  newShape,
const agx::AffineMatrix4x4 &  localTransform = agx::AffineMatrix4x4() 
)

◆ replaceShapeTransform() [1/2]

bool agxCollide::Geometry::replaceShapeTransform ( size_t  shapeIndex,
const agx::AffineMatrix4x4 &  newTransform 
)

Replace the shape transform for the specified shapeIndex.

Parameters
shapeIndex- Index of the transform that should be replaced. Valid values are 0..numShapes-1
newTransform- The new transform
Returns
true if shapeIndex is valid.

◆ replaceShapeTransform() [2/2]

bool agxCollide::Geometry::replaceShapeTransform ( Shape *  shape,
const agx::AffineMatrix4x4 &  newTransform 
)

Replace the shape transform for the specified shape.

Parameters
shape- The shape for which the transform should be replaced.
newTransform- The new transform
Returns
true if shape is valid.

◆ restore()

virtual void agxCollide::Geometry::restore ( agxStream::InputArchive &  in)
overridevirtual

◆ setCustomData()

void agxCollide::Geometry::setCustomData ( agx::Referenced *  data)

Store a ref_ptr to a user custom data class, which must be inherited from Referenced.

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setEnable()

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

Enable/disable collision testing for geometry.

A disabled geometry does not render in debug rendering or osg.

◆ setEnableCollisions() [1/2]

void agxCollide::Geometry::setEnableCollisions ( const Geometry *  otherGeometry,
bool  flag 
)

Specify whether otherGeometry is allowed to collide with this geometry.

◆ setEnableCollisions() [2/2]

void agxCollide::Geometry::setEnableCollisions ( bool  collide)

Should this geometry collide with any other geometries.

Disabling this still means that it will be part of MassProperty calculations if it belongs to a rigid body.

Parameters
collide- If false this geometry will not generate any contacts with any other geometry

◆ setEnableSerialization()

void agxStream::Serializable::setEnableSerialization ( bool  flag)
inherited

Set to false to disable serialization of this object.

It will just be ignored during serialization (writing). It is still possible to restore TO this object.

◆ setEnableUuidGeneration()

static void agxStream::Serializable::setEnableUuidGeneration ( bool  flag)
staticinherited

Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.

◆ setFinished()

void agxStream::Serializable::setFinished ( )
inherited

Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.

◆ setLocalPosition() [1/2]

void agxCollide::Geometry::setLocalPosition ( const agx::Vec3 &  p)

Set the position of the geometry relative to its frame's parent frame.

Parameters
p- local translate of geometry as a 3D vector

◆ setLocalPosition() [2/2]

void agxCollide::Geometry::setLocalPosition ( agx::Real  x,
agx::Real  y,
agx::Real  z 
)

Set the position of the geometry relative to its frame's parent frame.

Parameters
x- local x translate
y- local y translate
z- local z translate

◆ setLocalRotation() [1/2]

void agxCollide::Geometry::setLocalRotation ( const agx::Quat &  q)

Set the rotation of the geometry relative to its frame's parent frame.

Parameters
q- rotation given as a quaternion

◆ setLocalRotation() [2/2]

void agxCollide::Geometry::setLocalRotation ( const agx::EulerAngles &  e)

Set the rotation of the geometry relative to its frame's parent frame.

Parameters
e- rotation given as Euler angles

◆ setLocalTransform()

void agxCollide::Geometry::setLocalTransform ( const agx::AffineMatrix4x4 &  matrix)

Assign the local transformation matrix for this geometry, ignoring any eventual parent transformation.

Parameters
matrix- transformation matrix relative to parent transform for the geometry's frame

◆ setMaterial()

void agxCollide::Geometry::setMaterial ( agx::Material *  material)

Set the material of the geometry.

◆ setName()

void agxCollide::Geometry::setName ( const agx::Name &  name)

Set the name of this Geometry.

◆ setParentFrame()

bool agxCollide::Geometry::setParentFrame ( agx::Frame *  frame)

Set the parent frame of this geometry's frame.

This means that getLocalTranslate, getLocalRotate, getLocalTransform will be given in the parents coordinate frame. I.e., this frame's transformation will be concatenated with the parents.

Parameters
frame- new parent frame, 0 to remove parent
Returns
true if parent is changed (not the same as before) - otherwise false

◆ setPosition() [1/2]

void agxCollide::Geometry::setPosition ( const agx::Vec3 &  p)

Set the position of the frame in world coordinates.

Parameters
p- desired position in world coordinates.

◆ setPosition() [2/2]

void agxCollide::Geometry::setPosition ( agx::Real  x,
agx::Real  y,
agx::Real  z 
)

Set the position of the frame in world coordinates.

Parameters
x- desired x-coordinate in world frame
y- desired y-coordinate in world frame
z- desired z-coordinate in world frame

◆ setPropertyContainer()

void agxCollide::Geometry::setPropertyContainer ( agx::PropertyContainer *  container)

Give this a new PropertyContainer.

Parameters
container- The new PropertyContainer of this instance.

◆ setRotation() [1/3]

void agxCollide::Geometry::setRotation ( const agx::Quat &  q)

Set the rotation of the geometry relative to world frame.

Parameters
q- rotation given as a quaternion

◆ setRotation() [2/3]

void agxCollide::Geometry::setRotation ( const agx::EulerAngles &  e)

Set the rotation of the geometry relative to world frame.

Parameters
e- rotation given as Euler angles

◆ setRotation() [3/3]

void agxCollide::Geometry::setRotation ( const agx::OrthoMatrix3x3 &  m)

Set the rotation of the geometry relative to world frame.

Parameters
m- rotation given as an orthogonal transformation matrix

◆ setSensor()

void agxCollide::Geometry::setSensor ( bool  flag,
bool  generateContactData = true 
)

Sets if the geometry should be a sensor.

Sensors are included in collision detection but the resulting contacts are not passed to the solver.

Contact data generation for sensors is disabled by passing false into generateContactData. GeometryContacts are still created, but they will contain no contact points. This flag has no effect while isSensor returns false. Support for disabling contact data generation is currently only supported for some shape type pairs. Other shape type pairs will continue to get full contact data.

Parameters
flag- True to make this Geometry a sensor.
generateContactData- True if contact data is to be generated, false otherwise. False only supported for some shape type pairs.

◆ setSurfaceVelocity()

void agxCollide::Geometry::setSurfaceVelocity ( const agx::Vec3f &  surfaceVelocity)

Set the velocity of this geometry's surface in the geometry's local coordinate frame.

If this velocity is non-zero the constraints will try to achieve the relative velocity between the objects (in the friction plane) to be the wanted surface velocity.

Parameters
surfaceVelocity- velocity given in geometry's local coordinate frame

Definition at line 892 of file Geometry.h.

◆ setTransform()

void agxCollide::Geometry::setTransform ( const agx::AffineMatrix4x4 &  matrix)

Set the transform of the geometry.

Its frame will move to the specified transform, which is given in world coordintaes.

Parameters
matrix- desired transform for the frame in world coordinates.

◆ setUuid()

void agxStream::Serializable::setUuid ( const agx::Uuid &  uuid)
inherited

Explicitly set a Uuid on a serializable object.

Use this method with great care, as it can result in non-unique identifiers in the system!

◆ shapeUpdated()

virtual void agxCollide::Geometry::shapeUpdated ( )
virtual

◆ store()

virtual void agxCollide::Geometry::store ( agxStream::OutputArchive &  out) const
overridevirtual

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ updateBoundingVolume()

virtual void agxCollide::Geometry::updateBoundingVolume ( )
virtual

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

◆ shapeChangeEvent

ShapeChangeEvent agxCollide::Geometry::shapeChangeEvent

Definition at line 92 of file Geometry.h.


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