SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::defaulttype::SolidTypes< R >::Transform Class Reference

#include <SolidTypes.h>

Detailed Description

template<class R = float>
class sofa::defaulttype::SolidTypes< R >::Transform

Define a frame (child) whith 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 givne 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 &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 VecgetOriginOfParentInChild () 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 RotgetOrientation () 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...
 
Transformoperator*= (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 CreateSpatialVector ()
 
SpatialVector DTrans ()
 
SpatialVector operator* (const SpatialVector &sv) const
 
SpatialVector operator/ (const SpatialVector &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 (GLdouble *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

Transformoperator+= (const SpatialVector &a)
 
Transformoperator+= (const Transform &a)
 
template<class Real2 >
Transformoperator*= (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...
 

Attribute details

template<class R = float>
Rot sofa::defaulttype::SolidTypes< R >::Transform::orientation_
protected

child wrt parent

template<class R = float>
Vec sofa::defaulttype::SolidTypes< R >::Transform::origin_
protected

parent wrt child

Constructor details

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::Transform ( )

The default constructor does not initialize the transform.

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::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.

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::Transform ( const Rot q,
const Vec o 
)

WARNING: using Featherstone's conventions (see class documentation)

Define using Featherstone's conventions.

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::Transform ( const SpatialVector 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 integrated during one second, starting from the parent (used for time integration). The spatial vector is given in parent coordinates.

Function details

template<class R >
SolidTypes< R >::Vec sofa::defaulttype::SolidTypes< R >::Transform::backProjectPoint ( const Vec pointInParent) const

Project point from parent coordinates to this coordinates.

template<class R >
SolidTypes< R >::Vec sofa::defaulttype::SolidTypes< R >::Transform::backProjectVector ( const Vec vectorInParent) const

Projected a vector (i.e. a direction or a displacement) from parent coordinates to child coordinates.

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::clear ( )

Reset this to identity.

template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::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 !)

template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::DTrans ( )
template<class R >
SolidTypes< R >::Mat6x6 sofa::defaulttype::SolidTypes< R >::Transform::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.

template<class R >
const SolidTypes< R >::Rot & sofa::defaulttype::SolidTypes< R >::Transform::getOrientation ( ) const

Orientation of the child coordinate axes wrt the parent coordinate axes.

template<class R >
SolidTypes< R >::Vec sofa::defaulttype::SolidTypes< R >::Transform::getOrigin ( ) const

Origin of child in parent coordinates.

template<class R >
const SolidTypes< R >::Vec & sofa::defaulttype::SolidTypes< R >::Transform::getOriginOfParentInChild ( ) const

Parent origin in child coordinates (the way it is actually stored internally)

template<class R >
SolidTypes< R >::Mat3x3 sofa::defaulttype::SolidTypes< R >::Transform::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.

template<class R >
SolidTypes< R >::Transform sofa::defaulttype::SolidTypes< R >::Transform::identity ( )
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)

template<class R >
SolidTypes< R >::Transform sofa::defaulttype::SolidTypes< R >::Transform::inversed ( ) const

The inverse transform i.e. parent wrt child.

template<class R >
SolidTypes< R >::Transform sofa::defaulttype::SolidTypes< R >::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.

template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::operator* ( const SpatialVector sv) const
template<class R = float>
template<class Real2 >
Transform sofa::defaulttype::SolidTypes< R >::Transform::operator* ( Real2  a) const
inline
template<class R >
SolidTypes< R >::Transform & sofa::defaulttype::SolidTypes< R >::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.

template<class R = float>
template<class Real2 >
Transform& sofa::defaulttype::SolidTypes< R >::Transform::operator*= ( Real2  a)
inline
template<class R >
SolidTypes< R >::Transform & sofa::defaulttype::SolidTypes< R >::Transform::operator+= ( const SpatialVector a)

(this) *= Transform(v) Used for time integration. SHOULD WE RATHER APPLY (*this)=Transform(v)(*this) ???

template<class R >
SolidTypes< R >::Transform & sofa::defaulttype::SolidTypes< R >::Transform::operator+= ( const Transform a)
template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::operator/ ( const SpatialVector sv) const

Project a spatial vector from parent to child (the inverse of operator *). This method computes (*this).inversed()*sv without inverting (*this).

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::printInternal ( std::ostream &  out) const

Print the internal values (i.e. using Featherstone's conventions, see class documentation)

template<class R >
SolidTypes< R >::Vec sofa::defaulttype::SolidTypes< R >::Transform::projectPoint ( const Vec pointInChild) const

Project a point from child coordinates to parent coordinates.

template<class R >
SolidTypes< R >::Vec sofa::defaulttype::SolidTypes< R >::Transform::projectVector ( const Vec vectorInChild) const

Project a vector (i.e. a direction or a displacement) from child coordinates to parent coordinates.

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::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)

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::setOrientation ( const Rot q)

Orientation of the child coordinate axes wrt the parent coordinate axes.

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::setOrigin ( const Vec op)

Origin of child in parent coordinates.

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::writeOpenGlMatrix ( GLdouble m) const

Write an OpenGL matrix encoding the transformation of the coordinate system of the child wrt the coordinate system of the parent.

Related details

template<class R = float>
std::ostream& operator<< ( std::ostream &  out,
const Transform t 
)
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

template<class R = float>
std::istream& operator>> ( std::istream &  in,
Transform t 
)
friend

read from an input stream