t3d. Matrix4

4x4 matrix class.

Constructor

new Matrix4()

Create a 4x4 matrix.

Methods

clone() → {t3d.Matrix4}

Creates a new Matrix4 with identical elements to this one.
Returns:
Type: 
t3d.Matrix4

copy(m) → {t3d.Matrix4}

Copies the elements of matrix m into this matrix.
Parameters:
NameTypeDescription
mt3d.Matrix4
Returns:
Type: 
t3d.Matrix4

decompose(position, quaternion, scale) → {t3d.Matrix4}

Decomposes this matrix into it's position, quaternion and scale components.
Parameters:
NameTypeDescription
positiont3d.Vector3
quaterniont3d.Quaternion
scalet3d.Vector3
Returns:
Type: 
t3d.Matrix4

determinant() → {Number}

Computes and returns the determinant of this matrix.
Returns:
Type: 
Number

equals(m) → {Boolean}

Return true if this matrix and m are equal.
Parameters:
NameTypeDescription
mt3d.Matrix4
Returns:
Type: 
Boolean

extractRotation() → {t3d.Matrix4}

Extracts the rotation component of the supplied matrix m into this matrix's rotation component.
Returns:
Type: 
t3d.Matrix4

fromArray(array, offsetopt) → {t3d.Matrix4}

Sets the elements of this matrix based on an array in column-major format.
Parameters:
NameTypeAttributesDefaultDescription
arrayArray.<Number>
offsetNumber<optional>
0
Returns:
Type: 
t3d.Matrix4

getInverse() → {t3d.Matrix4}

Take the inverse of the matrix
Returns:
Type: 
t3d.Matrix4

getMaxScaleOnAxis() → {Number}

Gets the maximum scale value of the 3 axes.
Returns:
Type: 
Number

identity() → {t3d.Matrix4}

Resets this matrix to the identity matrix.
Returns:
Type: 
t3d.Matrix4

inverse() → {t3d.Matrix4}

Take the inverse of this matrix
Returns:
Type: 
t3d.Matrix4

isIdentity() → {Boolean}

Checks if the matrix is an identity matrix.
Returns:
- True if the matrix is an identity matrix, false otherwise.
Type: 
Boolean

lerpMatrices(m1, m2, ratio) → {t3d.Matrix4}

Linearly interpolates between two matrix4.
Parameters:
NameTypeDescription
m1t3d.Matrix4
m2t3d.Matrix4
ratioNumber
Returns:
Type: 
t3d.Matrix4

lookAtRH(eye, target, update) → {t3d.Matrix4}

Constructs a rotation matrix, looking from eye towards center oriented by the up vector.
Parameters:
NameTypeDescription
eyet3d.Vector3
targett3d.Vector3
updatet3d.Vector3
Returns:
Type: 
t3d.Matrix4

makeRotationAxis(axis, angle) → {t3d.Matrix4}

Sets this matrix as rotation transform around axis by theta radians.
Parameters:
NameTypeDescription
axist3d.Vector3
angleNumber
Returns:
Type: 
t3d.Matrix4

makeRotationFromQuaternion(q) → {t3d.Matrix4}

Sets the rotation component of this matrix to the rotation specified by q, as outlined here.
Parameters:
NameTypeDescription
qt3d.Quaternion
Returns:
Type: 
t3d.Matrix4

makeTranslation(x, y, z) → {t3d.Matrix4}

Sets this matrix as a translation transform.
Parameters:
NameTypeDescription
xNumberthe amount to translate in the X axis.
yNumberthe amount to translate in the Y axis.
zNumberthe amount to translate in the Z axis.
Returns:
Type: 
t3d.Matrix4

multiply(m) → {t3d.Matrix4}

Post-multiplies this matrix by m.
Parameters:
NameTypeDescription
mt3d.Matrix4
Returns:
Type: 
t3d.Matrix4

multiplyMatrices(a, b) → {t3d.Matrix4}

Sets this matrix to a x b.
Parameters:
NameTypeDescription
at3d.Matrix4
bt3d.Matrix4
Returns:
Type: 
t3d.Matrix4

premultiply(m) → {t3d.Matrix4}

Pre-multiplies this matrix by m.
Parameters:
NameTypeDescription
mt3d.Matrix4
Returns:
Type: 
t3d.Matrix4

set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) → {t3d.Matrix4}

Set the elements of this matrix to the supplied row-major values n11, n12, ... n44.
Parameters:
NameTypeDescription
n11Number
n12Number
n13Number
n14Number
n21Number
n22Number
n23Number
n24Number
n31Number
n32Number
n33Number
n34Number
n41Number
n42Number
n43Number
n44Number
Returns:
Type: 
t3d.Matrix4

setFromMatrix3(m) → {t3d.Matrix4}

Set the upper 3x3 elements of this matrix to the values of the Matrix3 m.
Parameters:
NameTypeDescription
mt3d.Matrix3
Returns:
Type: 
t3d.Matrix4

toArray(arrayopt, offsetopt) → {Array.<Number>}

Writes the elements of this matrix to an array in column-major format.
Parameters:
NameTypeAttributesDefaultDescription
arrayArray.<Number><optional>
offsetNumber<optional>
0
Returns:
Type: 
Array.<Number>

transform(position, scale, quaternion) → {t3d.Matrix4}

Make transform from position&scale&quaternion(Quaternion).
Parameters:
NameTypeDescription
positiont3d.Vector3
scalet3d.Vector3
quaterniont3d.Quaternion
Returns:
Type: 
t3d.Matrix4

transpose() → {t3d.Matrix4}

Transposes this matrix.
Returns:
Type: 
t3d.Matrix4