Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Matrix4

Serializable THREE.js Matrix4

Hierarchy

  • Matrix4
    • Matrix4

Index

Constructors

constructor

  • Returns Matrix4

Properties

elements

elements: number[]

Methods

clone

compose

  • compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4
  • Sets this matrix to the transformation composed of translation, rotation and scale.

    Parameters

    • translation: Vector3
    • rotation: Quaternion
    • scale: Vector3

    Returns Matrix4

copy

  • Parameters

    • m: Matrix4

    Returns Matrix4

copyPosition

  • copyPosition(m: Matrix4): Matrix4
  • Parameters

    • m: Matrix4

    Returns Matrix4

crossVector

  • crossVector(v: any): void
  • deprecated

    Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead.

    Parameters

    • v: any

    Returns void

decompose

  • decompose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4
  • Decomposes this matrix into it's position, quaternion and scale components.

    Parameters

    • translation: Vector3
    • rotation: Quaternion
    • scale: Vector3

    Returns Matrix4

determinant

  • determinant(): number

equals

  • equals(matrix: Matrix4): boolean
  • Parameters

    • matrix: Matrix4

    Returns boolean

extractBasis

  • extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4
  • Parameters

    • xAxis: Vector3
    • yAxis: Vector3
    • zAxis: Vector3

    Returns Matrix4

extractPosition

  • extractPosition(m: Matrix4): Matrix4
  • deprecated

    Use {@link Matrix4#copyPosition .copyPosition()} instead.

    Parameters

    • m: Matrix4

    Returns Matrix4

extractRotation

  • extractRotation(m: Matrix4): Matrix4
  • Copies the rotation component of the supplied matrix m into this matrix rotation component.

    Parameters

    • m: Matrix4

    Returns Matrix4

flattenToArrayOffset

  • flattenToArrayOffset(array: number[], offset: number): number[]
  • deprecated

    Use {@link Matrix4#toArray .toArray()} instead.

    Parameters

    • array: number[]
    • offset: number

    Returns number[]

fromArray

  • fromArray(array: number[] | ArrayLike<number>, offset?: number): Matrix4
  • Sets the values of this matrix from the provided array or array-like.

    Parameters

    • array: number[] | ArrayLike<number>

      the source array or array-like.

    • Optional offset: number

      (optional) offset into the array-like. Default is 0.

    Returns Matrix4

getInverse

  • getInverse(matrix: Matrix): Matrix
  • deprecated

    Use {@link Matrix4#invert .invert()} instead.

    Parameters

    • matrix: Matrix

    Returns Matrix

getMaxScaleOnAxis

  • getMaxScaleOnAxis(): number
  • Returns number

identity

  • identity(): Matrix4
  • Resets this matrix to identity.

    Returns Matrix4

invert

  • invert(): Matrix4
  • Inverts this matrix.

    Returns Matrix4

lookAt

  • lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4
  • Constructs a rotation matrix, looking from eye towards center with defined up vector.

    Parameters

    • eye: Vector3
    • target: Vector3
    • up: Vector3

    Returns Matrix4

makeBasis

  • makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4
  • Parameters

    • xAxis: Vector3
    • yAxis: Vector3
    • zAxis: Vector3

    Returns Matrix4

makeOrthographic

  • makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4
  • Creates an orthographic projection matrix.

    Parameters

    • left: number
    • right: number
    • top: number
    • bottom: number
    • near: number
    • far: number

    Returns Matrix4

makePerspective

  • makePerspective(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4
  • makePerspective(fov: number, aspect: number, near: number, far: number): Matrix4
  • Creates a frustum matrix.

    Parameters

    • left: number
    • right: number
    • bottom: number
    • top: number
    • near: number
    • far: number

    Returns Matrix4

  • Creates a perspective projection matrix.

    Parameters

    • fov: number
    • aspect: number
    • near: number
    • far: number

    Returns Matrix4

makeRotationAxis

  • makeRotationAxis(axis: Vector3, angle: number): Matrix4
  • Sets this matrix as rotation transform around axis by angle radians. Based on http://www.gamedev.net/reference/articles/article1199.asp.

    Parameters

    • axis: Vector3

      Rotation axis.

    • angle: number

    Returns Matrix4

makeRotationFromEuler

  • makeRotationFromEuler(euler: Euler): Matrix4
  • Parameters

    • euler: Euler

    Returns Matrix4

makeRotationFromQuaternion

  • makeRotationFromQuaternion(q: Quaternion): Matrix4
  • Parameters

    • q: Quaternion

    Returns Matrix4

makeRotationX

  • makeRotationX(theta: number): Matrix4
  • Sets this matrix as rotation transform around x axis by theta radians.

    Parameters

    • theta: number

      Rotation angle in radians.

    Returns Matrix4

makeRotationY

  • makeRotationY(theta: number): Matrix4
  • Sets this matrix as rotation transform around y axis by theta radians.

    Parameters

    • theta: number

      Rotation angle in radians.

    Returns Matrix4

makeRotationZ

  • makeRotationZ(theta: number): Matrix4
  • Sets this matrix as rotation transform around z axis by theta radians.

    Parameters

    • theta: number

      Rotation angle in radians.

    Returns Matrix4

makeScale

  • makeScale(x: number, y: number, z: number): Matrix4
  • Sets this matrix as scale transform.

    Parameters

    • x: number
    • y: number
    • z: number

    Returns Matrix4

makeTranslation

  • makeTranslation(x: number, y: number, z: number): Matrix4
  • Sets this matrix as translation transform.

    Parameters

    • x: number
    • y: number
    • z: number

    Returns Matrix4

multiply

  • multiply(m: Matrix4): Matrix4
  • Multiplies this matrix by m.

    Parameters

    • m: Matrix4

    Returns Matrix4

multiplyMatrices

  • multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4
  • Sets this matrix to a x b.

    Parameters

    • a: Matrix4
    • b: Matrix4

    Returns Matrix4

multiplyScalar

  • multiplyScalar(s: number): Matrix4
  • Multiplies this matrix by s.

    Parameters

    • s: number

    Returns Matrix4

multiplyToArray

  • multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4
  • Sets this matrix to a x b and stores the result into the flat array r. r can be either a regular Array or a TypedArray.

    deprecated

    This method has been removed completely.

    Parameters

    • a: Matrix4
    • b: Matrix4
    • r: number[]

    Returns Matrix4

multiplyVector3

  • multiplyVector3(v: any): any
  • deprecated

    Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead.

    Parameters

    • v: any

    Returns any

multiplyVector3Array

  • multiplyVector3Array(array: number[]): number[]
  • deprecated

    This method has been removed completely.

    Parameters

    • array: number[]

    Returns number[]

multiplyVector4

  • multiplyVector4(v: any): any
  • deprecated

    Use {@link Vector4#applyMatrix4 vector.applyMatrix4( matrix )} instead.

    Parameters

    • v: any

    Returns any

premultiply

  • premultiply(m: Matrix4): Matrix4
  • Parameters

    • m: Matrix4

    Returns Matrix4

rotateAxis

  • rotateAxis(v: any): void
  • deprecated

    Use {@link Vector3#transformDirection Vector3.transformDirection( matrix )} instead.

    Parameters

    • v: any

    Returns void

scale

  • scale(v: Vector3): Matrix4
  • Multiplies the columns of this matrix by vector v.

    Parameters

    • v: Vector3

    Returns Matrix4

set

  • set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): Matrix4
  • Sets all fields of this matrix.

    Parameters

    • n11: number
    • n12: number
    • n13: number
    • n14: number
    • n21: number
    • n22: number
    • n23: number
    • n24: number
    • n31: number
    • n32: number
    • n33: number
    • n34: number
    • n41: number
    • n42: number
    • n43: number
    • n44: number

    Returns Matrix4

setPosition

  • setPosition(v: number | Vector3, y?: number, z?: number): Matrix4
  • Sets the position component for this matrix from vector v.

    Parameters

    • v: number | Vector3
    • Optional y: number
    • Optional z: number

    Returns Matrix4

setRotationFromQuaternion

  • setRotationFromQuaternion(q: Quaternion): Matrix4
  • deprecated

    Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead.

    Parameters

    • q: Quaternion

    Returns Matrix4

toArray

  • toArray(array?: number[], offset?: number): number[]
  • toArray(array?: Matrix4Tuple, offset?: 0): Matrix4Tuple
  • toArray(array?: ArrayLike<number>, offset?: number): ArrayLike<number>
  • Returns an array with the values of this matrix, or copies them into the provided array.

    Parameters

    • Optional array: number[]

      (optional) array to store the matrix to. If this is not provided, a new array will be created.

    • Optional offset: number

      (optional) optional offset into the array.

    Returns number[]

    The created or provided array.

  • Parameters

    • Optional array: Matrix4Tuple
    • Optional offset: 0

    Returns Matrix4Tuple

  • Copies he values of this matrix into the provided array-like.

    Parameters

    • Optional array: ArrayLike<number>

      array-like to store the matrix to.

    • Optional offset: number

      (optional) optional offset into the array-like.

    Returns ArrayLike<number>

    The provided array-like.

transpose

  • transpose(): Matrix4
  • Transposes this matrix.

    Returns Matrix4

Static fromArray

  • fromArray(array: number[][]): Matrix4

Static rotationFromAxisAngle

  • rotationFromAxisAngle(vector: Vector3, angle: number): Matrix4

Static rotationFromEuler

  • rotationFromEuler(euler: Euler): Matrix4

Static rotationFromQuaternion

  • rotationFromQuaternion(quat: Quaternion): Matrix4

Static round