Matrix4f

Lore. Matrix4f

A class representing a 4x4 float matrix

Constructor

new Matrix4f(entriesopt)

Source:

Creates an instance of Matrix4f.

Parameters:
Name Type Attributes Default Description
entries Float32Array <optional>
new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])

Methods

(static) compose(position, quaternion, scale) → {Matrix4f}

Source:

Composes a matrix from the positional, rotational and scaling components.

Parameters:
Name Type Description
position Vector3f

The positional component.

quaternion Quaternion

The rotational component.

scale Vector3f

The scaling component.

Returns:

A matrix.

Type
Matrix4f

(static) fromQuaternion(q) → {Matrix4f}

Source:

Initialize a matrix from a quaternion.

Parameters:
Name Type Description
q Quaternion

A quaternion.

Returns:

A matrix.

Type
Matrix4f

(static) invert(matrix)

Source:

Inverts a matrix.

Parameters:
Name Type Description
matrix Matrix4f

A matrix to be inverted.

Returns:

The inverted matrix.

(static) lookAt(cameraPosition, target, up) → {Matrix4f}

Source:

Create a lookat matrix for a camera.

Parameters:
Name Type Description
cameraPosition Vector3f

The position of the camera.

target Vector3f

The lookat (target) of the camera.

up Vector3f

The up vector of the camera node.

Returns:

A matrix.

Type
Matrix4f

(static) multiply(a, b) → {Matrix4f}

Source:

Multiply the two matrices (a * b).

Parameters:
Name Type Description
a any

A matrix to be multiplied.

b any

A matrix to be multiplied.

Returns:

A matrix.

Type
Matrix4f

clone() → {Matrix4f}

Source:

Clones this matrix.

Returns:

A clone of the matrix.

Type
Matrix4f

compose(position, quaternion, scale) → {Matrix4f}

Source:

Composes the matrix from the positional, rotational and scaling components.

Parameters:
Name Type Description
position Vector3f

The positional component.

quaternion Quaternion

The rotational component.

scale Vector3f

The scaling component.

Returns:

Returns itself.

Type
Matrix4f

decompose(outPosition, outQuaternion, outScale) → {Matrix4f}

Source:

Decomposes the matrix into its positional, rotational and scaling component.

Parameters:
Name Type Description
outPosition Vector3f

The positional component will be written to this vector.

outQuaternion Quaternion

The rotational component will be written to this quaternion.

outScale Vector3f

The scaling component will be written to this vector.

Returns:

Returns itself.

Type
Matrix4f

determinant() → {Number}

Source:

Get the determinant of the matrix.

Returns:

The determinant of this matrix.

Type
Number

equals(a) → {Boolean}

Source:

Checks whether or not the entries of the two matrices match.

Parameters:
Name Type Description
a Matrix4f

A matrix.

Returns:

A boolean indicating whether or not the entries of the two matrices match.

Type
Boolean

invert() → {Matrix4f}

Source:

Inverts this matrix.

Returns:

Returns itself.

Type
Matrix4f

multiplyA(b) → {Matrix4f}

Source:

Multiplies this matrix with another matrix (a * b).

Parameters:
Name Type Description
b any

Another matrix.

Returns:

Returns itself.

Type
Matrix4f

multiplyB(a) → {Matrix4f}

Source:

Multiplies another matrix with this matrix (a * b).

Parameters:
Name Type Description
a any

Another matrix.

Returns:

Returns itself.

Type
Matrix4f

scale(v) → {Matrix4f}

Source:

Set the scale component of this matrix.

Parameters:
Name Type Description
v Vector3f

The scaling vector.

Returns:

Returns itself.

Type
Matrix4f

set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) → {Matrix4f}

Source:
Parameters:
Name Type Description
m00 Number

A matrix entry.

m10 Number

A matrix entry.

m20 Number

A matrix entry.

m30 Number

A matrix entry.

m01 Number

A matrix entry.

m11 Number

A matrix entry.

m21 Number

A matrix entry.

m31 Number

A matrix entry.

m02 Number

A matrix entry.

m12 Number

A matrix entry.

m22 Number

A matrix entry.

m32 Number

A matrix entry.

m03 Number

A matrix entry.

m13 Number

A matrix entry.

m23 Number

A matrix entry.

m33 Number

A matrix entry.

Returns:

Returns itself.

Type
Matrix4f

setPosition(vec) → {Matrix4f}

Source:

Set the position component of this matrix.

Parameters:
Name Type Description
vec any

The position vector.

Returns:

Returns itself.

Type
Matrix4f

setRotation(q) → {Matrix4f}

Source:

Set the rotation component of this matrix.

Parameters:
Name Type Description
q Quaternion

A quaternion representing the rotation.

Returns:

Returns itself.

Type
Matrix4f

toString() → {String}

Source:

Returns a string representation of the matrix.

Returns:

The string representation of this matrix.

Type
String