|
AGX Dynamics
2.37.2.0
|
The object defining a frame of reference and providing transformations operations. More...
#include <Frame.h>
Inheritance diagram for agx::Frame:Public Member Functions | |
| Frame () | |
| Default constructor. More... | |
| Frame (const agxData::AttributePtr< AffineMatrix4x4 > &localTransform, const agxData::AttributePtr< AffineMatrix4x4 > &globalTransform) | |
| Frame with existing matrix storage. More... | |
| Frame (const agx::AffineMatrix4x4 matrix) | |
| Instantiate a frame with relative transformation matrix. More... | |
| Frame (const agx::Frame &frame) | |
| Copy constructor. More... | |
| bool | allowTransferDataIntoChildren () const |
| const char * | getClassName () const override |
| const agx::AffineMatrix4x4 & | getLocalMatrix () const |
| Quat | getLocalRotate () const |
| agx::Vec3 | getLocalTranslate () const |
| const agx::AffineMatrix4x4 & | getMatrix () const |
| agx::Frame * | getParent () |
| const agx::Frame * | getParent () const |
| agx::RigidBody * | getRigidBody () |
| const agx::RigidBody * | getRigidBody () const |
| agx::Quat | getRotate () const |
| agxStream::StorageAgent * | getStorageAgent () const override |
| agx::Vec3 | getTranslate () const |
| bool | hasChildren () const |
| bool | hasParent () const |
| bool | isFinite () const |
| Frame & | operator= (const agx::Frame &frame) |
| Assignment operator. More... | |
| void | removeAllChildren () |
| Remove all children of this frame. More... | |
| bool | removeChild (agx::Frame *frame) |
| Remove a specified frame from the list of children. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| void | setAllowTransferIntoChildren (bool allow) |
| Specifies whether a transferDataIntoLeaves() operation will go into this frames children (including any attached bodies) and concatenating transformations. More... | |
| void | setEntityData (agxData::AttributePtr< agx::AffineMatrix4x4 > localTransform, agxData::AttributePtr< agx::AffineMatrix4x4 > globalTransform) |
| Assign entity data. More... | |
| void | setLocalMatrix (const agx::AffineMatrix4x4 &matrix) |
| Assign the local transformation matrix for this frame ignoring any eventual parent transformation. More... | |
| void | setLocalRotate (const agx::Quat &rotation) |
| Assign the parent relative rotation of this frame. More... | |
| void | setLocalRotate (const agx::EulerAngles &rotation) |
| Assign the parent relative rotation of this frame. More... | |
| void | setLocalTranslate (const agx::Vec3 &translate) |
| Assign the parent relative translate of this frame. More... | |
| void | setLocalTranslate (agx::Real x, agx::Real y, agx::Real z) |
| Assign the parent relative translate of this frame. More... | |
| void | setMatrix (const agx::AffineMatrix4x4 &matrix) |
This method will set the local matrix of this frame to be the matrix m multiplied with the inverse of the parents matrix: M = m * inv(parent) I.e., assign the final (world) transform of this frame. More... | |
| void | setMatrixPointers (const agxData::AttributePtr< agx::AffineMatrix4x4 > &localTransform, const agxData::AttributePtr< agx::AffineMatrix4x4 > &globalTransform) |
| Internal method. More... | |
| bool | setParent (agx::Frame *frame) |
| Set the parent of this Frame. More... | |
| void | setRotate (const agx::Quat &rotation) |
| Assign the final (world) rotation of this frame. More... | |
| void | setRotate (const agx::OrthoMatrix3x3 &rotation) |
| Assign the final (world) rotation of this frame. More... | |
| void | setRotate (const agx::EulerAngles &euler) |
| Assign the final (world) rotation of this frame. More... | |
| void | setTranslate (const agx::Vec3 &translate) |
| Assign the final (world) translate of this frame. More... | |
| void | setTranslate (agx::Real x, agx::Real y, agx::Real z) |
| Assign the final (world) translate of this frame. More... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
| void | transferChildren (agx::Frame *newParent) |
Move all the frame children of this frame to the new parent while retaining the original global transformation. More... | |
| void | transferDataIntoLeaves (bool keepLocalVelocity=true, bool clearTransform=true) |
| This method takes the transformation stored in this frame, and concatenates it to all of its children. More... | |
| agx::Vec3 | transformPointToLocal (const agx::Vec3 &pointWorld) const |
| Transform point from the world coordinate frame to this frame. More... | |
| agx::Vec3 | transformPointToLocal (agx::Real px, agx::Real py, agx::Real pz) const |
| Transform point from the world coordinate frame to this frame. More... | |
| agx::Vec3 & | transformPointToLocal (const agx::Vec3 &pointWorld, agx::Vec3 &pointLocal) const |
| Transform point from the world coordinate frame to this frame. More... | |
| agx::Vec3 | transformPointToWorld (const agx::Vec3 &pointLocal) const |
| Transform point from this frame to the world frame. More... | |
| agx::Vec3 | transformPointToWorld (agx::Real px, agx::Real py, agx::Real pz) const |
| Transform point from this frame to the world frame. More... | |
| agx::Vec3 & | transformPointToWorld (const agx::Vec3 &localPoint, agx::Vec3 &worldPoint) const |
| Transform point from this frame to the world frame. More... | |
| agx::Vec3 | transformVectorToLocal (const agx::Vec3 &worldVector) const |
| Transform vector from the world coordinate frame to this frame. More... | |
| agx::Vec3 | transformVectorToLocal (agx::Real vx, agx::Real vy, agx::Real vz) const |
| Transform vector from the world coordinate frame to this frame. More... | |
| agx::Vec3 & | transformVectorToLocal (const agx::Vec3 &vectorWorld, agx::Vec3 &vectorLocal) const |
| Transform vector from the world coordinate frame to this frame. More... | |
| agx::Vec3 | transformVectorToWorld (const agx::Vec3 &vectorLocal) const |
| Transform vector from this frame to the world frame. More... | |
| agx::Vec3 | transformVectorToWorld (agx::Real vx, agx::Real vy, agx::Real vz) const |
| Transform vector from this frame to the world frame. More... | |
| agx::Vec3 & | transformVectorToWorld (const agx::Vec3 &localVector, agx::Vec3 &worldVector) const |
| Transform vector from this frame to the world frame. More... | |
| void | updateLocalMatrix () |
| Internal method. More... | |
| void | updateLocalMatrixSSE () |
| Internal method. More... | |
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 agxStream::Serializable * | create () |
| static agxStream::Serializable * | create (agxStream::InputArchive &) |
| static const char * | getConstructClassId () |
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 | ~Frame () |
| Protected destructor - reference counted object. 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 |
The object defining a frame of reference and providing transformations operations.
A frame can have a parent. If so, localToWorld transformation is the concatenation of this frames transformation with the parents.
A frame can convert vectors and points into its parents coordinate system.
A frame of reference can be kinematic in which case the velocity and angular velocities are important objects.
A frame can internally be set to static, which means that getVelocity will always return zero.
| agx::Frame::Frame | ( | ) |
Default constructor.
| agx::Frame::Frame | ( | const agxData::AttributePtr< AffineMatrix4x4 > & | localTransform, |
| const agxData::AttributePtr< AffineMatrix4x4 > & | globalTransform | ||
| ) |
Frame with existing matrix storage.
|
explicit |
Instantiate a frame with relative transformation matrix.
| matrix | - transformation matrix that will be this frame's local matrix |
| agx::Frame::Frame | ( | const agx::Frame & | frame | ) |
Copy constructor.
| frame | - other frame |
|
protectedvirtual |
Protected destructor - reference counted object.
| bool agx::Frame::allowTransferDataIntoChildren | ( | ) | const |
|
inlinestatic |
|
inlinestatic |
|
inlineoverridevirtual |
Reimplemented from agxStream::Serializable.
|
inlinestatic |
| const AffineMatrix4x4 & agx::Frame::getLocalMatrix | ( | ) | const |
Definition at line 521 of file Frame.h.
References agx::Matrix4x4T< T >::get().
| Quat agx::Frame::getLocalRotate | ( | ) | const |
| Vec3 agx::Frame::getLocalTranslate | ( | ) | const |
| const agx::AffineMatrix4x4& agx::Frame::getMatrix | ( | ) | const |
Referenced by setMatrix().
| Frame * agx::Frame::getParent | ( | ) |
| const Frame * agx::Frame::getParent | ( | ) | const |
| agx::RigidBody * agx::Frame::getRigidBody | ( | ) |
| const agx::RigidBody * agx::Frame::getRigidBody | ( | ) | const |
| agx::Quat agx::Frame::getRotate | ( | ) | const |
|
inlineoverridevirtual |
Implements agxStream::Serializable.
| Vec3 agx::Frame::getTranslate | ( | ) | const |
| bool agx::Frame::hasChildren | ( | ) | const |
| bool agx::Frame::hasParent | ( | ) | const |
| bool agx::Frame::isFinite | ( | ) | const |
| Frame& agx::Frame::operator= | ( | const agx::Frame & | frame | ) |
Assignment operator.
| frame | - other frame |
| void agx::Frame::removeAllChildren | ( | ) |
| bool agx::Frame::removeChild | ( | agx::Frame * | frame | ) |
|
overridevirtual |
| void agx::Frame::setAllowTransferIntoChildren | ( | bool | allow | ) |
Specifies whether a transferDataIntoLeaves() operation will go into this frames children (including any attached bodies) and concatenating transformations.
Frames are usually setup in a hierarchy, a root->transferDataIntoLeaves() will take the transformation from the root concatenate transformation on the way down to the leave, where the transformation will be stored, in a body, or a leaf frame. If you call child->setAllowTransferDataIntoChildren( false ); the concatenated transformation will stop at the child, leaving its children untouched.
| allow | - true if transfer is allowed |
| void agx::Frame::setEntityData | ( | agxData::AttributePtr< agx::AffineMatrix4x4 > | localTransform, |
| agxData::AttributePtr< agx::AffineMatrix4x4 > | globalTransform | ||
| ) |
Assign entity data.
| void agx::Frame::setLocalMatrix | ( | const agx::AffineMatrix4x4 & | matrix | ) |
Assign the local transformation matrix for this frame ignoring any eventual parent transformation.
| matrix | - relative to parent transform for this frame |
Definition at line 526 of file Frame.h.
Referenced by agxSDK::LinkedSegment::getLinkedStructure().
| void agx::Frame::setLocalRotate | ( | const agx::Quat & | rotation | ) |
Assign the parent relative rotation of this frame.
| rotation | - parent relative rotation |
| void agx::Frame::setLocalRotate | ( | const agx::EulerAngles & | rotation | ) |
Assign the parent relative rotation of this frame.
| rotation | - parent relative rotation |
| void agx::Frame::setLocalTranslate | ( | const agx::Vec3 & | translate | ) |
| void agx::Frame::setMatrix | ( | const agx::AffineMatrix4x4 & | matrix | ) |
This method will set the local matrix of this frame to be the matrix m multiplied with the inverse of the parents matrix: M = m * inv(parent) I.e., assign the final (world) transform of this frame.
| matrix | - final transform for this frame (leads to local transform = matrix * inv(parent)) |
Definition at line 490 of file Frame.h.
References getMatrix(), and agx::AffineMatrix4x4T< T >::inverse().
| void agx::Frame::setMatrixPointers | ( | const agxData::AttributePtr< agx::AffineMatrix4x4 > & | localTransform, |
| const agxData::AttributePtr< agx::AffineMatrix4x4 > & | globalTransform | ||
| ) |
Internal method.
Assign transforms to this frame with existing matrix storage.
| bool agx::Frame::setParent | ( | agx::Frame * | frame | ) |
Set the parent of this Frame.
This means that getTranslate, getRotate, getTransform will be given in the parents coordinate frame. I.e., this frame's transformation will be concatenated with the parents.
| frame | - new parent frame, 0 to remove parent |
| void agx::Frame::setRotate | ( | const agx::Quat & | rotation | ) |
Assign the final (world) rotation of this frame.
| rotation | - final (world) rotate |
| void agx::Frame::setRotate | ( | const agx::OrthoMatrix3x3 & | rotation | ) |
Assign the final (world) rotation of this frame.
| rotation | - final (world) rotate |
| void agx::Frame::setRotate | ( | const agx::EulerAngles & | euler | ) |
Assign the final (world) rotation of this frame.
| euler | - final (world) rotate |
| void agx::Frame::setTranslate | ( | const agx::Vec3 & | translate | ) |
|
overridevirtual |
| void agx::Frame::transferChildren | ( | agx::Frame * | newParent | ) |
Move all the frame children of this frame to the new parent while retaining the original global transformation.
That is, the matrix (getMatrix()) of all children will be the same after the move. Can Throw exception if newFrame is child of this frame, because we cannot have frames being parents to them self.
| newParent | - parent frame |
| void agx::Frame::transferDataIntoLeaves | ( | bool | keepLocalVelocity = true, |
| bool | clearTransform = true |
||
| ) |
This method takes the transformation stored in this frame, and concatenates it to all of its children.
The transform for all frames between this and the leaf will be set to identity. So you can safely call transferDataIntoLeaves on a parent frame to a rigid body, and then remove the rigid body as a child of this frame. The transformation of the rigid body will be the same.
The local velocity of bodies will be retained. So If you have a body moving along positive Y, add parent frame which rotates 90deg negative around Y, the body keep moving along positive Y (in World coordinates). But if you call parent->transferDataIntoLeaves( true ) the body will keep its local velocity, which means that it will start moving along positive X.
| keepLocalVelocity | - if true, any bodies (which are leaves) will keep their local velocity (velocity will be transformed). If not, they will keep their current velocity (in world coordinates), i.e., velocities will NOT be transformed. |
| clearTransform | - If true, then the transformation of this local frame will be set to identity at the end of this method. Otherwise this has to be done explicitly. |
Transform point from the world coordinate frame to this frame.
| pointWorld | - point to transform, given in the world coordinate frame |
Definition at line 626 of file Frame.h.
Referenced by agxModel::NodeAttachment::createFromWorld(), and agxCable::SegmentAttachment::createFromWorld().
Transform point from the world coordinate frame to this frame.
| px | - x-component to transform, given in the world coordinate frame |
| py | - y-component to transform, given in the world coordinate frame |
| pz | - z-component to transform, given in the world coordinate frame |
| Vec3 & agx::Frame::transformPointToLocal | ( | const agx::Vec3 & | pointWorld, |
| agx::Vec3 & | pointLocal | ||
| ) | const |
Transform point from the world coordinate frame to this frame.
| pointWorld | - point to transform, given in the world coordinate frame |
| pointLocal | - transformed point given in this frame |
Definition at line 637 of file Frame.h.
References agx::AffineMatrix4x4T< T >::inverse(), and agx::AffineMatrix4x4T< T >::preMult().
Transform point from this frame to the world frame.
| pointLocal | - point to transform, given in this frame |
Definition at line 587 of file Frame.h.
References agxWire::transformPointToWorld().
Transform point from this frame to the world frame.
| px | - x-component to transform, given in this frame |
| py | - y-component to transform, given in this frame |
| pz | - z-component to transform, given in this frame |
Definition at line 593 of file Frame.h.
References agxWire::transformPointToWorld().
| Vec3 & agx::Frame::transformPointToWorld | ( | const agx::Vec3 & | localPoint, |
| agx::Vec3 & | worldPoint | ||
| ) | const |
Transform point from this frame to the world frame.
| localPoint | - point to transform, given in this frame |
| worldPoint | - the transformed point given in the world coordinate frame |
worldPoint point Definition at line 598 of file Frame.h.
References agx::AffineMatrix4x4T< T >::preMult().
Transform vector from the world coordinate frame to this frame.
| vx | - x-component to transform, given in the world coordinate world frame |
| vy | - y-component to transform, given in the world coordinate world frame |
| vz | - z-component to transform, given in the world coordinate world frame |
| Vec3 & agx::Frame::transformVectorToLocal | ( | const agx::Vec3 & | vectorWorld, |
| agx::Vec3 & | vectorLocal | ||
| ) | const |
Transform vector from the world coordinate frame to this frame.
| vectorWorld | - vector to transform, given in the world coordinate frame |
| vectorLocal | - transformed vector given in this frame |
Definition at line 617 of file Frame.h.
References agx::AffineMatrix4x4T< T >::postMult(), and agx::AffineMatrix4x4T< T >::setTranslate().
Transform vector from this frame to the world frame.
| vectorLocal | - vector to transform, given in this frame |
Definition at line 568 of file Frame.h.
References agxWire::transformVectorToWorld().
Transform vector from this frame to the world frame.
| vx | - x-component to transform, given in this frame |
| vy | - y-component to transform, given in this frame |
| vz | - z-component to transform, given in this frame |
Definition at line 574 of file Frame.h.
References agxWire::transformVectorToWorld().
| Vec3 & agx::Frame::transformVectorToWorld | ( | const agx::Vec3 & | localVector, |
| agx::Vec3 & | worldVector | ||
| ) | const |
Transform vector from this frame to the world frame.
| localVector | - vector to transform, given in this frame |
| worldVector | - the transformed vector given in the world coordinate frame |
worldVector vector Definition at line 579 of file Frame.h.
References agx::Matrix4x4T< T >::transform3x3().
| void agx::Frame::updateLocalMatrix | ( | ) |
| void agx::Frame::updateLocalMatrixSSE | ( | ) |
Internal method.
Performs the same operation as updateLocalMatrix but will use SSE implementation instead. It is important that the data is aligned correctly and it is the callers responsibility to know if this method can be used.
If in doubt, pick updateLocalMatrix instead.