AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agx::RotationalAngle Class Reference

Implementation of constraint angle ABOUT an axis. More...

#include <ConstraintAngle.h>

+ Inheritance diagram for agx::RotationalAngle:

Public Member Functions

 RotationalAngle (agx::Angle::Axis axis, agx::Real initialAngle=agx::Real(0))
 Construct given axis and initial angle.
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agx::RotationalAngle)
 
agx::Real getLastAngle () const
 
agx::Int getWindingNumber () const
 
virtual void onPostSolve (const agx::AttachmentPair &ap, agx::Real dt) override
 Updates winding number given angular speed about our axis.
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 Restore structural independent data from stream.
 
void setLastAngle (agx::Real lastAngle)
 Set the last angle between (-pi, +pi) (winding number NOT included)
 
void setWindingNumber (agx::Int windingNumber)
 Use with caution since each values of windingNumber represent plus or minus 360 degrees of the joint angle (e.g, affecting locks and ranges).
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 Store structural independent data to stream.
 
virtual void transform (const agx::AttachmentPair &ap) override
 Update value given constraint pair.
 
- Public Member Functions inherited from agx::Angle
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::Angle)
 
agx::Angle::Axis getAxis () const
 
virtual const agx::Vec3 & getDir (const agx::AttachmentPair &ap, agx::UInt index) const
 
agx::Angle::Type getType () const
 
agx::Real getValue () const
 
virtual void onPostSolve (const agx::AttachmentPair &ap, agx::Real dt)
 Post solvers, velocity dependent variables should be updated.
 
virtual void restore (agxStream::InputArchive &in) override
 Restore given stream.
 
virtual void restoreLightData (agxStream::StorageStream &str) override
 Restore structural independent data from stream.
 
virtual void store (agxStream::OutputArchive &out) const override
 Store given stream.
 
virtual void storeLightData (agxStream::StorageStream &str) const override
 Store structural independent data to stream.
 
virtual void transform (const agx::AttachmentPair &ap)
 Transform method to update the value of this angle.
 
- 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

static agxStream::Serializable * create (agxStream::InputArchive &)
 
static agx::RotationalAngle * safeCast (const agx::Angle *angle)
 Utility cast method.
 
- 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

 RotationalAngle ()
 Default constructor used during restore.
 
virtual ~RotationalAngle ()
 Reference counted object, protected destructor.
 
virtual void stepAbout (const agx::Vec3 &worldAxis, const AttachmentPair &ap, agx::Real dt)
 Integrate/step parameters given world axis.
 
virtual void stepBy (agx::Real deltaAngle)
 Integrate/step parameters given a delta angle.
 
virtual void transformImpl (const agx::AttachmentPair &ap, bool firstIsReference)
 The default behavior is that the first attachment is the reference frame.
 
- Protected Member Functions inherited from agx::Angle
 Angle (agx::Angle::Axis axis, agx::Angle::Type type, agx::Real initialAngle=agx::Real(0))
 Construct given axis and initial angle.
 
virtual ~Angle ()
 Reference counted object, protected destructor.
 
- 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::Real m_lastAngle
 
agx::Int m_windingNumber
 
- Protected Attributes inherited from agx::Angle
Axis m_axis
 
Type m_type
 
agx::Real m_value
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Public Types inherited from agx::Angle
enum  Axis { U , V , N }
 Axis this constraint angle is defined about or along. More...
 
enum  Type { TRANSLATIONAL , ROTATIONAL }
 Type, i.e., defines Axis as 'along' or 'about'. More...
 
- 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

Implementation of constraint angle ABOUT an axis.

Definition at line 134 of file ConstraintAngle.h.

Constructor & Destructor Documentation

◆ RotationalAngle() [1/2]

agx::RotationalAngle::RotationalAngle ( agx::Angle::Axis  axis,
agx::Real  initialAngle = agx::Real(0) 
)

Construct given axis and initial angle.

Note that the given initialAngle has to match the angle of the frames in the attachment pair this angle belongs to.

Parameters
axis- axis this angle is defined about
initialAngle- initial angle

◆ RotationalAngle() [2/2]

agx::RotationalAngle::RotationalAngle ( )
protected

Default constructor used during restore.

◆ ~RotationalAngle()

virtual agx::RotationalAngle::~RotationalAngle ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agx::RotationalAngle::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agx::RotationalAngle  )

◆ create()

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

Definition at line 187 of file ConstraintAngle.h.

◆ getLastAngle()

agx::Real agx::RotationalAngle::getLastAngle ( ) const
Returns
the previous angle (-pi, +pi) (winding number NOT included)

◆ getWindingNumber()

agx::Int agx::RotationalAngle::getWindingNumber ( ) const
Returns
the winding number

◆ onPostSolve()

virtual void agx::RotationalAngle::onPostSolve ( const agx::AttachmentPair &  ap,
agx::Real  dt 
)
overridevirtual

Updates winding number given angular speed about our axis.

Parameters
ap- attachment pair of this angle
dt- time step size

Reimplemented from agx::Angle.

◆ restoreLightData()

virtual void agx::RotationalAngle::restoreLightData ( agxStream::StorageStream &  str)
overridevirtual

Restore structural independent data from stream.

Reimplemented from agx::Angle.

◆ safeCast()

static agx::RotationalAngle * agx::RotationalAngle::safeCast ( const agx::Angle *  angle)
static

Utility cast method.

◆ setLastAngle()

void agx::RotationalAngle::setLastAngle ( agx::Real  lastAngle)

Set the last angle between (-pi, +pi) (winding number NOT included)

Parameters
lastAngle- will be clamped in range (-pi, +pi) if outside

◆ setWindingNumber()

void agx::RotationalAngle::setWindingNumber ( agx::Int  windingNumber)

Use with caution since each values of windingNumber represent plus or minus 360 degrees of the joint angle (e.g, affecting locks and ranges).

Parameters
windingNumber- new windingNumber

◆ stepAbout()

virtual void agx::RotationalAngle::stepAbout ( const agx::Vec3 &  worldAxis,
const AttachmentPair &  ap,
agx::Real  dt 
)
protectedvirtual

Integrate/step parameters given world axis.

The world axis is used to determine the rotation speed about the given reference axis and then the delta angle.

Parameters
worldAxis- world (rotation) axis
ap- attachment pair of this angle
dt- time step size

◆ stepBy()

virtual void agx::RotationalAngle::stepBy ( agx::Real  deltaAngle)
protectedvirtual

Integrate/step parameters given a delta angle.

The world axis of the first attachment is used as rotation axis.

Parameters
deltaAngle- delta angle (any sign, any value)

◆ storeLightData()

virtual void agx::RotationalAngle::storeLightData ( agxStream::StorageStream &  str) const
overridevirtual

Store structural independent data to stream.

Reimplemented from agx::Angle.

◆ transform()

virtual void agx::RotationalAngle::transform ( const agx::AttachmentPair &  ap)
overridevirtual

Update value given constraint pair.

Reimplemented from agx::Angle.

◆ transformImpl()

virtual void agx::RotationalAngle::transformImpl ( const agx::AttachmentPair &  ap,
bool  firstIsReference 
)
protectedvirtual

The default behavior is that the first attachment is the reference frame.

If firstIsReference = false, the angle will be calculated using the second attachment frame as the fixed frame. The default transform override is just channeling to this as transform( ap, true ).

Parameters
ap- attachment pair of this angle
firstIsReference- default behavior of constraints is firstIsReference = true, if false the second attachment in ap will be used as the reference

Member Data Documentation

◆ m_lastAngle

agx::Real agx::RotationalAngle::m_lastAngle
protected

Definition at line 240 of file ConstraintAngle.h.

◆ m_windingNumber

agx::Int agx::RotationalAngle::m_windingNumber
protected

Definition at line 239 of file ConstraintAngle.h.


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