- Cal3D 0.11 API Reference -

CalQuaternion Class Reference

The quaternion class. More...

#include <quaternion.h>

List of all members.

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


Detailed Description

The quaternion class.

Member Function Documentation

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.

Parameters:
q The quaternion to construct this quaternion instance from. Constructs the quaternion instance.
This function is a constructor of the quaternion instance.

Parameters:
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.

Parameters:
index The index to the specific component.
Returns:
A reference to the specific component. Provides access to the components of the quaternion instance.
This function provides read access to the three components of the quaternion instance.

Parameters:
index The index to the specific component.
Returns:
A constant reference to the specific component. Equates the quaternion instance with another quaternion.
This operator equates the quaternion instance with another quaternion.

Parameters:
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.

Parameters:
q The quaternion to be multiplied. Multiplies a vector to the quaternion instance.
This operator multiplies a vector to the quaternion instance.

Parameters:
v The vector to be multiplied. Calculates the product of two quaternions.
This operator calculates the product of two quaternions.

Parameters:
q The first quaternion.
r The second quaternion.
Returns:
The product of the two quaternions. Interpolates the quaternion instance to another quaternion.
This function interpolates the quaternion instance to another quaternion by a given factor.

Parameters:
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.

Parameters:
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

Parameters:
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.

Parameters:
s0 First word of the compressed quaternion.
s1 Second word of the compressed quaternion.
s2 Third word of the compressed quaternion.


The documentation for this class was generated from the following files:

Generated by The Cal3D Team with Doxygen 1.5.6