# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CQuatT Class Template Reference

A Template quaternion. More...

#include <quat.h>

List of all members.

Public Methods

Object
 CQuatT ()
 CQuatT (T X, T Y, T Z, T W)
 CQuatT (const CVector &axis, float angle)
 ctor of a UNIT quaternion, from an angle axis. More...

 CQuatT (const CAngleAxis &aa)
 ctor of a UNIT quaternion, from an angle axis. More...

Sets.
void set (T X, T Y, T Z, T W)
Comparison
bool operator== (const CQuatT &a) const
bool equal (const CQuatT &a, float epsilon=1E-6f) const
void identity ()
bool isIdentity () const
4D vector operations.
CQuatT & operator+= (const CQuatT &o)
CQuatT & operator-= (const CQuatT &o)
CQuatT & operator *= (T f)
CQuatT & operator/= (T f)
CQuatT operator+ (const CQuatT &o) const
CQuatT operator- (const CQuatT &o) const
CQuatT operator * (T f) const
CQuatT operator/ (T f) const
CQuatT operator- () const
CQuatT operator+ () const
sqrnorm () const
 return the square of the norm of the 4D vector. More...

norm () const
 return the norm of the 4D vector. More...

void normalize ()
 Normalize the quaternion. More...

CQuatT normed () const
 Return the quaternion normalized. More...

Basic Quaternions operations.
CQuatT operator * (const CQuatT &) const
 Quaternion multiplication/composition. More...

CQuatT & operator *= (const CQuatT &)
void invert ()
 Invert this quaternion. If normalized, conjugate is faster and does same thing. More...

CQuatT inverted () const
 return the quaternion inverted. More...

CQuatT conjugate () const
 return the conjugate of this quaternion. More...

To/From other orientation.
CVector getAxis () const
 Return the equivalent Unit axis of this quaternion. More...

float getAngle () const
 Return the equivalent angle of this quaternion. (in radian). More...

CAngleAxis getAngleAxis () const
 Return the equivalent Unit AngleAxis of this quaternion. More...

void setAngleAxis (const CVector &axis, float angle)
 Build a UNIT quaternion from an AngleAxis. More...

void setAngleAxis (const CAngleAxis &angAxis)
 Build a UNIT quaternion from an AngleAxis. More...

Misc.
CQuatT log ()
 compute logn quaternion. More...

CQuatT exp ()
 compute quaternion exponent. More...

void makeClosest (const CQuatT &o)
 ensure that *this and q are on same side of hypersphere, ie dotProduct(*this,q) is >0, modifying this if necessary. More...

void serial (IStream &f)
 serial. More...


Static Public Methods

Quaternions static functions.
dotProduct (const CQuatT< T > &q0, const CQuatT< T > &q1)
 Return the dotProduct of 2 quaternions. More...

CQuatT slerp (const CQuatT< T > &q0, const CQuatT< T > &q1, float t)
 Quaternion spherical linear interpolation. More...

CQuatT squad (const CQuatT< T > &q0, const CQuatT< T > &tgtQ0, const CQuatT< T > &tgtQ1, const CQuatT< T > &q1, float t)
 Quaternion Quadratic spherical linear interpolation. More...

CQuatT squadrev (const CAngleAxis &rot, const CQuatT< T > &q0, const CQuatT< T > &tgtQ0, const CQuatT< T > &tgtQ1, const CQuatT< T > &q1, float t)
 Quaternion Quadratic spherical linear interpolation, with multi revision support. More...

CQuatT lnDif (const CQuatT &q0, const CQuatT &q1)
 compute lnDiff of q0.inverted()*q1. More...


Public Attributes

x
y
z
w


Detailed Description

template<class T>
class NLMISC::CQuatT< T >

A Template quaternion.

Use CQuat and CQuatD.

Author:
Antoine Viau. , Nevrax France
Date:
2000

Definition at line 74 of file quat.h.


Constructor & Destructor Documentation

template<class T>
NLMISC::CQuatT< T >::CQuatT   [inline]
 

Definition at line 84 of file quat.h.

Referenced by NLMISC::CQuatT< float >::conjugate, NLMISC::CQuatT< float >::inverted, NLMISC::CQuatT< float >::normed, NLMISC::CQuatT< float >::operator *, NLMISC::CQuatT< float >::operator *=, NLMISC::CQuatT< float >::operator+, NLMISC::CQuatT< float >::operator+=, NLMISC::CQuatT< float >::operator-, NLMISC::CQuatT< float >::operator-=, NLMISC::CQuatT< float >::operator/, NLMISC::CQuatT< float >::operator/=, and NLMISC::CQuatT< float >::operator==.

template<class T>
NLMISC::CQuatT< T >::CQuatT   X,
  Y,
  Z,
  W
[inline]
 

Definition at line 85 of file quat.h.

template<class T>
NLMISC::CQuatT< T >::CQuatT const CVector   axis,
float    angle
[inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 87 of file quat.h.

template<class T>
NLMISC::CQuatT< T >::CQuatT const CAngleAxis   aa [inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 89 of file quat.h.


Member Function Documentation

template<class T>
CQuatT NLMISC::CQuatT< T >::conjugate   const [inline]
 

return the conjugate of this quaternion.

Definition at line 139 of file quat.h.

Referenced by invert.

template<class T>
T NLMISC::CQuatT< T >::dotProduct const CQuatT< T > &    q0,
const CQuatT< T > &    q1
[static]
 

Return the dotProduct of 2 quaternions.

Definition at line 309 of file quat.h.

Referenced by makeClosest.

template<class T>
bool NLMISC::CQuatT< T >::equal const CQuatT< T > &    a,
float    epsilon = 1E-6f
const [inline]
 

Definition at line 227 of file quat.h.

References w, x, y, and z.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::exp  
 

compute quaternion exponent.

Definition at line 445 of file quat.h.

References NLMISC::QuatEpsilon, x, y, and z.

template<class T>
float NLMISC::CQuatT< T >::getAngle   const [inline]
 

Return the equivalent angle of this quaternion. (in radian).

Definition at line 148 of file quat.h.

template<class T>
CAngleAxis NLMISC::CQuatT< T >::getAngleAxis   const [inline]
 

Return the equivalent Unit AngleAxis of this quaternion.

Definition at line 150 of file quat.h.

template<class T>
CVector NLMISC::CQuatT< T >::getAxis   const [inline]
 

Return the equivalent Unit axis of this quaternion.

Definition at line 146 of file quat.h.

template<class T>
void NLMISC::CQuatT< T >::identity   [inline]
 

Definition at line 102 of file quat.h.

Referenced by normalize.

template<class T>
void NLMISC::CQuatT< T >::invert   [inline]
 

Invert this quaternion. If normalized, conjugate is faster and does same thing.

Definition at line 265 of file quat.h.

References conjugate, and sqrnorm.

template<class T>
CQuatT NLMISC::CQuatT< T >::inverted   const [inline]
 

return the quaternion inverted.

Definition at line 137 of file quat.h.

template<class T>
bool NLMISC::CQuatT< T >::isIdentity   const [inline]
 

Definition at line 103 of file quat.h.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::lnDif const CQuatT< T > &    q0,
const CQuatT< T > &    q1
[static]
 

compute lnDiff of q0.inverted()*q1.

Definition at line 462 of file quat.h.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::log  
 

compute logn quaternion.

Definition at line 427 of file quat.h.

References NLMISC::QuatEpsilon, w, x, y, and z.

template<class T>
void NLMISC::CQuatT< T >::makeClosest const CQuatT< T > &    o
 

ensure that *this and q are on same side of hypersphere, ie dotProduct(*this,q) is >0, modifying this if necessary.

Definition at line 473 of file quat.h.

References dotProduct.

template<class T>
T NLMISC::CQuatT< T >::norm   const [inline]
 

return the norm of the 4D vector.

Definition at line 121 of file quat.h.

Referenced by normalize.

template<class T>
void NLMISC::CQuatT< T >::normalize   [inline]
 

Normalize the quaternion.

Definition at line 280 of file quat.h.

References identity, and norm.

template<class T>
CQuatT NLMISC::CQuatT< T >::normed   const [inline]
 

Return the quaternion normalized.

Definition at line 125 of file quat.h.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::operator * const CQuatT< T > &    const [inline]
 

Quaternion multiplication/composition.

Definition at line 242 of file quat.h.

References w, x, y, and z.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator *   f const [inline]
 

Definition at line 114 of file quat.h.

template<class T>
CQuatT< T > & NLMISC::CQuatT< T >::operator *= const CQuatT< T > &    [inline]
 

Definition at line 256 of file quat.h.

template<class T>
CQuatT& NLMISC::CQuatT< T >::operator *=   f [inline]
 

Definition at line 110 of file quat.h.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator+   const [inline]
 

Definition at line 117 of file quat.h.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator+ const CQuatT< T > &    o const [inline]
 

Definition at line 112 of file quat.h.

template<class T>
CQuatT& NLMISC::CQuatT< T >::operator+= const CQuatT< T > &    o [inline]
 

Definition at line 108 of file quat.h.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator-   const [inline]
 

Definition at line 116 of file quat.h.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator- const CQuatT< T > &    o const [inline]
 

Definition at line 113 of file quat.h.

template<class T>
CQuatT& NLMISC::CQuatT< T >::operator-= const CQuatT< T > &    o [inline]
 

Definition at line 109 of file quat.h.

template<class T>
CQuatT NLMISC::CQuatT< T >::operator/   f const [inline]
 

Definition at line 115 of file quat.h.

template<class T>
CQuatT& NLMISC::CQuatT< T >::operator/=   f [inline]
 

Definition at line 111 of file quat.h.

template<class T>
bool NLMISC::CQuatT< T >::operator== const CQuatT< T > &    a const [inline]
 

Definition at line 100 of file quat.h.

template<class T>
void NLMISC::CQuatT< T >::serial IStream   f [inline]
 

serial.

Definition at line 168 of file quat.h.

template<class T>
void NLMISC::CQuatT< T >::set   X,
  Y,
  Z,
  W
[inline]
 

Definition at line 95 of file quat.h.

template<class T>
void NLMISC::CQuatT< T >::setAngleAxis const CAngleAxis   angAxis [inline]
 

Build a UNIT quaternion from an AngleAxis.

Definition at line 155 of file quat.h.

template<class T>
void NLMISC::CQuatT< T >::setAngleAxis const CVector   axis,
float    angle
[inline]
 

Build a UNIT quaternion from an AngleAxis.

Definition at line 294 of file quat.h.

References v, w, x, y, and z.

Referenced by NLMISC::CQuatT< float >::CQuatT, and NLMISC::CQuatT< float >::setAngleAxis.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::slerp const CQuatT< T > &    q0,
const CQuatT< T > &    q1,
float    t
[static]
 

Quaternion spherical linear interpolation.

when t==0, ret==q0, when t==1, ret==q1. No hemisphere correction is made.

Definition at line 317 of file quat.h.

References t.

Referenced by squad.

template<class T>
T NLMISC::CQuatT< T >::sqrnorm   const [inline]
 

return the square of the norm of the 4D vector.

Definition at line 119 of file quat.h.

Referenced by invert, and NLMISC::CQuatT< float >::norm.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::squad const CQuatT< T > &    q0,
const CQuatT< T > &    tgtQ0,
const CQuatT< T > &    tgtQ1,
const CQuatT< T > &    q1,
float    t
[static]
 

Quaternion Quadratic spherical linear interpolation.

when t==0, ret==q0, when t==1, ret==q1. No hemisphere correction is made.

Definition at line 355 of file quat.h.

References slerp, and t.

template<class T>
CQuatT< T > NLMISC::CQuatT< T >::squadrev const CAngleAxis   rot,
const CQuatT< T > &    q0,
const CQuatT< T > &    tgtQ0,
const CQuatT< T > &    tgtQ1,
const CQuatT< T > &    q1,
float    t
[static]
 

Quaternion Quadratic spherical linear interpolation, with multi revision support.

Definition at line 366 of file quat.h.

References NLMISC::Pi, NLMISC::QuatEpsilon, s, t, and v.


Member Data Documentation

template<class T>
T NLMISC::CQuatT::w
 

Definition at line 77 of file quat.h.

Referenced by NLMISC::CQuatT< float >::conjugate, NLMISC::CQuatT< float >::CQuatT, equal, NLMISC::CQuatT< float >::identity, NLMISC::CQuatT< float >::isIdentity, log, operator *, NLMISC::CQuatT< float >::operator *, NLMISC::CQuatT< float >::operator *=, NLMISC::CQuatT< float >::operator+, NLMISC::CQuatT< float >::operator+=, NLMISC::CQuatT< float >::operator-, NLMISC::CQuatT< float >::operator-=, NLMISC::CQuatT< float >::operator/, NLMISC::CQuatT< float >::operator/=, NLMISC::CQuatT< float >::operator==, NLMISC::CQuatT< float >::serial, NLMISC::CQuatT< float >::set, setAngleAxis, and NLMISC::CQuatT< float >::sqrnorm.

template<class T>
T NLMISC::CQuatT::x
 

Definition at line 77 of file quat.h.

Referenced by NLMISC::CQuatT< float >::conjugate, NLMISC::CQuatT< float >::CQuatT, equal, exp, NLMISC::CQuatT< float >::identity, NLMISC::CQuatT< float >::isIdentity, log, operator *, NLMISC::CQuatT< float >::operator *, NLMISC::CQuatT< float >::operator *=, NLMISC::CQuatT< float >::operator+, NLMISC::CQuatT< float >::operator+=, NLMISC::CQuatT< float >::operator-, NLMISC::CQuatT< float >::operator-=, NLMISC::CQuatT< float >::operator/, NLMISC::CQuatT< float >::operator/=, NLMISC::CQuatT< float >::operator==, NLMISC::CQuatT< float >::serial, NLMISC::CQuatT< float >::set, setAngleAxis, and NLMISC::CQuatT< float >::sqrnorm.

template<class T>
T NLMISC::CQuatT::y
 

Definition at line 77 of file quat.h.

Referenced by NLMISC::CQuatT< float >::conjugate, NLMISC::CQuatT< float >::CQuatT, equal, exp, NLMISC::CQuatT< float >::identity, NLMISC::CQuatT< float >::isIdentity, log, operator *, NLMISC::CQuatT< float >::operator *, NLMISC::CQuatT< float >::operator *=, NLMISC::CQuatT< float >::operator+, NLMISC::CQuatT< float >::operator+=, NLMISC::CQuatT< float >::operator-, NLMISC::CQuatT< float >::operator-=, NLMISC::CQuatT< float >::operator/, NLMISC::CQuatT< float >::operator/=, NLMISC::CQuatT< float >::operator==, NLMISC::CQuatT< float >::serial, NLMISC::CQuatT< float >::set, setAngleAxis, and NLMISC::CQuatT< float >::sqrnorm.

template<class T>
T NLMISC::CQuatT::z
 

Definition at line 77 of file quat.h.

Referenced by NLMISC::CQuatT< float >::conjugate, NLMISC::CQuatT< float >::CQuatT, equal, exp, NLMISC::CQuatT< float >::identity, NLMISC::CQuatT< float >::isIdentity, log, operator *, NLMISC::CQuatT< float >::operator *, NLMISC::CQuatT< float >::operator *=, NLMISC::CQuatT< float >::operator+, NLMISC::CQuatT< float >::operator+=, NLMISC::CQuatT< float >::operator-, NLMISC::CQuatT< float >::operator-=, NLMISC::CQuatT< float >::operator/, NLMISC::CQuatT< float >::operator/=, NLMISC::CQuatT< float >::operator==, NLMISC::CQuatT< float >::serial, NLMISC::CQuatT< float >::set, setAngleAxis, and NLMISC::CQuatT< float >::sqrnorm.


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