Mali OpenGL ES SDK  2.0.0
A simple framework to aid development of OpenGL ES applications targeting ARM Mali platforms.
 All Classes Files Functions Variables Enumerations Enumerator
MaliSDK::Matrix Class Reference

Functions for manipulating matrices. More...

#include <Matrix.h>

List of all members.

Public Member Functions

float * getAsArray (void)
 Get the matrix elements as a column major order array.
 Matrix (void)
 Default constructor.
float & operator[] (unsigned element)
 Array operator for accessing the elements of the matrix.
Matrix operator* (Matrix right)
 Multiply operator to post multiply a matrix by another.
 Matrix (const float *array)
 Constructor from element array.
void print (void)
 Print the matrix.

Static Public Member Functions

static float degreesToRadians (float degrees)
 Convert an angle in degrees to radians.
static Vec4f vertexTransform (Vec4f *vector, Matrix *matrix)
 Transform a 4D vertex by a matrix.
static Vec3f vertexTransform (Vec3f *vector, Matrix *matrix)
 Transform a 3D vertex by a matrix.
static void matrixTranspose (Matrix *matrix)
 Transpose a matrix in-place.
static Matrix createRotationX (float angle)
 Create and return a rotation matrix around the x-axis matrix.
static Matrix createRotationY (float angle)
 Create and return a rotation matrix around the y-axis matrix.
static Matrix createRotationZ (float angle)
 Create and return a rotation matrix around the z-axis matrix.
static Matrix createTranslation (float x, float y, float z)
 Create and return a translation matrix.
static Matrix createScaling (float x, float y, float z)
 Create and return a scaling matrix.
static Matrix matrixPerspective (float FOV, float ratio, float zNear, float zFar)
 Create and return a perspective projection matrix.
static Matrix matrixOrthographic (float left, float right, float bottom, float top, float zNear, float zFar)
 Create and return an orthographic projection matrix.
static Matrix matrixInvert (Matrix *matrix)
 Get the inverse of a matrix.
static float matrixDeterminant (float *matrix)
 Calculate determinant of supplied 3x3 matrix.
static float matrixDeterminant (Matrix *matrix)
 Calculate determinant of supplied 4x4 matrix.
static Matrix matrixScale (Matrix *matrix, float scale)
 Scale each element in a matrix by a constant.

Static Public Attributes

static Matrix identityMatrix = Matrix(identityArray)
 The identity matrix.

Static Private Member Functions

static Matrix multiply (Matrix *left, Matrix *right)
 Multiply 2 matrices to return a third.

Private Attributes

float elements [16]
 A 16 element floating point array used to represent a 4x4 matrix.

Detailed Description

Functions for manipulating matrices.


Constructor & Destructor Documentation

MaliSDK::Matrix::Matrix ( const float *  array)

Constructor from element array.

Parameters:
[in]arrayA column major order array to use as the matrix elements.

Member Function Documentation

Matrix MaliSDK::Matrix::createRotationX ( float  angle)
static

Create and return a rotation matrix around the x-axis matrix.

Parameters:
[in]angleAngle of rotation (in degrees).
Returns:
A rotation matrix around the x-axis matrix with the required angle of rotation.
Matrix MaliSDK::Matrix::createRotationY ( float  angle)
static

Create and return a rotation matrix around the y-axis matrix.

Parameters:
[in]angleAngle of rotation (in degrees).
Returns:
A rotation matrix around the y-axis matrix with the required angle of rotation.
Matrix MaliSDK::Matrix::createRotationZ ( float  angle)
static

Create and return a rotation matrix around the z-axis matrix.

Parameters:
[in]angleAngle of rotation (in degrees).
Returns:
A rotation matrix around the z-axis matrix with the required angle of rotation.
Matrix MaliSDK::Matrix::createScaling ( float  x,
float  y,
float  z 
)
static

Create and return a scaling matrix.

Parameters:
[in]xScale factor in the x-axis.
[in]yScale factor in the y-axis.
[in]zScale factor in the z-axis.
Returns:
A scaling matrix with the required scaling factors.
Matrix MaliSDK::Matrix::createTranslation ( float  x,
float  y,
float  z 
)
static

Create and return a translation matrix.

Parameters:
[in]xDistance to translate in the x-axis.
[in]yDistance to translate in the y-axis.
[in]zDistance to translate in the z-axis.
Returns:
A translation matrix with the required translation distances.
float MaliSDK::Matrix::degreesToRadians ( float  degrees)
static

Convert an angle in degrees to radians.

Parameters:
[in]degreesThe angle (in degrees) to convert to radians.
float * MaliSDK::Matrix::getAsArray ( void  )

Get the matrix elements as a column major order array.

Returns:
A pointer to the matrix elements.
float MaliSDK::Matrix::matrixDeterminant ( float *  matrix)
static

Calculate determinant of supplied 3x3 matrix.

Parameters:
[in]matrixThe matrix to calculate the determinant of (supplied as a 9 element float array in column major order).
Returns:
The determinant of the supplied matrix.
float MaliSDK::Matrix::matrixDeterminant ( Matrix matrix)
static

Calculate determinant of supplied 4x4 matrix.

Parameters:
[in]matrixThe matrix to calculate the determinant of.
Returns:
The determinant of the supplied matrix.
Matrix MaliSDK::Matrix::matrixInvert ( Matrix matrix)
static

Get the inverse of a matrix.

Parameters:
[in]matrixThe matrix to invert.
Returns:
The inverse matrix of matrix.
Matrix MaliSDK::Matrix::matrixOrthographic ( float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)
static

Create and return an orthographic projection matrix.

Assumes Z is positive going away from the user's view (left-hand coordinate system).

Parameters:
[in]leftThe coordinate for the left vertical clipping plane.
[in]rightThe coordinate for the right vertical clipping plane.
[in]bottomThe coordinate for the bottom horizontal clipping plane.
[in]topThe coordinate for the top horizontal clipping plane.
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns:
An orthographic projection matrix.
Matrix MaliSDK::Matrix::matrixPerspective ( float  FOV,
float  ratio,
float  zNear,
float  zFar 
)
static

Create and return a perspective projection matrix.

Parameters:
[in]FOVThe field of view angle (in degrees) in the y direction.
[in]ratioThe ratio used to calculate the field of view in the x direction. The ratio of x (width) to y (height).
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns:
A perspective projection matrix.
Matrix MaliSDK::Matrix::matrixScale ( Matrix matrix,
float  scale 
)
static

Scale each element in a matrix by a constant.

Parameters:
[in]matrixThe matrix to scale.
[in]scaleThe scale factor
Returns:
The matrix matrix scaled by scale
void MaliSDK::Matrix::matrixTranspose ( Matrix matrix)
static

Transpose a matrix in-place.

Parameters:
[in,out]matrixThe matrix to transpose.
Matrix MaliSDK::Matrix::multiply ( Matrix left,
Matrix right 
)
staticprivate

Multiply 2 matrices to return a third.

Note:
When multiplying matrices the ordering of the parameters affects the result.
Parameters:
[in]leftFirst matrix to multiply.
[in]rightSecond matrix to multiply.
Returns:
The result of left * right
Matrix MaliSDK::Matrix::operator* ( Matrix  right)

Multiply operator to post multiply a matrix by another.

Parameters:
[in]rightThe matrix to post multiply by.
Returns:
The result of matrix * right.
float & MaliSDK::Matrix::operator[] ( unsigned  element)

Array operator for accessing the elements of the matrix.

Parameters:
[in]elementThe element index of the matrix (accepts 0-15).
Returns:
The element of the matrix.
Vec4f MaliSDK::Matrix::vertexTransform ( Vec4f vector,
Matrix matrix 
)
static

Transform a 4D vertex by a matrix.

Parameters:
[in]vectorThe 4D vector to be transformed.
[in]matrixThe transformation matrix.
Returns:
The result of matrix x vector
Vec3f MaliSDK::Matrix::vertexTransform ( Vec3f vector,
Matrix matrix 
)
static

Transform a 3D vertex by a matrix.

Parameters:
[in]vectorThe 3D vector to be transformed.
[in]matrixThe transformation matrix.
Returns:
The result of matrix x vector

Member Data Documentation

float MaliSDK::Matrix::elements[16]
private

A 16 element floating point array used to represent a 4x4 matrix.

Note:
Items are stored in column major order as OpenGL ES expects them.
Matrix MaliSDK::Matrix::identityMatrix = Matrix(identityArray)
static

The identity matrix.

A matrix with 1's on the main diagonal and 0's everywhere else.


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