Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::Quaternion Class Reference

#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
 
Quaternionoperator= (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
 

Detailed Description

A rotation quaternion with a vector (xyz) and scalar (w) component.

Constructor & Destructor Documentation

◆ Quaternion() [1/3]

Ult::Quaternion::Quaternion ( )

Quaternion constructor. Sets to identity (0,0,0,1).

◆ Quaternion() [2/3]

Ult::Quaternion::Quaternion ( const Quaternion & q)

Quaternion copy constructor.

◆ Quaternion() [3/3]

Ult::Quaternion::Quaternion ( const float x,
const float y,
const float z,
const float w )

Quaternion constructor from x,y,z,w values.

Member Function Documentation

◆ Conjugate()

Quaternion Ult::Quaternion::Conjugate ( ) const

Returns the conjugate of the quaternion = (-x,-y,-z,w).

◆ CreateMatrix()

void Ult::Quaternion::CreateMatrix ( float * matrix) const

Creates a rotation matrix from this quaternion and stores the result in 'matrix'.

◆ CrossProduct()

Quaternion Ult::Quaternion::CrossProduct ( const Quaternion & q) const

Returns the cross product of this and the input quaternion.

◆ EulerToQuaternion()

void Ult::Quaternion::EulerToQuaternion ( const Vector3D & euler)

Initializes this quaternion from euler angles (in degrees).

◆ Magnitude()

float Ult::Quaternion::Magnitude ( ) const

Returns the magnitude of this quaternion.

◆ MatrixToQuaternion()

void Ult::Quaternion::MatrixToQuaternion ( const float * matrix)

Initializes this quaternion from the rotation component of the input matrix.

◆ Normalize()

void Ult::Quaternion::Normalize ( )

Normalizes this quaternion.

◆ operator*()

Quaternion Ult::Quaternion::operator* ( const Quaternion & q) const

Multiplies this and the input quaternion.

◆ operator=()

Quaternion & Ult::Quaternion::operator= ( const Quaternion & q)

Sets this quaternion equal to the input quaternion.

◆ RotationAxisToQuaternion()

void Ult::Quaternion::RotationAxisToQuaternion ( const float angle,
const Vector3D & axis )

Initializes this quaternion from an angle (in degrees) and axis.

◆ Slerp()

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.

Member Data Documentation

◆ w

float Ult::Quaternion::w

◆ x

float Ult::Quaternion::x

The vector (x,y,z) and scalar (w) components of the quaternion.

◆ y

float Ult::Quaternion::y

◆ z

float Ult::Quaternion::z

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