AGX Dynamics  2.37.3.2
agx::MergeSplitBodyStorage Class Reference

Book keeping of a body which can be merged with other bodies. More...

#include <MergeSplitBodyStorage.h>

+ Inheritance diagram for agx::MergeSplitBodyStorage:

Public Types

typedef agx::Vector< agx::observer_ptr< agxCollide::Geometry > > GeometryObserverVector
 

Public Member Functions

 MergeSplitBodyStorage ()
 Default constructor. More...
 
 MergeSplitBodyStorage (agx::RigidBody *body)
 Constructor which associates a body to this body storage. More...
 
MergeSplitBodyStorage * getChild (size_t nth)
 
const MergeSplitBodyStorage * getChild (size_t nth) const
 
const char * getClassName () const override
 
const agxCollide::GeometryRefVector & getGeometries () const
 
size_t getNumChildren () const
 
MergeSplitBodyStorage * getParent ()
 
const MergeSplitBodyStorage * getParent () const
 
agx::RigidBody * getRigidBody ()
 
const agx::RigidBody * getRigidBody () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
AffineMatrix4x4 getTransformRelativeParent () const
 
bool hasChild (MergeSplitBodyStorage *child) const
 
bool hasChildren () const
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void store (agxStream::OutputArchive &out) const override
 
bool validate () const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
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
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
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 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...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
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 setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Static Public Member Functions

static void addMassProperties (MergeSplitBodyStorage *targetStorage, const MergeSplitBodyStorage *sourceStorage, Real sign)
 
static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
static void removeMassProperties (MergeSplitBodyStorage *targetStorage, const MergeSplitBodyStorage *sourceStorage, Real sign)
 
static void setRebuildThreshold (size_t numChildren, size_t numUpdates)
 Set the threshold when the inertiatensor of a parent should be completely rebuilt. More...
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 

Protected Member Functions

virtual ~MergeSplitBodyStorage ()
 
void addChild (MergeSplitBodyStorage *child)
 Add a storage as a child to this storage. More...
 
void addGeometry (agxCollide::Geometry *geom)
 
void calculateRelativeTransform (const MergeSplitBodyStorage *parentStorage)
 Calculate and store the transform relative the parent body. More...
 
void clear ()
 Reset this storage so its not associated to any body. More...
 
void followGeometry ()
 Make the body follow the first geometry in the list of geometries. More...
 
agx::Frame * getFrame ()
 
const agx::Frame * getFrame () const
 
agx::RigidBody::MotionControl getMotionControl () const
 
size_t getNumUpdates ()
 
void incrementNumUpdates ()
 
bool isMerged () const
 
bool removeChild (MergeSplitBodyStorage *child)
 Remove a storage so its no longer a child of this storage. More...
 
void resetNumUpdates ()
 
void restore (bool beingErased=false)
 Restore the associated body in that it will get back all its original geometries, motioncontrol etc. More...
 
void restoreMassProperties ()
 
void setMotionControl (agx::RigidBody::MotionControl m)
 
void setParent (MergeSplitBodyStorage *parent)
 Set the pointer to the parent body of this body. More...
 
void setRigidBody (agx::RigidBody *body)
 Associate this storage with the specified body. More...
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from agx::Referenced
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 inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Book keeping of a body which can be merged with other bodies.

Keep track of its children, parent bodies, original geometries belonging to this body etc.

Definition at line 35 of file MergeSplitBodyStorage.h.

Member Typedef Documentation

◆ GeometryObserverVector

Constructor & Destructor Documentation

◆ MergeSplitBodyStorage() [1/2]

agx::MergeSplitBodyStorage::MergeSplitBodyStorage ( )

Default constructor.

◆ MergeSplitBodyStorage() [2/2]

agx::MergeSplitBodyStorage::MergeSplitBodyStorage ( agx::RigidBody *  body)

Constructor which associates a body to this body storage.

◆ ~MergeSplitBodyStorage()

virtual agx::MergeSplitBodyStorage::~MergeSplitBodyStorage ( )
protectedvirtual

Member Function Documentation

◆ addChild()

void agx::MergeSplitBodyStorage::addChild ( MergeSplitBodyStorage *  child)
protected

Add a storage as a child to this storage.

◆ addGeometry()

void agx::MergeSplitBodyStorage::addGeometry ( agxCollide::Geometry *  geom)
protected

◆ addMassProperties()

static void agx::MergeSplitBodyStorage::addMassProperties ( MergeSplitBodyStorage *  targetStorage,
const MergeSplitBodyStorage *  sourceStorage,
Real  sign 
)
static

◆ calculateRelativeTransform()

void agx::MergeSplitBodyStorage::calculateRelativeTransform ( const MergeSplitBodyStorage *  parentStorage)
protected

Calculate and store the transform relative the parent body.

◆ clear()

void agx::MergeSplitBodyStorage::clear ( )
protected

Reset this storage so its not associated to any body.

◆ create() [1/2]

static agxStream::Serializable* agx::MergeSplitBodyStorage::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 53 of file MergeSplitBodyStorage.h.

◆ create() [2/2]

static agxStream::Serializable* agx::MergeSplitBodyStorage::create ( )
inlinestatic

Definition at line 53 of file MergeSplitBodyStorage.h.

◆ followGeometry()

void agx::MergeSplitBodyStorage::followGeometry ( )
protected

Make the body follow the first geometry in the list of geometries.

◆ getChild() [1/2]

MergeSplitBodyStorage* agx::MergeSplitBodyStorage::getChild ( size_t  nth)
Returns
a pointer to the nth child, nullptr if there are no children of this index.

◆ getChild() [2/2]

const MergeSplitBodyStorage* agx::MergeSplitBodyStorage::getChild ( size_t  nth) const
Returns
a pointer to the nth child, nullptr if there are no children of this index.

◆ getClassName()

const char* agx::MergeSplitBodyStorage::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 53 of file MergeSplitBodyStorage.h.

◆ getConstructClassId()

static const char* agx::MergeSplitBodyStorage::getConstructClassId ( )
inlinestatic

Definition at line 53 of file MergeSplitBodyStorage.h.

◆ getFrame() [1/2]

agx::Frame * agx::MergeSplitBodyStorage::getFrame ( )
inlineprotected
Returns
a pointer to this body storages frame

Definition at line 222 of file MergeSplitBodyStorage.h.

◆ getFrame() [2/2]

const agx::Frame * agx::MergeSplitBodyStorage::getFrame ( ) const
inlineprotected

Definition at line 227 of file MergeSplitBodyStorage.h.

◆ getGeometries()

const agxCollide::GeometryRefVector& agx::MergeSplitBodyStorage::getGeometries ( ) const
Returns
a const reference to the vector of geometries associated to this body storage.

◆ getMotionControl()

agx::RigidBody::MotionControl agx::MergeSplitBodyStorage::getMotionControl ( ) const
inlineprotected

Definition at line 232 of file MergeSplitBodyStorage.h.

◆ getNumChildren()

size_t agx::MergeSplitBodyStorage::getNumChildren ( ) const
inline
Returns
the number of children this body storage has

Definition at line 217 of file MergeSplitBodyStorage.h.

◆ getNumUpdates()

size_t agx::MergeSplitBodyStorage::getNumUpdates ( )
inlineprotected

Definition at line 207 of file MergeSplitBodyStorage.h.

◆ getParent() [1/2]

MergeSplitBodyStorage * agx::MergeSplitBodyStorage::getParent ( )
inline
Returns
a pointer to a parent MergeSplitBodyStorage

Definition at line 212 of file MergeSplitBodyStorage.h.

◆ getParent() [2/2]

const MergeSplitBodyStorage * agx::MergeSplitBodyStorage::getParent ( ) const
inline
Returns
a pointer to a parent MergeSplitBodyStorage

Definition at line 213 of file MergeSplitBodyStorage.h.

◆ getRigidBody() [1/2]

agx::RigidBody * agx::MergeSplitBodyStorage::getRigidBody ( )
inline
Returns
a pointer to the associated body

Definition at line 209 of file MergeSplitBodyStorage.h.

◆ getRigidBody() [2/2]

const agx::RigidBody * agx::MergeSplitBodyStorage::getRigidBody ( ) const
inline
Returns
a pointer to the associated body

Definition at line 210 of file MergeSplitBodyStorage.h.

◆ getStorageAgent()

agxStream::StorageAgent* agx::MergeSplitBodyStorage::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 53 of file MergeSplitBodyStorage.h.

◆ getTransformRelativeParent()

AffineMatrix4x4 agx::MergeSplitBodyStorage::getTransformRelativeParent ( ) const
inline

Definition at line 215 of file MergeSplitBodyStorage.h.

◆ hasChild()

bool agx::MergeSplitBodyStorage::hasChild ( MergeSplitBodyStorage *  child) const
Returns
true if the specified storage is a child of this

◆ hasChildren()

bool agx::MergeSplitBodyStorage::hasChildren ( ) const
inline
Returns
true if this storage has children

Definition at line 237 of file MergeSplitBodyStorage.h.

◆ incrementNumUpdates()

void agx::MergeSplitBodyStorage::incrementNumUpdates ( )
inlineprotected

Definition at line 203 of file MergeSplitBodyStorage.h.

◆ isMerged()

bool agx::MergeSplitBodyStorage::isMerged ( ) const
inlineprotected
Returns
true if this body is merged into a superbody

Definition at line 201 of file MergeSplitBodyStorage.h.

◆ removeChild()

bool agx::MergeSplitBodyStorage::removeChild ( MergeSplitBodyStorage *  child)
protected

Remove a storage so its no longer a child of this storage.

◆ removeMassProperties()

static void agx::MergeSplitBodyStorage::removeMassProperties ( MergeSplitBodyStorage *  targetStorage,
const MergeSplitBodyStorage *  sourceStorage,
Real  sign 
)
static

◆ resetNumUpdates()

void agx::MergeSplitBodyStorage::resetNumUpdates ( )
inlineprotected

Definition at line 205 of file MergeSplitBodyStorage.h.

◆ restore() [1/2]

virtual void agx::MergeSplitBodyStorage::restore ( agxStream::InputArchive &  in)
overridevirtual

◆ restore() [2/2]

void agx::MergeSplitBodyStorage::restore ( bool  beingErased = false)
protected

Restore the associated body in that it will get back all its original geometries, motioncontrol etc.

◆ restoreMassProperties()

void agx::MergeSplitBodyStorage::restoreMassProperties ( )
protected

◆ setMotionControl()

void agx::MergeSplitBodyStorage::setMotionControl ( agx::RigidBody::MotionControl  m)
protected

◆ setParent()

void agx::MergeSplitBodyStorage::setParent ( MergeSplitBodyStorage *  parent)
protected

Set the pointer to the parent body of this body.

◆ setRebuildThreshold()

static void agx::MergeSplitBodyStorage::setRebuildThreshold ( size_t  numChildren,
size_t  numUpdates 
)
static

Set the threshold when the inertiatensor of a parent should be completely rebuilt.

Parameters
numChildren- If a parent has less children than numChildren, rebuild the whole tensor
numUpdates- If a parent has been incrementally recalculated more than numUpdates, rebuild the whole tensor

◆ setRigidBody()

void agx::MergeSplitBodyStorage::setRigidBody ( agx::RigidBody *  body)
protected

Associate this storage with the specified body.

Stores information about motioncontrol, associated geometries etc.

◆ store()

virtual void agx::MergeSplitBodyStorage::store ( agxStream::OutputArchive &  out) const
overridevirtual

◆ validate()

bool agx::MergeSplitBodyStorage::validate ( ) const

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