- Cal3D 0.11 API Reference - |
The quaternion class. More...
#include <quaternion.h>
Public Member Functions | |
CalQuaternion (const CalQuaternion &q) | |
CalQuaternion (float qx, float qy, float qz, float qw) | |
float & | operator[] (unsigned int index) |
const float & | operator[] (unsigned int index) const |
void | operator= (const CalQuaternion &q) |
void | operator*= (const CalQuaternion &q) |
void | operator+= (const CalQuaternion &q) |
void | operator*= (const CalVector &v) |
void | operator*= (float s) |
bool | operator== (const CalQuaternion &rhs) const |
bool | operator!= (const CalQuaternion &rhs) const |
void | blend (float d, const CalQuaternion &q) |
void | clear () |
void | conjugate () |
void | invert () |
void | set (float qx, float qy, float qz, float qw) |
void | compress (short &s0, short &s1, short &s2) |
Constructs the quaternion instance. | |
void | decompress (short &s0, short &s1, short &s2) |
Sets new values from a compressed quaternion. | |
Public Attributes | |
float | x |
float | y |
float | z |
float | w |
The quaternion class.
void CalQuaternion::compress | ( | short & | s0, |
short & | s1, | ||
short & | s2 ) |
Constructs the quaternion instance.
This function is the default constructor of the quaternion instance. Constructs the quaternion instance.
This function is a constructor of the quaternion instance.
q | The quaternion to construct this quaternion instance from. Constructs the quaternion instance. |
This function is a constructor of the quaternion instance.
qx | The x component. |
qy | The y component. |
qz | The z component. |
qw | The w component. Destructs the quaternion instance. |
This function is the destructor of the quaternion instance. Provides access to the components of the quaternion instance.
This function provides read and write access to the three components of the quaternion instance.
index | The index to the specific component. |
This function provides read access to the three components of the quaternion instance.
index | The index to the specific component. |
This operator equates the quaternion instance with another quaternion.
q | The quaternion to equate the quaternion instance with. Multiplies another quaternion to the quaternion instance. |
This operator multiplies another quaternion to the quaternion instance.
q | The quaternion to be multiplied. Multiplies a vector to the quaternion instance. |
This operator multiplies a vector to the quaternion instance.
v | The vector to be multiplied. Calculates the product of two quaternions. |
This operator calculates the product of two quaternions.
q | The first quaternion. |
r | The second quaternion. |
This function interpolates the quaternion instance to another quaternion by a given factor.
d | The blending factor in the range [0.0, 1.0]. |
v | The quaternion to be interpolated to. Clears the quaternion instance. |
This function clears the quaternion instance. Conjugates the quaternion instance.
This function conjugates the quaternion instance. Inverts the quaternion instance.
This function inverts the quaternion instance. Sets new values.
This function sets new values in the quaternion instance.
qx | The x component. |
qy | The y component. |
qz | The z component. |
qw | The w component. Computes the shortest arc quaternion that will rotate one vector to another. |
This function finds the shortest arc quaternion. Based on equations from "Game Programming Gems" - chapter 2.10
from | The original vector |
to | The target vector Returns a compressed representation of the quaternion. Compresses the quaternion from traditional 4*4 = 16 bytes to 6 bytes. This is a lossy compression based on article "Quaternion, Compression" by Zarb-Adami in GPG3. |
s0 | First word of the compressed quaternion. |
s1 | Second word of the compressed quaternion. |
s2 | Third word of the compressed quaternion. |
void CalQuaternion::decompress | ( | short & | s0, |
short & | s1, | ||
short & | s2 ) |
Sets new values from a compressed quaternion.
Decompresses the quaternion from 6 bytes to traditional 4*4 = 16 bytes. The compression is based on article "Quaternion, Compression" by Zarb-Adami in GPG3.
s0 | First word of the compressed quaternion. |
s1 | Second word of the compressed quaternion. |
s2 | Third word of the compressed quaternion. |