Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::Quaternion Class Reference

Quaternion class. More...

#include <aeongames/Quaternion.hpp>

Collaboration diagram for AeonGames::Quaternion:
Collaboration graph

Public Member Functions

DLL Quaternion ()
 Default constructor.
DLL Quaternion (float w, float x, float y, float z)
 Construct a quaternion from individual components.
DLL Quaternion (const float *aData)
 Construct a quaternion from a float array.
DLL void Get (float *aData) const
 Copy the quaternion components to a float array.
DLL ~Quaternion ()
 destructor.
DLL Matrix4x4 GetMatrix4x4 () const
 Convert the quaternion to a 4x4 rotation matrix.
DLL Matrix3x3 GetMatrix3x3 () const
 Convert the quaternion to a 3x3 rotation matrix.

Operators

DLL Quaternionoperator= (const float *aLhs)
 Assign from a raw float array.
DLL Quaternionoperator*= (const Quaternion &lhs)
 Multiply this quaternion by another quaternion.
DLL float operator[] (const size_t aIndex) const
 Access a quaternion component by index (const).
DLL float & operator[] (const size_t aIndex)
 Access a quaternion component by index.
DLL QuaternionNormalize ()
 Normalize this quaternion in place.
DLL Vector3 GetEuler () const
 Get the Euler angle representation of this quaternion.
DLL QuaternionSetEuler (const Vector3 &aEuler)
 Set the quaternion from Euler angles.
static DLL const Quaternion GetFromAxisAngle (float angle, float x, float y, float z)
 Create a quaternion from an axis-angle representation.
static DLL const Quaternion GetFromEuler (const Vector3 &aEuler)
 Create a quaternion from Euler angles.

Detailed Description

Quaternion class.

Definition at line 33 of file Quaternion.hpp.

Constructor & Destructor Documentation

◆ Quaternion() [1/2]

AeonGames::Quaternion::Quaternion ( float w,
float x,
float y,
float z )

Construct a quaternion from individual components.

Parameters
wThe scalar (real) component.
xThe X imaginary component.
yThe Y imaginary component.
zThe Z imaginary component.

Definition at line 28 of file Quaternion.cpp.

◆ Quaternion() [2/2]

AeonGames::Quaternion::Quaternion ( const float * aData)

Construct a quaternion from a float array.

Parameters
aDataPointer to an array of at least 4 floats in W, X, Y, Z order.

Definition at line 33 of file Quaternion.cpp.

Member Function Documentation

◆ Get()

void AeonGames::Quaternion::Get ( float * aData) const

Copy the quaternion components to a float array.

Parameters
aDataPointer to an array of at least 4 floats to receive W, X, Y, Z values.

Definition at line 265 of file Quaternion.cpp.

◆ GetEuler()

Vector3 AeonGames::Quaternion::GetEuler ( ) const

Get the Euler angle representation of this quaternion.

Returns
A vector containing the Euler angles in degrees.

Definition at line 270 of file Quaternion.cpp.

◆ GetFromAxisAngle()

const Quaternion AeonGames::Quaternion::GetFromAxisAngle ( float angle,
float x,
float y,
float z )
static

Create a quaternion from an axis-angle representation.

Parameters
angleAngle in degrees of rotation.
xX component of the axis of rotation.
yY component of the axis of rotation.
zZ component of the axis of rotation.
Returns
The resulting quaternion.

Definition at line 228 of file Quaternion.cpp.

◆ GetFromEuler()

const Quaternion AeonGames::Quaternion::GetFromEuler ( const Vector3 & aEuler)
static

Create a quaternion from Euler angles.

Parameters
aEulerA vector containing Euler angles in degrees.
Returns
The resulting quaternion.

Definition at line 241 of file Quaternion.cpp.

◆ GetMatrix3x3()

Matrix3x3 AeonGames::Quaternion::GetMatrix3x3 ( ) const

Convert the quaternion to a 3x3 rotation matrix.

Returns
The equivalent 3x3 rotation matrix.

Definition at line 77 of file Quaternion.cpp.

◆ GetMatrix4x4()

Matrix4x4 AeonGames::Quaternion::GetMatrix4x4 ( ) const

Convert the quaternion to a 4x4 rotation matrix.

Returns
The equivalent 4x4 rotation matrix.

Definition at line 40 of file Quaternion.cpp.

◆ Normalize()

Quaternion & AeonGames::Quaternion::Normalize ( )

Normalize this quaternion in place.

Returns
Reference to this quaternion after normalization.

Definition at line 246 of file Quaternion.cpp.

◆ operator*=()

Quaternion & AeonGames::Quaternion::operator*= ( const Quaternion & lhs)

Multiply this quaternion by another quaternion.

Definition at line 116 of file Quaternion.cpp.

◆ operator=()

Quaternion & AeonGames::Quaternion::operator= ( const float * aLhs)

Assign from a raw float array.

Definition at line 110 of file Quaternion.cpp.

◆ operator[]() [1/2]

float & AeonGames::Quaternion::operator[] ( const size_t aIndex)

Access a quaternion component by index.

Definition at line 222 of file Quaternion.cpp.

◆ operator[]() [2/2]

float AeonGames::Quaternion::operator[] ( const size_t aIndex) const

Access a quaternion component by index (const).

Definition at line 216 of file Quaternion.cpp.

◆ SetEuler()

Quaternion & AeonGames::Quaternion::SetEuler ( const Vector3 & aEuler)

Set the quaternion from Euler angles.

Parameters
aEulerA vector containing the Euler angles in degrees.
Returns
Reference to this quaternion.

Definition at line 300 of file Quaternion.cpp.


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