Main Page   Groups   Namespaces  

mini3d::quat4d Class Reference
[Core]

quat4d - A 4D quaternion class, derived from array<double, 4> More...

Inheritance diagram for mini3d::quat4d:

mini3d::array< double, 4 > List of all members.

Public Member Functions

 quat4d ()
 A default constructor.
 quat4d (const array<double, 4>& src)
 A copy constructor from base class.
 quat4d (const quat4d& src)
 A copy constructor.
 quat4d (double v[4])
 A constructor.
 quat4d (double s, const vector3d& v)
 A constructor.
 quat4d (double vw, double vx, double vy, double vz)
 A constructor.
virtual ~quat4d ()
 A destructor.
quat4d operator* (const quat4d& rhs) const
 Multiply two quaternion and return the product.
quat4d operator/ (const quat4d& rhs) const
 Divide two quaternion and return the result ( will throw divid_by_zero exception if rhs.normal() < EPSILON ).
double w () const
 Get the w component of the quaternion.
double x () const
 Get the x component of the quaternion.
double y () const
 Get the y component of the quaternion.
double z () const
 Get the z component of the quaternion.
void w (double ww)
 Set the w component of the quaternion.
void x (double xx)
 Set the x component of the quaternion.
void y (double yy)
 Set the y component of the quaternion.
void z (double zz)
 Set the z component of the quaternion.
double scalar () const
 Get the scalar component (w).
vector3d vector () const
 Get the vector component (x, y, z).
quat4d conjugate () const
 Get the conjugate.
quat4d inverse () const
 Get the inverse ( will throw divid_by_zero exception if normal < EPSILON ).
void invert ()
 Invert itself.
void makeRotate (double rad, const vector3d& v)
 Construct a quaternion which represents the rotation about v in opAngle rad.
void makeRotate (const vector3d& v1, const vector3d& v2)
 Construct a quaternion which represents the rotation from v1 to v2.
quat4doperator= (const array<double, 4>& src)
 Copy from the base class.
quat4dslerp (quat4d q1, quat4d q2, double t)
 Spherical linear interpolation between two quaternion.

Static Public Attributes

static const quat4d _zero_quat

Protected Member Functions

void assign (double vw, double vx, double vy, double vz)
 Assignment.

Detailed Description

quat4d - A 4D quaternion class, derived from array<double, 4>

A quaternion [w x y z] contains
a scalar component w, and
a vector component [x, y, z].


Constructor & Destructor Documentation

mini3d::quat4d::quat4d (  ) 
 

A default constructor.

The quaternion will set as [0 0 0 0].

mini3d::quat4d::quat4d ( const array<double, 4>&  src  ) 
 

A copy constructor from base class.

Parameters:
src the quat4d vector to copy from.

mini3d::quat4d::quat4d ( const quat4d src  ) 
 

A copy constructor.

Parameters:
src the quat4d vector to copy from.

mini3d::quat4d::quat4d ( double  v[4]  ) 
 

A constructor.

The quaternion will set as [v[0] v[1] v[2] v[3]].

Parameters:
v a double array with 4 components

mini3d::quat4d::quat4d ( double  s,
const vector3d v
 

A constructor.

The quaternion will set as [vw vx vy vz].

Parameters:
s the scalar component
v the vector component

mini3d::quat4d::quat4d ( double  vw,
double  vx,
double  vy,
double  vz
 

A constructor.

The quaternion will set as [vw vx vy vz].

Parameters:
vw the scalar component
vx the x component for the vector
vy the y component for the vector
vz the z component for the vector

virtual mini3d::quat4d::~quat4d (  )  [virtual]
 

A destructor.


Member Function Documentation

void mini3d::quat4d::assign ( double  vw,
double  vx,
double  vy,
double  vz
[protected]
 

Assignment.

The quaternion will set as [vw vx vy vz].

Parameters:
vw the scalar component
vx the x component for the vector
vy the y component for the vector
vz the z component for the vector

quat4d mini3d::quat4d::conjugate (  )  const
 

Get the conjugate.

Returns:
the conjugate

quat4d mini3d::quat4d::inverse (  )  const
 

Get the inverse ( will throw divid_by_zero exception if normal < EPSILON ).

Returns:
the inverse

void mini3d::quat4d::invert (  ) 
 

Invert itself.

void mini3d::quat4d::makeRotate ( const vector3d v1,
const vector3d v2
 

Construct a quaternion which represents the rotation from v1 to v2.

Parameters:
v1 the from vector
v2 the to vector

void mini3d::quat4d::makeRotate ( double  rad,
const vector3d v
 

Construct a quaternion which represents the rotation about v in opAngle rad.

Parameters:
rad the radian
v the axis of rotation

quat4d mini3d::quat4d::operator* ( const quat4d rhs  )  const
 

Multiply two quaternion and return the product.

Parameters:
rhs the quaternion to multiply with
Returns:
the product of two quaternion

quat4d mini3d::quat4d::operator/ ( const quat4d rhs  )  const
 

Divide two quaternion and return the result ( will throw divid_by_zero exception if rhs.normal() < EPSILON ).

Parameters:
rhs the second operand quaternion
Returns:
the result of the division

quat4d& mini3d::quat4d::operator= ( const array<double, 4>&  src  ) 
 

Copy from the base class.

Parameters:
src the quaternion to copy from
Returns:
itself

double mini3d::quat4d::scalar (  )  const
 

Get the scalar component (w).

Returns:
w

quat4d& mini3d::quat4d::slerp ( quat4d  q1,
quat4d  q2,
double  t
 

Spherical linear interpolation between two quaternion.

Parameters:
q1 the quaternion to start from
q2 the quaternion at the end
t the parametric value
Returns:
itself (the quaternion at time t)

vector3d mini3d::quat4d::vector (  )  const
 

Get the vector component (x, y, z).

Returns:
(x, y, z)

void mini3d::quat4d::w ( double  ww  )  [inline]
 

Set the w component of the quaternion.

Parameters:
the w component

double mini3d::quat4d::w (  )  const [inline]
 

Get the w component of the quaternion.

Returns:
the w component

void mini3d::quat4d::x ( double  xx  )  [inline]
 

Set the x component of the quaternion.

Parameters:
the x component

double mini3d::quat4d::x (  )  const [inline]
 

Get the x component of the quaternion.

Returns:
the x component

void mini3d::quat4d::y ( double  yy  )  [inline]
 

Set the y component of the quaternion.

Parameters:
the y component

double mini3d::quat4d::y (  )  const [inline]
 

Get the y component of the quaternion.

Returns:
the y component

void mini3d::quat4d::z ( double  zz  )  [inline]
 

Set the z component of the quaternion.

Parameters:
the z component

double mini3d::quat4d::z (  )  const [inline]
 

Get the z component of the quaternion.

Returns:
the z component


Member Data Documentation

const quat4d mini3d::quat4d::_zero_quat [static]
 


The documentation for this class was generated from the following file:
Generated for libmini3d by Doxygen 1.4.4 © 1997-2001