Matrix3

3x3 matrix.

Constructor

new L3D.Matrix3(…arguments)

Creates a new matrix.

new Matrix3() // Creates an identity matrix

new Matrix3(Matrix3) // Creates a clone of the given matrix.

new Matrix3(Array[9]) // Creates a Matrix4 from the given array.

new Matarix3(0) // Creates a zero matrix.

new Matrix3(m00, m01, m02,
            m10, m11, m12,
            m20, m21, m22) // Create a matrix from individual elements.
Parameters
arguments* *

Variable arguments for constructor overloading.

Properties

static Identity Matrix3

An identity Matrix3.

static Zero Matrix3

A Matrix3 filled with zeros.

Methods

clone()Matrix3

Create a copy of this matrix.

Returns
Matrix3

determinant() → number

Calculate the determinant of the matrix.

Returns
number

invert()Matrix3

Invert this matrix.

Returns
Matrix3

rotate(angle)Matrix3

Rotate the matrix by a given angle

Parameters
angle number
Returns
Matrix3

scale(v)Matrix3

Scale the matrix by the given vector.

Parameters
v Vector2
Returns
Matrix3

setFrom()

setFrom(m00, m01, m02, m10, m11, m12, m20, m21, m22)

setFrom([m00, m01, m02, m10, m11, m12, m20, m21, m22])

setFrom(Matrix3)

setIdentity()Matrix3

Set the matrix as an identity matrix.

Returns
Matrix3

setQuaternion(q)Matrix3

Set the matrix as a rotation matrix.

Parameters
q Quaternion
Returns
Matrix3

setRotate(angle)Matrix3

Set the matrix as a rotation matrix.

Parameters
angle number
Returns
Matrix3

setScale(v)Matrix3

Set the matrix as a scale matrix.

Parameters
v Vector2
Returns
Matrix3

setTranslate(v)Matrix3

Set the matrix as a translation matrix.

Parameters
v Vector2
Returns
Matrix3

toArray() → Array.<number>

Convert the matrix to an Array.

Returns
Array.<number>

transformVector2(v, z, out)Vector2

Transform a Vector2 by this matrix.

Parameters
v Vector2
z number 1
out Vector2
Returns
Vector2

transformVector3(v, out)Vector3

Transofrm a Vector3 by this matrix.

Parameters
v Vector3
out Vector3
Returns
Vector3

translate(v)Matrix3

Translate the matrix by the given vector.

Parameters
v Vector2
Returns
Matrix3

transpose()Matrix3

Transpose this matrix.

Returns
Matrix3

static invert(m, out)Matrix3

Invert a matrix.

Parameters
m Matrix3
out Matrix3
Returns
Matrix3

static multiply(a, b, out)

Multiply two matrices together.

Parameters
a Matrix3
b Matrix3
out Matrix3

static rotate(m, angle, out)

Rotate a matrix by the given angle.

Parameters
m Matrix3
angle number
out Matrix3

static scale(m, v, out)

Scale a matrix.

Parameters
m Matrix3
v Vector2
out Matrix3

static translate(m, v, out)Matrix3

Translate the matrix by the given vector. Returns a new matrix.

Parameters
m Matrix3
v Vector2
out Matrix3
Returns
Matrix3

static transpose(m, out)Matrix3

Transpose a matrix

Parameters
m Matrix3
out Matrix3
Returns
Matrix3