A set of functions that perform mathematical operations on 2x2 Matrices.

- member of jStage

Though create(fx, fy, rx, ry) initializes a matrix as a 4-element Float32Array, any array object with four elements may be used with these functions. See tojicode.com for more information about this implementation.

- clone(mat)
- copy(mat, out)
- create(fx, fy, rx, ry)
- createIdentity()
- identity(out)
- rotate(mat, rad, out)

Initializes a new Float32Array with four elements for use as a 2x2 matrix, taking it's initial values from another matrix object.

mat:A compatible array-matrix object to clone.

A new Float32Array with four elements representing a 2x2 matrix.

Sets the values of the given matrix to the values of another matrix.

mat:The matrix object from which you're copying values.

out:The matrix object to which you're assigning values.

The matrix object passed as the out parameter.

Initializes a new Float32Array with four elements for use as a 2x2 matrix.

fx:The initial value for the top-left component.

fy:The initial value for the top-right component.

rx:The initial value for the bottom-left component.

ry:The initial value for the bottom-right component.

A new Float32Array with four elements representing a 2x2 matrix.

Initializes a new Float32Array with four elements for use as a 2x2 matrix, with the initial values set as per the 2x2 identity matrix.

A new Float32Array with four elements representing a 2x2 matrix.

Sets the values of the given matrix to the 2x2 indentity matrix.

out:The matrix object to which you're assigning the identity matrix values.

The matrix object passed as the out parameter.

Rotates a coordinate system represented by a given matrix by a value in radians.

mat:The matrix object with the values you're rotating.

rad:The amount, in radians, by which to rotate the given matrix.

out:The matrix object in which to store the rotation result.

The matrix object passed as the out parameter.