Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Quaternion (const Quaternion &q) | |
Quaternion (const float x, const float y, const float z, const float w) | |
Quaternion | operator* (const Quaternion &q) const |
Quaternion & | operator= (const Quaternion &q) |
float | Magnitude () const |
void | Normalize () |
Quaternion | Conjugate () const |
void | RotationAxisToQuaternion (const float angle, const Vector3D &axis) |
void | EulerToQuaternion (const Vector3D &euler) |
Quaternion | CrossProduct (const Quaternion &q) const |
void | CreateMatrix (float *matrix) const |
void | MatrixToQuaternion (const float *matrix) |
void | Slerp (const Quaternion &q1, const Quaternion &q2, float t) |
Public Attributes | |
float | x |
float | y |
float | z |
float | w |
A rotation quaternion with a vector (xyz) and scalar (w) component.
Ult::Quaternion::Quaternion | ( | ) |
Quaternion constructor. Sets to identity (0,0,0,1).
Ult::Quaternion::Quaternion | ( | const Quaternion & | q | ) |
Quaternion copy constructor.
Ult::Quaternion::Quaternion | ( | const float | x, |
const float | y, | ||
const float | z, | ||
const float | w ) |
Quaternion constructor from x,y,z,w values.
Quaternion Ult::Quaternion::Conjugate | ( | ) | const |
Returns the conjugate of the quaternion = (-x,-y,-z,w).
void Ult::Quaternion::CreateMatrix | ( | float * | matrix | ) | const |
Creates a rotation matrix from this quaternion and stores the result in 'matrix'.
Quaternion Ult::Quaternion::CrossProduct | ( | const Quaternion & | q | ) | const |
Returns the cross product of this and the input quaternion.
void Ult::Quaternion::EulerToQuaternion | ( | const Vector3D & | euler | ) |
Initializes this quaternion from euler angles (in degrees).
float Ult::Quaternion::Magnitude | ( | ) | const |
Returns the magnitude of this quaternion.
void Ult::Quaternion::MatrixToQuaternion | ( | const float * | matrix | ) |
Initializes this quaternion from the rotation component of the input matrix.
void Ult::Quaternion::Normalize | ( | ) |
Normalizes this quaternion.
Quaternion Ult::Quaternion::operator* | ( | const Quaternion & | q | ) | const |
Multiplies this and the input quaternion.
Quaternion & Ult::Quaternion::operator= | ( | const Quaternion & | q | ) |
Sets this quaternion equal to the input quaternion.
void Ult::Quaternion::RotationAxisToQuaternion | ( | const float | angle, |
const Vector3D & | axis ) |
Initializes this quaternion from an angle (in degrees) and axis.
void Ult::Quaternion::Slerp | ( | const Quaternion & | q1, |
const Quaternion & | q2, | ||
float | t ) |
Set this quaternion to the spherical-linear-interpolation of q1 and q2 at time t.
float Ult::Quaternion::w |
float Ult::Quaternion::x |
The vector (x,y,z) and scalar (w) components of the quaternion.
float Ult::Quaternion::y |
float Ult::Quaternion::z |