OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Quaternions.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include "Quaternions.h"

Go to the source code of this file.

Functions

Quaternion construct_quaternion (float x, float y, float z, float degs)
 
void construct_modelview_matrix (Quaternion quaternion, float *mat)
 
Quaternion multiply_quaternions (Quaternion a, Quaternion b)
 

Function Documentation

void construct_modelview_matrix ( Quaternion  quaternion,
float mat 
)

Constructs a modelview matrix based on a given quaternion.

Parameters
quaternionQuaternion describing rotation angle and vector to be used for matrix creation.
matArray to store a modelview matrix. Cannot be NULL.

Definition at line 43 of file Quaternions.cpp.

Quaternion construct_quaternion ( float  x,
float  y,
float  z,
float  degs 
)

Function that returns a new quaternion. It inserts the angle in the real part and the vector in the vector part, yielding a quaternion that represents a rotation around the axis.

Parameters
xX coordinate of a vector defining a rotation axis.
yY coordinate of a vector defining a rotation axis.
zZ coordinate of a vector defining a rotation axis.
degsRotation in degrees.
Returns
Result quaternion.

Definition at line 27 of file Quaternions.cpp.

Quaternion multiply_quaternions ( Quaternion  a,
Quaternion  b 
)

Multiplies quaternion a by b and returns the product. NOTE: quaternion multiplication is not commutative.

Parameters
aQuaternion a.
bQuaternion b.
Returns
Product a*b.

Definition at line 71 of file Quaternions.cpp.