# CSIBCQuaternion Class Reference

Generic class representing quaternions. More...

`#include <SIBCQuaternion.h>`

List of all members.

## Public Member Functions
| CSIBCQuaternion ()
| CSIBCQuaternion (const CSIBCQuaternion &in_quat)
SI_Error | Init ()
SI_Error | Init (CSIBCQuaternion &in_quat)
SI_Error | Init (SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ, SI_Float in_dW)
SI_Error | Init (SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ)
SI_Float | GetX () const
SI_Float | GetY () const
SI_Float | GetZ () const
SI_Float | GetW () const
SI_Error | SetX (SI_Float in_dX)
SI_Error | SetY (SI_Float in_dY)
SI_Error | SetZ (SI_Float in_dZ)
SI_Error | SetW (SI_Float in_dW)
SI_Error | GetMatrix (CSIBCMatrix4x4 &out_mat)
SI_Error | GetXYZRotation (CSIBCVector3D &out_vect)
SI_Error | GetXYZRotation (SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ, CSIBCVector3D &out_vect)
SI_Error | GetAxisAngle (CSIBCVector3D &out_vAxis, float &out_fAngle)
SI_Error | Set (SI_Float in_dX, SI_Float in_dY, SI_Float in_dZ, SI_Float in_dW)
void | operator= (const CSIBCQuaternion &in_quat)
SI_Error | SelfTest ()

## Detailed Description

Generic class representing quaternions.

The notation used in this quaternion class (W, X, Y, Z) makes the quaternions closely related to 4D vectors (See CSIBCVector4D). In general, the quaternion can be thought of as a scalar plus a vector, where the W component is the vector, and X, Y and Z are the coefficients of the I, J and K matricies respectively.

The components of the CSIBCQuaternion class are represented by single precision floating-point numbers. Its corresponding double precision class, CSIBCQuaterniond, has much more functionality, such as the ability to interpolate and multiply quaternions.

## Constructor & Destructor Documentation

CSIBCQuaternion | ( |  | ) | `[inline]`

Default Constructor. Sets all components of the quaternion to zero, except W, which is set to one.

See also:
  CSIBCQuaternion::Init()

CSIBCQuaternion | ( | const CSIBCQuaternion & | in_quat | ) | `[inline]`

Copy Copnstructor. Copies the data from `in_quat` to the new quaternion.

Parameters:

  | in_quat | Quaternion containing data to copy to this quaternion.

See also:
  CSIBCQuaternion::operator=

  CSIBCQuaternion::Init(CSIBCQuaternion &)

## Member Function Documentation

SI_Error Init | ( |  | ) | `[inline]`

Initializes the quaternion components values all to zero, except W, which is set to one.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly initialized.

See also:
  CSIBCQuaternion::CSIBCQuaternion()

  CSIBCQuaternion::Init

SI_Error Init | ( | CSIBCQuaternion & | in_quat | ) |

Initializes the quaternion component values to those of `in_quat`.

Parameters:

  | in_quat | The quaternion from which to copy initialization values.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly initialized.

See also:
  CSIBCQuaternion::CSIBCQuaternion(CSIBCQuaternion &)

  CSIBCQuaternion::Init

SI_Error Init | ( | SI_Float | in_dX,
|  | SI_Float | in_dY,
|  | SI_Float | in_dZ,
|  | SI_Float | in_dW |
| ) |  |  |

Initializes the quaternion components values to the values given.

Parameters:

  | in_dX | The new value for the X component of the quaternion.
  | in_dY | The new value for the Y component of the quaternion.
  | in_dZ | The new value for the Z component of the quaternion.
  | in_dW | The new value for the W component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly initialized.

See also:
  CSIBCQuaternion::Init

  CSIBCQuaternion::Set

SI_Error Init | ( | SI_Float | in_dX,
|  | SI_Float | in_dY,
|  | SI_Float | in_dZ |
| ) |  |  |

Initializes the quaternion to the quaternion represented by the euler rotations given by the euler angles (pitch-roll-yaw) of the parameters.

Parameters:

  | in_dX | Value for the pitch euler angle, for the quaternion value.
  | in_dY | Value for the roll euler angle, for the quaternion value.
  | in_dZ | Value for the yaw euler angle, for the quaternion value.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly initialized.

See also:
  CSIBCQuaternion::Init

SI_Float GetX | ( |  | ) | const`[inline]`

Gets the X component of the quaternion.

Returns:
  SI_Float The X component of the quaternion.

See also:
  CSIBCQuaternion::GetY

  CSIBCQuaternion::GetZ

  CSIBCQuaternion::GetW

  CSIBCQuaternion::SetX

SI_Float GetY | ( |  | ) | const`[inline]`

Gets the Y component of the quaternion.

Returns:
  SI_Float The Y component of the quaternion.

See also:
  CSIBCQuaternion::GetX

  CSIBCQuaternion::GetZ

  CSIBCQuaternion::GetW

  CSIBCQuaternion::SetY

SI_Float GetZ | ( |  | ) | const`[inline]`

Gets the Z component of the quaternion.

Returns:
  SI_Float The Z component of the quaternion.

See also:
  CSIBCQuaternion::GetX

  CSIBCQuaternion::GetY

  CSIBCQuaternion::GetW

  CSIBCQuaternion::SetZ

SI_Float GetW | ( |  | ) | const`[inline]`

Gets the W component of the quaternion.

Returns:
  SI_Float The W component of the quaternion.

See also:
  CSIBCQuaternion::GetX

  CSIBCQuaternion::GetY

  CSIBCQuaternion::GetZ

  CSIBCQuaternion::SetW

SI_Error SetX | ( | SI_Float | in_dX | ) | `[inline]`

Sets the X component of the quaternion.

Parameters:

  | in_dX | The new values for the X component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly set.

See also:
  CSIBCQuaternion::Set

  CSIBCQuaternion::SetY

  CSIBCQuaternion::SetZ

  CSIBCQuaternion::SetW

  CSIBCQuaternion::GetX

SI_Error SetY | ( | SI_Float | in_dY | ) | `[inline]`

Sets the Y component of the quaternion.

Parameters:

  | in_dY | The new values for the Y component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly set.

See also:
  CSIBCQuaternion::Set

  CSIBCQuaternion::SetX

  CSIBCQuaternion::SetZ

  CSIBCQuaternion::SetW

  CSIBCQuaternion::GetY

SI_Error SetZ | ( | SI_Float | in_dZ | ) | `[inline]`

Sets the Z component of the quaternion.

Parameters:

  | in_dZ | The new values for the Z component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly set.

See also:
  CSIBCQuaternion::Set

  CSIBCQuaternion::SetX

  CSIBCQuaternion::SetY

  CSIBCQuaternion::SetW

  CSIBCQuaternion::GetZ

SI_Error SetW | ( | SI_Float | in_dW | ) | `[inline]`

Sets the W component of the quaternion.

Parameters:

  | in_dW | The new values for the W component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly set.

See also:
  CSIBCQuaternion::Set

  CSIBCQuaternion::SetX

  CSIBCQuaternion::SetY

  CSIBCQuaternion::SetZ

  CSIBCQuaternion::GetW

SI_Error GetMatrix | ( | CSIBCMatrix4x4 & | out_mat | ) |

Returns the rotation matrix corresponding to this quaternion. The quaternion must be a unit quaternion for this operation to succeed.

Parameters:

  | out_mat | Reference to the matrix object to receive the rotation matrix.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly converted. SI_ERR_ERROR_MSG - The quaternion was not a unit quaternion.

See also:
  CSIBCQuaternion::GetXYZRotation

  CSIBCQuaternion::GetAxisAngle

SI_Error GetXYZRotation | ( | CSIBCVector3D & | out_vect | ) | `[inline]`

Returns the euler rotation angles (pitch-roll-yaw) represented by this quaternion.

Parameters:

  | out_vect | Vector to receive the euler rotation angles.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly converted.

See also:
  CSIBCQuaternion::GetMatrix

  CSIBCQuaternion::GetAxisAngle

SI_Error GetXYZRotation | ( | SI_Float | in_dX,
|  | SI_Float | in_dY,
|  | SI_Float | in_dZ,
|  | CSIBCVector3D & | out_vect |
| ) |  |  |

Returns the euler rotation angles (pitch-roll-yaw) represented by this quaternion.

Parameters:

  | out_vect | Vector to receive the euler rotation angles.
  | in_dX | Ignored.
  | in_dY | Ignored.
  | in_dZ | Ignored.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly converted.

See also:
  CSIBCQuaternion::GetMatrix

  CSIBCQuaternion::GetAxisAngle

SI_Error GetAxisAngle | ( | CSIBCVector3D & | out_vAxis,
|  | float & | out_fAngle |
| ) |  |  |

Gets the axis of rotation, and rotation angle about the axis, that is represented by this quaternion.

Parameters:

  | out_vAxis | Receives the axis of rotation.
  | out_fAngle | Receives the angle of rotation about the axis (in radians).

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly converted. SI_ERR_ERROR_MSG - The quaternion could not be converted, axis components and angle are all zero.

See also:
  CSIBCQuaternion::GetXYZRotation

SI_Error Set | ( | SI_Float | in_dX,
|  | SI_Float | in_dY,
|  | SI_Float | in_dZ,
|  | SI_Float | in_dW |
| ) |  |  | `[inline]`

Sets all components of the quaternion.

Parameters:

  | in_dX | Value for the X component of the quaternion.
  | in_dY | Value for the Y component of the quaternion.
  | in_dZ | Value for the Z component of the quaternion.
  | in_dW | Value for the W component of the quaternion.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion was properly set.

See also:
  CSIBCQuaternion::SetX

  CSIBCQuaternion::SetY

  CSIBCQuaternion::SetZ

  CSIBCQuaternion::SetW

void operator= | ( | const CSIBCQuaternion & | in_quat | ) | `[inline]`

Sets this quaternion equal to `in_quat`.

Parameters:

  | in_quat | Quaternion to set this quaternion equal to.

See also:
  CSIBCQuaternion::Init(CSIBCQuaternion &)

SI_Error SelfTest | ( |  | ) | `[inline]`

Tests to see whether this quaternion is valid. If the quaternion is invalid, an assertion will occur.

Returns:
  SI_Error Error code indicating the success or failure of this command.

returns: SI_SUCCESS - The quaternion is valid.

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

- SIBCQuaternion.h