- Cal3D 0.11 API Reference -

Public Member Functions | Public Attributes | List of all members
CalQuaternion Class 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
 

Detailed Description

The quaternion class.

Member Function Documentation

◆ compress()

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
qThe quaternion to construct this quaternion instance from. Constructs the quaternion instance.

This function is a constructor of the quaternion instance.

Parameters
qxThe x component.
qyThe y component.
qzThe z component.
qwThe 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
indexThe 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
indexThe 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
qThe quaternion to equate the quaternion instance with. Multiplies another quaternion to the quaternion instance.

This operator multiplies another quaternion to the quaternion instance.

Parameters
qThe quaternion to be multiplied. Multiplies a vector to the quaternion instance.

This operator multiplies a vector to the quaternion instance.

Parameters
vThe vector to be multiplied. Calculates the product of two quaternions.

This operator calculates the product of two quaternions.

Parameters
qThe first quaternion.
rThe 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
dThe blending factor in the range [0.0, 1.0].
vThe 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
qxThe x component.
qyThe y component.
qzThe z component.
qwThe 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
fromThe original vector
toThe 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.
s0First word of the compressed quaternion.
s1Second word of the compressed quaternion.
s2Third word of the compressed quaternion.

◆ decompress()

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
s0First word of the compressed quaternion.
s1Second word of the compressed quaternion.
s2Third word of the compressed quaternion.

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

Generated by The Cal3D Team with Doxygen 1.10.0