#include <Transform.h>
Define a frame (child) with respect to another (parent). A frame represents a local coordinate system.
Internal data represents the orientation of the child wrt the parent, BUT the translation vector represents the origin of the parent with respect to the child. For example, the coordinates M_p of point M in parent given the coordinates M_c of the same point in child are given by: M_p = orientation * ( M_c - origin ). This is due to Featherstone's conventions. Use method setTranslationRotation( const Vec& t, const Rot& q ) to model the Transform the standard way (i.e. translation given in the parent frame).
Protected Attributes | |
Rot | orientation_ |
child wrt parent More... | |
Vec | origin_ |
parent wrt child More... | |
Public Member Functions | |
Transform () | |
The default constructor does not initialize the transform. More... | |
Transform (const Vec &origin, const Rot &orientation) | |
Origin of the child in parent coordinates, orientation of the child wrt to parent. More... | |
Transform (const Rot &q, const Vec &o) | |
WARNING: using Featherstone's conventions (see class documentation) More... | |
void | set (const Vec &t, const Rot &q) |
Origin of the child in the parent coordinate system and the orientation of the child wrt the parent (i.e. standard way) More... | |
void | clear () |
Reset this to identity. More... | |
Transform (const SpatialVector< TReal > &v) | |
Origin of the child in the parent coordinate system and the orientation of the child wrt the parent (i.e. standard way) More... | |
Transform | inversed () const |
The inverse transform i.e. parent wrt child. More... | |
const Vec & | getOriginOfParentInChild () const |
Parent origin in child coordinates (the way it is actually stored internally) More... | |
Vec | getOrigin () const |
Origin of child in parent coordinates. More... | |
void | setOrigin (const Vec &) |
Origin of child in parent coordinates. More... | |
const Rot & | getOrientation () const |
Orientation of the child coordinate axes wrt the parent coordinate axes. More... | |
void | setOrientation (const Rot &) |
Orientation of the child coordinate axes wrt the parent coordinate axes. More... | |
Mat3x3 | getRotationMatrix () const |
Matrix which projects vectors from child coordinates to parent coordinates. The columns of the matrix are the axes of the child base axes in the parent coordinate system. More... | |
Mat6x6 | getAdjointMatrix () const |
Adjoint matrix to the transform This matrix transports velocities in twist coordinates from the child frame to the parent frame. Its inverse transpose does the same for the wrenches. More... | |
Vec | projectVector (const Vec &vectorInChild) const |
Project a vector (i.e. a direction or a displacement) from child coordinates to parent coordinates. More... | |
Vec | projectPoint (const Vec &pointInChild) const |
Project a point from child coordinates to parent coordinates. More... | |
Vec | backProjectVector (const Vec &vectorInParent) const |
Projected a vector (i.e. a direction or a displacement) from parent coordinates to child coordinates. More... | |
Vec | backProjectPoint (const Vec &pointInParent) const |
Project point from parent coordinates to this coordinates. More... | |
Transform | operator* (const Transform &f2) const |
Combine two transforms. If (*this) locates frame B (child) wrt frame A (parent) and if f2 locates frame C (child) wrt frame B (parent) then the result locates frame C wrt to Frame A. More... | |
Transform & | operator*= (const Transform &f2) |
Combine two transforms. If (*this) locates frame B (child) wrt frame A (parent) and if f2 locates frame C (child) wrt frame B (parent) then the result locates frame C wrt to Frame A. More... | |
SpatialVector< TReal > | CreateSpatialVector () |
SpatialVector< TReal > | DTrans () |
SpatialVector< TReal > | operator* (const SpatialVector< TReal > &sv) const |
SpatialVector< TReal > | operator/ (const SpatialVector< TReal > &sv) const |
Project a spatial vector from parent to child (the inverse of operator *). This method computes (*this).inversed()*sv without inverting (*this). More... | |
void | writeOpenGlMatrix (double *m) const |
Write an OpenGL matrix encoding the transformation of the coordinate system of the child wrt the coordinate system of the parent. More... | |
void | printInternal (std::ostream &) const |
Print the internal values (i.e. using Featherstone's conventions, see class documentation) More... | |
Time integration | |
Methods used in time integration | |
Transform & | operator+= (const SpatialVector< TReal > &a) |
Transform & | operator+= (const Transform &a) |
template<class Real2 > | |
Transform & | operator*= (Real2 a) |
template<class Real2 > | |
Transform | operator* (Real2 a) const |
Static Public Member Functions | |
static Transform | identity () |
The identity transform (child = parent) More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Transform &t) |
std::istream & | operator>> (std::istream &in, Transform &t) |
read from an input stream More... | |
|
protected |
child wrt parent
|
protected |
parent wrt child
sofa::type::Transform< TReal >::Transform |
The default constructor does not initialize the transform.
sofa::type::Transform< TReal >::Transform | ( | const Vec & | origin, |
const Rot & | orientation | ||
) |
Origin of the child in parent coordinates, orientation of the child wrt to parent.
Define using standard conventions.
sofa::type::Transform< TReal >::Transform | ( | const Rot & | q, |
const Vec & | o | ||
) |
WARNING: using Featherstone's conventions (see class documentation)
Define using Featherstone's conventions.
sofa::type::Transform< TReal >::Transform | ( | const SpatialVector< TReal > & | v | ) |
Origin of the child in the parent coordinate system and the orientation of the child wrt the parent (i.e. standard way)
Define as a given SpatialVector integrated during one second. The spatial vector is given in parent coordinates.
Define child as a given SpatialVector<TReal> integrated during one second, starting from the parent (used for time integration). The spatial vector is given in parent coordinates.
auto sofa::type::Transform< TReal >::backProjectPoint | ( | const Vec & | pointInParent | ) | const |
Project point from parent coordinates to this coordinates.
auto sofa::type::Transform< TReal >::backProjectVector | ( | const Vec & | vectorInParent | ) | const |
Projected a vector (i.e. a direction or a displacement) from parent coordinates to child coordinates.
void sofa::type::Transform< TReal >::clear |
Reset this to identity.
SpatialVector< TReal > sofa::type::Transform< TReal >::CreateSpatialVector |
Project a spatial vector from child to parent TODO One should handle differently the transformation of a twist and a wrench ! This applying the adjoint to velocities or its transpose to wrench : V_parent = Ad . V_child or W_child = Ad^T . W_parent To project a wrench in the child frame to the parent frame you need to do parent_wrench = this->inversed * child_wrench (this doc needs to be douv-ble checked !)
SpatialVector< TReal > sofa::type::Transform< TReal >::DTrans |
auto sofa::type::Transform< TReal >::getAdjointMatrix |
Adjoint matrix to the transform This matrix transports velocities in twist coordinates from the child frame to the parent frame. Its inverse transpose does the same for the wrenches.
const Transform< TReal >::Rot & sofa::type::Transform< TReal >::getOrientation |
Orientation of the child coordinate axes wrt the parent coordinate axes.
Transform< TReal >::Vec sofa::type::Transform< TReal >::getOrigin |
Origin of child in parent coordinates.
const Transform< TReal >::Vec & sofa::type::Transform< TReal >::getOriginOfParentInChild |
Parent origin in child coordinates (the way it is actually stored internally)
auto sofa::type::Transform< TReal >::getRotationMatrix |
Matrix which projects vectors from child coordinates to parent coordinates. The columns of the matrix are the axes of the child base axes in the parent coordinate system.
|
static |
The identity transform (child = parent)
Define given the origin of the child wrt the parent and the orientation of the child wrt the parent (i.e. standard way)
Transform< TReal > sofa::type::Transform< TReal >::inversed |
The inverse transform i.e. parent wrt child.
SpatialVector< TReal > sofa::type::Transform< TReal >::operator* | ( | const SpatialVector< TReal > & | sv | ) | const |
Transform< TReal > sofa::type::Transform< TReal >::operator* | ( | const Transform< TReal > & | f2 | ) | const |
Combine two transforms. If (*this) locates frame B (child) wrt frame A (parent) and if f2 locates frame C (child) wrt frame B (parent) then the result locates frame C wrt to Frame A.
|
inline |
Transform< TReal > & sofa::type::Transform< TReal >::operator*= | ( | const Transform< TReal > & | f2 | ) |
Combine two transforms. If (*this) locates frame B (child) wrt frame A (parent) and if f2 locates frame C (child) wrt frame B (parent) then the result locates frame C wrt to Frame A.
|
inline |
Transform< TReal > & sofa::type::Transform< TReal >::operator+= | ( | const SpatialVector< TReal > & | a | ) |
(this) *= Transform(v) Used for time integration. SHOULD WE RATHER APPLY (*this)=Transform(v)(*this) ???
Transform< TReal > & sofa::type::Transform< TReal >::operator+= | ( | const Transform< TReal > & | a | ) |
SpatialVector< TReal > sofa::type::Transform< TReal >::operator/ | ( | const SpatialVector< TReal > & | sv | ) | const |
Project a spatial vector from parent to child (the inverse of operator *). This method computes (*this).inversed()*sv without inverting (*this).
void sofa::type::Transform< TReal >::printInternal | ( | std::ostream & | out | ) | const |
Print the internal values (i.e. using Featherstone's conventions, see class documentation)
auto sofa::type::Transform< TReal >::projectPoint | ( | const Vec & | pointInChild | ) | const |
Project a point from child coordinates to parent coordinates.
Transform< TReal >::Vec sofa::type::Transform< TReal >::projectVector | ( | const Vec & | vectorInChild | ) | const |
Project a vector (i.e. a direction or a displacement) from child coordinates to parent coordinates.
void sofa::type::Transform< TReal >::set | ( | const Vec & | t, |
const Rot & | q | ||
) |
Origin of the child in the parent coordinate system and the orientation of the child wrt the parent (i.e. standard way)
Define given the origin of the child wrt the parent and the orientation of the child wrt the parent (i.e. standard way)
void sofa::type::Transform< TReal >::setOrientation | ( | const Rot & | q | ) |
Orientation of the child coordinate axes wrt the parent coordinate axes.
void sofa::type::Transform< TReal >::setOrigin | ( | const Vec & | op | ) |
Origin of child in parent coordinates.
void sofa::type::Transform< TReal >::writeOpenGlMatrix | ( | double * | m | ) | const |
Write an OpenGL matrix encoding the transformation of the coordinate system of the child wrt the coordinate system of the parent.
|
friend |
Draw the axes of the child coordinate system in the parent coordinate system Print the origin of the child in the parent coordinate system and the quaternion defining the orientation of the child wrt the parent
|
friend |
read from an input stream