AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxModel::NodeAttachment Class Referenceabstract

Base class for attachments to Deformable1D nodes. More...

#include <Deformable1DAttachment.h>

+ Inheritance diagram for agxModel::NodeAttachment:

Public Types

enum  InitializationMode { USE_RELATIVE_TRANSFORM , ROTATE_TO_NODE_DIRECTION }
 Each attachment implementation controls the initialization mode. More...
 

Public Member Functions

 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxModel::NodeAttachment)
 
agx::Constraint * getConstraint () const
 
agx::Frame * getFrame () const
 
InitializationMode getInitMode () const
 
const agx::String & getName () const
 
agx::RigidBody * getRigidBody () const
 
agx::AffineMatrix4x4 getWorldMatrix () const
 
virtual agx::Bool initialize (agxModel::Deformable1DNode *node)
 Initializes constraint.
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 Restore structural independent data from stream.
 
void setName (const agx::String &name)
 Name this attachment, e.g., to find this attachment using agxModel::Node::getAttachment( const agx::String& name ).
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 Store structural independent data to stream.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

template<typename T >
static agxModel::NodeAttachmentRef createFromBody (agx::AffineMatrix4x4 bodyTransform, agx::RigidBody *rb)
 Creates an node attachment given a transform in rb local frame.
 
template<typename T >
static agxModel::NodeAttachmentRef createFromBody (agx::Vec3 bodyPoint, agx::RigidBody *rb)
 Creates an node attachment given a point in rb local frame.
 
template<typename T >
static agxModel::NodeAttachmentRef createFromWorld (agx::AffineMatrix4x4 worldTransform, agx::RigidBody *rb)
 Creates an node attachment given a transform in world frame.
 
template<typename T >
static agxModel::NodeAttachmentRef createFromWorld (agx::Vec3 worldPoint, agx::RigidBody *rb)
 Creates an node attachment given a point in world frame.
 
- 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.
 

Protected Member Functions

 NodeAttachment (agx::RigidBody *rb, agx::Frame *rbAttachmentFrame, agxModel::NodeAttachment::InitializationMode initMode)
 Construct given rigid body and a relative frame.
 
virtual ~NodeAttachment ()
 Reference counted object, protected destructor.
 
virtual agx::ConstraintRef createConstraint (agx::RigidBodyRef rb1, agx::FrameRef f1, agx::RigidBodyRef rb2, agx::FrameRef f2) const =0
 Create the attachment constraint.
 
void restore (agxStream::InputArchive &in) override
 Serialization restore.
 
void store (agxStream::OutputArchive &out) const override
 Serialization store.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

agx::ConstraintRef m_constraint
 
InitializationMode m_initMode
 
agx::String m_name
 
agx::RigidBodyRef m_rb
 
agx::FrameRef m_rbAttachmentFrame
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

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.
 

Detailed Description

Base class for attachments to Deformable1D nodes.

Definition at line 36 of file Deformable1DAttachment.h.

Member Enumeration Documentation

◆ InitializationMode

Each attachment implementation controls the initialization mode.

Enumerator
USE_RELATIVE_TRANSFORM 
ROTATE_TO_NODE_DIRECTION 

Definition at line 42 of file Deformable1DAttachment.h.

Constructor & Destructor Documentation

◆ NodeAttachment()

agxModel::NodeAttachment::NodeAttachment ( agx::RigidBody *  rb,
agx::Frame *  rbAttachmentFrame,
agxModel::NodeAttachment::InitializationMode  initMode 
)
protected

Construct given rigid body and a relative frame.

Parameters
rb- rigid body (null for world attachment)
rbAttachmentFrame- relative (to rigid body) frame
initMode- The mode for the attachment see InitializationMode

◆ ~NodeAttachment()

virtual agxModel::NodeAttachment::~NodeAttachment ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE()

agxModel::NodeAttachment::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agxModel::NodeAttachment  )

◆ createConstraint()

virtual agx::ConstraintRef agxModel::NodeAttachment::createConstraint ( agx::RigidBodyRef  rb1,
agx::FrameRef  f1,
agx::RigidBodyRef  rb2,
agx::FrameRef  f2 
) const
protectedpure virtual

◆ createFromBody() [1/2]

template<typename T >
agxModel::NodeAttachmentRef agxModel::NodeAttachment::createFromBody ( agx::AffineMatrix4x4  bodyTransform,
agx::RigidBody *  rb 
)
static

Creates an node attachment given a transform in rb local frame.

The attachment frame will coincide at the given local transform.

Parameters
bodyTransform- constraint transform given in the local body frame
rb- rigid body attached to
Returns
the attachment of type T

Definition at line 374 of file Deformable1DAttachment.h.

◆ createFromBody() [2/2]

template<typename T >
agxModel::NodeAttachmentRef agxModel::NodeAttachment::createFromBody ( agx::Vec3  bodyPoint,
agx::RigidBody *  rb 
)
static

Creates an node attachment given a point in rb local frame.

The attachment frame will coincide at the given local point.

Parameters
bodyPoint- constraint center point given in the local body frame
rb- rigid body attached to
Returns
the attachment of type T

Definition at line 362 of file Deformable1DAttachment.h.

◆ createFromWorld() [1/2]

template<typename T >
agxModel::NodeAttachmentRef agxModel::NodeAttachment::createFromWorld ( agx::AffineMatrix4x4  worldTransform,
agx::RigidBody *  rb 
)
static

Creates an node attachment given a transform in world frame.

The attachment frame will coincide at the given world frame.

Parameters
worldTransform- constraint transform given in the world frame
rb- rigid body attached to
Returns
the attachment of type T

Definition at line 368 of file Deformable1DAttachment.h.

References agx::RigidBody::getTransform(), and agx::AffineMatrix4x4T< T >::inverse().

◆ createFromWorld() [2/2]

template<typename T >
agxModel::NodeAttachmentRef agxModel::NodeAttachment::createFromWorld ( agx::Vec3  worldPoint,
agx::RigidBody *  rb 
)
static

Creates an node attachment given a point in world frame.

The attachment frame will coincide at the given world point.

Parameters
worldPoint- constraint center point given in the world frame
rb- rigid body attached to
Returns
the attachment of type T

Definition at line 356 of file Deformable1DAttachment.h.

References agx::RigidBody::getFrame(), and agx::Frame::transformPointToLocal().

◆ getConstraint()

agx::Constraint * agxModel::NodeAttachment::getConstraint ( ) const
Returns
the constraint of this attachment

◆ getFrame()

agx::Frame * agxModel::NodeAttachment::getFrame ( ) const
Returns
relative frame

◆ getInitMode()

InitializationMode agxModel::NodeAttachment::getInitMode ( ) const

◆ getName()

const agx::String & agxModel::NodeAttachment::getName ( ) const
Returns
name of this attachment

◆ getRigidBody()

agx::RigidBody * agxModel::NodeAttachment::getRigidBody ( ) const
Returns
the rigid body

◆ getWorldMatrix()

agx::AffineMatrix4x4 agxModel::NodeAttachment::getWorldMatrix ( ) const
Returns
world transform of this attachment

◆ initialize()

virtual agx::Bool agxModel::NodeAttachment::initialize ( agxModel::Deformable1DNode *  node)
virtual

Initializes constraint.

◆ restore()

void agxModel::NodeAttachment::restore ( agxStream::InputArchive &  in)
overrideprotected

Serialization restore.

◆ restoreLightData()

virtual void agxModel::NodeAttachment::restoreLightData ( agxStream::StorageStream &  str)
overridevirtual

Restore structural independent data from stream.

◆ setName()

void agxModel::NodeAttachment::setName ( const agx::String &  name)

Name this attachment, e.g., to find this attachment using agxModel::Node::getAttachment( const agx::String& name ).

Parameters
name- name of this attachment

◆ store()

void agxModel::NodeAttachment::store ( agxStream::OutputArchive &  out) const
overrideprotected

Serialization store.

◆ storeLightData()

virtual void agxModel::NodeAttachment::storeLightData ( agxStream::StorageStream &  str) const
overridevirtual

Store structural independent data to stream.

Member Data Documentation

◆ m_constraint

agx::ConstraintRef agxModel::NodeAttachment::m_constraint
protected

Definition at line 176 of file Deformable1DAttachment.h.

◆ m_initMode

InitializationMode agxModel::NodeAttachment::m_initMode
protected

Definition at line 177 of file Deformable1DAttachment.h.

◆ m_name

agx::String agxModel::NodeAttachment::m_name
protected

Definition at line 173 of file Deformable1DAttachment.h.

◆ m_rb

agx::RigidBodyRef agxModel::NodeAttachment::m_rb
protected

Definition at line 174 of file Deformable1DAttachment.h.

◆ m_rbAttachmentFrame

agx::FrameRef agxModel::NodeAttachment::m_rbAttachmentFrame
protected

Definition at line 175 of file Deformable1DAttachment.h.


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