Matrix

Class used to store matrix data (4x4)

Hierarchy

  • Matrix

Index

Constructors

constructor

Find examples in Playground
  • Creates an empty matrix (filled with zeros)

    Returns Matrix

Properties

m

Find examples in Playground
m: Float32Array

Gets or sets the internal data of the matrix

updateFlag

Find examples in Playground
updateFlag: number

Gets the update flag of the matrix which is an unique number for the matrix. It will be incremented every time the matrix data change. You can use it to speed the comparison between two versions of the same matrix.

Static IdentityReadOnly

Find examples in Playground
IdentityReadOnly: Matrix

Gets an identity matrix that must not be updated

Methods

add

Find examples in Playground
  • Adds the current matrix with a second one

    Parameters

    • other: Matrix

      defines the matrix to add

    Returns Matrix

    a new matrix as the addition of the current matrix and the given one

addToRef

Find examples in Playground
  • Sets the given matrix "result" to the addition of the current matrix and the given one

    Parameters

    • other: Matrix

      defines the matrix to add

    • result: Matrix

      defines the target matrix

    Returns Matrix

    the current matrix

addToSelf

Find examples in Playground
  • Adds in place the given matrix to the current matrix

    Parameters

    • other: Matrix

      defines the second operand

    Returns Matrix

    the current updated matrix

asArray

Find examples in Playground
  • asArray(): Float32Array
  • Returns the matrix as a Float32Array

    Returns Float32Array

    the matrix underlying array.

clone

Find examples in Playground
  • Clone the current matrix

    Returns Matrix

    a new matrix from the current matrix

copyFrom

Find examples in Playground
  • Copy the current matrix from the given one

    Parameters

    • other: Matrix

      defines the source matrix

    Returns Matrix

    the current updated matrix

copyToArray

Find examples in Playground
  • copyToArray(array: Float32Array, offset?: number): Matrix
  • Populates the given array from the starting index with the current matrix values

    Parameters

    • array: Float32Array

      defines the target array

    • Optional offset: number

      defines the offset in the target array where to start storing values

    Returns Matrix

    the current matrix

decompose

Find examples in Playground
  • Decomposes the current Matrix into a translation, rotation and scaling components

    Parameters

    • Optional scale: Vector3

      defines the scale vector3 given as a reference to update

    • Optional rotation: Quaternion

      defines the rotation quaternion given as a reference to update

    • Optional translation: Vector3

      defines the translation vector3 given as a reference to update

    Returns boolean

    true if operation was successful

determinant

Find examples in Playground
  • determinant(): number
  • Gets the determinant of the matrix

    Returns number

    the matrix determinant

equals

Find examples in Playground
  • equals(value: Matrix): boolean
  • Check equality between this matrix and a second one

    Parameters

    • value: Matrix

      defines the second matrix to compare

    Returns boolean

    true is the current matrix and the given one values are strictly equal

getClassName

Find examples in Playground
  • getClassName(): string
  • Returns the name of the current matrix class

    Returns string

    the string "Matrix"

getHashCode

Find examples in Playground
  • getHashCode(): number
  • Gets the hash code of the current matrix

    Returns number

    the hash code

getRotationMatrix

Find examples in Playground
  • Gets only rotation part of the current matrix

    Returns Matrix

    a new matrix sets to the extracted rotation matrix from the current one

getRotationMatrixToRef

Find examples in Playground
  • Extracts the rotation matrix from the current one and sets it as the given "result"

    Parameters

    • result: Matrix

      defines the target matrix to store data to

    Returns Matrix

    the current matrix

getRow

Find examples in Playground
  • Gets specific row of the matrix

    Parameters

    • index: number

      defines the number of the row to get

    Returns Nullable<Vector4>

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

getTranslation

Find examples in Playground
  • Gets the translation value of the current matrix

    Returns Vector3

    a new Vector3 as the extracted translation from the matrix

getTranslationToRef

Find examples in Playground
  • Fill a Vector3 with the extracted translation from the matrix

    Parameters

    • result: Vector3

      defines the Vector3 where to store the translation

    Returns Matrix

    the current matrix

invert

Find examples in Playground
  • Inverts the current matrix in place

    Returns Matrix

    the current inverted matrix

invertToRef

Find examples in Playground
  • Sets the given matrix to the current inverted Matrix

    Parameters

    • other: Matrix

      defines the target matrix

    Returns Matrix

    the unmodified current matrix

isIdentity

Find examples in Playground
  • isIdentity(considerAsTextureMatrix?: boolean): boolean
  • Check if the current matrix is indentity

    Parameters

    • Optional considerAsTextureMatrix: boolean

      defines if the current matrix must be considered as a texture matrix (3x2)

    Returns boolean

    true is the matrix is the identity matrix

multiply

Find examples in Playground
  • Multiply two matrices

    Parameters

    • other: Matrix

      defines the second operand

    Returns Matrix

    a new matrix set with the multiplication result of the current Matrix and the given one

multiplyToArray

Find examples in Playground
  • multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix
  • Sets the Float32Array "result" from the given index "offset" with the multiplication of the current matrix and the given one

    Parameters

    • other: Matrix

      defines the second operand

    • result: Float32Array

      defines the array where to store the multiplication

    • offset: number

      defines the offset in the target array where to start storing values

    Returns Matrix

    the current matrix

multiplyToRef

Find examples in Playground
  • Sets the given matrix "result" with the multiplication result of the current Matrix and the given one

    Parameters

    • other: Matrix

      defines the second operand

    • result: Matrix

      defines the matrix where to store the multiplication

    Returns Matrix

    the current matrix

removeRotationAndScaling

Find examples in Playground
  • removeRotationAndScaling(): Matrix
  • Remove rotation and scaling part from the matrix

    Returns Matrix

    the updated matrix

reset

Find examples in Playground
  • Sets all the matrix elements to zero

    Returns Matrix

    the current matrix

scale

Find examples in Playground
  • scale(scale: number): Matrix
  • Compute a new matrix set with the current matrix values multiplied by scale (float)

    Parameters

    • scale: number

      defines the scale factor

    Returns Matrix

    a new matrix

scaleAndAddToRef

Find examples in Playground
  • Scale the current matrix values by a factor and add the result to a given matrix

    Parameters

    • scale: number

      defines the scale factor

    • result: Matrix

      defines the Matrix to store the result

    Returns Matrix

    the current matrix

scaleToRef

Find examples in Playground
  • Scale the current matrix values by a factor to a given result matrix

    Parameters

    • scale: number

      defines the scale factor

    • result: Matrix

      defines the matrix to store the result

    Returns Matrix

    the current matrix

setRow

Find examples in Playground
  • Sets the index-th row of the current matrix to the vector4 values

    Parameters

    • index: number

      defines the number of the row to set

    • row: Vector4

      defines the target vector4

    Returns Matrix

    the updated current matrix

setRowFromFloats

Find examples in Playground
  • setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix
  • Sets the index-th row of the current matrix with the given 4 x float values

    Parameters

    • index: number

      defines the row index

    • x: number

      defines the x component to set

    • y: number

      defines the y component to set

    • z: number

      defines the z component to set

    • w: number

      defines the w component to set

    Returns Matrix

    the updated current matrix

setTranslation

Find examples in Playground
  • Inserts the translation vector in the current matrix

    Parameters

    • vector3: Vector3

      defines the translation to insert

    Returns Matrix

    the current updated matrix

setTranslationFromFloats

Find examples in Playground
  • setTranslationFromFloats(x: number, y: number, z: number): Matrix
  • Inserts the translation vector (using 3 floats) in the current matrix

    Parameters

    • x: number

      defines the 1st component of the translation

    • y: number

      defines the 2nd component of the translation

    • z: number

      defines the 3rd component of the translation

    Returns Matrix

    the current updated matrix

toArray

Find examples in Playground
  • toArray(): Float32Array
  • Returns the matrix as a Float32Array

    Returns Float32Array

    the matrix underlying array

toNormalMatrix

Find examples in Playground
  • toNormalMatrix(ref: Matrix): void
  • Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).

    Parameters

    • ref: Matrix

      matrix to store the result

    Returns void

transpose

Find examples in Playground
  • Compute the transpose of the matrix

    Returns Matrix

    the new transposed matrix

transposeToRef

Find examples in Playground
  • Compute the transpose of the matrix and store it in a given matrix

    Parameters

    • result: Matrix

      defines the target matrix

    Returns Matrix

    the current matrix

Static Compose

Find examples in Playground
  • Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)

    Parameters

    • scale: Vector3

      defines the scale vector3

    • rotation: Quaternion

      defines the rotation quaternion

    • translation: Vector3

      defines the translation vector3

    Returns Matrix

    a new matrix

Static ComposeToRef

Find examples in Playground
  • Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)

    Parameters

    • scale: Vector3

      defines the scale vector3

    • rotation: Quaternion

      defines the rotation quaternion

    • translation: Vector3

      defines the translation vector3

    • result: Matrix

      defines the target matrix

    Returns void

Static DecomposeLerp

Find examples in Playground
  • Builds 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

    Parameters

    • startValue: Matrix

      defines the first matrix

    • endValue: Matrix

      defines the second matrix

    • gradient: number

      defines the gradient between the two matrices

    Returns Matrix

    the new matrix

Static DecomposeLerpToRef

Find examples in Playground
  • DecomposeLerpToRef(startValue: Matrix, endValue: Matrix, gradient: number, result: Matrix): void
  • Update a matrix to values which 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

    Parameters

    • startValue: Matrix

      defines the first matrix

    • endValue: Matrix

      defines the second matrix

    • gradient: number

      defines the gradient between the two matrices

    • result: Matrix

      defines the target matrix

    Returns void

Static FromArray

Find examples in Playground
  • FromArray(array: ArrayLike<number>, offset?: number): Matrix
  • Creates a matrix from an array

    Parameters

    • array: ArrayLike<number>

      defines the source array

    • Optional offset: number

      defines an offset in the source array

    Returns Matrix

    a new Matrix set from the starting index of the given array

Static FromArrayToRef

Find examples in Playground
  • FromArrayToRef(array: ArrayLike<number>, offset: number, result: Matrix): void
  • Copy the content of an array into a given matrix

    Parameters

    • array: ArrayLike<number>

      defines the source array

    • offset: number

      defines an offset in the source array

    • result: Matrix

      defines the target matrix

    Returns void

Static FromFloat32ArrayToRefScaled

Find examples in Playground
  • FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void
  • Stores an array into a matrix after having multiplied each component by a given factor

    Parameters

    • array: Float32Array

      defines the source array

    • offset: number

      defines the offset in the source array

    • scale: number

      defines the scaling factor

    • result: Matrix

      defines the target matrix

    Returns void

Static FromQuaternionToRef

Find examples in Playground
  • Creates a rotation matrix from a quaternion and stores it in a target matrix

    Parameters

    • quat: Quaternion

      defines the quaternion to use

    • result: Matrix

      defines the target matrix

    Returns void

Static FromValues

Find examples in Playground
  • FromValues(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): Matrix
  • Creates new matrix from a list of values (16)

    Parameters

    • initialM11: number

      defines 1st value of 1st row

    • initialM12: number

      defines 2nd value of 1st row

    • initialM13: number

      defines 3rd value of 1st row

    • initialM14: number

      defines 4th value of 1st row

    • initialM21: number

      defines 1st value of 2nd row

    • initialM22: number

      defines 2nd value of 2nd row

    • initialM23: number

      defines 3rd value of 2nd row

    • initialM24: number

      defines 4th value of 2nd row

    • initialM31: number

      defines 1st value of 3rd row

    • initialM32: number

      defines 2nd value of 3rd row

    • initialM33: number

      defines 3rd value of 3rd row

    • initialM34: number

      defines 4th value of 3rd row

    • initialM41: number

      defines 1st value of 4th row

    • initialM42: number

      defines 2nd value of 4th row

    • initialM43: number

      defines 3rd value of 4th row

    • initialM44: number

      defines 4th value of 4th row

    Returns Matrix

    the new matrix

Static FromValuesToRef

Find examples in Playground
  • FromValuesToRef(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, result: Matrix): void
  • Stores a list of values (16) inside a given matrix

    Parameters

    • initialM11: number

      defines 1st value of 1st row

    • initialM12: number

      defines 2nd value of 1st row

    • initialM13: number

      defines 3rd value of 1st row

    • initialM14: number

      defines 4th value of 1st row

    • initialM21: number

      defines 1st value of 2nd row

    • initialM22: number

      defines 2nd value of 2nd row

    • initialM23: number

      defines 3rd value of 2nd row

    • initialM24: number

      defines 4th value of 2nd row

    • initialM31: number

      defines 1st value of 3rd row

    • initialM32: number

      defines 2nd value of 3rd row

    • initialM33: number

      defines 3rd value of 3rd row

    • initialM34: number

      defines 4th value of 3rd row

    • initialM41: number

      defines 1st value of 4th row

    • initialM42: number

      defines 2nd value of 4th row

    • initialM43: number

      defines 3rd value of 4th row

    • initialM44: number

      defines 4th value of 4th row

    • result: Matrix

      defines the target matrix

    Returns void

Static FromXYZAxesToRef

Find examples in Playground
  • Sets the given matrix as a rotation matrix composed from the 3 left handed axes

    Parameters

    • xaxis: Vector3

      defines the value of the 1st axis

    • yaxis: Vector3

      defines the value of the 2nd axis

    • zaxis: Vector3

      defines the value of the 3rd axis

    • result: Matrix

      defines the target matrix

    Returns void

Static GetAsMatrix2x2

Find examples in Playground
  • GetAsMatrix2x2(matrix: Matrix): Float32Array
  • Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array

    Parameters

    • matrix: Matrix

      defines the matrix to use

    Returns Float32Array

    a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix

Static GetAsMatrix3x3

Find examples in Playground
  • GetAsMatrix3x3(matrix: Matrix): Float32Array
  • Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array

    Parameters

    • matrix: Matrix

      defines the matrix to use

    Returns Float32Array

    a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix

Static GetFinalMatrix

Find examples in Playground
  • Computes a complete transformation matrix

    Parameters

    • viewport: Viewport

      defines the viewport to use

    • world: Matrix

      defines the world matrix

    • view: Matrix

      defines the view matrix

    • projection: Matrix

      defines the projection matrix

    • zmin: number

      defines the near clip plane

    • zmax: number

      defines the far clip plane

    Returns Matrix

    the transformation matrix

Static Identity

Find examples in Playground
  • Creates a new identity matrix

    Returns Matrix

    a new identity matrix

Static IdentityToRef

Find examples in Playground
  • IdentityToRef(result: Matrix): void
  • Creates a new identity matrix and stores the result in a given matrix

    Parameters

    • result: Matrix

      defines the target matrix

    Returns void

Static Invert

Find examples in Playground
  • Creates a new matrix as the invert of a given matrix

    Parameters

    • source: Matrix

      defines the source matrix

    Returns Matrix

    the new matrix

Static Lerp

Find examples in Playground
  • Returns a new Matrix whose values are the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".

    Parameters

    • startValue: Matrix

      defines the start value

    • endValue: Matrix

      defines the end value

    • gradient: number

      defines the gradient factor

    Returns Matrix

    the new matrix

Static LerpToRef

Find examples in Playground
  • Set the given matrix "result" as the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue".

    Parameters

    • startValue: Matrix

      defines the start value

    • endValue: Matrix

      defines the end value

    • gradient: number

      defines the gradient factor

    • result: Matrix

      defines the Matrix object where to store data

    Returns void

Static LookAtLH

Find examples in Playground
  • Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" This function works in left handed mode

    Parameters

    • eye: Vector3

      defines the final position of the entity

    • target: Vector3

      defines where the entity should look at

    • up: Vector3

      defines the up vector for the entity

    Returns Matrix

    the new matrix

Static LookAtLHToRef

Find examples in Playground
  • Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". This function works in left handed mode

    Parameters

    • eye: Vector3

      defines the final position of the entity

    • target: Vector3

      defines where the entity should look at

    • up: Vector3

      defines the up vector for the entity

    • result: Matrix

      defines the target matrix

    Returns void

Static LookAtRH

Find examples in Playground
  • Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" This function works in right handed mode

    Parameters

    • eye: Vector3

      defines the final position of the entity

    • target: Vector3

      defines where the entity should look at

    • up: Vector3

      defines the up vector for the entity

    Returns Matrix

    the new matrix

Static LookAtRHToRef

Find examples in Playground
  • Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". This function works in right handed mode

    Parameters

    • eye: Vector3

      defines the final position of the entity

    • target: Vector3

      defines where the entity should look at

    • up: Vector3

      defines the up vector for the entity

    • result: Matrix

      defines the target matrix

    Returns void

Static OrthoLH

Find examples in Playground
  • OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix
  • Create a left-handed orthographic projection matrix

    Parameters

    • width: number

      defines the viewport width

    • height: number

      defines the viewport height

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a left-handed orthographic projection matrix

Static OrthoLHToRef

Find examples in Playground
  • OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void
  • Store a left-handed orthographic projection to a given matrix

    Parameters

    • width: number

      defines the viewport width

    • height: number

      defines the viewport height

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    Returns void

Static OrthoOffCenterLH

Find examples in Playground
  • OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix
  • Create a left-handed orthographic projection matrix

    Parameters

    • left: number

      defines the viewport left coordinate

    • right: number

      defines the viewport right coordinate

    • bottom: number

      defines the viewport bottom coordinate

    • top: number

      defines the viewport top coordinate

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a left-handed orthographic projection matrix

Static OrthoOffCenterLHToRef

Find examples in Playground
  • OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void
  • Stores a left-handed orthographic projection into a given matrix

    Parameters

    • left: number

      defines the viewport left coordinate

    • right: number

      defines the viewport right coordinate

    • bottom: number

      defines the viewport bottom coordinate

    • top: number

      defines the viewport top coordinate

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    Returns void

Static OrthoOffCenterRH

Find examples in Playground
  • OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix
  • Creates a right-handed orthographic projection matrix

    Parameters

    • left: number

      defines the viewport left coordinate

    • right: number

      defines the viewport right coordinate

    • bottom: number

      defines the viewport bottom coordinate

    • top: number

      defines the viewport top coordinate

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a right-handed orthographic projection matrix

Static OrthoOffCenterRHToRef

Find examples in Playground
  • OrthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void
  • Stores a right-handed orthographic projection into a given matrix

    Parameters

    • left: number

      defines the viewport left coordinate

    • right: number

      defines the viewport right coordinate

    • bottom: number

      defines the viewport bottom coordinate

    • top: number

      defines the viewport top coordinate

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    Returns void

Static PerspectiveFovLH

Find examples in Playground
  • PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix
  • Creates a left-handed perspective projection matrix

    Parameters

    • fov: number

      defines the horizontal field of view

    • aspect: number

      defines the aspect ratio

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a left-handed perspective projection matrix

Static PerspectiveFovLHToRef

Find examples in Playground
  • PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void
  • Stores a left-handed perspective projection into a given matrix

    Parameters

    • fov: number

      defines the horizontal field of view

    • aspect: number

      defines the aspect ratio

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    • Optional isVerticalFovFixed: boolean

      defines it the fov is vertically fixed (default) or horizontally

    Returns void

Static PerspectiveFovRH

Find examples in Playground
  • PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix
  • Creates a right-handed perspective projection matrix

    Parameters

    • fov: number

      defines the horizontal field of view

    • aspect: number

      defines the aspect ratio

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a right-handed perspective projection matrix

Static PerspectiveFovRHToRef

Find examples in Playground
  • PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void
  • Stores a right-handed perspective projection into a given matrix

    Parameters

    • fov: number

      defines the horizontal field of view

    • aspect: number

      defines the aspect ratio

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    • Optional isVerticalFovFixed: boolean

      defines it the fov is vertically fixed (default) or horizontally

    Returns void

Static PerspectiveFovWebVRToRef

Find examples in Playground
  • PerspectiveFovWebVRToRef(fov: object, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void
  • Stores a perspective projection for WebVR info a given matrix

    Parameters

    • fov: object

      defines the field of view

      • downDegrees: number
      • leftDegrees: number
      • rightDegrees: number
      • upDegrees: number
    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    • result: Matrix

      defines the target matrix

    • Optional rightHanded: boolean

      defines if the matrix must be in right-handed mode (false by default)

    Returns void

Static PerspectiveLH

Find examples in Playground
  • PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix
  • Creates a left-handed perspective projection matrix

    Parameters

    • width: number

      defines the viewport width

    • height: number

      defines the viewport height

    • znear: number

      defines the near clip plane

    • zfar: number

      defines the far clip plane

    Returns Matrix

    a new matrix as a left-handed perspective projection matrix

Static Reflection

Find examples in Playground
  • Computes a reflection matrix from a plane

    Parameters

    • plane: Plane

      defines the reflection plane

    Returns Matrix

    a new matrix

Static ReflectionToRef

Find examples in Playground
  • Computes a reflection matrix from a plane

    Parameters

    • plane: Plane

      defines the reflection plane

    • result: Matrix

      defines the target matrix

    Returns void

Static RotationAxis

Find examples in Playground
  • Creates a new rotation matrix for "angle" radians around the given axis

    Parameters

    • axis: Vector3

      defines the axis to use

    • angle: number

      defines the angle (in radians) to use

    Returns Matrix

    the new matrix

Static RotationAxisToRef

Find examples in Playground
  • RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void
  • Creates a new rotation matrix for "angle" radians around the given axis and stores it in a given matrix

    Parameters

    • axis: Vector3

      defines the axis to use

    • angle: number

      defines the angle (in radians) to use

    • result: Matrix

      defines the target matrix

    Returns void

Static RotationX

Find examples in Playground
  • RotationX(angle: number): Matrix
  • Creates a new rotation matrix for "angle" radians around the X axis

    Parameters

    • angle: number

      defines the angle (in radians) to use

    Returns Matrix

    the new matrix

Static RotationXToRef

Find examples in Playground
  • RotationXToRef(angle: number, result: Matrix): void
  • Creates a new rotation matrix for "angle" radians around the X axis and stores it in a given matrix

    Parameters

    • angle: number

      defines the angle (in radians) to use

    • result: Matrix

      defines the target matrix

    Returns void

Static RotationY

Find examples in Playground
  • RotationY(angle: number): Matrix
  • Creates a new rotation matrix for "angle" radians around the Y axis

    Parameters

    • angle: number

      defines the angle (in radians) to use

    Returns Matrix

    the new matrix

Static RotationYToRef

Find examples in Playground
  • RotationYToRef(angle: number, result: Matrix): void
  • Creates a new rotation matrix for "angle" radians around the Y axis and stores it in a given matrix

    Parameters

    • angle: number

      defines the angle (in radians) to use

    • result: Matrix

      defines the target matrix

    Returns void

Static RotationYawPitchRoll

Find examples in Playground
  • RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix
  • Creates a rotation matrix

    Parameters

    • yaw: number

      defines the yaw angle in radians (Y axis)

    • pitch: number

      defines the pitch angle in radians (X axis)

    • roll: number

      defines the roll angle in radians (X axis)

    Returns Matrix

    the new rotation matrix

Static RotationYawPitchRollToRef

Find examples in Playground
  • RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void
  • Creates a rotation matrix and stores it in a given matrix

    Parameters

    • yaw: number

      defines the yaw angle in radians (Y axis)

    • pitch: number

      defines the pitch angle in radians (X axis)

    • roll: number

      defines the roll angle in radians (X axis)

    • result: Matrix

      defines the target matrix

    Returns void

Static RotationZ

Find examples in Playground
  • RotationZ(angle: number): Matrix
  • Creates a new rotation matrix for "angle" radians around the Z axis

    Parameters

    • angle: number

      defines the angle (in radians) to use

    Returns Matrix

    the new matrix

Static RotationZToRef

Find examples in Playground
  • RotationZToRef(angle: number, result: Matrix): void
  • Creates a new rotation matrix for "angle" radians around the Z axis and stores it in a given matrix

    Parameters

    • angle: number

      defines the angle (in radians) to use

    • result: Matrix

      defines the target matrix

    Returns void

Static Scaling

Find examples in Playground
  • Scaling(x: number, y: number, z: number): Matrix
  • Creates a scaling matrix

    Parameters

    • x: number

      defines the scale factor on X axis

    • y: number

      defines the scale factor on Y axis

    • z: number

      defines the scale factor on Z axis

    Returns Matrix

    the new matrix

Static ScalingToRef

Find examples in Playground
  • ScalingToRef(x: number, y: number, z: number, result: Matrix): void
  • Creates a scaling matrix and stores it in a given matrix

    Parameters

    • x: number

      defines the scale factor on X axis

    • y: number

      defines the scale factor on Y axis

    • z: number

      defines the scale factor on Z axis

    • result: Matrix

      defines the target matrix

    Returns void

Static Translation

Find examples in Playground
  • Translation(x: number, y: number, z: number): Matrix
  • Creates a translation matrix

    Parameters

    • x: number

      defines the translation on X axis

    • y: number

      defines the translation on Y axis

    • z: number

      defines the translationon Z axis

    Returns Matrix

    the new matrix

Static TranslationToRef

Find examples in Playground
  • TranslationToRef(x: number, y: number, z: number, result: Matrix): void
  • Creates a translation matrix and stores it in a given matrix

    Parameters

    • x: number

      defines the translation on X axis

    • y: number

      defines the translation on Y axis

    • z: number

      defines the translationon Z axis

    • result: Matrix

      defines the target matrix

    Returns void

Static Transpose

Find examples in Playground
  • Compute the transpose of a given matrix

    Parameters

    • matrix: Matrix

      defines the matrix to transpose

    Returns Matrix

    the new matrix

Static TransposeToRef

Find examples in Playground
  • Compute the transpose of a matrix and store it in a target matrix

    Parameters

    • matrix: Matrix

      defines the matrix to transpose

    • result: Matrix

      defines the target matrix

    Returns void

Static Zero

Find examples in Playground
  • Creates a new zero matrix

    Returns Matrix

    a new zero matrix

Generated using TypeDoc