Class: Matrix4

Matrix4()

A 4x4 matrix. Its elements are stored in column-major order.

Constructor

new Matrix4()

Creates a new identity Matrix4.
Source:

Members

(static) identity

An identity Matrix4.
Source:

(static) zero

A Matrix4 with all elements equal to zero.
Source:

Methods

clone() → {Matrix4}

Creates a clone of the matrix.
Source:
Returns:
The cloned matrix.
Type
Matrix4

copy(matrix) → {Matrix4}

Copies the elements from another matrix.
Parameters:
Name Type Description
matrix Matrix4 The matrix to copy the elements from.
Source:
Returns:
The matrix.
Type
Matrix4

determinant() → {Number}

Calculates the determinant of the matrix.
Source:
Returns:
The determinant of the matrix.
Type
Number

equals(matrix) → {Boolean}

Compares if the elements of the matrix are equal to the elements of another matrix.
Parameters:
Name Type Description
matrix Matrix4 The matrix to compare the components to.
Source:
Returns:
A value indicating whether all the elements are equal.
Type
Boolean

invert() → {Matrix4}

Inverts the matrix.
Source:
Returns:
The matrix.
Type
Matrix4

lookAt(source, target, up) → {Vector3}

Sets the matrix to a view matrix that looks at a target.
Parameters:
Name Type Description
source Vector3 The position to translate to.
target Vector3 The target to look at.
up Vector3 The up direction.
Source:
Returns:
The matrix.
Type
Vector3

makeOrthographic(left, right, top, bottom, near, far) → {Matrix4}

Sets the matrix to an orthographic projection matrix.
Parameters:
Name Type Description
left Number The left clipping plane distance.
right Number The right clipping plane distance.
top Number The top clipping plane distance.
bottom Number The bottom clipping plane distance.
near Number The near clipping plane distance.
far Number The far clipping plane distance.
Source:
Returns:
The matrix.
Type
Matrix4

makePerspective(left, right, top, bottom, near, far) → {Matrix4}

Sets the matrix to a perspective projection matrix.
Parameters:
Name Type Description
left Number The left clipping plane distance.
right Number The right clipping plane distance.
top Number The top clipping plane distance.
bottom Number The bottom clipping plane distance.
near Number The near clipping plane distance.
far Number The far clipping plane distance.
Source:
Returns:
The matrix.
Type
Matrix4

makeRotationX(theta) → {Matrix4}

Sets the matrix to a rotation matrix around the x axis.
Parameters:
Name Type Description
theta Number The angle of the rotation in radians.
Source:
Returns:
The matrix.
Type
Matrix4

makeRotationY(theta) → {Matrix4}

Sets the matrix to a rotation matrix around the y axis.
Parameters:
Name Type Description
theta Number The angle of the rotation in radians.
Source:
Returns:
The matrix.
Type
Matrix4

makeRotationZ(theta) → {Matrix4}

Sets the matrix to a rotation matrix around the z axis.
Parameters:
Name Type Description
theta Number The angle of the rotation in radians.
Source:
Returns:
The matrix.
Type
Matrix4

makeScale(scale) → {Matrix4}

Sets the matrix to a scale matrix.
Parameters:
Name Type Description
scale Vector3 The vector containing the scale values.
Source:
Returns:
The matrix.
Type
Matrix4

makeScaleValues(x, y, z) → {Matrix4}

Sets the matrix to a scale matrix.
Parameters:
Name Type Description
x Number The scale along the x axis.
y Number The scale along the y axis.
z Number The scale along the z axis.
Source:
Returns:
The matrix.
Type
Matrix4

makeTranslation(translation) → {Matrix4}

Sets the matrix to a translation matrix.
Parameters:
Name Type Description
translation Vector3 The vector containing the translation values.
Source:
Returns:
The matrix.
Type
Matrix4

makeTranslationValues(x, y, z) → {Matrix4}

Sets the matrix to a translation matrix.
Parameters:
Name Type Description
x Number The translation along the x axis.
y Number The translation along the y axis.
z Number The translation along the z axis.
Source:
Returns:
The matrix.
Type
Matrix4

multiply(a) → {Matrix4}

Post-multiplies another matrix, and sets this matrix to the result.
Parameters:
Name Type Description
a Matrix4 The matrix to post-multiply with.
Source:
Returns:
The matrix.
Type
Matrix4

multiplyMatrices(a, b) → {Matrix4}

Sets the matrix to the multiplication of two matrices.
Parameters:
Name Type Description
a Matrix4 The first matrix.
b Matrix4 The second matrix.
Source:
Returns:
The matrix.
Type
Matrix4

premultiply(a) → {Matrix4}

Pre-multiplies another matrix, and sets this matrix to the result.
Parameters:
Name Type Description
a Matrix4 The matrix to pre-multiply with.
Source:
Returns:
The matrix.
Type
Matrix4

set(a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, a30, a31, a32, a33) → {Matrix4}

Sets the elements of the matrix.
Parameters:
Name Type Description
a00 Number The element at row 0 and column 0.
a01 Number The element at row 0 and column 1.
a02 Number The element at row 0 and column 2.
a03 Number The element at row 0 and column 3.
a10 Number The element at row 1 and column 0.
a11 Number The element at row 1 and column 1.
a12 Number The element at row 1 and column 2.
a13 Number The element at row 1 and column 3.
a20 Number The element at row 2 and column 0.
a21 Number The element at row 2 and column 1.
a22 Number The element at row 2 and column 2.
a23 Number The element at row 2 and column 3.
a30 Number The element at row 3 and column 0.
a31 Number The element at row 3 and column 1.
a32 Number The element at row 3 and column 2.
a33 Number The element at row 3 and column 3.
Source:
Returns:
The matrix.
Type
Matrix4

setIdentity() → {Matrix4}

Sets the elements of the matrix to the identity.
Source:
Returns:
The matrix.
Type
Matrix4

transpose() → {Matrix4}

Transposes the matrix.
Source:
Returns:
The matrix.
Type
Matrix4

(static) fromValues(a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, a30, a31, a32, a33) → {Matrix4}

Creates a new Matrix4 from the values of each element.
Parameters:
Name Type Description
a00 Number The element at row 0 and column 0.
a01 Number The element at row 0 and column 1.
a02 Number The element at row 0 and column 2.
a03 Number The element at row 0 and column 3.
a10 Number The element at row 1 and column 0.
a11 Number The element at row 1 and column 1.
a12 Number The element at row 1 and column 2.
a13 Number The element at row 1 and column 3.
a20 Number The element at row 2 and column 0.
a21 Number The element at row 2 and column 1.
a22 Number The element at row 2 and column 2.
a23 Number The element at row 2 and column 3.
a30 Number The element at row 3 and column 0.
a31 Number The element at row 3 and column 1.
a32 Number The element at row 3 and column 2.
a33 Number The element at row 3 and column 3.
Source:
Returns:
The created matrix.
Type
Matrix4