AGX Dynamics 2.41.3.0
Loading...
Searching...
No Matches
agx::Attachment Class Reference

Constraint attachment base class for any type of frame. More...

#include <Attachment.h>

+ Inheritance diagram for agx::Attachment:

Public Types

enum  Transformed {
  U , V , N , ANCHOR_POS ,
  CM_TO_ANCHOR_POS , NUM_ELEMENTS
}
 Data access enum. More...
 

Public Member Functions

 Attachment (agx::Frame *relFrame)
 Construct given frame.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agx::Attachment)
 
template<typename T >
T * as ()
 Unsafe version, static cast of this to T.
 
template<typename T >
const T * as () const
 Unsafe version, static cast of this to T.
 
virtual agx::Real calculateAngularSpeed (const agx::Attachment *other) const
 
virtual agx::Real calculateDistance (const agx::Attachment *other) const
 
virtual agx::Real calculateLinearDistance (const agx::Attachment *other) const
 
virtual agx::Real calculateLinearSpeed (const agx::Attachment *other) const
 
const agx::Vec3get (agx::Attachment::Transformed entry) const
 
virtual agx::Vec3 getAngularVelocity () const
 
agx::FramegetFrame () const
 
virtual agx::Vec3 getLinearVelocity () const
 
agx::Vec3 getLocal (agx::Attachment::Transformed entry) const
 
template<typename T >
agx::Bool is () const
 
template<typename T >
Bool is () const
 
template<>
Bool is () const
 
virtual agx::Bool objectDeleted () const
 
template<typename T >
T * safeAs ()
 Dynamic cast of this to T.
 
template<typename T >
const T * safeAs () const
 Dynamic cast of this to T.
 
void setFrame (agx::Frame *frame)
 Assign a new frame - transformed data will be updated.
 
virtual void transform ()
 Subclass - implement this method!
 
virtual agx::Bool valid () const
 
- 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.
 
Referencedoperator= (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

static agxStream::Serializablecreate (agxStream::InputArchive &)
 
static void createAttachmentBase (const agx::Vec3d &N, agx::Vec3d &U, agx::Vec3d &V)
 Given vector N, create orthonormal base.
 
static void createAttachmentBase (const agx::Vec3f &N, agx::Vec3f &U, agx::Vec3f &V)
 
- 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

 Attachment ()
 Constructor to use during restore.
 
virtual ~Attachment ()
 Reference counted object, protected destructor.
 
void transform (const agx::AffineMatrix4x4 &cmTransform, const agx::Vec3 &cmToModel, const agx::AffineMatrix4x4 &localConstraintTransform)
 Fill Transformed data given center of mass transform and offset from model frame to center of mass frame (assumes not rotated relative each other).
 
- 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::FrameRef m_relFrame
 
agx::Vec3 m_transformed [NUM_ELEMENTS]
 
- 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 DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Constraint attachment base class for any type of frame.

Subclass for moving frames (e.g., rigid bodies).

Definition at line 37 of file agx/Attachment.h.

Member Enumeration Documentation

◆ Transformed

Data access enum.

Enumerator

Constraint attachment x-axis.

Constraint attachment y-axis.

Constraint attachment z-axis.

ANCHOR_POS 

Constraint attachment world position.

CM_TO_ANCHOR_POS 

Vector from center of mass (if moving) to anchor point given in world frame.

NUM_ELEMENTS 

Number of data elements.

Definition at line 43 of file agx/Attachment.h.

Constructor & Destructor Documentation

◆ Attachment() [1/2]

agx::Attachment::Attachment ( agx::Frame relFrame)

Construct given frame.

Parameters
relFrame- that transforms from center to anchor point.

◆ Attachment() [2/2]

agx::Attachment::Attachment ( )
protected

Constructor to use during restore.

◆ ~Attachment()

virtual agx::Attachment::~Attachment ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agx::Attachment::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agx::Attachment  )

◆ as() [1/2]

template<typename T >
T * agx::Attachment::as

Unsafe version, static cast of this to T.

See also
safeAs
Returns
this attachment as subclass using static cast

Definition at line 540 of file agx/Attachment.h.

References agxAssert.

◆ as() [2/2]

template<typename T >
const T * agx::Attachment::as

Unsafe version, static cast of this to T.

See also
safeAs
Returns
this attachment as subclass using static cast

Definition at line 559 of file agx/Attachment.h.

References agxAssert.

◆ calculateAngularSpeed()

virtual agx::Real agx::Attachment::calculateAngularSpeed ( const agx::Attachment other) const
virtual
Returns
relative speed about world z-axis of this attachment

Reimplemented in agx::RigidBodyAttachment.

◆ calculateDistance()

virtual agx::Real agx::Attachment::calculateDistance ( const agx::Attachment other) const
virtual
Parameters
other- The other attachment
Returns
the distance between this and the other attachment

Reimplemented in agx::RigidBodyAttachment.

◆ calculateLinearDistance()

virtual agx::Real agx::Attachment::calculateLinearDistance ( const agx::Attachment other) const
virtual
Returns
the projected (along this attachments world z-axis) distance between this and the other attachment

Reimplemented in agx::RigidBodyAttachment.

◆ calculateLinearSpeed()

virtual agx::Real agx::Attachment::calculateLinearSpeed ( const agx::Attachment other) const
virtual
Returns
relative speed along world z-axis of this attachment

Reimplemented in agx::RigidBodyAttachment.

◆ create()

static agxStream::Serializable * agx::Attachment::create ( agxStream::InputArchive )
inlinestatic

Definition at line 176 of file agx/Attachment.h.

◆ createAttachmentBase() [1/2]

static void agx::Attachment::createAttachmentBase ( const agx::Vec3d N,
agx::Vec3d U,
agx::Vec3d V 
)
static

Given vector N, create orthonormal base.

Parameters
N- in vector (a.k.a. z axis)
U- out vector (a.k.a. x axis)
V- out vector (a.k.a. y axis)

Referenced by agx::OrientedFrictionModelImpl< T >::calculateTangentPlane().

◆ createAttachmentBase() [2/2]

static void agx::Attachment::createAttachmentBase ( const agx::Vec3f N,
agx::Vec3f U,
agx::Vec3f V 
)
static

◆ get()

const Vec3 & agx::Attachment::get ( agx::Attachment::Transformed  entry) const
Returns
the transformed data

Definition at line 517 of file agx/Attachment.h.

References m_transformed.

◆ getAngularVelocity()

virtual agx::Vec3 agx::Attachment::getAngularVelocity ( ) const
virtual
Returns
linear velocity of this attachment given in world frame

Reimplemented in agx::RigidBodyAttachment.

◆ getFrame()

Frame * agx::Attachment::getFrame ( ) const
Returns
the frame

Definition at line 522 of file agx/Attachment.h.

References m_relFrame.

◆ getLinearVelocity()

virtual agx::Vec3 agx::Attachment::getLinearVelocity ( ) const
virtual
Returns
linear velocity of this attachment given in world frame

Reimplemented in agx::RigidBodyAttachment.

◆ getLocal()

agx::Vec3 agx::Attachment::getLocal ( agx::Attachment::Transformed  entry) const
Returns
the local data

◆ is() [1/3]

template<typename T >
agx::Bool agx::Attachment::is ( ) const
Returns
true if this object is of type T

◆ is() [2/3]

template<typename T >
Bool agx::Attachment::is ( ) const

Definition at line 528 of file agx/Attachment.h.

◆ is() [3/3]

template<>
Bool agx::Attachment::is ( ) const

Definition at line 534 of file agx/Attachment.h.

◆ objectDeleted()

virtual agx::Bool agx::Attachment::objectDeleted ( ) const
virtual
Returns
true if the parent object has been deleted

Reimplemented in agx::RigidBodyAttachment.

◆ safeAs() [1/2]

template<typename T >
T * agx::Attachment::safeAs

Dynamic cast of this to T.

Returns
this attachment as subclass using dynamic cast

Definition at line 553 of file agx/Attachment.h.

◆ safeAs() [2/2]

template<typename T >
const T * agx::Attachment::safeAs

Dynamic cast of this to T.

Returns
this attachment as subclass using dynamic cast

Definition at line 571 of file agx/Attachment.h.

◆ setFrame()

void agx::Attachment::setFrame ( agx::Frame frame)

Assign a new frame - transformed data will be updated.

Parameters
frame- new frame

◆ transform() [1/2]

virtual void agx::Attachment::transform ( )
virtual

Subclass - implement this method!

Default this method will copy data from relative frame to transformed data.

Reimplemented in agx::RigidBodyAttachment.

◆ transform() [2/2]

void agx::Attachment::transform ( const agx::AffineMatrix4x4 cmTransform,
const agx::Vec3 cmToModel,
const agx::AffineMatrix4x4 localConstraintTransform 
)
protected

Fill Transformed data given center of mass transform and offset from model frame to center of mass frame (assumes not rotated relative each other).

Parameters
cmTransform- world transform of the center of mass frame
cmToModel- in local coordinates, vector from center of mass frame to model frame
localConstraintTransform- transform of the local constraint frame

◆ valid()

virtual agx::Bool agx::Attachment::valid ( ) const
virtual
Returns
true if valid

Reimplemented in agx::RigidBodyAttachment.

Member Data Documentation

◆ m_relFrame

agx::FrameRef agx::Attachment::m_relFrame
protected

Definition at line 200 of file agx/Attachment.h.

Referenced by getFrame().

◆ m_transformed

agx::Vec3 agx::Attachment::m_transformed[NUM_ELEMENTS]
protected

Definition at line 199 of file agx/Attachment.h.

Referenced by get().


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