class Matrix

Static identity matrix to be used as matrix

Must not be updated.

Boolean : True is the matrix is the identity matrix

Name | Type | Description | |
---|---|---|---|

optional | considerAsTextureMatrix | boolean |

Returns the matrix determinant (float).

Returns the matrix underlying array.

Returns the matrix underlying array.

Inverts in place the Matrix.

Returns the Matrix inverted.

Sets all the matrix elements to zero.

Returns the Matrix.

Returns a new Matrix as the addition result of the current Matrix and the passed one.

Name | Type | Description | |
---|---|---|---|

other | Matrix |

Sets the passed matrix "result" with the ddition result of the current Matrix and the passed one.

Returns the Matrix.

Name | Type | Description | |
---|---|---|---|

other | Matrix | ||

result | Matrix |

Adds in place the passed matrix to the current Matrix.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

other | Matrix |

Sets the passed matrix with the current inverted Matrix.

Returns the unmodified current Matrix.

Name | Type | Description | |
---|---|---|---|

other | Matrix |

Inserts the translation vector (using 3 x floats) in the current Matrix.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

x | number | ||

y | number | ||

z | number |

Inserts the translation vector in the current Matrix.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

vector3 | Vector3 |

Returns a new Vector3 as the extracted translation from the Matrix.

Fill a Vector3 with the extracted translation from the Matrix.

Name | Type | Description | |
---|---|---|---|

result | Vector3 |

Remove rotation and scaling part from the Matrix.

Returns the updated Matrix.

Returns a new Matrix set with the multiplication result of the current Matrix and the passed one.

Name | Type | Description | |
---|---|---|---|

other | Matrix |

Updates the current Matrix from the passed one values.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

other | Matrix |

Populates the passed array from the starting index with the Matrix values.

Returns the Matrix.

Name | Type | Description | |
---|---|---|---|

array | Float32Array | ||

optional | offset | number |

Sets the passed matrix "result" with the multiplication result of the current Matrix and the passed one.

Name | Type | Description | |
---|---|---|---|

other | Matrix | ||

result | Matrix |

Sets the Float32Array "result" from the passed index "offset" with the multiplication result of the current Matrix and the passed one.

Name | Type | Description | |
---|---|---|---|

other | Matrix | ||

result | Float32Array | ||

offset | number |

Boolean : True is the current Matrix and the passed one values are strictly equal.

Name | Type | Description | |
---|---|---|---|

value | Matrix |

Returns a new Matrix from the current Matrix.

Returns the string "Matrix"

Returns the Matrix hash code.

Decomposes the current Matrix into :

a scale vector3 passed as a reference to update,

a rotation quaternion passed as a reference to update,

a translation vector3 passed as a reference to update.

Returns the boolean `true`

.

Name | Type | Description | |
---|---|---|---|

scale | Vector3 | ||

rotation | Quaternion | ||

translation | Vector3 |

Returns a new Matrix as the extracted rotation matrix from the current one.

Extracts the rotation matrix from the current one and sets it as the passed "result".

Returns the current Matrix.

Name | Type | Description | |
---|---|---|---|

result | Matrix |

Returns a new Matrix set from the starting index of the passed array.

Name | Type | Description | |
---|---|---|---|

array | ArrayLike<number> | ||

optional | offset | number |

Sets the passed "result" matrix from the starting index of the passed array.

Name | Type | Description | |
---|---|---|---|

array | ArrayLike<number> | ||

offset | number | ||

result | Matrix |

Sets the passed "result" matrix from the starting index of the passed Float32Array by multiplying each element by the float "scale".

Name | Type | Description | |
---|---|---|---|

array | Float32Array | ||

offset | number | ||

scale | number |

Sets the passed matrix "result" with the 16 passed floats.

Name | Type | Description | |
---|---|---|---|

initialM11 | number | ||

initialM12 | number | ||

initialM13 | number | ||

initialM14 | number | ||

initialM21 | number | ||

initialM22 | number | ||

initialM23 | number | ||

initialM24 | number | ||

initialM31 | number | ||

initialM32 | number | ||

initialM33 | number | ||

initialM34 | number | ||

initialM41 | number | ||

initialM42 | number | ||

initialM43 | number | ||

initialM44 | number |

Returns the index-th row of the current matrix as a new Vector4.

Name | Type | Description | |
---|---|---|---|

index | number |

Sets the index-th row of the current matrix with the passed Vector4 values.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

index | number | ||

row | Vector4 |

Compute the transpose of the matrix.

Returns a new Matrix.

Compute the transpose of the matrix.

Returns the current matrix.

Name | Type | Description | |
---|---|---|---|

result | Matrix |

Sets the index-th row of the current matrix with the passed 4 x float values.

Returns the updated Matrix.

Name | Type | Description | |
---|---|---|---|

index | number | ||

x | number | ||

y | number | ||

z | number |

Returns a new Matrix set from the 16 passed floats.

Name | Type | Description | |
---|---|---|---|

initialM11 | number | ||

initialM12 | number | ||

initialM13 | number | ||

initialM14 | number | ||

initialM21 | number | ||

initialM22 | number | ||

initialM23 | number | ||

initialM24 | number | ||

initialM31 | number | ||

initialM32 | number | ||

initialM33 | number | ||

initialM34 | number | ||

initialM41 | number | ||

initialM42 | number | ||

initialM43 | number |

Returns a new Matrix composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).

Name | Type | Description | |
---|---|---|---|

scale | Vector3 | ||

rotation | Quaternion | ||

translation | Vector3 |

Update a Matrix with values composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).

Name | Type | Description | |
---|---|---|---|

scale | Vector3 | ||

rotation | Quaternion | ||

translation | Vector3 |

Returns a new indentity Matrix.

Sets the passed "result" as an identity matrix.

Name | Type | Description | |
---|---|---|---|

result | Matrix |

Returns a new zero Matrix.

Returns a new rotation matrix for "angle" radians around the X axis.

Name | Type | Description | |
---|---|---|---|

angle | number |

Returns a new Matrix as the passed inverted one.

Name | Type | Description | |
---|---|---|---|

source | Matrix |

Sets the passed matrix "result" as a rotation matrix for "angle" radians around the X axis.

Name | Type | Description | |
---|---|---|---|

angle | number | ||

result | Matrix |

Returns a new rotation matrix for "angle" radians around the Y axis.

Name | Type | Description | |
---|---|---|---|

angle | number |

Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Y axis.

Name | Type | Description | |
---|---|---|---|

angle | number | ||

result | Matrix |

Returns a new rotation matrix for "angle" radians around the Z axis.

Name | Type | Description | |
---|---|---|---|

angle | number |

Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Z axis.

Name | Type | Description | |
---|---|---|---|

angle | number | ||

result | Matrix |

Returns a new rotation matrix for "angle" radians around the passed axis.

Name | Type | Description | |
---|---|---|---|

axis | Vector3 | ||

angle | number |

Sets the passed matrix "result" as a rotation matrix for "angle" radians around the passed axis.

Name | Type | Description | |
---|---|---|---|

axis | Vector3 | ||

angle | number | ||

result | Matrix |

Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z).

Name | Type | Description | |
---|---|---|---|

yaw | number | ||

pitch | number | ||

roll | number |

Sets the passed matrix "result" as a rotation matrix from the Euler angles (y, x, z).

Name | Type | Description | |
---|---|---|---|

yaw | number | ||

pitch | number | ||

roll | number |

Returns a new Matrix as a scaling matrix from the passed floats (x, y, z).

Name | Type | Description | |
---|---|---|---|

x | number | ||

y | number | ||

z | number |

Sets the passed matrix "result" as a scaling matrix from the passed floats (x, y, z).

Name | Type | Description | |
---|---|---|---|

x | number | ||

y | number | ||

z | number |

Returns a new Matrix as a translation matrix from the passed floats (x, y, z).

Name | Type | Description | |
---|---|---|---|

x | number | ||

y | number | ||

z | number |

Sets the passed matrix "result" as a translation matrix from the passed floats (x, y, z).

Name | Type | Description | |
---|---|---|---|

x | number | ||

y | number | ||

z | number |

Returns a new Matrix whose values are the interpolated values for "gradien" (float) between the ones of the matrices "startValue" and "endValue".

Name | Type | Description | |
---|---|---|---|

startValue | Matrix | ||

endValue | Matrix | ||

gradient | number |

Returns a new Matrix whose values are computed by :

decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices,

interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end,

recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices.

Name | Type | Description | |
---|---|---|---|

startValue | Matrix | ||

endValue | Matrix | ||

gradient | number |

Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".

This methods works for a Left-Handed system.

Name | Type | Description | |
---|---|---|---|

eye | Vector3 | ||

target | Vector3 | ||

up | Vector3 |

Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".

This methods works for a Left-Handed system.

Name | Type | Description | |
---|---|---|---|

eye | Vector3 | ||

target | Vector3 | ||

up | Vector3 |

Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".

This methods works for a Right-Handed system.

Name | Type | Description | |
---|---|---|---|

eye | Vector3 | ||

target | Vector3 | ||

up | Vector3 |

Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".

This methods works for a Left-Handed system.

Name | Type | Description | |
---|---|---|---|

eye | Vector3 | ||

target | Vector3 | ||

up | Vector3 |

Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

width | number | ||

height | number | ||

znear | number |

Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

width | number | ||

height | number | ||

znear | number | ||

zfar | number |

Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

left | number | ||

right | number | ||

bottom | number | ||

top | number | ||

znear | number |

Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

left | number | ||

right | number | ||

bottom | number | ||

top | number | ||

znear | number | ||

zfar | number |

Returns a new Matrix as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

left | number | ||

right | number | ||

bottom | number | ||

top | number | ||

znear | number |

Sets the passed matrix "result" as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

left | number | ||

right | number | ||

bottom | number | ||

top | number | ||

znear | number | ||

zfar | number |

Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.

Name | Type | Description | |
---|---|---|---|

width | number | ||

height | number | ||

znear | number |

Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.

Name | Type | Description | |
---|---|---|---|

fov | number | ||

aspect | number | ||

znear | number |

Sets the passed matrix "result" as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.

Name | Type | Description | |
---|---|---|---|

fov | number | ||

aspect | number | ||

znear | number | ||

zfar | number | ||

result | Matrix |

Returns a new Matrix as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.

Name | Type | Description | |
---|---|---|---|

fov | number | ||

aspect | number | ||

znear | number |

Sets the passed matrix "result" as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.

Name | Type | Description | |
---|---|---|---|

fov | number | ||

aspect | number | ||

znear | number | ||

zfar | number | ||

result | Matrix |

Sets the passed matrix "result" as a left-handed perspective projection matrix for WebVR computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.

Name | Type | Description | |
---|---|---|---|

fov | { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number } | ||

znear | number | ||

zfar | number | ||

result | Matrix |

Returns the final transformation matrix : world * view * projection * viewport

Name | Type | Description | |
---|---|---|---|

viewport | Viewport | ||

world | Matrix | ||

view | Matrix | ||

projection | Matrix | ||

zmin | number |

Returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the passed Matrix.

Name | Type | Description | |
---|---|---|---|

matrix | Matrix |

Returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the passed Matrix.

Name | Type | Description | |
---|---|---|---|

matrix | Matrix |

Compute the transpose of the passed Matrix.

Returns a new Matrix.

Name | Type | Description | |
---|---|---|---|

matrix | Matrix |

Compute the transpose of the passed Matrix and store it in the result matrix.

Name | Type | Description | |
---|---|---|---|

matrix | Matrix | ||

result | Matrix |

Returns a new Matrix as the reflection matrix across the passed plane.

Name | Type | Description | |
---|---|---|---|

plane | Plane |

Sets the passed matrix "result" as the reflection matrix across the passed plane.

Name | Type | Description | |
---|---|---|---|

plane | Plane | ||

result | Matrix |

Sets the passed matrix "mat" as a rotation matrix composed from the 3 passed left handed axis.

Name | Type | Description | |
---|---|---|---|

xaxis | Vector3 | ||

yaxis | Vector3 | ||

zaxis | Vector3 |

Sets the passed matrix "result" as a rotation matrix according to the passed quaternion.

Name | Type | Description | |
---|---|---|---|

quat | Quaternion | ||

result | Matrix |