|
AGX Dynamics
2.37.3.2
|
With this class you can attach an ObserverFrame object relative to a RigidBody. More...
#include <ObserverFrame.h>
Inheritance diagram for agx::ObserverFrame:Public Member Functions | |
| ObserverFrame (const agx::Name &name="", agx::RigidBody *rb=nullptr, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4()) | |
| Construct given name. More... | |
| ObserverFrame (agx::RigidBody *rb, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4()) | |
| Construct without name. More... | |
| void | attach (agx::RigidBody *rb, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4()) |
| Attach the ObserverFrame to a rigid body. More... | |
| void | attachWithWorldTransform (agx::RigidBody *rb, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4()) |
| Attach the ObserverFrame to a rigid body. More... | |
| void | detach () |
| Detach the current rigid body, setting the current rigid body to the world and the frame to identity. More... | |
| agx::Vec3 | getAcceleration () const |
| Get the acceleration of the ObserverFrame in the world. More... | |
| agx::Vec3 | getAngularAcceleration () const |
| Get the angular acceleration of the ObserverFrame in the world. More... | |
| agx::Vec3 | getAngularVelocity () const |
| Get the angular velocity of the ObserverFrame in the world. More... | |
| agx::RigidBody * | getAttachment () const |
| const char * | getClassName () const override |
| bool | getEnable () const |
| Access the state enable flag. More... | |
| agx::Frame * | getFrame () |
| Returns the model frame containing model the transformation and utilities to manipulate position, rotation etc. More... | |
| const agx::Frame * | getFrame () const |
| Returns the model frame containing model the transformation and utilities to manipulate position, rotation etc. More... | |
| agx::Vec3 | getLocalPosition () const |
| agx::Quat | getLocalRotation () const |
| const agx::AffineMatrix4x4 & | getLocalTransform () const |
| agx::Name | getName () const |
| agx::Frame * | getParentFrame () |
| const agx::Frame * | getParentFrame () const |
| agx::Vec3 | getPosition () const |
| Current model frame position, given in world coordinate frame. More... | |
| agx::Vec3 | getRelativeAcceleration (const agx::RigidBody *rb) const |
| Get the relative acceleration of a rigid body and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeAcceleration (const agx::ObserverFrame *obs) const |
| Get the relative acceleration of an observer frame and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeAngularAcceleration (const agx::RigidBody *rb) const |
| Get the relative angular acceleration of a rigid body and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeAngularAcceleration (const agx::ObserverFrame *obs) const |
| Get the relative angular acceleration of an observer frame and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeAngularVelocity (const agx::RigidBody *rb) const |
| Get the relative angular velocity of a rigid body and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeAngularVelocity (const agx::ObserverFrame *obs) const |
| Get the relative angular velocity of an observer frame and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativePosition (const agx::ObserverFrame *obs) const |
| Get the relative position (distance) of an observer frame and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativePosition (const agx::RigidBody *body) const |
| Get the relative position (distance) of an observer frame and the RigidBody in the world. More... | |
| agx::Vec3 | getRelativeVelocity (const agx::RigidBody *rb) const |
| Get the relative velocity of a rigid body and the ObserverFrame in the world. More... | |
| agx::Vec3 | getRelativeVelocity (const agx::ObserverFrame *obs) const |
| Get the relative velocity of an observer frame and the ObserverFrame in the world. More... | |
| const agx::RigidBody * | getRigidBody () const |
| agx::RigidBody * | getRigidBody () |
| agx::Quat | getRotation () const |
| Current model frame rotation, given in world coordinate frame. More... | |
| agxStream::StorageAgent * | getStorageAgent () const override |
| agx::DynamicsSystem * | getSystem () |
| const agx::DynamicsSystem * | getSystem () const |
| agx::Vec3 | getVelocity () const |
| Get the velocity of the ObserverFrame in the world. More... | |
| bool | isEnabled () const |
| Access the state enable flag. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| bool | setCmAndInertiaInObserver (agx::RigidBody *rb, const agx::SPDMatrix3x3 &inertia) |
| Set the specified inertia in the frame of the observer on the rigid body. More... | |
| void | setEnable (bool enable) |
| Change state enable of this observer frame. More... | |
| void | setLocalPosition (const agx::Vec3 &p) |
| Assign the parent relative translate of this frame. More... | |
| void | setLocalPosition (agx::Real x, agx::Real y, agx::Real z) |
| Assign the parent relative translate of this frame. More... | |
| void | setLocalRotation (const agx::Quat &q) |
| Assign the parent relative rotation of this frame. More... | |
| void | setLocalRotation (const agx::EulerAngles &e) |
| Assign the parent relative rotation of this frame. More... | |
| void | setLocalTransform (const agx::AffineMatrix4x4 &matrix) |
| Assign the local transformation matrix for this frame ignoring any eventual parent transformation. More... | |
| void | setName (const agx::Name &name) |
| Assign new name to this observer frame. More... | |
| bool | setParentFrame (agx::Frame *frame) |
| Set the parent Frame of this ObserverFrame. More... | |
| void | setPosition (const agx::Vec3 &p) |
| Assign the final (world) translate of this frame. More... | |
| void | setPosition (agx::Real x, agx::Real y, agx::Real z) |
| Assign the final (world) translate of this frame. More... | |
| void | setRotation (const agx::Quat &q) |
| Set the rotation of the frame relative to world frame. More... | |
| void | setRotation (const agx::EulerAngles &e) |
| Set the rotation of the frame relative to world frame. More... | |
| void | setRotation (const agx::OrthoMatrix3x3 &m) |
| Set the rotation of the frame relative to world frame. More... | |
| void | setTransform (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... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
| agx::Vec3 | transformPointToLocal (const agx::Vec3 &pointWorld) const |
| agx::Vec3 | transformPointToWorld (const agx::Vec3 &pointLocal) const |
| agx::Vec3 | transformVectorToLocal (const agx::Vec3 &vectorWorld) const |
| agx::Vec3 | transformVectorToWorld (const agx::Vec3 &vectorLocal) const |
| Wrapper functions for Frame. 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 | ~ObserverFrame () |
| void | setSystem (agx::DynamicsSystem *system) |
| Assign dynamics system which this body belongs to. 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 |
With this class you can attach an ObserverFrame object relative to a RigidBody.
It allows for queering position/rotation/velocity in a coordinate system that is local to this ObserverFrame.
Definition at line 43 of file ObserverFrame.h.
| agx::ObserverFrame::ObserverFrame | ( | const agx::Name & | name = "", |
| agx::RigidBody * | rb = nullptr, |
||
| const agx::AffineMatrix4x4 & | transform = agx::AffineMatrix4x4() |
||
| ) |
Construct given name.
Default: rigid body = nullptr/world, transform = identity
| name | - name of this observer frame (default: "") |
| rb | - the rigid body to attach to, by default world |
| transform | - the frame of reference of the ObserverFrame |
| agx::ObserverFrame::ObserverFrame | ( | agx::RigidBody * | rb, |
| const agx::AffineMatrix4x4 & | transform = agx::AffineMatrix4x4() |
||
| ) |
Construct without name.
Default: transform = identity
| rb | - the rigid body to attach to, null if world |
| transform | - the frame of reference of the ObserverFrame |
|
protectedvirtual |
| void agx::ObserverFrame::attach | ( | agx::RigidBody * | rb, |
| const agx::AffineMatrix4x4 & | transform = agx::AffineMatrix4x4() |
||
| ) |
Attach the ObserverFrame to a rigid body.
This will remove previous attachments.
| void agx::ObserverFrame::attachWithWorldTransform | ( | agx::RigidBody * | rb, |
| const agx::AffineMatrix4x4 & | transform = agx::AffineMatrix4x4() |
||
| ) |
Attach the ObserverFrame to a rigid body.
This will remove previous attachments.
|
inlinestatic |
Definition at line 357 of file ObserverFrame.h.
|
inlinestatic |
Definition at line 357 of file ObserverFrame.h.
| void agx::ObserverFrame::detach | ( | ) |
Detach the current rigid body, setting the current rigid body to the world and the frame to identity.
| agx::Vec3 agx::ObserverFrame::getAcceleration | ( | ) | const |
Get the acceleration of the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getAngularAcceleration | ( | ) | const |
Get the angular acceleration of the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getAngularVelocity | ( | ) | const |
Get the angular velocity of the ObserverFrame in the world.
| agx::RigidBody* agx::ObserverFrame::getAttachment | ( | ) | const |
|
inlineoverridevirtual |
Reimplemented from agxStream::Serializable.
Definition at line 357 of file ObserverFrame.h.
|
inlinestatic |
Definition at line 357 of file ObserverFrame.h.
| bool agx::ObserverFrame::getEnable | ( | ) | const |
Access the state enable flag.
Definition at line 382 of file ObserverFrame.h.
| Frame * agx::ObserverFrame::getFrame | ( | ) |
Returns the model frame containing model the transformation and utilities to manipulate position, rotation etc.
Definition at line 392 of file ObserverFrame.h.
| const Frame * agx::ObserverFrame::getFrame | ( | ) | const |
Returns the model frame containing model the transformation and utilities to manipulate position, rotation etc.
Definition at line 397 of file ObserverFrame.h.
| agx::Vec3 agx::ObserverFrame::getLocalPosition | ( | ) | const |
| agx::Quat agx::ObserverFrame::getLocalRotation | ( | ) | const |
| const agx::AffineMatrix4x4& agx::ObserverFrame::getLocalTransform | ( | ) | const |
| agx::Name agx::ObserverFrame::getName | ( | ) | const |
| agx::Frame* agx::ObserverFrame::getParentFrame | ( | ) |
| const agx::Frame* agx::ObserverFrame::getParentFrame | ( | ) | const |
| agx::Vec3 agx::ObserverFrame::getPosition | ( | ) | const |
Current model frame position, given in world coordinate frame.
| agx::Vec3 agx::ObserverFrame::getRelativeAcceleration | ( | const agx::RigidBody * | rb | ) | const |
Get the relative acceleration of a rigid body and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeAcceleration | ( | const agx::ObserverFrame * | obs | ) | const |
Get the relative acceleration of an observer frame and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeAngularAcceleration | ( | const agx::RigidBody * | rb | ) | const |
Get the relative angular acceleration of a rigid body and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeAngularAcceleration | ( | const agx::ObserverFrame * | obs | ) | const |
Get the relative angular acceleration of an observer frame and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeAngularVelocity | ( | const agx::RigidBody * | rb | ) | const |
Get the relative angular velocity of a rigid body and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeAngularVelocity | ( | const agx::ObserverFrame * | obs | ) | const |
Get the relative angular velocity of an observer frame and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativePosition | ( | const agx::ObserverFrame * | obs | ) | const |
Get the relative position (distance) of an observer frame and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativePosition | ( | const agx::RigidBody * | body | ) | const |
Get the relative position (distance) of an observer frame and the RigidBody in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeVelocity | ( | const agx::RigidBody * | rb | ) | const |
Get the relative velocity of a rigid body and the ObserverFrame in the world.
| agx::Vec3 agx::ObserverFrame::getRelativeVelocity | ( | const agx::ObserverFrame * | obs | ) | const |
Get the relative velocity of an observer frame and the ObserverFrame in the world.
|
inline |
Definition at line 402 of file ObserverFrame.h.
|
inline |
Definition at line 407 of file ObserverFrame.h.
| agx::Quat agx::ObserverFrame::getRotation | ( | ) | const |
Current model frame rotation, given in world coordinate frame.
|
inlineoverridevirtual |
Implements agxStream::Serializable.
Definition at line 357 of file ObserverFrame.h.
| agx::DynamicsSystem* agx::ObserverFrame::getSystem | ( | ) |
| const agx::DynamicsSystem* agx::ObserverFrame::getSystem | ( | ) | const |
| agx::Vec3 agx::ObserverFrame::getVelocity | ( | ) | const |
Get the velocity of the ObserverFrame in the world.
| bool agx::ObserverFrame::isEnabled | ( | ) | const |
Access the state enable flag.
Definition at line 387 of file ObserverFrame.h.
|
overridevirtual |
| bool agx::ObserverFrame::setCmAndInertiaInObserver | ( | agx::RigidBody * | rb, |
| const agx::SPDMatrix3x3 & | inertia | ||
| ) |
Set the specified inertia in the frame of the observer on the rigid body.
Also set the center of mass to the origin of the observer
| rb | The rigid body to change the inertia on |
| inertia | The inertia in the frame of the observer |
| void agx::ObserverFrame::setEnable | ( | bool | enable | ) |
Change state enable of this observer frame.
Default: true.
| enable | - true to enable, false to disable |
| void agx::ObserverFrame::setLocalPosition | ( | const agx::Vec3 & | p | ) |
Assign the parent relative translate of this frame.
| p | - parent relative translate |
Assign the parent relative translate of this frame.
| x | - parent relative x translate |
| y | - parent relative y translate |
| z | - parent relative z translate |
| void agx::ObserverFrame::setLocalRotation | ( | const agx::Quat & | q | ) |
Assign the parent relative rotation of this frame.
| q | - rotation given as a quaternion |
| void agx::ObserverFrame::setLocalRotation | ( | const agx::EulerAngles & | e | ) |
Assign the parent relative rotation of this frame.
| e | - rotation given as Euler angles |
| void agx::ObserverFrame::setLocalTransform | ( | 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 |
| void agx::ObserverFrame::setName | ( | const agx::Name & | name | ) |
Assign new name to this observer frame.
Default: ""
| bool agx::ObserverFrame::setParentFrame | ( | agx::Frame * | frame | ) |
Set the parent Frame of this ObserverFrame.
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::ObserverFrame::setPosition | ( | const agx::Vec3 & | p | ) |
Assign the final (world) translate of this frame.
| p | - final (world) translate of this frame |
Assign the final (world) translate of this frame.
| x | - final (world) x translate of this frame |
| y | - final (world) y translate of this frame |
| z | - final (world) z translate of this frame |
| void agx::ObserverFrame::setRotation | ( | const agx::Quat & | q | ) |
Set the rotation of the frame relative to world frame.
| q | - rotation given as a quaternion |
| void agx::ObserverFrame::setRotation | ( | const agx::EulerAngles & | e | ) |
Set the rotation of the frame relative to world frame.
| e | - rotation given as Euler angles |
| void agx::ObserverFrame::setRotation | ( | const agx::OrthoMatrix3x3 & | m | ) |
Set the rotation of the frame relative to world frame.
| m | - rotation given as an orthogonal transformation matrix |
|
protected |
Assign dynamics system which this body belongs to.
| system | - dynamics system which this body belongs to |
| void agx::ObserverFrame::setTransform | ( | 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)) |
|
overridevirtual |
Wrapper functions for Frame.