Aether3D Game Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Quaternion Class Reference

Stores an orientation. More...

#include <Quaternion.hpp>

Public Member Functions

 Quaternion ()
 Constructor.
 
 Quaternion (const Vec3 &vec, float aW)
 
Vec3 operator* (const Vec3 &vec) const
 Multiplying a quaternion q with a vector v applies the q-rotation to vec. More...
 
Quaternion operator* (const Quaternion &aQ) const
 Applies rotation aQ to this quaternion and returns the result. More...
 
bool operator== (const Quaternion &q) const
 
bool operator!= (const Quaternion &q) const
 
Quaternion Conjugate () const
 
float FindTwist (const Vec3 &axis) const
 Finds twist angle around axis. More...
 
void GetAxisAngle (Vec3 &outAxis, float &outAngleRad) const
 
void FromEuler (const Vec3 &euler)
 
void FromAxisAngle (const Vec3 &axis, float angleDeg)
 
void FromMatrix (const Matrix44 &mat)
 
void GetMatrix (Matrix44 &outMatrix) const
 
Vec3 GetEuler () const
 
void Normalize ()
 Normalizes the quaternion if it's not near unit-length already.
 

Static Public Member Functions

static Quaternion CreateFromAxisAngle (const Vec3 &axis, float angleDeg)
 

Public Attributes

float x
 
float y
 
float z
 
float w
 

Detailed Description

Stores an orientation.

Constructor & Destructor Documentation

Quaternion::Quaternion ( const Vec3 vec,
float  aW 
)
inline
Parameters
vecVector.
aWw.

Member Function Documentation

Quaternion Quaternion::Conjugate ( ) const
inline

Gets conjugate. If the quaternion is of unit length, the conjugate is the inverse.

Returns
Conjugate.
static Quaternion Quaternion::CreateFromAxisAngle ( const Vec3 axis,
float  angleDeg 
)
inlinestatic
Parameters
axisAxis. Should be normalized.
angleDegAngle in degrees.
float Quaternion::FindTwist ( const Vec3 axis) const
inline

Finds twist angle around axis.

Parameters
axisAxis.
Returns
Twist angle (
Todo:
in radians? )
void Quaternion::FromAxisAngle ( const Vec3 axis,
float  angleDeg 
)
inline
Parameters
axisAxis. Should be normalized.
angleDegAngle in degrees.
void Quaternion::FromEuler ( const Vec3 euler)
inline
void Quaternion::FromMatrix ( const Matrix44 mat)
inline
Parameters
matMatrix.
void Quaternion::GetAxisAngle ( Vec3 outAxis,
float &  outAngleRad 
) const
inline
Parameters
outAxisAxis.
outAngleRadin radians.
Vec3 Quaternion::GetEuler ( ) const
inline
void Quaternion::GetMatrix ( Matrix44 outMatrix) const
inline

Gets matrix for unit-length quaternion.

Parameters
outMatrixcolumn-major order matrix.
bool Quaternion::operator!= ( const Quaternion q) const
inline

Inequality operator.

Parameters
qTested Quaternion.
Returns
True if quaternions are not component-wise equal, false otherwise.
Vec3 Quaternion::operator* ( const Vec3 vec) const
inline

Multiplying a quaternion q with a vector v applies the q-rotation to vec.

Parameters
vecInput vector.
Returns
Output vector that's rotated by this Quaternion.
Quaternion Quaternion::operator* ( const Quaternion aQ) const
inline

Applies rotation aQ to this quaternion and returns the result.

Returns
This quaterion rotated by aQ.
bool Quaternion::operator== ( const Quaternion q) const
inline

Equality operator.

Parameters
qTested Quaternion.
Returns
True if quaternions are component-wise equal, false otherwise.

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