Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

TQuaternion< T > Class Template Reference
[Quaternion]

Generic Quaternion Class. More...

#include <quaternion.h>

List of all members.

Public Member Functions

Constructors and Destructors
 TQuaternion () throw ()
 Default constructor.
 TQuaternion (const TQuaternion &q) throw ()
 Copy constructor.
 TQuaternion (const TVector3< T > &axis, const T &new_angle) throw ()
 Detailed constructor.
 TQuaternion (const T &x, const T &y, const T &z, const T &new_angle) throw ()
 Detailed constructor.
virtual ~TQuaternion () throw ()
 Destructor.
virtual void clear () throw ()
 Clear method.
Assignment
void set (const TQuaternion &q) throw ()
void set (const TVector3< T > &axis, const T &new_angle) throw ()
 Assign the TQuaternion components.
void set (const T &x, const T &y, const T &z, const T &new_angle) throw ()
 Assign the TQuaternion components.
TQuaternionoperator= (const TQuaternion &q) throw ()
 Assign from another TQuaternion.
void get (TQuaternion &q) const throw ()
 Assign to another TQuaternion.
void setIdentity () throw ()
 Assign the components to the standard values.
void swap (TQuaternion &q) throw ()
 Swap the contents of two TQuaternion.
Accessors
getAngle () const throw ()
 Get the positive angle rotation.
TVector3< T > getAxis () throw (Exception::DivisionByZero)
 Get the normalized direction vector of the rotation axis.
TMatrix4x4< T > & getRotationMatrix (TMatrix4x4< T > &m) const throw ()
 Get the rotation matrix.
TQuaternion operator- () const throw ()
 Negative sign.
TQuaternion getInverse () const throw ()
 Get the inverse TQuaternion.
TQuaternion getConjugate () const throw ()
 Return the conjugate TQuaternion.
TQuaternionoperator+= (const TQuaternion &q) throw ()
 Add a TQuaternion to this TQuaternion.
TQuaternionoperator-= (const TQuaternion &q) throw ()
 Substract a TQuaternion from this TQuaternion.
Predicates
bool operator== (const TQuaternion &q) const throw ()
 Equality operator.
bool operator!= (const TQuaternion &q) const throw ()
 Inequality operator.
Debugging and Diagnostics
void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Internal state dump.

Public Attributes

Attributes
i
 x component of the axis.
j
 y component of the axis.
k
 z component of the axis.
angle
 Angle component.


Detailed Description

template<typename T>
class TQuaternion< T >

Generic Quaternion Class.

Representing a rotation in three dimensional space.


Constructor & Destructor Documentation

template<typename T>
TQuaternion< T >::TQuaternion  )  throw ()
 

Default constructor.

This method creates a new TQuaternion object. The axis-components are initialized to 0, the angle is set to 1.

template<typename T>
TQuaternion< T >::TQuaternion const TQuaternion< T > &  q  )  throw ()
 

Copy constructor.

Create a new TQuaternion object from another.

Parameters:
TQuaternion the TQuaternion object to be copied

template<typename T>
TQuaternion< T >::TQuaternion const TVector3< T > &  axis,
const T &  new_angle
throw ()
 

Detailed constructor.

Create a new TQuaternion object from a variable of type TVector3 and an angle.

Parameters:
axis assigned to the axis
new_angle assigned to the angle

template<typename T>
TQuaternion< T >::TQuaternion const T &  x,
const T &  y,
const T &  z,
const T &  new_angle
throw ()
 

Detailed constructor.

Create a new TQuaternion object from three values of type T and an angle.

Parameters:
x assigned to the x-component of the axis
y assigned to the y-component of the axis
z assigned to the z-component of the axis
new_angle assigned to the angle

template<typename T>
TQuaternion< T >::~TQuaternion  )  throw () [virtual]
 

Destructor.

Destructs the TQuaternion object. As there are no dynamic data structures, nothing happens.


Member Function Documentation

template<typename T>
void TQuaternion< T >::clear  )  throw () [virtual]
 

Clear method.

The values are set to 0.

template<typename T>
void TQuaternion< T >::dump std::ostream &  s = std::cout,
Size  depth = 0
const throw ()
 

Internal state dump.

Dump the current internal state of {*this} to the output ostream s with dumping depth depth .

Parameters:
s - output stream where to output the internal state of {*this}
depth - the dumping depth

template<typename T>
void TQuaternion< T >::get TQuaternion< T > &  q  )  const throw ()
 

Assign to another TQuaternion.

Assigns the components to another TQuaternion.

Parameters:
q the TQuaternion to be assigned to

template<typename T>
T TQuaternion< T >::getAngle  )  const throw ()
 

Get the positive angle rotation.

Returns:
T the angle value

template<typename T>
TVector3< T > TQuaternion< T >::getAxis  )  throw (Exception::DivisionByZero)
 

Get the normalized direction vector of the rotation axis.

Returns:
TVector3 the axis

template<typename T>
TQuaternion< T > TQuaternion< T >::getConjugate  )  const throw ()
 

Return the conjugate TQuaternion.

(The axis components are negated.)

Returns:
TQuaternion the conjugate TQuaternion

template<typename T>
TQuaternion< T > TQuaternion< T >::getInverse  )  const throw ()
 

Get the inverse TQuaternion.

Returns:
TQuaternion the inverse TQuaternion

template<typename T>
TMatrix4x4< T > & TQuaternion< T >::getRotationMatrix TMatrix4x4< T > &  m  )  const throw ()
 

Get the rotation matrix.

Parameters:
m the matrix to compute from
Returns:
TMatrix4x4 the rotation matrix

template<typename T>
bool TQuaternion< T >::operator!= const TQuaternion< T > &  q  )  const throw ()
 

Inequality operator.

Returns:
bool, true if the two TQuaternion differ in at least one component, false otherwise

template<typename T>
TQuaternion< T > & TQuaternion< T >::operator+= const TQuaternion< T > &  q  )  throw ()
 

Add a TQuaternion to this TQuaternion.

Parameters:
q the TQuaternion to add
Returns:
TQuaternion& {*this}

template<typename T>
TQuaternion< T > TQuaternion< T >::operator-  )  const throw ()
 

Negative sign.

template<typename T>
TQuaternion< T > & TQuaternion< T >::operator-= const TQuaternion< T > &  q  )  throw ()
 

Substract a TQuaternion from this TQuaternion.

Parameters:
q the TQuaternion to substract
Returns:
TQuaternion& {*this}

template<typename T>
TQuaternion< T > & TQuaternion< T >::operator= const TQuaternion< T > &  q  )  throw ()
 

Assign from another TQuaternion.

Parameters:
q the TQuaternion object to assign from

template<typename T>
bool TQuaternion< T >::operator== const TQuaternion< T > &  q  )  const throw ()
 

Equality operator.

Returns:
bool, true if all components are equal, false otherwise

template<typename T>
void TQuaternion< T >::set const T &  x,
const T &  y,
const T &  z,
const T &  new_angle
throw ()
 

Assign the TQuaternion components.

Parameters:
x assigned to the x-component of the axis
y assigned to the y-component of the axis
z assigned to the z-component of the axis
new_angle assigned to the angle

template<typename T>
void TQuaternion< T >::set const TVector3< T > &  axis,
const T &  new_angle
throw ()
 

Assign the TQuaternion components.

Parameters:
axis the new axis component
new_angle the new angle component

template<typename T>
void TQuaternion< T >::setIdentity  )  throw ()
 

Assign the components to the standard values.

The axis-components are set to 0, the angle is set to 1.

template<typename T>
void TQuaternion< T >::swap TQuaternion< T > &  q  )  throw ()
 

Swap the contents of two TQuaternion.

Parameters:
q the TQuaternion to swap contents with


Member Data Documentation

template<typename T>
T TQuaternion< T >::angle
 

Angle component.

template<typename T>
T TQuaternion< T >::i
 

x component of the axis.

template<typename T>
T TQuaternion< T >::j
 

y component of the axis.

template<typename T>
T TQuaternion< T >::k
 

z component of the axis.