sofa::helper::Quater< Real > Class Template Reference

#include <Quater.h>

Collaboration diagram for sofa::helper::Quater< Real >:

Collaboration graph
[legend]

Public Member Functions

 Quater ()
virtual ~Quater ()
 Quater (Real x, Real y, Real z, Real w)
template<class Real2 >
 Quater (const Real2 q[])
template<class Real2 >
 Quater (const Quater< Real2 > &q)
 Quater (const defaulttype::Vec< 3, Real > &axis, Real angle)
const Real * ptr () const
 Cast into a standard C array of elements.
Real * ptr ()
 Cast into a standard C array of elements.
void normalize ()
 Normalize a quaternion.
void clear ()
void fromMatrix (const defaulttype::Matrix3 &m)
template<class Mat33 >
void toMatrix (Mat33 &m) const
template<class Vec >
Vec rotate (const Vec &v) const
 Apply the rotation to a given vector.
template<class Vec >
Vec inverseRotate (const Vec &v) const
 Apply the inverse rotation to a given vector.
Quater< Real > operator+ (const Quater< Real > &q1) const
 Given two quaternions, add them together to get a third quaternion.
Quater< Real > operator* (const Quater< Real > &q1) const
Quater< Real > operator* (const Real &r) const
Quater quatVectMult (const defaulttype::Vec< 3, Real > &vect)
 Given two Quaters, multiply them together to get a third quaternion.
Quater vectQuatMult (const defaulttype::Vec< 3, Real > &vect)
Real & operator[] (int index)
const Real & operator[] (int index) const
Quater inverse () const
defaulttype::Vec< 3, Real > toEulerVector () const
void buildRotationMatrix (Real m[4][4]) const
 Build a rotation matrix, given a quaternion rotation.
void writeOpenGlMatrix (double *m) const
 Write an OpenGL rotation matrix.
void writeOpenGlMatrix (float *m) const
 Write an OpenGL rotation matrix.
Quater axisToQuat (defaulttype::Vec< 3, Real > a, Real phi)
 Given an axis and angle, compute quaternion.
void print ()
 Print quaternion (C style).
void operator+= (const Quater &q2)
void operator*= (const Quater &q2)

Static Public Member Functions

static Quater identity ()
template<class V >
static Quater createFromRotationVector (const V &a)
 Create using rotation vector (axis*angle) given in parent coordinates.
static Quater createQuaterFromEuler (defaulttype::Vec< 3, Real > v)
 Create a quaternion from Euler.
template<class T >
static Quater createFromRotationVector (T a0, T a1, T a2)
 Create using the entries of a rotation vector (axis*angle) given in parent coordinates.
template<class V >
static Quater set (const V &a)
 Create using rotation vector (axis*angle) given in parent coordinates.
template<class T >
static Quater set (T a0, T a1, T a2)
 Create using using the entries of a rotation vector (axis*angle) given in parent coordinates.
static unsigned int size ()

Private Attributes

Real _q [4]

Friends

std::ostream & operator<< (std::ostream &out, const Quater &v)
 write to an output stream
std::istream & operator>> (std::istream &in, Quater &v)
 read from an input stream

Detailed Description

template<class Real>
class sofa::helper::Quater< Real >

Definition at line 43 of file Quater.h.


Constructor & Destructor Documentation

template<class Real >
sofa::helper::Quater< Real >::Quater (  )  [inline]

template<class Real >
sofa::helper::Quater< Real >::~Quater (  )  [inline, virtual]

Definition at line 67 of file Quater.inl.

template<class Real >
sofa::helper::Quater< Real >::Quater ( Real  x,
Real  y,
Real  z,
Real  w 
) [inline]

Definition at line 51 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

template<class Real >
template<class Real2 >
sofa::helper::Quater< Real >::Quater ( const Real2  q[]  )  [inline]

Definition at line 53 of file Quater.h.

template<class Real >
template<class Real2 >
sofa::helper::Quater< Real >::Quater ( const Quater< Real2 > &  q  )  [inline]

Definition at line 55 of file Quater.h.

template<class Real >
sofa::helper::Quater< Real >::Quater ( const defaulttype::Vec< 3, Real > &  axis,
Real  angle 
) [inline]

Definition at line 60 of file Quater.inl.

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


Member Function Documentation

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::axisToQuat ( defaulttype::Vec< 3, Real >  a,
Real  phi 
) [inline]

template<class Real >
void sofa::helper::Quater< Real >::buildRotationMatrix ( Real  m[4][4]  )  const [inline]

template<class Real >
void sofa::helper::Quater< Real >::clear (  )  [inline]

template<class Real >
template<class T >
static Quater sofa::helper::Quater< Real >::createFromRotationVector ( T  a0,
T  a1,
T  a2 
) [inline, static]

Create using the entries of a rotation vector (axis*angle) given in parent coordinates.

Definition at line 208 of file Quater.h.

template<class Real >
template<class V >
static Quater sofa::helper::Quater< Real >::createFromRotationVector ( const V &  a  )  [inline, static]

template<class Real >
static Quater sofa::helper::Quater< Real >::createQuaterFromEuler ( defaulttype::Vec< 3, Real >  v  )  [inline, static]

Create a quaternion from Euler.

Definition at line 194 of file Quater.h.

template<class Real >
void sofa::helper::Quater< Real >::fromMatrix ( const defaulttype::Matrix3 &  m  )  [inline]

template<class Real >
static Quater sofa::helper::Quater< Real >::identity (  )  [inline, static]

Definition at line 58 of file Quater.h.

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

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::inverse (  )  const [inline]

template<class Real >
template<class Vec >
Vec sofa::helper::Quater< Real >::inverseRotate ( const Vec &  v  )  const [inline]

template<class Real >
void sofa::helper::Quater< Real >::normalize (  )  [inline]

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::operator* ( const Real &  r  )  const [inline]

Definition at line 148 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::operator* ( const Quater< Real > &  q1  )  const [inline]

Definition at line 123 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

template<class Real >
void sofa::helper::Quater< Real >::operator*= ( const Quater< Real > &  q2  ) 

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::operator+ ( const Quater< Real > &  q1  )  const [inline]

Given two quaternions, add them together to get a third quaternion.

Given two rotations, e1 and e2, expressed as quaternion rotations, figure out the equivalent single rotation and stuff it into dest.

Adding quaternions to get a compound rotation is analagous to adding translations to get a compound translation.

This routine also normalizes the result every RENORMCOUNT times it is called, to keep error from creeping in. NOTE: This routine is written so that q1 or q2 may be the same as dest (or each other).

Definition at line 79 of file Quater.inl.

References sofa::helper::Quater< Real >::_q, sofa::helper::Quater< Real >::normalize(), and RENORMCOUNT.

template<class Real >
void sofa::helper::Quater< Real >::operator+= ( const Quater< Real > &  q2  ) 

template<class Real >
const Real& sofa::helper::Quater< Real >::operator[] ( int  index  )  const [inline]

Definition at line 153 of file Quater.h.

template<class Real >
Real& sofa::helper::Quater< Real >::operator[] ( int  index  )  [inline]

Definition at line 147 of file Quater.h.

template<class Real >
void sofa::helper::Quater< Real >::print (  )  [inline]

Print quaternion (C style).

Definition at line 456 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

template<class Real >
Real* sofa::helper::Quater< Real >::ptr (  )  [inline]

Cast into a standard C array of elements.

Definition at line 70 of file Quater.h.

template<class Real >
const Real* sofa::helper::Quater< Real >::ptr (  )  const [inline]

Cast into a standard C array of elements.

Definition at line 64 of file Quater.h.

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::quatVectMult ( const defaulttype::Vec< 3, Real > &  vect  )  [inline]

Given two Quaters, multiply them together to get a third quaternion.

Definition at line 159 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

Referenced by sofa::gui::glut::SimpleGUI::ApplyMouseInteractorTransformation().

template<class Real >
template<class Vec >
Vec sofa::helper::Quater< Real >::rotate ( const Vec &  v  )  const [inline]

Apply the rotation to a given vector.

Definition at line 106 of file Quater.h.

Referenced by sofa::component::visualmodel::VisualModelImpl::addBBox(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addDForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce(), sofa::component::forcefield::ConicalForceField< DataTypes >::addForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce2(), sofa::component::mapping::ArticulatedSystemMapping< BasicMapping >::apply(), sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::applyController(), sofa::component::mapping::LaparoscopicRigidMapping< BasicMapping >::applyJ(), sofa::component::mapping::LaparoscopicRigidMapping< BasicMapping >::applyJT(), sofa::component::visualmodel::VisualModelImpl::applyRotation(), sofa::component::MechanicalObject< DataTypes >::applyRotation(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::applyStiffnessLarge(), sofa::component::constraint::AttachConstraint< DataTypes >::calcRestRotations(), sofa::component::MechanicalObject< DataTypes >::computeNewPoint(), sofa::component::mapping::computeOrientation(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::correctPosChild(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::draw(), sofa::component::constraint::ParabolicConstraint< DataTypes >::draw(), sofa::defaulttype::SolidTypes< R >::Transform::getOrigin(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::init(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::initTranslateChild(), sofa::defaulttype::SolidTypes< R >::Transform::inversed(), sofa::defaulttype::SolidTypes< R >::Transform::operator*(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::posOnChildGlobal(), sofa::defaulttype::SolidTypes< R >::Transform::projectPoint(), sofa::component::constraint::ParabolicConstraint< DataTypes >::projectPosition(), sofa::defaulttype::SolidTypes< R >::Transform::projectVector(), sofa::component::constraint::ParabolicConstraint< DataTypes >::projectVelocity(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::rotateResponse(), and sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::translateChild().

template<class Real >
template<class T >
static Quater sofa::helper::Quater< Real >::set ( T  a0,
T  a1,
T  a2 
) [inline, static]

Create using using the entries of a rotation vector (axis*angle) given in parent coordinates.

Definition at line 225 of file Quater.h.

template<class Real >
template<class V >
static Quater sofa::helper::Quater< Real >::set ( const V &  a  )  [inline, static]

Create using rotation vector (axis*angle) given in parent coordinates.

Definition at line 221 of file Quater.h.

template<class Real >
static unsigned int sofa::helper::Quater< Real >::size ( void   )  [inline, static]

Definition at line 252 of file Quater.h.

template<class Real >
defaulttype::Vec< 3, Real > sofa::helper::Quater< Real >::toEulerVector (  )  const [inline]

template<class Real >
template<class Mat33 >
void sofa::helper::Quater< Real >::toMatrix ( Mat33 &  m  )  const [inline]

template<class Real >
Quater< Real > sofa::helper::Quater< Real >::vectQuatMult ( const defaulttype::Vec< 3, Real > &  vect  )  [inline]

template<class Real >
void sofa::helper::Quater< Real >::writeOpenGlMatrix ( float *  m  )  const [inline]

Write an OpenGL rotation matrix.

Definition at line 386 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

template<class Real >
void sofa::helper::Quater< Real >::writeOpenGlMatrix ( double *  m  )  const [inline]

Write an OpenGL rotation matrix.

Write an OpenGL rotation matrix

Definition at line 361 of file Quater.inl.

References sofa::helper::Quater< Real >::_q.

Referenced by sofa::helper::gl::Cylinder::update(), sofa::helper::gl::Axis::update(), and sofa::defaulttype::SolidTypes< R >::Transform::writeOpenGlMatrix().


Friends And Related Function Documentation

template<class Real >
std::ostream& operator<< ( std::ostream &  out,
const Quater< Real > &  v 
) [friend]

write to an output stream

Definition at line 242 of file Quater.h.

template<class Real >
std::istream& operator>> ( std::istream &  in,
Quater< Real > &  v 
) [friend]

read from an input stream

Definition at line 247 of file Quater.h.


Field Documentation

template<class Real >
Real sofa::helper::Quater< Real >::_q[4] [private]


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

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