OpenGLPrakt --> math

class cQuaternion

A class for representing a quaternion and its operations.

Contains a class representing a quaternion and allowing operations like multiplying quaternions, transforming vertices and generating a matrix from a quaternion.

Source:
../src/cQuaternion.hh:27

See Also:
cMatrix, cVertex

Constructors Index

cQuaternion
[public] default constructor
cQuaternion
[public] constructor w/ hard initialization of quaternion
cQuaternion
[public] constructor w/ initialization


Methods Index

GetAsMatrix
[public] return the matrix representation of the quaternion
GetAsMatrix
[public] shortcut for retrieving the quaternion in matrix representation prevents allocating temporary on stack
GetInverse
[public] return the inverse of the quaternion
GetLength
[public] return "length" of quaternion
GetS
[public] return s component of quaternion
GetV
[public] return v component of quaternion
Normalize
[public] normalize the quaternion (make it length 1)
operator *
[public] operator * for two quaternions (multiply two quaternions)
operator *
[public] operator * for vertices (applies quaternion to vertex)
operator *=
[public] operator *= for quaternions (multiply two quaternions)
SetIdentity
[public] set quaternion to identity (no transformation/rotation)
SetRotation
[public] set quaternion to represent given rotation (angle in degree)


Constructors

cQuaternion

public cQuaternion ( ) ;

default constructor

cQuaternion

public cQuaternion ( const GLfloat cw ,
                     const GLfloat cx ,
                     const GLfloat cy ,
                     const GLfloat cz ) ;

constructor w/ hard initialization of quaternion

Parameters:
cw scalar value of quaternion
cx x component of complex value
cy y component of complex value
cz z component of complex value

cQuaternion

public cQuaternion ( const GLfloat angle ,
                     const cVertex & axis ) ;

constructor w/ initialization

Parameters:
angle angle in degree
axis vector to rotate around

Methods

operator *

public cQuaternion operator * ( const cQuaternion & q ) const ;

operator * for two quaternions (multiply two quaternions)

Parameters:
q quaternion to multiply with

Return:
resulting cQuaternion object

operator *=

public cQuaternion & operator *= ( const cQuaternion & q ) ;

operator *= for quaternions (multiply two quaternions)

Parameters:
q quaternion to multiply with

Return:
reference to cQuaternion

operator *

public cVertex operator * ( const cVertex & v ) ;

operator * for vertices (applies quaternion to vertex)

Parameters:
v cVertex to transform

Return:
the transformed vertex as cVertex object

SetIdentity

public void SetIdentity ( ) ;

set quaternion to identity (no transformation/rotation)

SetRotation

public void SetRotation ( const GLfloat angle ,
                          const cVertex & axis ) ;

set quaternion to represent given rotation (angle in degree)

Parameters:
angle in degree
axis to turn around

Normalize

public void Normalize ( ) ;

normalize the quaternion (make it length 1)

GetS

public GLfloat GetS ( ) const ;

return s component of quaternion

Return:
GLfloat value of s

GetV

public cVertex GetV ( ) const ;

return v component of quaternion

Return:
cVertex object with value of v

GetLength

public GLfloat GetLength ( ) const ;

return "length" of quaternion

Return:
GLfloat

GetInverse

public cQuaternion GetInverse ( ) ;

return the inverse of the quaternion

Return:
inverse quaternion

GetAsMatrix

public cMatrix GetAsMatrix ( ) ;

return the matrix representation of the quaternion

Return:
cMatrix object representing quaternion

GetAsMatrix

public void GetAsMatrix ( cMatrix & tmp ) ;

shortcut for retrieving the quaternion in matrix representation prevents allocating temporary on stack

Parameters:
tmp reference to cMatrix object

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.