Options
All
  • Public
  • Public/Protected
  • All
Menu

A 4x4 Matrix.

example

// Simple rig for rotating around 3 axes var m = new THREE.Matrix4(); var m1 = new THREE.Matrix4(); var m2 = new THREE.Matrix4(); var m3 = new THREE.Matrix4(); var alpha = 0; var beta = Math.PI; var gamma = Math.PI/2; m1.makeRotationX( alpha ); m2.makeRotationY( beta ); m3.makeRotationZ( gamma ); m.multiplyMatrices( m1, m2 ); m.multiply( m3 );

Hierarchy

  • Matrix4

Implements

Index

Constructors

constructor

  • Returns Matrix4

Properties

elements

elements: Float32Array

Float32Array with matrix values.

Methods

clone

  • clone(): this
  • Returns this

compose

  • Sets this matrix to the transformation composed of translation, rotation and scale.

    Parameters

    Returns Matrix4

copy

  • copy(m: this): this
  • Parameters

    • m: this

    Returns this

copyPosition

  • Parameters

    Returns Matrix4

crossVector

  • crossVector(v: any): void
  • deprecated

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

    Parameters

    • v: any

    Returns void

decompose

  • Decomposes this matrix into the translation, rotation and scale components. If parameters are not passed, new instances will be created.

    Parameters

    Returns Object[]

determinant

  • determinant(): number

equals

  • Parameters

    Returns boolean

extractBasis

extractPosition

  • deprecated

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

    Parameters

    Returns Matrix4

extractRotation

  • Copies the rotation component of the supplied matrix m into this matrix rotation component.

    Parameters

    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[], offset?: number): Matrix4
  • Parameters

    • array: number[]
    • Optional offset: number

    Returns Matrix4

getInverse

getMaxScaleOnAxis

  • getMaxScaleOnAxis(): number
  • Returns number

identity

  • Resets this matrix to identity.

    Returns Matrix4

lookAt

  • Constructs a rotation matrix, looking from eye towards center with defined up vector.

    Parameters

    Returns Matrix4

makeBasis

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

makeRotationFromEuler

  • Parameters

    Returns Matrix4

makeRotationFromQuaternion

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

  • Multiplies this matrix by m.

    Parameters

    Returns Matrix4

multiplyMatrices

  • Sets this matrix to a x b.

    Parameters

    Returns Matrix4

multiplyScalar

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

    Parameters

    • s: number

    Returns Matrix4

multiplyToArray

  • 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

    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

  • Parameters

    Returns Matrix4

rotateAxis

  • rotateAxis(v: any): void
  • deprecated

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

    Parameters

    • v: any

    Returns void

scale

  • Multiplies the columns of this matrix by vector v.

    Parameters

    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

  • Sets the position component for this matrix from vector v.

    Parameters

    Returns Matrix4

setRotationFromQuaternion

  • deprecated

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

    Parameters

    Returns Matrix4

toArray

  • toArray(): number[]
  • Returns number[]

transpose

Generated using TypeDoc