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

Go to the source code of this file.

Functions

void matrixIdentityFunction (float *matrix)
 Takes a 4 * 4 and sets the elements to the Identity function. More...
 
void matrixTranslate (float *matrix, float x, float y, float z)
 Takes in a 4 * 4 matrix and translates it by the vector defined by x y and z. More...
 
void matrixMultiply (float *destination, float *operand1, float *operand2)
 Takes 2 matrices and multiplies them together. Then stores the result in a third matrix. More...
 
void matrixFrustum (float *matrix, float left, float right, float bottom, float top, float zNear, float zFar)
 Create a viewing frustum and store the result in the first parameter. This is usually called by matrixPerspective. More...
 
void matrixPerspective (float *matrix, float fieldOfView, float aspectRatio, float zNear, float zFar)
 Create a perspective projection matrix and store the results in the first parameter. More...
 
void matrixRotateX (float *matrix, float angle)
 Rotates a matrix around the x axis by a given angle. More...
 
void matrixRotateY (float *matrix, float angle)
 Rotates a matrix around the y axis by a given angle. More...
 
void matrixRotateZ (float *matrix, float angle)
 Rotates a matrix around the Z axis by a given angle. More...
 
void matrixScale (float *matrix, float x, float y, float z)
 Scales a matrix by a given factor in the x, y and z axis. More...
 
float matrixDegreesToRadians (float degrees)
 Function to convert degrees into Radians. More...
 

Function Documentation

float matrixDegreesToRadians ( float  degrees)

Function to convert degrees into Radians.

Parameters
[in]degreesAngle to be converted.
Returns
Converted angle in Radians.

Definition at line 152 of file Matrix.cpp.

void matrixFrustum ( float matrix,
float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)

Create a viewing frustum and store the result in the first parameter. This is usually called by matrixPerspective.

Parameters
[out]matrixDestination of the frustum.
[in]leftLeft side of the frustum.
[in]rightRight side of the frustum.
[in]bottomBottom of the frustum.
[in]topTop of the frustum.
[in]zNearNear visible distance of the frustum.
[in]zFarFar visible distance of the frustum.

Definition at line 79 of file Matrix.cpp.

void matrixIdentityFunction ( float matrix)

Takes a 4 * 4 and sets the elements to the Identity function.

Parameters
[out]matrixPointer to an array of a 4 * 4 matrix. Must be at least 16 elements long.

Definition at line 24 of file Matrix.cpp.

void matrixMultiply ( float destination,
float operand1,
float operand2 
)

Takes 2 matrices and multiplies them together. Then stores the result in a third matrix.

Parameters
[out]destinationA pointer to the array the result of the multiplication should be stored.
[in]operand1A pointer to the first matrix to be multiplied.
[in]operand2A pointer to the second matrix to be multiplied.

Definition at line 59 of file Matrix.cpp.

void matrixPerspective ( float matrix,
float  fieldOfView,
float  aspectRatio,
float  zNear,
float  zFar 
)

Create a perspective projection matrix and store the results in the first parameter.

Parameters
[out]matrixDestination of the perspective projection matrix.
[in]fieldOfViewThe field of view in degrees. How far you expect the camera to see in degrees.
[in]aspectRatioThe aspect ratio of your viewport.
[in]zNearHow close objects can be to the camera before they disappear.
[in]zFarHow far away objects can be before they are no longer drawn.

Definition at line 97 of file Matrix.cpp.

void matrixRotateX ( float matrix,
float  angle 
)

Rotates a matrix around the x axis by a given angle.

Parameters
[in,out]matrixA pointer to the matrix to be rotated
[in]angleA float representing the angle to rotate by in degrees.

Definition at line 105 of file Matrix.cpp.

void matrixRotateY ( float matrix,
float  angle 
)

Rotates a matrix around the y axis by a given angle.

Parameters
[in,out]matrixA pointer to the matrix to be rotated
[in]angleA float representing the angle to rotate by in degrees.

Definition at line 117 of file Matrix.cpp.

void matrixRotateZ ( float matrix,
float  angle 
)

Rotates a matrix around the Z axis by a given angle.

Parameters
[in,out]matrixA pointer to the matrix to be rotated
[in]angleA float representing the angle to rotate by in degrees.

Definition at line 129 of file Matrix.cpp.

void matrixScale ( float matrix,
float  x,
float  y,
float  z 
)

Scales a matrix by a given factor in the x, y and z axis.

Parameters
[in,out]matrixA pointer to the matrix to be scaled.
[in]xScaling factor in the X axis.
[in]yScaling factor in the Y axis.
[in]zScaling factor in the Z axis.

Definition at line 141 of file Matrix.cpp.

void matrixTranslate ( float matrix,
float  x,
float  y,
float  z 
)

Takes in a 4 * 4 matrix and translates it by the vector defined by x y and z.

Parameters
[in,out]matrixPointer to an array of a 4 * 4 matrix. Must be at least 16 elements long
[in]xX component of the translation vector.
[in]yY component of the translation vector.
[in]zZ component of the translation vector.

Definition at line 49 of file Matrix.cpp.