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::Quaternion ( const Vec3 vec,
float  aW 
)
inline
Parameters
vecVector.
aWw.

Member Function Documentation

◆ Conjugate()

Quaternion Quaternion::Conjugate ( ) const
inline

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

Returns
Conjugate.

◆ CreateFromAxisAngle()

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

◆ FindTwist()

float Quaternion::FindTwist ( const Vec3 axis) const
inline

Finds twist angle around axis.

Parameters
axisAxis.
Returns
Twist angle (
Todo:
in radians? )

◆ FromAxisAngle()

void Quaternion::FromAxisAngle ( const Vec3 axis,
float  angleDeg 
)
inline
Parameters
axisAxis. Should be normalized.
angleDegAngle in degrees.

◆ FromEuler()

void Quaternion::FromEuler ( const Vec3 euler)
inline

◆ FromMatrix()

void Quaternion::FromMatrix ( const Matrix44 mat)
inline
Parameters
matMatrix.

◆ GetAxisAngle()

void Quaternion::GetAxisAngle ( Vec3 outAxis,
float &  outAngleRad 
) const
inline
Parameters
outAxisAxis.
outAngleRadin radians.

◆ GetEuler()

Vec3 Quaternion::GetEuler ( ) const
inline

◆ GetMatrix()

void Quaternion::GetMatrix ( Matrix44 outMatrix) const
inline

Gets matrix for unit-length quaternion.

Parameters
outMatrixcolumn-major order matrix.

◆ operator!=()

bool Quaternion::operator!= ( const Quaternion q) const
inline

Inequality operator.

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

◆ operator*() [1/2]

Quaternion Quaternion::operator* ( const Quaternion aQ) const
inline

Applies rotation aQ to this quaternion and returns the result.

Returns
This quaterion rotated by aQ.

◆ operator*() [2/2]

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.

◆ operator==()

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: