- Cal3D 0.9 API Reference -

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# CalQuaternion Class Reference

The quaternion class. More...

`#include <quaternion.h>`

List of all members.

## Public Member Functions

| CalQuaternion ()
| Constructs the quaternion instance.
| CalQuaternion (const CalQuaternion &q)
| Constructs the quaternion instance.
| CalQuaternion (float qx, float qy, float qz, float qw)
| Constructs the quaternion instance.
| ~CalQuaternion ()
| Destructs the quaternion instance.
float & | operator[] (unsigned int index)
| Provides access to the components of the quaternion instance.
const float & | operator[] (unsigned int index) const
| Provides access to the components of the quaternion instance.
void | operator= (const CalQuaternion &q)
| Equates the quaternion instance with another quaternion.
void | operator *= (const CalQuaternion &q)
| Multiplies another quaternion to the quaternion instance.
void | operator *= (const CalVector &v)
| Multiplies a vector to the quaternion instance.
void | blend (float d, const CalQuaternion &q)
| Interpolates the quaternion instance to another quaternion.
void | clear ()
| Clears the quaternion instance.
void | conjugate ()
| Conjugates the quaternion instance.
void | invert ()
| Inverts the quaternion instance.
void | set (float qx, float qy, float qz, float qw)
| Sets new values.

## Public Attributes

float | x
float | y
float | z
float | w

## Friends

CAL3D_API CalQuaternion | operator * (const CalQuaternion &q, const CalQuaternion &r)
| Calculates the product of two quaternions.
CAL3D_API CalQuaternion | shortestArc (const CalVector &from, const CalVector &to)
| Computes the shortest arc quaternion that will rotate one vector to another.

## Detailed Description

The quaternion class.

## Constructor & Destructor Documentation

CalQuaternion::CalQuaternion | ( |  | ) |

| Constructs the quaternion instance. This function is the default constructor of the quaternion instance.

CalQuaternion::CalQuaternion | ( | const CalQuaternion & | q | ) |

| Constructs the quaternion instance. This function is a constructor of the quaternion instance.

Parameters:

  q | The quaternion to construct this quaternion instance from.

CalQuaternion::CalQuaternion | ( | float | qx,
|  | float | qy,
|  | float | qz,
|  | float | qw
| ) |

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

CalQuaternion::~CalQuaternion | ( |  | ) |

| Destructs the quaternion instance. This function is the destructor of the quaternion instance.

## Member Function Documentation

void CalQuaternion::blend | ( | float | d,
|  | const CalQuaternion & | q
| ) |

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

void CalQuaternion::clear | ( |  | ) |

| Clears the quaternion instance. This function clears the quaternion instance.

void CalQuaternion::conjugate | ( |  | ) |

| Conjugates the quaternion instance. This function conjugates the quaternion instance.

void CalQuaternion::invert | ( |  | ) |

| Inverts the quaternion instance. This function inverts the quaternion instance.

void CalQuaternion::operator *= | ( | const CalVector & | v | ) |

| Multiplies a vector to the quaternion instance. This operator multiplies a vector to the quaternion instance.

Parameters:

  v | The vector to be multiplied.

void CalQuaternion::operator *= | ( | const CalQuaternion & | q | ) |

| Multiplies another quaternion to the quaternion instance. This operator multiplies another quaternion to the quaternion instance.

Parameters:

  q | The quaternion to be multiplied.

void CalQuaternion::operator= | ( | const CalQuaternion & | q | ) |

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

const float & CalQuaternion::operator[] | ( | unsigned int | index | ) | const

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

float & CalQuaternion::operator[] | ( | unsigned int | index | ) |

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

void CalQuaternion::set | ( | float | qx,
|  | float | qy,
|  | float | qz,
|  | float | qw
| ) |

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

## Friends And Related Function Documentation

CAL3D_API CalQuaternion operator * | ( | const CalQuaternion & | q,
|  | const CalQuaternion & | r
| ) | `[friend]`

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

CAL3D_API CalQuaternion shortestArc | ( | const CalVector & | from,
|  | const CalVector & | to
| ) | `[friend]`

| 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

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

- quaternion.h
- quaternion.cpp

Generated at Wed Apr 7 16:57:17 2004 by The Cal3D Team with 1.3.6 © 1997-2001 Dimitri van Heesch