Class: Matrix

The Matrix class is used to represent a 4x4 transformation matrix. Matrix objects are used to transform points in 3D space.

Member Variables

(none)

Member Functions


void Set(mat)

Set the value of a matrix by copying an existing matrix.

mat (Matrix): another Matrix object whose value you wish to copy Return value: none
void Multiply(mat)

Multiplies two matrices. The calling object is multiplied by the matrix "mat".

mat (Matrix): a Matrix object to multiply into the calling object Return value: none
void Transform(vec2)

Apply a matrix transformation to a 2D vector object.

vec2 (Vector2): a vector to transform Return value: none
void Transform(vec3)

Apply a matrix transformation to a 3D vector object.

vec3 (Vector3): a vector to transform Return value: none
void Invert()

Invert the matrix.

Return value: none
void Identity()

Set the matrix to be an identity matrix. An identity matrix has no transformation - any vectors transformed by it will retain their original positions. Use this function to reset a matrix before creating a different transformation.

Return value: none
void Translate(dx, dy, dz)

Prepend a translation onto the current matrix.

dx (float): the x value of the translation dy (float): the y value of the translation dz (float): the z value of the translation Return value: none
void Scale(sx, sy, sz)

Prepend a scale onto the current matrix.

sx (float): the x value of the scale sy (float): the y value of the scale sz (float): the z value of the scale Return value: none
void Rotate(axis, angle)

Prepend a rotation onto the current matrix.

axis (int): the angle (in radians) to rotate about (axis constants can be found here) angle (float): the angle (in radians) to rotate the vector Return value: none
void Perspective(alpha, near, far, aspect)

Prepend a perspective transform onto the current matrix.

alpha (float): the field of view angle (in radians) near (float): distance from the virtual eye to the near clipping plane far (float): distance from the virtual eye to the far clipping plane aspect (float): aspect ratio of the final viewing plane Return value: none