Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GQuaternion Class Reference

Represents a quaternion, or an axis-angle rotation. More...

#include <gauge3d/3dmath/quaternion.h>

List of all members.

Public Methods

 GQuaternion ()
 Creates an uninitialized quaternion.

 GQuaternion (const GVector &axis,GCoordinate angle)
 Creates a quaternion that represents the given axis-angle rotation. The axis must be normalized!

void Rotate (const GVector in[],GVector out[],int num)const
 Applies the quaternion rotation to a set of vectors. More...

void Rotate (GVector *vec)const
 Rotate a single vector in place.

void Interpolate (const GQuaternion &q1,const GQuaternion &q2,GCoordinate t)
 Spherical linear interpolation between quaternions. More...

GCoordinate Angle ()const
 Extracts the angle of the quaternion rotation.

GVector Axis ()const
 Extracts the axis of the quaternion rotation.

GVector RawAxis ()const
 Returns the axis without normalizing it. Faster.

void Set (const GVector &axis,GCoordinate angle)
 Sets the quaternion to represent the given axis-angle rotation. The axis must be a unit vector!

GQuaternion operator * (const GQuaternion &other)const
 Combines two quaternion rotations into one. More...

const GQuaternion& operator *= (const GQuaternion &other)
 Combines two quaternion rotations into one. More...


Public Attributes

Coordinates
GCoordinate x
 imaginary component 1.

GCoordinate y
 imaginary component 2.

GCoordinate z
 imaginary component 3.

GCoordinate w
 real component.


Detailed Description

Represents a quaternion, or an axis-angle rotation.

A quaternion is a complex number with one real component and three imaginary components. But you don't need to worry about that. All you care about is the fact that quaternions are an efficient way to represent axis-angle rotations.


Member Function Documentation

void GAUGE3D::GQuaternion::Rotate ( const GVector in[],
GVector out[],
int num ) const
 

Applies the quaternion rotation to a set of vectors.

Parameters:
in   An array of vectors to rotate.
out   Location to which to write the rotated vectors. May be the same as in.
num   Number of vectors to rotate.
Remarks:
Rotating many vectors at once is faster than rotating vectors individually.

void GAUGE3D::GQuaternion::Interpolate ( const GQuaternion & q1,
const GQuaternion & q2,
GCoordinate t )
 

Spherical linear interpolation between quaternions.

Interpolate() interpolates along a sphere between q1 and q2 using time value t, which is between 0.0 (q1), and 1.0 (q2). The results are stored in this. This is useful if you want to find the orientation between two quaternions, or want to animate an object moving between these two orientations.

GQuaternion GAUGE3D::GQuaternion::operator * ( const GQuaternion & other ) const
 

Combines two quaternion rotations into one.

Applying the resulting quaternion to a vector will have the same effect as if you had first applied the second operand of the multiplication to the vector, and then the first operand. This is similar to matrix multiplication.

const GQuaternion & GAUGE3D::GQuaternion::operator *= ( const GQuaternion & other )
 

Combines two quaternion rotations into one.

Applying the resulting quaternion to a vector will have the same effect as if you had first applied the second operand of the multiplication to the vector, and then the first operand. This is similar to matrix multiplication.


The documentation for this class was generated from the following file:
Generated at Tue Jan 30 17:07:34 2001 for gauge3d by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000