Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gmtl::Quat Class Template Reference
[Abstract Data Types: Matrix, Vec, Quat, Coord, Sphere, Plane]

Quat: Class to encapsulate quaternion behaviors. More...

#include <Quat.h>

Collaboration diagram for gmtl::Quat:

Collaboration graph
[legend]
List of all members.

Public Types

typedef DATA_TYPE DataType
 use this to declare single value types of the same type as this matrix. More...

enum  Params { Size = 4 }

Public Methods

 Quat ()
 default constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1]. More...

 Quat (const DATA_TYPE x, const DATA_TYPE y, const DATA_TYPE z, const DATA_TYPE w)
 data constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1]. More...

 Quat (const Quat< DATA_TYPE > &q)
 copy constructor. More...

void set (const DATA_TYPE x, const DATA_TYPE y, const DATA_TYPE z, const DATA_TYPE w)
 directly set the quaternion's values. More...

void get (DATA_TYPE &x, DATA_TYPE &y, DATA_TYPE &z, DATA_TYPE &w)
 get the raw data elements of the quaternion. More...

DATA_TYPE & operator[] (const int x)
 bracket operator. More...

const DATA_TYPE & operator[] (const int x) const
 bracket operator(const version). More...

const DATA_TYPE * getData () const
 Get a DATA_TYPE pointer to the quat internal data. More...


Public Attributes

Vec< DATA_TYPE, 4 > mData

Detailed Description

template<typename DATA_TYPE>
class gmtl::Quat< DATA_TYPE >

Quat: Class to encapsulate quaternion behaviors.

this Quaternion is ordered in memory: x,y,z,w.

See also:
Quatf , Quatd
Note: The code for most of these routines was built using the following references

References:

Definition at line 76 of file Quat.h.


Member Typedef Documentation

template<typename DATA_TYPE>
typedef DATA_TYPE gmtl::Quat::DataType
 

use this to declare single value types of the same type as this matrix.

Definition at line 81 of file Quat.h.


Member Enumeration Documentation

template<typename DATA_TYPE>
enum gmtl::Quat::Params
 

Enumeration values:
Size 

Definition at line 83 of file Quat.h.

00083 { Size = 4 };


Constructor & Destructor Documentation

template<typename DATA_TYPE>
gmtl::Quat< DATA_TYPE >::Quat   [inline]
 

default constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1].

NOTE: the addition identity is [0,0,0,0]

template<typename DATA_TYPE>
gmtl::Quat< DATA_TYPE >::Quat const DATA_TYPE    x,
const DATA_TYPE    y,
const DATA_TYPE    z,
const DATA_TYPE    w
[inline]
 

data constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1].

NOTE: the addition identity is [0,0,0,0]

template<typename DATA_TYPE>
gmtl::Quat< DATA_TYPE >::Quat const Quat< DATA_TYPE > &    q [inline]
 

copy constructor.


Member Function Documentation

template<typename DATA_TYPE>
void gmtl::Quat< DATA_TYPE >::get DATA_TYPE &    x,
DATA_TYPE &    y,
DATA_TYPE &    z,
DATA_TYPE &    w
[inline]
 

get the raw data elements of the quaternion.

Postcondition:
sets the given variables to the quaternion's x, y, z, and w values

Definition at line 122 of file Quat.h.

References mData, gmtl::Welt, gmtl::Xelt, gmtl::Yelt, and gmtl::Zelt.

00123    {
00124       x = mData[Xelt];
00125       y = mData[Yelt];
00126       z = mData[Zelt];
00127       w = mData[Welt];
00128    }

template<typename DATA_TYPE>
const DATA_TYPE* gmtl::Quat< DATA_TYPE >::getData   const [inline]
 

Get a DATA_TYPE pointer to the quat internal data.

Postcondition:
Returns a ptr to the head of the quat data

Definition at line 170 of file Quat.h.

References mData.

00170 { return (DATA_TYPE*)mData.getData();}

template<typename DATA_TYPE>
const DATA_TYPE& gmtl::Quat< DATA_TYPE >::operator[] const int    x const [inline]
 

bracket operator(const version).

raw data accessor.

"Example (access raw data element in a Quat):"

    Quatf q;
    float rads = acos( q[Welt] ) / 2.0f;

See also:
VectorIndex

Definition at line 161 of file Quat.h.

References gmtlASSERT, and mData.

00162    {
00163       gmtlASSERT( x >= 0 && x < 4 && "out of bounds error" );
00164       return mData[x];
00165    }

template<typename DATA_TYPE>
DATA_TYPE& gmtl::Quat< DATA_TYPE >::operator[] const int    x [inline]
 

bracket operator.

raw data accessor.

"Example (access raw data element in a Quat):"

    Quatf q;
    q[Xelt] = 0.001231176f;
    q[Yelt] = 0.1222f;
    q[Zelt] = 0.721f;
    q[Welt] = 0.982323f;

See also:
VectorIndex

Definition at line 144 of file Quat.h.

References gmtlASSERT, and mData.

00145    {
00146       gmtlASSERT( x >= 0 && x < 4 && "out of bounds error" );
00147       return mData[x];
00148    }

template<typename DATA_TYPE>
void gmtl::Quat< DATA_TYPE >::set const DATA_TYPE    x,
const DATA_TYPE    y,
const DATA_TYPE    z,
const DATA_TYPE    w
[inline]
 

directly set the quaternion's values.

Precondition:
x,y,z,w should be normalized
Postcondition:
the quaternion is set with the given values

Definition at line 114 of file Quat.h.

References mData.

00115    {
00116       mData.set( x, y, z, w );
00117    }


Member Data Documentation

template<typename DATA_TYPE>
Vec<DATA_TYPE, 4> gmtl::Quat::mData
 

Definition at line 174 of file Quat.h.

Referenced by get, getData, operator[], and set.


The documentation for this class was generated from the following file:
Generated on Mon Apr 7 15:29:30 2003 for GenericMathTemplateLibrary by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002