AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxModel::RigidNodeAttachment Class Reference

Node attachment using lock joint, i.e., the node cannot move relative to this attachment. More...

#include <Deformable1DAttachment.h>

+ Inheritance diagram for agxModel::RigidNodeAttachment:

Public Types

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

Public Member Functions

 RigidNodeAttachment (agx::RigidBody *rb, const agx::Vec3 &relPosition)
 Construct given rigid body and relative (to rigid body) position. More...
 
 RigidNodeAttachment (agx::RigidBody *rb, const agx::AffineMatrix4x4 &relTransform)
 Construct given rigid body and relative (to rigid body) transform. More...
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxModel::NodeAttachment)
 
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
 
const char * getClassName () const override
 
agx::Constraint * getConstraint () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::Frame * getFrame () const
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
InitializationMode getInitMode () const
 
const agx::String & getName () const
 
int getReferenceCount () const
 
agx::RigidBody * getRigidBody () const
 
agxStream::StorageAgent * getStorageAgent () const override
 
agx::Uuid getUuid () const
 
agx::AffineMatrix4x4 getWorldMatrix () const
 
virtual agx::Bool initialize (agxModel::Deformable1DNode *node)
 Initializes constraint. More...
 
template<typename T >
bool is () const
 Subclass test. More...
 
bool isFinished () 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...
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 Restore structural independent data from stream. 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 setName (const agx::String &name)
 Name this attachment, e.g., to find this attachment using agxModel::Node::getAttachment( const agx::String& name ). More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 Store structural independent data to stream. 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 agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
template<typename T >
static agxModel::NodeAttachmentRef createFromBody (agx::Vec3 bodyPoint, agx::RigidBody *rb)
 Creates an node attachment given a point in rb local frame. More...
 
template<typename T >
static agxModel::NodeAttachmentRef createFromBody (agx::AffineMatrix4x4 bodyTransform, agx::RigidBody *rb)
 Creates an node attachment given a transform in rb local frame. More...
 
template<typename T >
static agxModel::NodeAttachmentRef createFromWorld (agx::Vec3 worldPoint, agx::RigidBody *rb)
 Creates an node attachment given a point in world frame. More...
 
template<typename T >
static agxModel::NodeAttachmentRef createFromWorld (agx::AffineMatrix4x4 worldTransform, agx::RigidBody *rb)
 Creates an node attachment given a transform in world frame. More...
 
static const char * getConstructClassId ()
 
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)
 

Protected Member Functions

 RigidNodeAttachment ()
 Default constructor for serialization. More...
 
virtual ~RigidNodeAttachment ()
 Reference counted object, protected destructor. More...
 
void allocateObserverVector () const
 
virtual agx::ConstraintRef createConstraint (agx::RigidBodyRef rb1, agx::FrameRef f1, agx::RigidBodyRef rb2, agx::FrameRef f2) const override
 
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

agx::ConstraintRef m_constraint
 
InitializationMode m_initMode
 
Mutex m_mutex
 
agx::String m_name
 
ObserverContainer m_observers
 
agx::RigidBodyRef m_rb
 
agx::FrameRef m_rbAttachmentFrame
 
AtomicValue m_refCount
 

Detailed Description

Node attachment using lock joint, i.e., the node cannot move relative to this attachment.

Definition at line 252 of file Deformable1DAttachment.h.

Member Enumeration Documentation

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

agxModel::RigidNodeAttachment::RigidNodeAttachment ( agx::RigidBody *  rb,
const agx::Vec3 &  relPosition 
)

Construct given rigid body and relative (to rigid body) position.

The direction of the Deformable1D will be used.

Parameters
rb- rigid body
relPosition- position in rigid body frame
agxModel::RigidNodeAttachment::RigidNodeAttachment ( agx::RigidBody *  rb,
const agx::AffineMatrix4x4 &  relTransform 
)

Construct given rigid body and relative (to rigid body) transform.

The relative transform defines the lock joint.

Parameters
rb- rigid body
relTransform- transform in rigid body frame
agxModel::RigidNodeAttachment::RigidNodeAttachment ( )
protected

Default constructor for serialization.

virtual agxModel::RigidNodeAttachment::~RigidNodeAttachment ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

agxModel::NodeAttachment::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agxModel::NodeAttachment  )
inherited
void agx::Referenced::allocateObserverVector ( ) const
protectedinherited
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(), and agx::InternalData::getOrCreate().

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

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

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

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited
static agxStream::Serializable* agxModel::RigidNodeAttachment::create ( )
inlinestatic

Definition at line 271 of file Deformable1DAttachment.h.

static agxStream::Serializable* agxModel::RigidNodeAttachment::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 271 of file Deformable1DAttachment.h.

virtual agx::ConstraintRef agxModel::NodeAttachmentT< agx::LockJoint >::createConstraint ( agx::RigidBodyRef  rb1,
agx::FrameRef  f1,
agx::RigidBodyRef  rb2,
agx::FrameRef  f2 
) const
inlineoverrideprotectedvirtualinherited
Returns
new constraint of type T

Implements agxModel::NodeAttachment.

Definition at line 209 of file Deformable1DAttachment.h.

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

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.

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

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.

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

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().

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

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().

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
void agxStream::Serializable::generateUuid ( )
protectedinherited
const char* agxModel::RigidNodeAttachment::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 271 of file Deformable1DAttachment.h.

agx::Constraint* agxModel::NodeAttachment::getConstraint ( ) const
inherited
Returns
the constraint of this attachment
static const char* agxModel::RigidNodeAttachment::getConstructClassId ( )
inlinestatic

Definition at line 271 of file Deformable1DAttachment.h.

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
bool agxStream::Serializable::getEnableSerialization ( ) const
inherited
Returns
true if serialization is enabled for this object

Definition at line 273 of file Serializable.h.

bool agxStream::Serializable::getEnableUuidGeneration ( )
inherited
Returns
true if Uuid:s should be generated for each new Serializable object
agx::Frame* agxModel::NodeAttachment::getFrame ( ) const
inherited
Returns
relative frame
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.

InitializationMode agxModel::NodeAttachment::getInitMode ( ) const
inherited
const agx::String& agxModel::NodeAttachment::getName ( ) const
inherited
Returns
name of this attachment
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
agx::RigidBody* agxModel::NodeAttachment::getRigidBody ( ) const
inherited
Returns
the rigid body
agxStream::StorageAgent* agxModel::RigidNodeAttachment::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 271 of file Deformable1DAttachment.h.

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

Definition at line 268 of file Serializable.h.

agx::AffineMatrix4x4 agxModel::NodeAttachment::getWorldMatrix ( ) const
inherited
Returns
world transform of this attachment
virtual agx::Bool agxModel::NodeAttachment::initialize ( agxModel::Deformable1DNode *  node)
virtualinherited

Initializes constraint.

template<typename T >
bool agx::Referenced::is ( ) const
inherited
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.

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.

Referenced by agxData::Val< UInt >::Val().

virtual void agxModel::RigidNodeAttachment::restore ( agxStream::InputArchive &  in)
overridevirtual
virtual void agxModel::NodeAttachment::restoreLightData ( agxStream::StorageStream &  str)
overridevirtualinherited

Restore structural independent data from stream.

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

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

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.

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.

void agxStream::Serializable::setFinished ( )
inherited

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

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

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

Parameters
name- name of this attachment
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!

virtual void agxModel::RigidNodeAttachment::store ( agxStream::OutputArchive &  out) const
overridevirtual
virtual void agxModel::NodeAttachment::storeLightData ( agxStream::StorageStream &  str) const
overridevirtualinherited

Store structural independent data to stream.

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.

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.

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

Member Data Documentation

agx::ConstraintRef agxModel::NodeAttachment::m_constraint
protectedinherited

Definition at line 176 of file Deformable1DAttachment.h.

InitializationMode agxModel::NodeAttachment::m_initMode
protectedinherited

Definition at line 177 of file Deformable1DAttachment.h.

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

agx::String agxModel::NodeAttachment::m_name
protectedinherited

Definition at line 173 of file Deformable1DAttachment.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

agx::RigidBodyRef agxModel::NodeAttachment::m_rb
protectedinherited

Definition at line 174 of file Deformable1DAttachment.h.

agx::FrameRef agxModel::NodeAttachment::m_rbAttachmentFrame
protectedinherited

Definition at line 175 of file Deformable1DAttachment.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


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