TDME2 1.9.121
Public Member Functions | Private Attributes | List of all members
Quaternion Class Referencefinal

Quaternion class. More...

#include <tdme/math/Quaternion.h>

Collaboration diagram for Quaternion:
Collaboration graph

Public Member Functions

 Quaternion (const Quaternion &q)
 Public constructor. More...
 
 Quaternion (float x, float y, float z, float w)
 Public constructor. More...
 
 Quaternion (const Vector3 &v, float w)
 Public constructor. More...
 
Quaternionset (float x, float y, float z, float w)
 Set up this quaternion by components. More...
 
Quaternionset (const Quaternion &q)
 Sets up this quaternion by quaternion q. More...
 
Quaternionset (const Vector3 &v, float w)
 Set quaternion. More...
 
float getX () const
 
QuaternionsetX (float x)
 Set X. More...
 
float getY () const
 
QuaternionsetY (float y)
 Set Y. More...
 
float getZ () const
 
QuaternionsetZ (float z)
 Set Z. More...
 
float getW () const
 
QuaternionsetW (float w)
 Set W. More...
 
Quaternionidentity ()
 Set up quaternion identity. More...
 
Quaternioninvert ()
 Inverts this quaternion. More...
 
Quaternionrotate (const Vector3 &axis, float angle)
 Creates a rotation quaternion. More...
 
Quaternionnormalize ()
 Normalize quaternion. More...
 
Quaternionmultiply (const Quaternion q)
 Multiplies this quaternion with quaternion q. More...
 
Quaternionadd (const Quaternion &q)
 Adds given quaternion q to this quaternion. More...
 
Quaternionsub (const Quaternion &q)
 Subtracts given quaternion q from this quaternion. More...
 
Quaternionscale (float value)
 Scales this quaternion with given value. More...
 
Vector3 multiply (const Vector3 &v) const
 Multiplies a quaternion with given vector v. More...
 
Matrix4x4 computeMatrix () const
 Computes a matrix from given. More...
 
array< float, 4 > & getArray () const
 Returns array data. More...
 
float & operator[] (int i)
 Array access operator. More...
 
const float & operator[] (int i) const
 Const array access operator. More...
 
Quaternion operator+ (const Quaternion &q) const
 Operator +. More...
 
Quaternion operator- (const Quaternion &q) const
 Operator -. More...
 
Quaternion operator* (const float f) const
 Operator * (float) More...
 
Quaternion operator* (const Quaternion &q) const
 Operator * (Quaternion&) More...
 
Vector3 operator* (const Vector3 &v) const
 Operattor * (Vector&) More...
 
Quaternion operator/ (const float f) const
 Operator / (f) More...
 
Quaternion operator/ (const Quaternion &q) const
 Operator / (Quaternion&) More...
 
Quaternionoperator+= (const Quaternion &q)
 Operator +=. More...
 
Quaternionoperator-= (Quaternion &q)
 Operator -=. More...
 
Quaternionoperator*= (Quaternion &q)
 Operator *=. More...
 
Quaternionoperator/= (Quaternion &q)
 Operator /=. More...
 
bool operator== (const Quaternion &q) const
 Equality comparison operator. More...
 
bool operator!= (const Quaternion &q) const
 Non equality comparison operator. More...
 
Quaternion clone () const
 Clones the quaternion. More...
 
bool equals (const Quaternion &q) const
 Compares this quaternion with given quaternion. More...
 
bool equals (const Quaternion &q, float tolerance) const
 Compares this quaternion with given quaternion. More...
 
 Quaternion ()
 Public constructor. More...
 

Private Attributes

array< float, 4 > data
 

Detailed Description

Quaternion class.

Author
Andreas Drewke

Definition at line 21 of file Quaternion.h.

Constructor & Destructor Documentation

◆ Quaternion() [1/4]

Quaternion ( const Quaternion q)
inline

Public constructor.

Parameters
qquaternion

Definition at line 32 of file Quaternion.h.

◆ Quaternion() [2/4]

Quaternion ( float  x,
float  y,
float  z,
float  w 
)
inline

Public constructor.

Parameters
xx
yy
zz
ww

Definition at line 43 of file Quaternion.h.

◆ Quaternion() [3/4]

Quaternion ( const Vector3 v,
float  w 
)
inline

Public constructor.

Parameters
vvector
ww

Definition at line 55 of file Quaternion.h.

◆ Quaternion() [4/4]

Quaternion ( )
inline

Public constructor.

Definition at line 509 of file Quaternion.h.

Member Function Documentation

◆ add()

Quaternion & add ( const Quaternion q)
inline

Adds given quaternion q to this quaternion.

Parameters
qquaterion q
Returns
this quaternion

Definition at line 242 of file Quaternion.h.

◆ clone()

Quaternion clone ( ) const
inline

Clones the quaternion.

Returns
new cloned vector

Definition at line 477 of file Quaternion.h.

◆ computeMatrix()

Matrix4x4 computeMatrix ( ) const
inline

Computes a matrix from given.

Returns
resulting matrix

Definition at line 299 of file Quaternion.h.

◆ equals() [1/2]

bool equals ( const Quaternion q) const
inline

Compares this quaternion with given quaternion.

Parameters
qquaternion q
Returns
equality

Definition at line 486 of file Quaternion.h.

◆ equals() [2/2]

bool equals ( const Quaternion q,
float  tolerance 
) const
inline

Compares this quaternion with given quaternion.

Parameters
qquaternion q
tolerancetolerance per component(x, y, z)
Returns
equality

Definition at line 496 of file Quaternion.h.

◆ getArray()

array< float, 4 > & getArray ( ) const
inline

Returns array data.

Returns
array data

Definition at line 324 of file Quaternion.h.

◆ getW()

float getW ( ) const
inline
Returns
w

Definition at line 153 of file Quaternion.h.

◆ getX()

float getX ( ) const
inline
Returns
x

Definition at line 102 of file Quaternion.h.

◆ getY()

float getY ( ) const
inline
Returns
y

Definition at line 119 of file Quaternion.h.

◆ getZ()

float getZ ( ) const
inline
Returns
z

Definition at line 136 of file Quaternion.h.

◆ identity()

Quaternion & identity ( )
inline

Set up quaternion identity.

Returns
this quaternion

Definition at line 171 of file Quaternion.h.

◆ invert()

Quaternion & invert ( )
inline

Inverts this quaternion.

Returns
this quaternion

Definition at line 183 of file Quaternion.h.

◆ multiply() [1/2]

Quaternion & multiply ( const Quaternion  q)
inline

Multiplies this quaternion with quaternion q.

Parameters
qquaterion q
Returns
this quaternion

Definition at line 227 of file Quaternion.h.

◆ multiply() [2/2]

Vector3 multiply ( const Vector3 v) const
inline

Multiplies a quaternion with given vector v.

Parameters
vvector v
Returns
resulting vector 3

Definition at line 281 of file Quaternion.h.

◆ normalize()

Quaternion & normalize ( )
inline

Normalize quaternion.

Definition at line 213 of file Quaternion.h.

◆ operator!=()

bool operator!= ( const Quaternion q) const
inline

Non equality comparison operator.

Parameters
qquaternion to compare to
Returns
non equality

Definition at line 469 of file Quaternion.h.

◆ operator*() [1/3]

Quaternion operator* ( const float  f) const
inline

Operator * (float)

Parameters
fvalue to multiply by
Returns
new quaternion (this * f)

Definition at line 371 of file Quaternion.h.

◆ operator*() [2/3]

Quaternion operator* ( const Quaternion q) const
inline

Operator * (Quaternion&)

Parameters
qquaternion to multiply by
Returns
new quaternion (this * q)

Definition at line 381 of file Quaternion.h.

◆ operator*() [3/3]

Vector3 operator* ( const Vector3 v) const
inline

Operattor * (Vector&)

Parameters
vvector to multiply by
Returns
new Vector ()thic * v

Definition at line 391 of file Quaternion.h.

◆ operator*=()

Quaternion & operator*= ( Quaternion q)
inline

Operator *=.

Parameters
qquaternion to multiply by
Returns
this quaternion multiplied by q

Definition at line 439 of file Quaternion.h.

◆ operator+()

Quaternion operator+ ( const Quaternion q) const
inline

Operator +.

Parameters
qquaternion to add
Returns
new quaternion (this + q)

Definition at line 351 of file Quaternion.h.

◆ operator+=()

Quaternion & operator+= ( const Quaternion q)
inline

Operator +=.

Parameters
qquaternion to add
Returns
this quaternion added by q

Definition at line 421 of file Quaternion.h.

◆ operator-()

Quaternion operator- ( const Quaternion q) const
inline

Operator -.

Parameters
qquaternion to subtrct
Returns
new quaternion (this - q)

Definition at line 361 of file Quaternion.h.

◆ operator-=()

Quaternion & operator-= ( Quaternion q)
inline

Operator -=.

Parameters
qquaternion to substract
Returns
this quaternion substracted by q

Definition at line 430 of file Quaternion.h.

◆ operator/() [1/2]

Quaternion operator/ ( const float  f) const
inline

Operator / (f)

Parameters
qvalue to divide by
Returns
new quaternion (this / f)

Definition at line 400 of file Quaternion.h.

◆ operator/() [2/2]

Quaternion operator/ ( const Quaternion q) const
inline

Operator / (Quaternion&)

Parameters
qquaternion to divide by
Returns
new quaternion (this / q)

Definition at line 410 of file Quaternion.h.

◆ operator/=()

Quaternion & operator/= ( Quaternion q)
inline

Operator /=.

Parameters
qquaternion to devide by
Returns
this quaternion devided by q

Definition at line 448 of file Quaternion.h.

◆ operator==()

bool operator== ( const Quaternion q) const
inline

Equality comparison operator.

Parameters
qquaternion to compare to
Returns
equality

Definition at line 459 of file Quaternion.h.

◆ operator[]() [1/2]

float & operator[] ( int  i)
inline

Array access operator.

Parameters
iindex
Returns
quaternion component

Definition at line 333 of file Quaternion.h.

◆ operator[]() [2/2]

const float & operator[] ( int  i) const
inline

Const array access operator.

Parameters
iindex
Returns
quaternion component

Definition at line 342 of file Quaternion.h.

◆ rotate()

Quaternion & rotate ( const Vector3 axis,
float  angle 
)
inline

Creates a rotation quaternion.

Parameters
axisaxis
angleangle
Returns
this quaternion

Definition at line 196 of file Quaternion.h.

◆ scale()

Quaternion & scale ( float  value)
inline

Scales this quaternion with given value.

Parameters
valuevalue
Returns
this quaternion

Definition at line 268 of file Quaternion.h.

◆ set() [1/3]

Quaternion & set ( const Quaternion q)
inline

Sets up this quaternion by quaternion q.

Parameters
qq
Returns

Definition at line 81 of file Quaternion.h.

◆ set() [2/3]

Quaternion & set ( const Vector3 v,
float  w 
)
inline

Set quaternion.

Parameters
vvector
ww

Definition at line 91 of file Quaternion.h.

◆ set() [3/3]

Quaternion & set ( float  x,
float  y,
float  z,
float  w 
)
inline

Set up this quaternion by components.

Parameters
xx
yy
zz
ww

Definition at line 68 of file Quaternion.h.

◆ setW()

Quaternion & setW ( float  w)
inline

Set W.

Parameters
ww
Returns
this quaternion

Definition at line 162 of file Quaternion.h.

◆ setX()

Quaternion & setX ( float  x)
inline

Set X.

Parameters
xx
Returns
this quaternion

Definition at line 111 of file Quaternion.h.

◆ setY()

Quaternion & setY ( float  y)
inline

Set Y.

Parameters
yy
Returns
this quaternion

Definition at line 128 of file Quaternion.h.

◆ setZ()

Quaternion & setZ ( float  z)
inline

Set Z.

Parameters
zz
Returns
this quaternion

Definition at line 145 of file Quaternion.h.

◆ sub()

Quaternion & sub ( const Quaternion q)
inline

Subtracts given quaternion q from this quaternion.

Parameters
qquaterion q
Returns
this quaternion

Definition at line 255 of file Quaternion.h.

Member Data Documentation

◆ data

array<float, 4> data
private

Definition at line 25 of file Quaternion.h.


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