Quat: Class to encapsulate quaternion behaviors.
More...
#include <Quat.h>
List of all members.
Public Types |
enum | Params { Size = 4
} |
typedef DATA_TYPE | DataType |
| use this to declare single value types of the same type as this matrix.
|
Public Member Functions |
| Quat () |
| default constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1].
|
| 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].
|
| Quat (const Quat< DATA_TYPE > &q) |
| copy constructor
|
void | set (const DATA_TYPE x, const DATA_TYPE y, const DATA_TYPE z, const DATA_TYPE w) |
| directly set the quaternion's values
|
void | get (DATA_TYPE &x, DATA_TYPE &y, DATA_TYPE &z, DATA_TYPE &w) const |
| get the raw data elements of the quaternion.
|
DATA_TYPE & | operator[] (const int x) |
| bracket operator.
|
const DATA_TYPE & | operator[] (const int x) const |
| bracket operator (const version).
|
const DATA_TYPE * | getData () const |
| Get a DATA_TYPE pointer to the quat internal data.
|
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:
-
Advanced Animation and Rendering Techniques: pp363-365
-
Animating Rotation with Quaternion Curves, Ken Shoemake, SIGGRAPH Proceedings Vol 19, Number 3, 1985
-
Quaternion Calculus for Animation, Ken Shoemake SIGGRAPH course notes 1989
-
Game Developer Magazine: Feb 98, pg.34-42
-
Motivation for the use of Quaternions to perform transformations http://www.rust.net/~kgeoinfo/quat1.htm
-
On quaternions; or on a new system of imaginaries in algebra, Sir William Rowan Hamilton, Philosophical Magazine, xxv, pp. 10-13 (July 1844)
-
You also can find more on quaternions at
-
Or search on google....
Definition at line 47 of file Quat.h.
Member Typedef Documentation
template<typename DATA_TYPE>
use this to declare single value types of the same type as this matrix.
Definition at line 52 of file Quat.h.
Member Enumeration Documentation
template<typename DATA_TYPE>
- Enumerator:
-
Definition at line 54 of file Quat.h.
Constructor & Destructor Documentation
template<typename DATA_TYPE>
default constructor, initializes to quaternion multiplication identity [x,y,z,w] == [0,0,0,1].
NOTE: the addition identity is [0,0,0,0]
Definition at line 60 of file Quat.h.
: mData( (DATA_TYPE)0.0, (DATA_TYPE)0.0, (DATA_TYPE)0.0, (DATA_TYPE)1.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]
Definition at line 69 of file Quat.h.
: mData( x, y, z, w )
{
}
template<typename DATA_TYPE>
copy constructor
Definition at line 77 of file Quat.h.
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 | |
|
) |
| | const [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 93 of file Quat.h.
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 141 of file Quat.h.
{ 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 132 of file Quat.h.
{
gmtlASSERT( x >= 0 && x < 4 && "out of bounds error" );
return mData[x];
}
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 115 of file Quat.h.
{
gmtlASSERT( x >= 0 && x < 4 && "out of bounds error" );
return mData[x];
}
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 85 of file Quat.h.
{
mData.set( x, y, z, w );
}
Member Data Documentation
template<typename DATA_TYPE>
The documentation for this class was generated from the following file: