NLMISC::CQuatD Class Reference

#include <quat.h>

Inheritance diagram for NLMISC::CQuatD:

NLMISC::CQuatT< double >

Detailed Description

A double quaternion.
Author:
Antoine Viau.

Nevrax France

Date:
2000

Definition at line 523 of file quat.h.

Public Member Functions

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

bool equal (const CQuatT &a, float epsilon=1E-6f) const
CQuatT exp ()
 compute quaternion exponent.

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

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

CVector getAxis () const
 Return the equivalent Unit axis of this quaternion.

void identity ()
void invert ()
 Invert this quaternion. If normalized, conjugate is faster and does same thing.

CQuatT inverted () const
 return the quaternion inverted.

bool isIdentity () const
CQuatT log ()
 compute logn quaternion.

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.

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

void normalize ()
 Normalize the quaternion.

CQuatT normed () const
 Return the quaternion normalized.

CQuatT operator * (const CQuatT &) const
 Quaternion multiplication/composition.

CQuatT operator * (doublef) const
CQuatToperator *= (const CQuatT &)
CQuatToperator *= (doublef)
CQuatT operator+ () const
CQuatT operator+ (const CQuatT &o) const
CQuatToperator+= (const CQuatT &o)
CQuatT operator- () const
CQuatT operator- (const CQuatT &o) const
CQuatToperator-= (const CQuatT &o)
CQuatT operator/ (doublef) const
CQuatToperator/= (doublef)
bool operator== (const CQuatT &a) const
void serial (IStream &f)
 serial.

void set (doubleX, doubleY, doubleZ, doubleW)
void setAngleAxis (const CAngleAxis &angAxis)
 Build a UNIT quaternion from an AngleAxis.

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

double sqrnorm () const
 return the square of the norm of the 4D vector.

CQuat conversion.
 CQuatD (const CQuat &o)
 operator CQuat () const
CQuatDoperator= (const CQuatT< float > &o)
Object
 CQuatD (const CAngleAxis &aa)
 ctor of a UNIT quaternion, from an angle axis.

 CQuatD (const CVector &axis, float angle)
 ctor of a UNIT quaternion, from an angle axis.

 CQuatD (double X, double Y, double Z, double W)
 ctor of a UNIT quaternion, from an angle axis.

 CQuatD ()
 ctor of a UNIT quaternion, from an angle axis.

 CQuatD (const CQuatT< double > &o)
 ctor of a UNIT quaternion, from an angle axis.

CQuatDoperator= (const CQuatT< double > &o)
 ctor of a UNIT quaternion, from an angle axis.


Static Public Member Functions

double dotProduct (const CQuatT< double > &q0, const CQuatT< double > &q1)
 Return the dotProduct of 2 quaternions.

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

CQuatT slerp (const CQuatT< double > &q0, const CQuatT< double > &q1, float t)
CQuatT squad (const CQuatT< double > &q0, const CQuatT< double > &tgtQ0, const CQuatT< double > &tgtQ1, const CQuatT< double > &q1, float t)
CQuatT squadrev (const CAngleAxis &rot, const CQuatT< double > &q0, const CQuatT< double > &tgtQ0, const CQuatT< double > &tgtQ1, const CQuatT< double > &q1, float t)

Data Fields

double w
double x
double y
double z

Static Public Attributes

const CQuatD Identity


Constructor & Destructor Documentation

NLMISC::CQuatD::CQuatD const CQuatT< double > &  o  )  [inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 531 of file quat.h.

00531 : CQuatT<double>(o) {}

NLMISC::CQuatD::CQuatD  )  [inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 532 of file quat.h.

00532 {}

NLMISC::CQuatD::CQuatD double  X,
double  Y,
double  Z,
double  W
[inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 533 of file quat.h.

00533 : CQuatT<double>(X,Y,Z,W) {}

NLMISC::CQuatD::CQuatD const CVector axis,
float  angle
[inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 535 of file quat.h.

00535 : CQuatT<double>(axis, angle) {}

NLMISC::CQuatD::CQuatD const CAngleAxis aa  )  [inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 537 of file quat.h.

00537 : CQuatT<double>(aa) {}

NLMISC::CQuatD::CQuatD const CQuat o  )  [inline]
 

Definition at line 543 of file quat.h.

References NLMISC::CQuatT< float >::w, w, NLMISC::CQuatT< float >::x, x, NLMISC::CQuatT< float >::y, y, NLMISC::CQuatT< float >::z, and z.

00543 {x=o.x; y=o.y; z=o.z; w=o.w;}


Member Function Documentation

CQuatT NLMISC::CQuatT< double >::conjugate  )  const [inline, inherited]
 

return the conjugate of this quaternion.

Definition at line 139 of file quat.h.

Referenced by NL3D::CAnimationOptimizer::nearlySameQuaternion().

00139 {return CQuatT(-x, -y, -z, w);}

double NLMISC::CQuatT< double >::dotProduct const CQuatT< double > &  q0,
const CQuatT< double > &  q1
[static, inherited]
 

Return the dotProduct of 2 quaternions.

bool NLMISC::CQuatT< double >::equal const CQuatT< double > &  a,
float  epsilon = 1E-6f
const [inherited]
 

CQuatT NLMISC::CQuatT< double >::exp  )  [inherited]
 

compute quaternion exponent.

float NLMISC::CQuatT< double >::getAngle  )  const [inline, inherited]
 

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

Definition at line 148 of file quat.h.

00148 {return (float)(2*acos(w/norm()));}

CAngleAxis NLMISC::CQuatT< double >::getAngleAxis  )  const [inline, inherited]
 

Return the equivalent Unit AngleAxis of this quaternion.

Definition at line 150 of file quat.h.

00150 {return CAngleAxis(getAxis(), getAngle());}

CVector NLMISC::CQuatT< double >::getAxis void   )  const [inline, inherited]
 

Return the equivalent Unit axis of this quaternion.

Definition at line 146 of file quat.h.

00146 {CVector ret((float)x,(float)y,(float)z); return ret.normed();}

void NLMISC::CQuatT< double >::identity  )  [inline, inherited]
 

Definition at line 102 of file quat.h.

00102 {x = y = z = 0.0f ;     w = 1.0f; }

void NLMISC::CQuatT< double >::invert  )  [inherited]
 

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

CQuatT NLMISC::CQuatT< double >::inverted  )  const [inline, inherited]
 

return the quaternion inverted.

Definition at line 137 of file quat.h.

00137 {CQuatT ret= *this; ret.invert(); return ret;}

bool NLMISC::CQuatT< double >::isIdentity  )  const [inline, inherited]
 

Definition at line 103 of file quat.h.

00103 {return (x==0.0f && y==0.0f && z==0.0f && w==1.0f);}

CQuatT NLMISC::CQuatT< double >::lnDif const CQuatT< double > &  q0,
const CQuatT< double > &  q1
[static, inherited]
 

compute lnDiff of q0.inverted()*q1.

CQuatT NLMISC::CQuatT< double >::log  )  [inherited]
 

compute logn quaternion.

void NLMISC::CQuatT< double >::makeClosest const CQuatT< double > &  o  )  [inherited]
 

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

double NLMISC::CQuatT< double >::norm  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 121 of file quat.h.

00121 {return (T)sqrt(sqrnorm());}

void NLMISC::CQuatT< double >::normalize  )  [inherited]
 

Normalize the quaternion.

CQuatT NLMISC::CQuatT< double >::normed  )  const [inline, inherited]
 

Return the quaternion normalized.

Definition at line 125 of file quat.h.

00125 {CQuatT ret= *this; ret.normalize(); return ret;}

CQuatT NLMISC::CQuatT< double >::operator * const CQuatT< double > &   )  const [inherited]
 

Quaternion multiplication/composition.

CQuatT NLMISC::CQuatT< double >::operator * double   f  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 114 of file quat.h.

00114 {return CQuatT(x*f,y*f,z*f,w*f);}

CQuatT& NLMISC::CQuatT< double >::operator *= const CQuatT< double > &   )  [inherited]
 

return the conjugate of this quaternion.

CQuatT& NLMISC::CQuatT< double >::operator *= double   f  )  [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 110 of file quat.h.

00110 {x*=f;y*=f;z*=f;w*=f; return *this;}

NLMISC::CQuatD::operator CQuat  )  const [inline]
 

Definition at line 545 of file quat.h.

References w, x, y, and z.

00545 {return CQuat((float)x, (float)y, (float)z, (float)w);} 

CQuatT NLMISC::CQuatT< double >::operator+  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 117 of file quat.h.

00117 {return *this; }

CQuatT NLMISC::CQuatT< double >::operator+ const CQuatT< double > &  o  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 112 of file quat.h.

00112 {return CQuatT(x+o.x,y+o.y,z+o.z,w+o.w);}

CQuatT& NLMISC::CQuatT< double >::operator+= const CQuatT< double > &  o  )  [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 108 of file quat.h.

00108 {x+=o.x; y+=o.y; z+=o.z; w+=o.w; return *this;}

CQuatT NLMISC::CQuatT< double >::operator-  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 116 of file quat.h.

00116 {return(CQuatT(-x,-y,-z,-w)); }

CQuatT NLMISC::CQuatT< double >::operator- const CQuatT< double > &  o  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 113 of file quat.h.

00113 {return CQuatT(x-o.x,y-o.y,z-o.z,w-o.w);}

CQuatT& NLMISC::CQuatT< double >::operator-= const CQuatT< double > &  o  )  [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 109 of file quat.h.

00109 {x-=o.x; y-=o.y; z-=o.z; w-=o.w; return *this;}

CQuatT NLMISC::CQuatT< double >::operator/ double   f  )  const [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 115 of file quat.h.

00115 {double oof= 1.0/f; return CQuatT(x*oof,y*oof,z*oof,w*oof);}

CQuatT& NLMISC::CQuatT< double >::operator/= double   f  )  [inline, inherited]
 

return the norm of the 4D vector.

Definition at line 111 of file quat.h.

00111 {double oof= 1.0/f; x=(T)(x*oof); y=(T)(y*oof); z= (T)(z*oof); w=(T)(w*oof); return *this;}

CQuatD& NLMISC::CQuatD::operator= const CQuatT< float > &  o  )  [inline]
 

Definition at line 544 of file quat.h.

References NLMISC::CQuatT< T >::w, w, NLMISC::CQuatT< T >::x, x, NLMISC::CQuatT< T >::y, y, NLMISC::CQuatT< T >::z, and z.

00544 {x=o.x; y=o.y; z=o.z; w=o.w; return *this;}

CQuatD& NLMISC::CQuatD::operator= const CQuatT< double > &  o  )  [inline]
 

ctor of a UNIT quaternion, from an angle axis.

Definition at line 530 of file quat.h.

References NLMISC::CQuatT< T >::w, w, NLMISC::CQuatT< T >::x, x, NLMISC::CQuatT< T >::y, y, NLMISC::CQuatT< T >::z, and z.

00530 {x=o.x; y=o.y; z=o.z; w=o.w; return *this;}

bool NLMISC::CQuatT< double >::operator== const CQuatT< double > &  a  )  const [inline, inherited]
 

Definition at line 100 of file quat.h.

00100 {return (x==a.x && y==a.y && z==a.z && w==a.w);}

void NLMISC::CQuatT< double >::serial IStream f  )  [inline, inherited]
 

serial.

Definition at line 168 of file quat.h.

00169         {
00170                 f.serial(x,y,z,w);
00171         }

void NLMISC::CQuatT< double >::set double   X,
double   Y,
double   Z,
double   W
[inline, inherited]
 

Definition at line 95 of file quat.h.

00095 {x= X; y= Y; z= Z; w= W;}

void NLMISC::CQuatT< double >::setAngleAxis const CAngleAxis angAxis  )  [inline, inherited]
 

Build a UNIT quaternion from an AngleAxis.

Definition at line 155 of file quat.h.

00155 {setAngleAxis(angAxis.Axis, angAxis.Angle);}

void NLMISC::CQuatT< double >::setAngleAxis const CVector axis,
float  angle
[inherited]
 

Build a UNIT quaternion from an AngleAxis.

CQuatT NLMISC::CQuatT< double >::slerp const CQuatT< double > &  q0,
const CQuatT< double > &  q1,
float  t
[static, inherited]
 

Quaternion spherical linear interpolation. when t==0, ret==q0, when t==1, ret==q1. No hemisphere correction is made.

double NLMISC::CQuatT< double >::sqrnorm  )  const [inline, inherited]
 

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

Definition at line 119 of file quat.h.

00119 {return (x*x + y*y + z*z + w*w);}

CQuatT NLMISC::CQuatT< double >::squad const CQuatT< double > &  q0,
const CQuatT< double > &  tgtQ0,
const CQuatT< double > &  tgtQ1,
const CQuatT< double > &  q1,
float  t
[static, inherited]
 

Quaternion Quadratic spherical linear interpolation. when t==0, ret==q0, when t==1, ret==q1. No hemisphere correction is made.

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

Quaternion Quadratic spherical linear interpolation, with multi revision support.


Field Documentation

const CQuatD NLMISC::CQuatD::Identity [static]
 

Definition at line 36 of file quat.cpp.

double NLMISC::CQuatT< double >::w [inherited]
 

Definition at line 77 of file quat.h.

Referenced by NL3D::CAnimationOptimizer::nearlySameQuaternion().

double NLMISC::CQuatT< double >::x [inherited]
 

Definition at line 77 of file quat.h.

double NLMISC::CQuatT< double >::y [inherited]
 

Definition at line 77 of file quat.h.

double NLMISC::CQuatT< double >::z [inherited]
 

Definition at line 77 of file quat.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:30:23 2004 for NeL by doxygen 1.3.6