Public Attributes

decQuaternion Class Reference

4 Component Quaternion. More...

#include <decQuaternion.h>

List of all members.

Public Member Functions

Constructors and Destructors
 decQuaternion ()
 Creates a new quaternion initialized to no rotation.
 decQuaternion (float nx, float ny, float nz, float nw)
 Creates a new quaternion with the given values.
 decQuaternion (const decQuaternion &q)
 Creates a new quaternion with the values of another quaternion.
Management
float Length () const
 Retrieves the length of the quaternion.
void Normalize ()
 Normalizes the quaternion.
decQuaternion Conjugate () const
 Retrieves the conjugation of this quaternion.
decQuaternion Slerp (const decQuaternion &other, float factor) const
 Calculates the slerp of this quaternion with another given an interpolation factor.
bool IsEqualTo (const decQuaternion &q, float threshold=0.0001) const
 Determines if the components of this quaternion are equal to another one with respect to a threshold.
void SetZero ()
 Sets all components to 0 and w to 1.
void Set (float nx, float ny, float nz, float nw)
 Sets the components to the given values.
void Set (const decQuaternion &q)
 Sets the quaternion from another one.
Operators
decQuaternion operator- () const
 Retrieves the negation of this quaternion.
decQuaternionoperator= (const decQuaternion &q)
 Sets the components of this quaternion to the values of another one.
decQuaternionoperator+= (const decQuaternion &q)
 Adds the components of another quaternion to this one.
decQuaternionoperator-= (const decQuaternion &q)
 Subtracts the components of another quaternion from this quaternion.
decQuaternionoperator*= (float k)
 Multiplies the components of this quaternion with a value k.
decQuaternionoperator/= (float k)
 Divides the components of this quaternion by a value k.
decQuaternion operator+ (const decQuaternion &q) const
 Retrieves a new quaternion with the sum of this quaternion with another one.
decQuaternion operator- (const decQuaternion &q) const
 Retrieves a new quaternion with the difference of this quaternion to another one.
decQuaternion operator* (float k) const
 Retrieves a new quaternion with this quaternion scaled by k.
decQuaternion operator* (const decQuaternion &q) const
 Retrieves a new quaternion with this quaternion multiplied by another quaternion.
decQuaternion operator/ (float k) const
 Retrieves a new quaternion with this quaternion divided by k.
decVector operator* (const decVector &v) const
 Rotate a vector by this quaternion.
decDVector operator* (const decDVector &v) const
 Rotate a vector by this quaternion.
bool operator< (const decQuaternion &q) const
 Determines if all the components of this quaternion are less then the components of another one.
bool operator> (const decQuaternion &q) const
 Determines if all the components of this quaternion are greater then the components of another one.
bool operator<= (const decQuaternion &q) const
 Determines if all the components of this quaternion are less then or equal to the components of another one.
bool operator>= (const decQuaternion &q) const
 Determines if all the components of this quaternion are greater then or equal to the components of another one.

Public Attributes

float w
 W Component of quaternion.
float x
 X Component of quaternion.
float y
 Y Component of quaternion.
float z
 Z Component of quaternion.

Detailed Description

4 Component Quaternion.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

decQuaternion::decQuaternion (  ) [inline]

Creates a new quaternion initialized to no rotation.

References w, x, y, and z.

Referenced by Conjugate(), operator*(), operator+(), operator-(), and operator/().

decQuaternion::decQuaternion ( float  nx,
float  ny,
float  nz,
float  nw 
) [inline]

Creates a new quaternion with the given values.

References w, x, y, and z.

decQuaternion::decQuaternion ( const decQuaternion q ) [inline]

Creates a new quaternion with the values of another quaternion.

References w, x, y, and z.


Member Function Documentation

decQuaternion decQuaternion::Conjugate (  ) const [inline]

Retrieves the conjugation of this quaternion.

References decQuaternion(), w, x, y, and z.

bool decQuaternion::IsEqualTo ( const decQuaternion q,
float  threshold = 0.0001 
) const

Determines if the components of this quaternion are equal to another one with respect to a threshold.

float decQuaternion::Length (  ) const

Retrieves the length of the quaternion.

void decQuaternion::Normalize (  )

Normalizes the quaternion.

If the length of the quaternion is 0 an exception is thrown.

decQuaternion decQuaternion::operator* ( float  k ) const [inline]

Retrieves a new quaternion with this quaternion scaled by k.

References decQuaternion(), w, x, y, and z.

decQuaternion decQuaternion::operator* ( const decQuaternion q ) const [inline]

Retrieves a new quaternion with this quaternion multiplied by another quaternion.

References decQuaternion(), w, x, y, and z.

decVector decQuaternion::operator* ( const decVector v ) const

Rotate a vector by this quaternion.

decDVector decQuaternion::operator* ( const decDVector v ) const

Rotate a vector by this quaternion.

decQuaternion& decQuaternion::operator*= ( float  k ) [inline]

Multiplies the components of this quaternion with a value k.

References w, x, y, and z.

decQuaternion decQuaternion::operator+ ( const decQuaternion q ) const [inline]

Retrieves a new quaternion with the sum of this quaternion with another one.

References decQuaternion(), w, x, y, and z.

decQuaternion& decQuaternion::operator+= ( const decQuaternion q ) [inline]

Adds the components of another quaternion to this one.

References w, x, y, and z.

decQuaternion decQuaternion::operator- (  ) const [inline]

Retrieves the negation of this quaternion.

References decQuaternion(), w, x, y, and z.

decQuaternion decQuaternion::operator- ( const decQuaternion q ) const [inline]

Retrieves a new quaternion with the difference of this quaternion to another one.

References decQuaternion(), w, x, y, and z.

decQuaternion& decQuaternion::operator-= ( const decQuaternion q ) [inline]

Subtracts the components of another quaternion from this quaternion.

References w, x, y, and z.

decQuaternion decQuaternion::operator/ ( float  k ) const [inline]

Retrieves a new quaternion with this quaternion divided by k.

If k is 0 an exception is thrown.

References decQuaternion(), THROW, w, x, y, and z.

decQuaternion& decQuaternion::operator/= ( float  k ) [inline]

Divides the components of this quaternion by a value k.

If the value k is 0 an exception is thrown.

References THROW, w, x, y, and z.

bool decQuaternion::operator< ( const decQuaternion q ) const [inline]

Determines if all the components of this quaternion are less then the components of another one.

References w, x, y, and z.

bool decQuaternion::operator<= ( const decQuaternion q ) const [inline]

Determines if all the components of this quaternion are less then or equal to the components of another one.

References w, x, y, and z.

decQuaternion& decQuaternion::operator= ( const decQuaternion q ) [inline]

Sets the components of this quaternion to the values of another one.

References w, x, y, and z.

bool decQuaternion::operator> ( const decQuaternion q ) const [inline]

Determines if all the components of this quaternion are greater then the components of another one.

References w, x, y, and z.

bool decQuaternion::operator>= ( const decQuaternion q ) const [inline]

Determines if all the components of this quaternion are greater then or equal to the components of another one.

References w, x, y, and z.

void decQuaternion::Set ( const decQuaternion q ) [inline]

Sets the quaternion from another one.

References w, x, y, and z.

void decQuaternion::Set ( float  nx,
float  ny,
float  nz,
float  nw 
) [inline]

Sets the components to the given values.

References w, x, y, and z.

void decQuaternion::SetZero (  ) [inline]

Sets all components to 0 and w to 1.

References w, x, y, and z.

decQuaternion decQuaternion::Slerp ( const decQuaternion other,
float  factor 
) const

Calculates the slerp of this quaternion with another given an interpolation factor.


Member Data Documentation


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