Quaternion< T > Class Template Reference

#include <quaternion.h>

List of all members.


Detailed Description

template<class T>
class Quaternion< T >

This class represents a quaternion (4D vector).

It is based on the quaternion class by Sobiet Void (robin@cyberversion.com). From the url http://www.gamedev.net/reference/articles/article1095.asp. This is a template version so no implementation file is present. The header file contains both the declarationand the implementation.

Definition at line 53 of file quaternion.h.

Public Member Functions

 Quaternion ()
 The default constructor.
 Quaternion (const T w, const T x, const T y, const T z)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. With this version the individual components of the quaternion can be set.
 Quaternion (const T xAngle, const T yAngle, const T zAngle)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version allows creation of a quaternion from an Euler representation.
 Quaternion (const Vector3D< T > v, const T angle)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version allows creation of a quaternion from an axis/angle representation.
 ~Quaternion ()
 The default destructor.
Quaternion operator * (const Quaternion &quat)
 Implements quaternion multiplication.
Quaternionoperator= (const Quaternion &quat)
 The copy constructor.
void identity ()
 Sets the quaternion to the identity quaternion (1, 0, 0, 0).
void normalize ()
 Normalizes the quaternion.
void setValues (const T w, const T x, const T y, const T z)
 Sets the quaternion to the given values.
void conjugate ()
 Changes the quaternion into its conjugate.
void inverse ()
 Changes the quaternion into its inverse.
w () const
 Returns the w-value of the quaternion.
x () const
 Returns the x-value of the quaternion.
y () const
 Returns the y-value of the quaternion.
z () const
 Returns the z-value of the quaternion.
void eulerToQuaternion (const T xAngle, const T yAngle, const T zAngle)
 Returns a quaternion constructed from 3 Euler angles (in degrees).
void axisToQuaternion (const Vector3D< T > v, const T angle)
 Returns a quaternion constructed from an axis/angle representation (in degrees).
void getAxisAngle (Vector3D< T > &v, T &angle)
 Returns the axis (vector) - angle (in degrees) representation of the quaternion.

Private Member Functions

void limitRange (const T minimum, T &value, const T maximum)
 Limits the range of value between minimum and maximum.

Private Attributes

wQuat
xQuat
yQuat
zQuat
 Internal quaternion representation (w, xi, yj, zk).


Constructor & Destructor Documentation

template<class T>
Quaternion< T >::Quaternion  ) 
 

The default constructor.

Definition at line 97 of file quaternion.h.

template<class T>
Quaternion< T >::Quaternion const T  w,
const T  x,
const T  y,
const T  z
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. With this version the individual components of the quaternion can be set.

Definition at line 104 of file quaternion.h.

template<class T>
Quaternion< T >::Quaternion const T  xAngle,
const T  yAngle,
const T  zAngle
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version allows creation of a quaternion from an Euler representation.

Definition at line 112 of file quaternion.h.

template<class T>
Quaternion< T >::Quaternion const Vector3D< T >  v,
const T  angle
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version allows creation of a quaternion from an axis/angle representation.

Definition at line 120 of file quaternion.h.

template<class T>
Quaternion< T >::~Quaternion  ) 
 

The default destructor.

Definition at line 128 of file quaternion.h.


Member Function Documentation

template<class T>
Quaternion< T > Quaternion< T >::operator * const Quaternion< T > &  quat  ) 
 

Implements quaternion multiplication.

Definition at line 134 of file quaternion.h.

template<class T>
Quaternion< T > & Quaternion< T >::operator= const Quaternion< T > &  quat  ) 
 

The copy constructor.

Definition at line 146 of file quaternion.h.

template<class T>
void Quaternion< T >::identity  ) 
 

Sets the quaternion to the identity quaternion (1, 0, 0, 0).

Definition at line 158 of file quaternion.h.

template<class T>
void Quaternion< T >::normalize  ) 
 

Normalizes the quaternion.

Definition at line 168 of file quaternion.h.

template<class T>
void Quaternion< T >::setValues const T  w,
const T  x,
const T  y,
const T  z
 

Sets the quaternion to the given values.

Definition at line 201 of file quaternion.h.

template<class T>
void Quaternion< T >::conjugate  ) 
 

Changes the quaternion into its conjugate.

Definition at line 223 of file quaternion.h.

template<class T>
void Quaternion< T >::inverse  ) 
 

Changes the quaternion into its inverse.

Definition at line 232 of file quaternion.h.

template<class T>
T Quaternion< T >::w  )  const
 

Returns the w-value of the quaternion.

Definition at line 244 of file quaternion.h.

template<class T>
T Quaternion< T >::x  )  const
 

Returns the x-value of the quaternion.

Definition at line 251 of file quaternion.h.

template<class T>
T Quaternion< T >::y  )  const
 

Returns the y-value of the quaternion.

Definition at line 258 of file quaternion.h.

template<class T>
T Quaternion< T >::z  )  const
 

Returns the z-value of the quaternion.

Definition at line 265 of file quaternion.h.

template<class T>
void Quaternion< T >::eulerToQuaternion const T  xAngle,
const T  yAngle,
const T  zAngle
 

Returns a quaternion constructed from 3 Euler angles (in degrees).

Definition at line 272 of file quaternion.h.

template<class T>
void Quaternion< T >::axisToQuaternion const Vector3D< T >  v,
const T  angle
 

Returns a quaternion constructed from an axis/angle representation (in degrees).

Definition at line 299 of file quaternion.h.

template<class T>
void Quaternion< T >::getAxisAngle Vector3D< T > &  v,
T &  angle
 

Returns the axis (vector) - angle (in degrees) representation of the quaternion.

Definition at line 322 of file quaternion.h.

template<class T>
void Quaternion< T >::limitRange const T  minimum,
T &  value,
const T  maximum
[private]
 

Limits the range of value between minimum and maximum.

Definition at line 348 of file quaternion.h.


Member Data Documentation

template<class T>
T Quaternion< T >::wQuat [private]
 

Definition at line 89 of file quaternion.h.

template<class T>
T Quaternion< T >::xQuat [private]
 

Definition at line 89 of file quaternion.h.

template<class T>
T Quaternion< T >::yQuat [private]
 

Definition at line 89 of file quaternion.h.

template<class T>
T Quaternion< T >::zQuat [private]
 

Internal quaternion representation (w, xi, yj, zk).

Definition at line 89 of file quaternion.h.


Generated on Fri May 19 14:31:58 2006 for Brabosphere by  doxygen 1.4.6-NO