sofa::defaulttype::SolidTypes< R >::Transform Class Reference

Define a frame (child) whith respect to another (parent). More...

#include <SolidTypes.h>

Collaboration diagram for sofa::defaulttype::SolidTypes< R >::Transform:

Collaboration graph
[legend]

Public Member Functions

 Transform ()
 The default constructor does not initialize the transform.
 Transform (const Vec &origin, const Rot &orientation)
 Origin of the child in parent coordinates, orientation of the child wrt to parent.
 Transform (const Rot &q, const Vec &o)
 WARNING: using Featherstone's conventions (see class documentation).
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).
void clear ()
 Reset this to identity.
 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).
Transform inversed () const
 The inverse transform i.e. parent wrt child.
const Vec & getOriginOfParentInChild () const
 Parent origin in child coordinates (the way it is actually stored internally).
Vec getOrigin () const
 Origin of child in parent coordinates.
void setOrigin (const Vec &)
 Origin of child in parent coordinates.
const Rot & getOrientation () const
 Orientation of the child coordinate axes wrt the parent coordinate axes.
void setOrientation (const Rot &)
 Orientation of the child coordinate axes wrt the parent coordinate axes.
Mat 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.
Vec projectVector (const Vec &vectorInChild) const
 Project a vector (i.e. a direction or a displacement) from child coordinates to parent coordinates.
Vec projectPoint (const Vec &pointInChild) const
 Project a point from child coordinates to parent coordinates.
Vec backProjectVector (const Vec &vectorInParent) const
 Projected a vector (i.e. a direction or a displacement) from parent coordinates to child coordinates.
Vec backProjectPoint (const Vec &pointInParent) const
 Project point from parent coordinates to this coordinates.
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.
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.
SpatialVector operator* (const SpatialVector &sv) const
 Project a spatial vector from child to parent.
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).
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.
void glDraw () const
 Draw the axes of the child coordinate system in the parent coordinate system.
void printInternal (std::ostream &) const
 Print the internal values (i.e. using Featherstone's conventions, see class documentation).
Time integration
Methods used in time integration

Transform & operator+= (const SpatialVector &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).

Protected Attributes

Rot orientation_
 child wrt parent
Vec origin_
 parent wrt child

Friends

std::ostream & operator<< (std::ostream &out, const Transform &t)
 Print the origin of the child in the parent coordinate system and the quaternion defining the orientation of the child wrt the parent.

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).

Definition at line 183 of file SolidTypes.h.


Constructor & Destructor Documentation

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

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::Transform ( const Vec &  origin,
const Rot &  orientation 
) [inline]

Origin of the child in parent coordinates, orientation of the child wrt to parent.

Define using standard conventions.

Definition at line 155 of file SolidTypes.inl.

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

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

Define using Featherstone's conventions.

Definition at line 150 of file SolidTypes.inl.

template<class R >
sofa::defaulttype::SolidTypes< R >::Transform::Transform ( const SpatialVector &  v  )  [inline]

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.

Definition at line 184 of file SolidTypes.inl.

References sofa::helper::Quater< Real >::createFromRotationVector(), sofa::defaulttype::SolidTypes< R >::SpatialVector::freeVec, sofa::helper::Quater< Real >::inverseRotate(), sofa::defaulttype::SolidTypes< R >::SpatialVector::lineVec, sofa::defaulttype::SolidTypes< R >::Transform::orientation_, and sofa::defaulttype::SolidTypes< R >::Transform::origin_.


Member Function Documentation

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

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

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

Definition at line 235 of file SolidTypes.inl.

References sofa::helper::Quater< Real >::inverseRotate(), and sofa::defaulttype::SolidTypes< R >::Transform::orientation_.

Referenced by sofa::core::objectmodel::Context::getLocalGravity().

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

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

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

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

template<class R >
SolidTypes< R >::Mat sofa::defaulttype::SolidTypes< R >::Transform::getRotationMatrix (  )  const [inline]

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.

Definition at line 247 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::orientation_.

Referenced by sofa::defaulttype::SolidTypes< R >::RigidInertia::operator*().

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::glDraw (  )  const [inline]

Draw the axes of the child coordinate system in the parent coordinate system.

Definition at line 325 of file SolidTypes.inl.

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

Definition at line 177 of file SolidTypes.inl.

References sofa::helper::Quater< Real >::identity(), and sofa::defaulttype::SolidTypes< R >::Transform::Transform().

Referenced by sofa::defaulttype::SolidTypes< R >::Transform::Transform().

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

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

Definition at line 265 of file SolidTypes.h.

template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::operator* ( const SpatialVector &  sv  )  const [inline]

template<class R >
SolidTypes< R >::Transform sofa::defaulttype::SolidTypes< R >::Transform::operator* ( const Transform &  f2  )  const [inline]

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 Transform &  f2  )  [inline]

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.

Definition at line 279 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::getOrientation(), sofa::defaulttype::SolidTypes< R >::Transform::getOriginOfParentInChild(), sofa::helper::Quater< Real >::inverseRotate(), sofa::defaulttype::SolidTypes< R >::Transform::orientation_, and sofa::defaulttype::SolidTypes< R >::Transform::origin_.

template<class R >
SolidTypes< R >::Transform & sofa::defaulttype::SolidTypes< R >::Transform::operator+= ( const Transform &  a  )  [inline]

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

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

Definition at line 349 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::Transform().

template<class R >
SolidTypes< R >::SpatialVector sofa::defaulttype::SolidTypes< R >::Transform::operator/ ( const SpatialVector &  sv  )  const [inline]

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

Definition at line 296 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::inversed().

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

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

Definition at line 341 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::orientation_, and sofa::defaulttype::SolidTypes< R >::Transform::origin_.

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

Project a point from child coordinates to parent coordinates.

Definition at line 229 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::orientation_, sofa::defaulttype::SolidTypes< R >::Transform::origin_, and sofa::helper::Quater< Real >::rotate().

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

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

Definition at line 223 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::orientation_, and sofa::helper::Quater< Real >::rotate().

Referenced by sofa::component::contextobject::CoordinateSystem::apply().

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::set ( const Vec &  t,
const Rot &  q 
) [inline]

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).

Definition at line 162 of file SolidTypes.inl.

References sofa::helper::Quater< Real >::inverseRotate().

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

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

Definition at line 217 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::orientation_.

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

template<class R >
void sofa::defaulttype::SolidTypes< R >::Transform::writeOpenGlMatrix ( double *  m  )  const [inline]

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

Definition at line 312 of file SolidTypes.inl.

References sofa::defaulttype::SolidTypes< R >::Transform::getOrigin(), sofa::defaulttype::SolidTypes< R >::Transform::orientation_, and sofa::helper::Quater< Real >::writeOpenGlMatrix().


Friends And Related Function Documentation

template<class R = float>
std::ostream& operator<< ( std::ostream &  out,
const Transform &  t 
) [friend]

Print the origin of the child in the parent coordinate system and the quaternion defining the orientation of the child wrt the parent.

Definition at line 237 of file SolidTypes.h.


Field Documentation

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

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


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

Generated on Sun Nov 23 04:23:55 2008 for Sofa by  doxygen 1.5.7.1