Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains the definition of a 4x4 Matrix of doubles, and associated functions to transform it. The matrix is column-major to match OpenGL's interpretation, and it looks like this:

m00 m10 m20 m30
m01 m11 m21 m31
m02 m12 m22 m32
m03 m13 m23 m33

author

Richard Greenlees

author

Kai Burjack

Hierarchy

  • Matrix4

Indexable

[key: number]: {}
  • [key: number]: number

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Matrix4(): Matrix4
  • new Matrix4(mat: Matrix4): Matrix4
  • new Matrix4(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Matrix4
  • new Matrix4(col0: Vector4, col1: Vector4, col2: Vector4, col3: Vector4): Matrix4
  • Create a new Matrix4 and set it to {@link #identity() identity}.

    Returns Matrix4

  • Create a new Matrix4 and make it a copy of the given matrix.

    Parameters

    • mat: Matrix4
           the <a href="Matrix4.html">Matrix4</a> to copy the values from
      

    Returns Matrix4

  • Create a new 4x4 matrix using the supplied double values.

    The matrix layout will be:

    m00, m10, m20, m30
    m01, m11, m21, m31
    m02, m12, m22, m32
    m03, m13, m23, m33

    Parameters

    • m00: number
           the value of m00
      
    • m01: number
           the value of m01
      
    • m02: number
           the value of m02
      
    • m03: number
           the value of m03
      
    • m10: number
           the value of m10
      
    • m11: number
           the value of m11
      
    • m12: number
           the value of m12
      
    • m13: number
           the value of m13
      
    • m20: number
           the value of m20
      
    • m21: number
           the value of m21
      
    • m22: number
           the value of m22
      
    • m23: number
           the value of m23
      
    • m30: number
           the value of m30
      
    • m31: number
           the value of m31
      
    • m32: number
           the value of m32
      
    • m33: number
           the value of m33
      

    Returns Matrix4

  • Create a new {@link Matrix4d} and initialize its four columns using the supplied vectors.

    Parameters

    Returns Matrix4

Properties

m00

m00: number

m01

m01: number

m02

m02: number

m03

m03: number

m10

m10: number

m11

m11: number

m12

m12: number

m13

m13: number

m20

m20: number

m21

m21: number

m22

m22: number

m23

m23: number

m30

m30: number

m31

m31: number

m32

m32: number

m33

m33: number

properties

properties: { PROPERTY_AFFINE: boolean; PROPERTY_IDENTITY: boolean; PROPERTY_ORTHONORMAL: boolean; PROPERTY_TRANSLATION: boolean } = ...

Type declaration

  • PROPERTY_AFFINE: boolean
  • PROPERTY_IDENTITY: boolean
  • PROPERTY_ORTHONORMAL: boolean
  • PROPERTY_TRANSLATION: boolean

Accessors

0

  • get 0(): { 0: number; 1: number; 2: number; 3: number }
  • Returns { 0: number; 1: number; 2: number; 3: number }

    • get 0(): number
    • set 0(v: number): void
    • get 1(): number
    • set 1(v: number): void
    • get 2(): number
    • set 2(v: number): void
    • get 3(): number
    • set 3(v: number): void

1

  • get 1(): { 0: number; 1: number; 2: number; 3: number }
  • Returns { 0: number; 1: number; 2: number; 3: number }

    • get 0(): number
    • set 0(v: number): void
    • get 1(): number
    • set 1(v: number): void
    • get 2(): number
    • set 2(v: number): void
    • get 3(): number
    • set 3(v: number): void

2

  • get 2(): { 0: number; 1: number; 2: number; 3: number }
  • Returns { 0: number; 1: number; 2: number; 3: number }

    • get 0(): number
    • set 0(v: number): void
    • get 1(): number
    • set 1(v: number): void
    • get 2(): number
    • set 2(v: number): void
    • get 3(): number
    • set 3(v: number): void

3

  • get 3(): { 0: number; 1: number; 2: number; 3: number }
  • Returns { 0: number; 1: number; 2: number; 3: number }

    • get 0(): number
    • set 0(v: number): void
    • get 1(): number
    • set 1(v: number): void
    • get 2(): number
    • set 2(v: number): void
    • get 3(): number
    • set 3(v: number): void

PROPERTY_AFFINE

  • get PROPERTY_AFFINE(): boolean
  • Assume the given properties about this matrix.

    Use one or multiple of 0, {@link Matrix4dc#PROPERTY_IDENTITY}, {@link Matrix4dc#PROPERTY_TRANSLATION}, {@link Matrix4dc#PROPERTY_AFFINE}, {@link Matrix4dc#PROPERTY_PERSPECTIVE}, {@link Matrix4fc#PROPERTY_ORTHONORMAL}.

    Returns boolean

    this

PROPERTY_IDENTITY

  • get PROPERTY_IDENTITY(): boolean

PROPERTY_ORTHONORMAL

  • get PROPERTY_ORTHONORMAL(): boolean

PROPERTY_PERSPECTIVE

  • get PROPERTY_PERSPECTIVE(): boolean

PROPERTY_TRANSLATION

  • get PROPERTY_TRANSLATION(): boolean

Methods

add

add4x3

affineSpan

  • Compute the extents of the coordinate system before this {@link #isAffine() affine} transformation was applied and store the resulting corner coordinates in corner and the span vectors in xDir, yDir and zDir.

    That means, given the maximum extents of the coordinate system between [-1..+1] in all dimensions, this method returns one corner and the length and direction of the three base axis vectors in the coordinate system before this transformation is applied, which transforms into the corner coordinates [-1, +1].

    This method is equivalent to computing at least three adjacent corners using {@link #frustumCorner(int, Vector3d)} and subtracting them to obtain the length and direction of the span vectors.

    Parameters

    • corner: Vector3
           will hold one corner of the span (usually the corner {@link Matrix4dc#CORNER_NXNYNZ})
      
    • xDir: Vector3
           will hold the direction and length of the span along the positive X axis
      
    • yDir: Vector3
           will hold the direction and length of the span along the positive Y axis
      
    • zDir: Vector3
           will hold the direction and length of the span along the positive z axis
      

    Returns Matrix4

    this

arcball

  • arcball(radius: number, center: Vector3, angleX: number, angleY: number, dest?: Matrix4): Matrix4
  • arcball(radius: number, centerX: number, centerY: number, centerZ: number, angleX: number, angleY: number, dest: Matrix4): Matrix4
  • Apply an arcball view transformation to this matrix with the given radius and center position of the arcball and the specified X and Y rotation angles.

    This method is equivalent to calling: translate(0, 0, -radius).rotateX(angleX).rotateY(angleY).translate(-center.x, -center.y, -center.z)

    Parameters

    • radius: number
           the arcball radius
      
    • center: Vector3
           the center position of the arcball
      
    • angleX: number
           the rotation angle around the X axis in radians
      
    • angleY: number
           the rotation angle around the Y axis in radians
      
    • Optional dest: Matrix4

    Returns Matrix4

    dest

  • Parameters

    • radius: number
    • centerX: number
    • centerY: number
    • centerZ: number
    • angleX: number
    • angleY: number
    • dest: Matrix4

    Returns Matrix4

billboardCylindrical

  • Set this matrix to a cylindrical billboard transformation that rotates the local +Z axis of a given object with position objPos towards a target position at targetPos while constraining a cylindrical rotation around the given up vector.

    This method can be used to create the complete model transformation for a given object, including the translation of the object to its position objPos.

    Parameters

    • objPos: Vector3
           the position of the object to rotate towards <code>targetPos</code>
      
    • targetPos: Vector3
           the position of the target (for example the camera) towards which to rotate the object
      
    • up: Vector3
           the rotation axis (must be {@link Vector3d#normalize() normalized})
      

    Returns Matrix4

    this

billboardSpherical

  • Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position objPos towards a target position at targetPos.

    This method can be used to create the complete model transformation for a given object, including the translation of the object to its position objPos.

    If preserving an up vector is not necessary when rotating the +Z axis, then a shortest arc rotation can be obtained using {@link #billboardSpherical(Vector3dc, Vector3dc)}.

    see

    #billboardSpherical(Vector3dc, Vector3dc)

    Parameters

    • objPos: Vector3
           the position of the object to rotate towards <code>targetPos</code>
      
    • targetPos: Vector3
           the position of the target (for example the camera) towards which to rotate the object
      
    • up: Vector3
           the up axis used to orient the object
      

    Returns Matrix4

    this

  • Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position objPos towards a target position at targetPos using a shortest arc rotation by not preserving any up vector of the object.

    This method can be used to create the complete model transformation for a given object, including the translation of the object to its position objPos.

    In order to specify an up vector which needs to be maintained when rotating the +Z axis of the object, use {@link #billboardSpherical(Vector3, Vector3, Vector3)}.

    see

    #billboardSpherical(Vector3dc, Vector3dc, Vector3dc)

    Parameters

    • objPos: Vector3
           the position of the object to rotate towards <code>targetPos</code>
      
    • targetPos: Vector3
           the position of the target (for example the camera) towards which to rotate the object
      

    Returns Matrix4

    this

clone

cofactor3x3

  • Compute the cofactor matrix of the upper left 3x3 submatrix of this and store it into dest.

    The cofactor matrix can be used instead of {@link #normal(Matrix3d)} to transform normals when the orientation of the normals with respect to the surface should be preserved.

    Parameters

    • Optional dest: Matrix3
              will hold the result
      

    Returns Matrix3

    dest

  • Compute the cofactor matrix of the upper left 3x3 submatrix of this and store it into dest. All other values of dest will be set to {@link #identity() identity}.

    The cofactor matrix can be used instead of {@link #normal(Matrix4d)} to transform normals when the orientation of the normals with respect to the surface should be preserved.

    Parameters

    • Optional dest: Matrix4
              will hold the result
      

    Returns Matrix4

    dest

determinant

  • determinant(): number

determinant3x3

  • determinant3x3(): number

determinantAffine

  • determinantAffine(): number

equals

  • equals(m: any, delta?: number): boolean

fma4x3

  • Component-wise add the upper 4x3 submatrices of this and other by first multiplying each component of other's 4x3 submatrix by otherFactor and adding that result to this.

    The matrix other will not be changed.

    Parameters

    • other: Matrix4
           the other matrix
      
    • otherFactor: number
           the factor to multiply each of the other matrix's 4x3 components
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

frustum

  • frustum(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • frustum(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • Apply an arbitrary perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and F the frustum matrix, then the new matrix will be M * F. So when transforming a vector v with the new matrix by using M * F * v, the frustum transformation will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setFrustum(double, double, double, double, double, double, boolean) setFrustum()}.

    Reference: http://www.songho.ca

    see

    #setFrustum(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance along the x-axis to the left frustum edge
      
    • right: number
             the distance along the x-axis to the right frustum edge
      
    • bottom: number
             the distance along the y-axis to the bottom frustum edge
      
    • top: number
             the distance along the y-axis to the top frustum edge
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • left: number
    • right: number
    • bottom: number
    • top: number
    • zNear: number
    • zFar: number
    • Optional dest: Matrix4

    Returns Matrix4

frustumAabb

  • Compute the axis-aligned bounding box of the frustum described by this matrix and store the minimum corner coordinates in the given min and the maximum corner coordinates in the given max vector.

    The matrix this is assumed to be the {@link #invert() inverse} of the origial view-projection matrix for which to compute the axis-aligned bounding box in world-space.

    The axis-aligned bounding box of the unit frustum is (-1, -1, -1), (1, 1, 1).

    Parameters

    • min: Vector3
           will hold the minimum corner coordinates of the axis-aligned bounding box
      
    • max: Vector3
           will hold the maximum corner coordinates of the axis-aligned bounding box
      

    Returns Matrix4

    this

frustumLH

  • frustumLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • frustumLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, dest: Matrix4): Matrix4
  • Apply an arbitrary perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and F the frustum matrix, then the new matrix will be M * F. So when transforming a vector v with the new matrix by using M * F * v, the frustum transformation will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setFrustumLH(double, double, double, double, double, double, boolean) setFrustumLH()}.

    Reference: http://www.songho.ca

    see

    #setFrustumLH(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance along the x-axis to the left frustum edge
      
    • right: number
             the distance along the x-axis to the right frustum edge
      
    • bottom: number
             the distance along the y-axis to the bottom frustum edge
      
    • top: number
             the distance along the y-axis to the top frustum edge
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • left: number
    • right: number
    • bottom: number
    • top: number
    • zNear: number
    • zFar: number
    • dest: Matrix4

    Returns Matrix4

frustumRayDir

get

  • get(dest: Matrix4): Matrix4
  • get(column: number, row: number): number
  • get(dest: number[], offset?: number): number[]

get3x3

getColumn

getEulerAnglesXYZ

getEulerAnglesZYX

getNormalizedRotation

getRow

  • Apply a rotation transformation, rotating about the given {@link AxisAngle4d} and store the result in dest.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and A the rotation matrix obtained from the given {@link AxisAngle4d}, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the {@link AxisAngle4d} rotation will be applied first!

    In order to set the matrix to a rotation transformation without post-multiplying, use {@link #rotation(AxisAngle4d)}.

    Reference: http://en.wikipedia.org

    see

    #rotate(double, double, double, double)

    see

    #rotation(AxisAngle4d)

    Parameters

    • row: number
    • dest: Vector3
           will hold the result
      

    Returns Vector3

    dest

  • Parameters

    Returns Vector4

getRowColumn

  • getRowColumn(row: number, column: number): number

getScale

getTranslation

getUnnormalizedRotation

identity

  • Reset this matrix to the identity.

    Please note that if a call to {@link #identity()} is immediately followed by a call to: {@link #translate(double, double, double) translate}, {@link #rotate(double, double, double, double) rotate}, {@link #scale(double, double, double) scale}, {@link #perspective(double, double, double, double) perspective}, {@link #frustum(double, double, double, double, double, double) frustum}, {@link #ortho(double, double, double, double, double, double) ortho}, {@link #ortho2D(double, double, double, double) ortho2D}, {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt}, {@link #lookAlong(double, double, double, double, double, double) lookAlong}, or any of their overloads, then the call to {@link #identity()} can be omitted and the subsequent call replaced with: {@link #translation(double, double, double) translation}, {@link #rotation(double, double, double, double) rotation}, {@link #scaling(double, double, double) scaling}, {@link #setPerspective(double, double, double, double) setPerspective}, {@link #setFrustum(double, double, double, double, double, double) setFrustum}, {@link #setOrtho(double, double, double, double, double, double) setOrtho}, {@link #setOrtho2D(double, double, double, double) setOrtho2D}, {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt}, {@link #setLookAlong(double, double, double, double, double, double) setLookAlong}, or any of their overloads.

    Returns Matrix4

    this

invert

  • Invert this matrix.

    If this matrix represents an {@link #isAffine() affine} transformation, such as translation, rotation, scaling and shearing, and thus its last row is equal to (0, 0, 0, 1), then {@link #invertAffine()} can be used instead of this method.

    see

    #invertAffine()

    Parameters

    Returns Matrix4

    this

invertAffine

  • Invert this matrix by assuming that it is an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)).

    Parameters

    Returns Matrix4

    this

invertFrustum

  • If this is an arbitrary perspective projection matrix obtained via one of the {@link #frustum(double, double, double, double, double, double) frustum()} methods or via {@link #setFrustum(double, double, double, double, double, double) setFrustum()}, then this method builds the inverse of this.

    This method can be used to quickly obtain the inverse of a perspective projection matrix.

    If this matrix represents a symmetric perspective frustum transformation, as obtained via {@link #perspective(double, double, double, double) perspective()}, then {@link #invertPerspective()} should be used instead.

    see

    #frustum(double, double, double, double, double, double)

    see

    #invertPerspective()

    Parameters

    Returns Matrix4

    this

invertOrtho

  • Invert this orthographic projection matrix.

    This method can be used to quickly obtain the inverse of an orthographic projection matrix.

    Parameters

    Returns Matrix4

    this

invertPerspective

  • If this is a perspective projection matrix obtained via one of the {@link #perspective(double, double, double, double) perspective()} methods or via {@link #setPerspective(double, double, double, double) setPerspective()}, that is, if this is a symmetrical perspective frustum transformation, then this method builds the inverse of this.

    This method can be used to quickly obtain the inverse of a perspective projection matrix when being obtained via {@link #perspective(double, double, double, double) perspective()}.

    see

    #perspective(double, double, double, double)

    Parameters

    Returns Matrix4

    this

invertPerspectiveView

isAffine

  • isAffine(): boolean

isFinite

  • isFinite(): boolean

lerp

  • Linearly interpolate this and other using the given interpolation factor t and store the result in this.

    If t is 0.0 then the result is this. If the interpolation factor is 1.0 then the result is other.

    Parameters

    • other: Matrix4
           the other matrix
      
    • t: number
           the interpolation factor between 0.0 and 1.0
      
    • Optional dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

lookAlong

  • Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.

    If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

    This is equivalent to calling {@link #lookAt(Vector3dc, Vector3dc, Vector3dc) lookAt} with eye = (0, 0, 0) and center = dir.

    In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(Vector3dc, Vector3dc) setLookAlong()}.

    see

    #lookAlong(double, double, double, double, double, double)

    see

    #lookAt(Vector3dc, Vector3dc, Vector3dc)

    see

    #setLookAlong(Vector3dc, Vector3dc)

    Parameters

    • dir: Vector3
             the direction in space to look along
      
    • up: Vector3
             the direction of 'up'
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.

    If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

    This is equivalent to calling {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt()} with eye = (0, 0, 0) and center = dir.

    In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()}

    see

    #lookAt(double, double, double, double, double, double, double, double, double)

    see

    #setLookAlong(double, double, double, double, double, double)

    Parameters

    • dirX: number
               the x-coordinate of the direction to look along
      
    • dirY: number
               the y-coordinate of the direction to look along
      
    • dirZ: number
               the z-coordinate of the direction to look along
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • Optional dest: Matrix4
               will hold the result
      

    Returns Matrix4

    dest

lookAt

  • Apply a "lookat" transformation to this matrix for a right-handed coordinate system, that aligns -z with center - eye and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc)}.

    see

    #lookAt(double, double, double, double, double, double, double, double, double)

    see

    #setLookAlong(Vector3dc, Vector3dc)

    Parameters

    • eye: Vector3
             the position of the camera
      
    • center: Vector3
             the point in space to look at
      
    • up: Vector3
             the direction of 'up'
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply a "lookat" transformation to this matrix for a right-handed coordinate system, that aligns -z with center - eye and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}.

    see

    #lookAt(Vector3dc, Vector3dc, Vector3dc)

    see

    #setLookAt(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • Optional dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

lookAtLH

  • Apply a "lookat" transformation to this matrix for a left-handed coordinate system, that aligns +z with center - eye and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAtLH(Vector3dc, Vector3dc, Vector3dc)}.

    see

    #lookAtLH(double, double, double, double, double, double, double, double, double)

    see

    #setLookAtLH(Vector3dc, Vector3dc, Vector3dc)

    Parameters

    • eye: Vector3
             the position of the camera
      
    • center: Vector3
             the point in space to look at
      
    • up: Vector3
             the direction of 'up'
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply a "lookat" transformation to this matrix for a left-handed coordinate system, that aligns +z with center - eye and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()}.

    see

    #lookAtLH(Vector3dc, Vector3dc, Vector3dc)

    see

    #setLookAtLH(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • Optional dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

lookAtPerspective

  • lookAtPerspective(eyeX: number, eyeY: number, eyeZ: number, centerX: number, centerY: number, centerZ: number, upX: number, upY: number, upZ: number, dest: Matrix4): Matrix4
  • Apply a "lookat" transformation to this matrix for a right-handed coordinate system, that aligns -z with center - eye and store the result in dest.

    This method assumes this to be a perspective transformation, obtained via {@link #frustum(double, double, double, double, double, double) frustum()} or {@link #perspective(double, double, double, double) perspective()} or one of their overloads.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}.

    see

    #setLookAt(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

lookAtPerspectiveLH

  • lookAtPerspectiveLH(eyeX: number, eyeY: number, eyeZ: number, centerX: number, centerY: number, centerZ: number, upX: number, upY: number, upZ: number, dest: Matrix4): Matrix4
  • Apply a "lookat" transformation to this matrix for a left-handed coordinate system, that aligns +z with center - eye and store the result in dest.

    This method assumes this to be a perspective transformation, obtained via {@link #frustumLH(double, double, double, double, double, double) frustumLH()} or {@link #perspectiveLH(double, double, double, double) perspectiveLH()} or one of their overloads.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()}.

    see

    #setLookAtLH(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

mapXZY

mapXZnY

mapXnYnZ

mapXnZY

mapXnZnY

mapYXZ

mapYZX

mapYZnX

mapYnXZ

mapYnXnZ

mapYnZX

mapYnZnX

mapZXY

mapZXnY

mapZYX

mapZYnX

mapZnXY

mapZnXnY

mapZnYX

mapZnYnX

mapnXYnZ

mapnXZY

mapnXZnY

mapnXnYZ

mapnXnYnZ

mapnXnZY

mapnXnZnY

mapnYXZ

mapnYXnZ

mapnYZX

mapnYZnX

mapnYnXZ

mapnYnXnZ

mapnYnZX

mapnYnZnX

mapnZXY

mapnZXnY

mapnZYX

mapnZYnX

mapnZnXY

mapnZnXnY

mapnZnYX

mapnZnYnX

mul

  • mul(right: Matrix4, dest: Matrix4): Matrix4
  • mul(r00: number, r01: number, r02: number, r03: number, r10: number, r11: number, r12: number, r13: number, r20: number, r21: number, r22: number, r23: number, r30: number, r31: number, r32: number, r33: number, dest?: Matrix4): Matrix4
  • Multiply this matrix by the supplied right matrix.

    If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    Parameters

    Returns Matrix4

    this

  • Multiply this matrix by the matrix with the supplied elements.

    If M is this matrix and R the right matrix whose elements are supplied via the parameters, the: then new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    Parameters

    • r00: number
           the m00 element of the right matrix
      
    • r01: number
           the m01 element of the right matrix
      
    • r02: number
           the m02 element of the right matrix
      
    • r03: number
           the m03 element of the right matrix
      
    • r10: number
           the m10 element of the right matrix
      
    • r11: number
           the m11 element of the right matrix
      
    • r12: number
           the m12 element of the right matrix
      
    • r13: number
           the m13 element of the right matrix
      
    • r20: number
           the m20 element of the right matrix
      
    • r21: number
           the m21 element of the right matrix
      
    • r22: number
           the m22 element of the right matrix
      
    • r23: number
           the m23 element of the right matrix
      
    • r30: number
           the m30 element of the right matrix
      
    • r31: number
           the m31 element of the right matrix
      
    • r32: number
           the m32 element of the right matrix
      
    • r33: number
           the m33 element of the right matrix
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mul0

  • Multiply this matrix by the supplied right matrix.

    If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    This method neither assumes nor checks for any matrix properties of this or right and will always perform a complete 4x4 matrix multiplication. This method should only be used whenever the multiplied matrices do not have any properties for which there are optimized multiplication methods available.

    Parameters

    • right: Matrix4
           the right operand of the matrix multiplication
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mul3x3

  • mul3x3(r00: number, r01: number, r02: number, r10: number, r11: number, r12: number, r20: number, r21: number, r22: number, dest?: Matrix4): Matrix4
  • Multiply this matrix by the 3x3 matrix with the supplied elements expanded to a 4x4 matrix with all other matrix elements set to identity.

    If M is this matrix and R the right matrix whose elements are supplied via the parameters, the: then new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    Parameters

    • r00: number
           the m00 element of the right matrix
      
    • r01: number
           the m01 element of the right matrix
      
    • r02: number
           the m02 element of the right matrix
      
    • r10: number
           the m10 element of the right matrix
      
    • r11: number
           the m11 element of the right matrix
      
    • r12: number
           the m12 element of the right matrix
      
    • r20: number
           the m20 element of the right matrix
      
    • r21: number
           the m21 element of the right matrix
      
    • r22: number
           the m22 element of the right matrix
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mul4x3ComponentWise

mulAffine

  • Multiply this matrix by the supplied right matrix, of: both which are assumed to be {@link #isAffine() affine}, store: and the result in this.

    This method assumes that this matrix and the given right matrix both represent an {@link #isAffine() affine} transformation (i.e. their last rows are equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrices only represent affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).

    This method will not modify either the last row of this or the last row of right.

    If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    Parameters

    • right: Matrix4
           the right operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulAffineR

  • Multiply this matrix by the supplied right matrix, is: which assumed to be {@link #isAffine() affine}, store: and the result in this.

    This method assumes that the given right matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrix only represents affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).

    If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

    Parameters

    • right: Matrix4
           the right operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulComponentWise

mulLocal

  • Pre-multiply this matrix by the supplied left matrix and store the result in this.

    If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

    Parameters

    • left: Matrix4
           the left operand of the matrix multiplication
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulLocalAffine

  • Pre-multiply this matrix by the supplied left matrix, of: both which are assumed to be {@link #isAffine() affine}, store: and the result in this.

    This method assumes that this matrix and the given left matrix both represent an {@link #isAffine() affine} transformation (i.e. their last rows are equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrices only represent affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).

    This method will not modify either the last row of this or the last row of left.

    If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

    Parameters

    • left: Matrix4
           the left operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulOrthoAffine

  • Multiply this orthographic projection matrix by the supplied {@link #isAffine() affine} view matrix.

    If M is this matrix and V the view matrix, then the new matrix will be M * V. So when transforming a vector v with the new matrix by using M * V * v, the transformation of the view matrix will be applied first!

    Parameters

    • view: Matrix4
           the affine matrix which to multiply <code>this</code> with
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulPerspectiveAffine

  • Multiply this symmetric perspective projection matrix by the supplied {@link #isAffine() affine} view matrix.

    If P is this matrix and V the view matrix, then the new matrix will be P * V. So when transforming a vector v with the new matrix by using P * V * v, the transformation of the view matrix will be applied first!

    Parameters

    • view: Matrix4
           the {@link #isAffine() affine} matrix to multiply <code>this</code> symmetric perspective projection matrix by
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

mulTranslationAffine

negateX

negateY

negateZ

normal

  • Compute a normal matrix from the upper left 3x3 submatrix of this and store it into the upper left 3x3 submatrix of dest. All other values of dest will be set to {@link #identity() identity}.

    The normal matrix of m is the transpose of the inverse of m.

    Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that case this itself is its normal matrix. In that case, use {@link #set3x3(Matrix4dc)} to set a given Matrix4d to only the upper left 3x3 submatrix of a given matrix.

    see

    #set3x3(Matrix4dc)

    Parameters

    • Optional dest: Matrix4
              will hold the result
      

    Returns Matrix4

    dest

  • Compute a normal matrix from the upper left 3x3 submatrix of this and store it into dest.

    The normal matrix of m is the transpose of the inverse of m.

    Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that case this itself is its normal matrix. In that case, use {@link Matrix3d#set(Matrix4dc)} to set a given Matrix3d to only the upper left 3x3 submatrix of this matrix.

    see

    Matrix3d#set(Matrix4dc)

    see

    #get3x3(Matrix3d)

    Parameters

    • dest: Matrix3
              will hold the result
      

    Returns Matrix3

    dest

normalize3x3

  • Normalize the upper left 3x3 submatrix of this matrix.

    The resulting matrix will map unit vectors to unit vectors, though a pair of orthogonal input unit vectors need not be mapped to a pair of orthogonal output vectors if the original matrix was not orthogonal itself (i.e. had skewing).

    Parameters

    Returns Matrix4

    this

  • Parameters

    Returns Matrix3

normalizedPositiveX

normalizedPositiveY

normalizedPositiveZ

obliqueZ

  • Apply an oblique projection transformation to this matrix with the given values for a and b and store the result in dest.

    If M is this matrix and O the oblique transformation matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the oblique transformation will be applied first!

    The oblique transformation is defined as:

    x' = x + a*z
    y' = y + a*z
    z' = z
    
    or in matrix form:
    1 0 a 0
    0 1 b 0
    0 0 1 0
    0 0 0 1
    

    Parameters

    • a: number
             the value for the z factor that applies to x
      
    • b: number
             the value for the z factor that applies to y
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

origin

originAffine

ortho

  • ortho(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • ortho(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • Apply an orthographic projection transformation for a right-handed coordinate system using OpenGL's NDC z range of [-1..+1] to this matrix and store the result in dest.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho(double, double, double, double, double, double) setOrtho()}.

    Reference: http://www.songho.ca

    see

    #setOrtho(double, double, double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply an orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()}.

    Reference: http://www.songho.ca

    see

    #setOrtho(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

ortho2D

  • ortho2D(left: number, right: number, bottom: number, top: number, dest?: Matrix4): Matrix4
  • Apply an orthographic projection transformation for a right-handed coordinate system to this matrix and store the result in dest.

    This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, Matrix4d) ortho()} with zNear=-1 and zFar=+1.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2D(double, double, double, double) setOrtho()}.

    Reference: http://www.songho.ca

    see

    #ortho(double, double, double, double, double, double, Matrix4d)

    see

    #setOrtho2D(double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

ortho2DLH

  • ortho2DLH(left: number, right: number, bottom: number, top: number, dest?: Matrix4): Matrix4
  • Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in dest.

    This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, Matrix4d) orthoLH()} with zNear=-1 and zFar=+1.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2DLH(double, double, double, double) setOrthoLH()}.

    Reference: http://www.songho.ca

    see

    #orthoLH(double, double, double, double, double, double, Matrix4d)

    see

    #setOrtho2DLH(double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

orthoCrop

orthoLH

  • orthoLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • orthoLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • Apply an orthographic projection transformation for a left-handed coordiante system using OpenGL's NDC z range of [-1..+1] to this matrix and store the result in dest.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()}.

    Reference: http://www.songho.ca

    see

    #setOrthoLH(double, double, double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply an orthographic projection transformation for a left-handed coordiante system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrthoLH(double, double, double, double, double, double, boolean) setOrthoLH()}.

    Reference: http://www.songho.ca

    see

    #setOrthoLH(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

orthoSymmetric

  • orthoSymmetric(width: number, height: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • orthoSymmetric(width: number, height: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • Apply a symmetric orthographic projection transformation for a right-handed coordinate system using OpenGL's NDC z range of [-1..+1] to this matrix and store the result in dest.

    This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, Matrix4d) ortho()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(double, double, double, double) setOrthoSymmetric()}.

    Reference: http://www.songho.ca

    see

    #setOrthoSymmetric(double, double, double, double)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, boolean, Matrix4d) ortho()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(double, double, double, double, boolean) setOrthoSymmetric()}.

    Reference: http://www.songho.ca

    see

    #setOrthoSymmetric(double, double, double, double, boolean)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

orthoSymmetricLH

  • orthoSymmetricLH(width: number, height: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • orthoSymmetricLH(width: number, height: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • Apply a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of [-1..+1] to this matrix and store the result in dest.

    This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, Matrix4d) orthoLH()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double) setOrthoSymmetricLH()}.

    Reference: http://www.songho.ca

    see

    #setOrthoSymmetricLH(double, double, double, double)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, boolean, Matrix4d) orthoLH()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

    In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double, boolean) setOrthoSymmetricLH()}.

    Reference: http://www.songho.ca

    see

    #setOrthoSymmetricLH(double, double, double, double, boolean)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

perspective

  • perspective(fovy: number, aspect: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • perspective(fovy: number, aspect: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and P the perspective projection matrix, then the new matrix will be M * P. So when transforming a vector v with the new matrix by using M * P * v, the perspective projection will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspective(double, double, double, double, boolean) setPerspective}.

    see

    #setPerspective(double, double, double, double, boolean)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • fovy: number
    • aspect: number
    • zNear: number
    • zFar: number
    • Optional dest: Matrix4

    Returns Matrix4

perspectiveFar

  • perspectiveFar(): number

perspectiveFov

  • perspectiveFov(): number

perspectiveFrustumSlice

  • perspectiveFrustumSlice(near: number, far: number, dest: Matrix4): Matrix4

perspectiveInvOrigin

perspectiveLH

  • perspectiveLH(fovy: number, aspect: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • perspectiveLH(fovy: number, aspect: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • Apply a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and P the perspective projection matrix, then the new matrix will be M * P. So when transforming a vector v with the new matrix by using M * P * v, the perspective projection will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveLH(double, double, double, double, boolean) setPerspectiveLH}.

    see

    #setPerspectiveLH(double, double, double, double, boolean)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • fovy: number
    • aspect: number
    • zNear: number
    • zFar: number
    • Optional dest: Matrix4

    Returns Matrix4

perspectiveNear

  • perspectiveNear(): number

perspectiveOffCenter

  • perspectiveOffCenter(fovy: number, offAngleX: number, offAngleY: number, aspect: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • perspectiveOffCenter(fovy: number, offAngleX: number, offAngleY: number, aspect: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • Apply an asymmetric off-center perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    The given angles offAngleX and offAngleY are the horizontal and vertical angles between the line of sight and the line given by the center of the near and far frustum planes. So, when offAngleY is just fovy/2 then the projection frustum is rotated towards +Y and the bottom frustum plane is parallel to the XZ-plane.

    If M is this matrix and P the perspective projection matrix, then the new matrix will be M * P. So when transforming a vector v with the new matrix by using M * P * v, the perspective projection will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveOffCenter(double, double, double, double, double, double, boolean) setPerspectiveOffCenter}.

    see

    #setPerspectiveOffCenter(double, double, double, double, double, double, boolean)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • offAngleX: number
             the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes
      
    • offAngleY: number
             the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • fovy: number
    • offAngleX: number
    • offAngleY: number
    • aspect: number
    • zNear: number
    • zFar: number
    • Optional dest: Matrix4

    Returns Matrix4

perspectiveOrigin

perspectiveRect

  • perspectiveRect(width: number, height: number, zNear: number, zFar: number, zZeroToOne: boolean, dest?: Matrix4): Matrix4
  • perspectiveRect(width: number, height: number, zNear: number, zFar: number, dest?: Matrix4): Matrix4
  • Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range to this matrix and store the result in dest.

    If M is this matrix and P the perspective projection matrix, then the new matrix will be M * P. So when transforming a vector v with the new matrix by using M * P * v, the perspective projection will be applied first!

    In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(double, double, double, double, boolean) setPerspectiveRect}.

    see

    #setPerspectiveRect(double, double, double, double, boolean)

    Parameters

    • width: number
             the width of the near frustum plane
      
    • height: number
             the height of the near frustum plane
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

  • Parameters

    • width: number
    • height: number
    • zNear: number
    • zFar: number
    • Optional dest: Matrix4

    Returns Matrix4

pick

  • pick(x: number, y: number, width: number, height: number, viewport: number[], dest?: Matrix4): Matrix4

positiveX

positiveY

positiveZ

project

projectedGridRange

public

reflect

  • Apply a mirror/reflection transformation to this matrix that reflects about the given plane specified via the plane normal and a point on the plane.

    If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

    Parameters

    • nx: number
           the x-coordinate of the plane normal
      
    • ny: number
           the y-coordinate of the plane normal
      
    • nz: number
           the z-coordinate of the plane normal
      
    • px: number
           the x-coordinate of a point on the plane
      
    • py: number
           the y-coordinate of a point on the plane
      
    • pz: number
           the z-coordinate of a point on the plane
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Apply a mirror/reflection transformation to this matrix that reflects about the given plane specified via the plane normal and a point on the plane.

    If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

    Parameters

    Returns Matrix4

    this

  • Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation and a point on the plane.

    This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is (0, 0, 1). So, if the given {@link Quaterniondc} is the identity (does not apply any additional rotation), the reflection plane will be z=0, offset by the given point.

    If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

    Parameters

    • orientation: Quaternion
           the plane orientation relative to an implied normal vector of <code>(0, 0, 1)</code>
      
    • point: Vector3
           a point on the plane
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Apply a mirror/reflection transformation to this matrix that reflects about the given plane specified via the equation xa + yb + z*c + d = 0.

    The vector (a, b, c) must be a unit vector.

    If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

    Reference: msdn.microsoft.com

    Parameters

    • a: number
           the x factor in the plane equation
      
    • b: number
           the y factor in the plane equation
      
    • c: number
           the z factor in the plane equation
      
    • d: number
           the constant in the plane equation
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

reflection

  • Set this matrix to a mirror/reflection transformation that reflects about the given plane specified via the equation xa + yb + z*c + d = 0.

    The vector (a, b, c) must be a unit vector.

    Reference: msdn.microsoft.com

    Parameters

    • a: number
           the x factor in the plane equation
      
    • b: number
           the y factor in the plane equation
      
    • c: number
           the z factor in the plane equation
      
    • d: number
           the constant in the plane equation
      

    Returns Matrix4

    this

  • Set this matrix to a mirror/reflection transformation that reflects about the given plane specified via the plane normal and a point on the plane.

    Parameters

    Returns Matrix4

    this

  • Set this matrix to a mirror/reflection transformation that reflects about a plane specified via the plane orientation and a point on the plane.

    This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is (0, 0, 1). So, if the given {@link Quaterniondc} is the identity (does not apply any additional rotation), the reflection plane will be z=0, offset by the given point.

    Parameters

    Returns Matrix4

    this

  • Set this matrix to a mirror/reflection transformation that reflects about the given plane specified via the plane normal and a point on the plane.

    Parameters

    • nx: number
           the x-coordinate of the plane normal
      
    • ny: number
           the y-coordinate of the plane normal
      
    • nz: number
           the z-coordinate of the plane normal
      
    • px: number
           the x-coordinate of a point on the plane
      
    • py: number
           the y-coordinate of a point on the plane
      
    • pz: number
           the z-coordinate of a point on the plane
      

    Returns Matrix4

    this

rotate

  • Apply a rotation transformation, rotating the given radians about the specified axis and store the result in dest.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and A the rotation matrix obtained from the given angle and axis, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the axis-angle rotation will be applied first!

    In order to set the matrix to a rotation transformation without post-multiplying, use {@link #rotation(double, Vector3dc)}.

    Reference: http://en.wikipedia.org

    see

    #rotate(double, double, double, double)

    see

    #rotation(double, Vector3dc)

    Parameters

    • angle: number
           the angle in radians
      
    • axis: Vector3
           the rotation axis (needs to be {@link Vector3d#normalize() normalized})
      
    • Optional dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

  • Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

    In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.

    see

    #rotation(double, double, double, double)

    Parameters

    • ang: number
             the angle is in radians
      
    • x: number
             the x component of the axis
      
    • y: number
             the y component of the axis
      
    • z: number
             the z component of the axis
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateAffine

  • rotateAffine(ang: number, x: number, y: number, z: number, dest?: Matrix4): Matrix4
  • Apply rotation to this {@link #isAffine() affine} matrix by rotating the given amount of radians about the specified (x, y, z) axis and store the result in dest.

    This method assumes this to be {@link #isAffine() affine}.

    The axis described by the three components needs to be a unit vector.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.

    Reference: http://en.wikipedia.org

    see

    #rotation(double, double, double, double)

    Parameters

    • ang: number
             the angle in radians
      
    • x: number
             the x component of the axis
      
    • y: number
             the y component of the axis
      
    • z: number
             the z component of the axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateAffineXYZ

  • rotateAffineXYZ(angleX: number, angleY: number, angleZ: number, dest?: Matrix4): Matrix4
  • Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method assumes that this matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)

    Parameters

    • angleX: number
             the angle to rotate about X
      
    • angleY: number
             the angle to rotate about Y
      
    • angleZ: number
             the angle to rotate about Z
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateAffineYXZ

  • rotateAffineYXZ(angleY: number, angleX: number, angleZ: number, dest?: Matrix4): Matrix4
  • Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method assumes that this matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    Parameters

    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • angleZ: number
             the angle to rotate about Z
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateAffineZYX

  • rotateAffineZYX(angleZ: number, angleY: number, angleX: number, dest?: Matrix4): Matrix4
  • Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method assumes that this matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)) and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    Parameters

    • angleZ: number
             the angle to rotate about Z
      
    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateAround

rotateAroundAffine

  • Apply the rotation transformation of the given {@link Quaterniondc} to this matrix while using (ox, oy, oz) as the rotation origin.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be M * Q. So when transforming a vector v with the new matrix by using M * Q * v, the quaternion rotation will be applied first!

    This method is equivalent to calling: translate(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)

    Reference: http://en.wikipedia.org

    Parameters

    • quat: Quaternion
           the {@link Quaterniondc}
      
    • ox: number
           the x coordinate of the rotation origin
      
    • oy: number
           the y coordinate of the rotation origin
      
    • oz: number
           the z coordinate of the rotation origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateAroundLocal

  • Pre-multiply the rotation - and possibly scaling - transformation of the given {@link Quaterniondc} to this matrix while using (ox, oy, oz) as the rotation origin.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be Q * M. So when transforming a vector v with the new matrix by using Q * M * v, the quaternion rotation will be applied last!

    This method is equivalent to calling: translateLocal(-ox, -oy, -oz).rotateLocal(quat).translateLocal(ox, oy, oz)

    Reference: http://en.wikipedia.org

    Parameters

    • quat: Quaternion
           the {@link Quaterniondc}
      
    • ox: number
           the x coordinate of the rotation origin
      
    • oy: number
           the y coordinate of the rotation origin
      
    • oz: number
           the z coordinate of the rotation origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateLocal

  • rotateLocal(ang: number, x: number, y: number, z: number, dest?: Matrix4): Matrix4
  • Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified (x, y, z) axis and store the result in dest.

    The axis described by the three components needs to be a unit vector.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

    In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.

    Reference: http://en.wikipedia.org

    see

    #rotation(double, double, double, double)

    Parameters

    • ang: number
             the angle in radians
      
    • x: number
             the x component of the axis
      
    • y: number
             the y component of the axis
      
    • z: number
             the z component of the axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateLocalX

  • Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in dest.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

    In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationX(double) rotationX()}.

    Reference: http://en.wikipedia.org

    see

    #rotationX(double)

    Parameters

    • ang: number
             the angle in radians to rotate about the X axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateLocalY

  • Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result in dest.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

    In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationY(double) rotationY()}.

    Reference: http://en.wikipedia.org

    see

    #rotationY(double)

    Parameters

    • ang: number
             the angle in radians to rotate about the Y axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateLocalZ

  • Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in dest.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

    In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(double) rotationZ()}.

    Reference: http://en.wikipedia.org

    see

    #rotationZ(double)

    Parameters

    • ang: number
             the angle in radians to rotate about the Z axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateTowards

  • Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a rotation transformation without post-multiplying it, use {@link #rotationTowards(Vector3dc, Vector3dc) rotationTowards()}.

    This method is equivalent to calling: mulAffine(new Matrix4d().lookAt(new Vector3d(), new Vector3d(dir).negate(), up).invertAffine(), dest)

    see

    #rotateTowards(double, double, double, double, double, double, Matrix4d)

    see

    #rotationTowards(Vector3dc, Vector3dc)

    Parameters

    • direction: Vector3
               the direction to rotate towards
      
    • up: Vector3
               the up vector
      
    • Optional dest: Matrix4
               will hold the result
      

    Returns Matrix4

    dest

  • Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with dir and store the result in dest.

    If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

    In order to set the matrix to a rotation transformation without post-multiplying it, use {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}.

    This method is equivalent to calling: mulAffine(new Matrix4d().lookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine(), dest)

    see

    #rotateTowards(Vector3dc, Vector3dc)

    see

    #rotationTowards(double, double, double, double, double, double)

    Parameters

    • dirX: number
               the x-coordinate of the direction to rotate towards
      
    • dirY: number
               the y-coordinate of the direction to rotate towards
      
    • dirZ: number
               the z-coordinate of the direction to rotate towards
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      
    • Optional dest: Matrix4
               will hold the result
      

    Returns Matrix4

    dest

rotateTowardsXY

  • Apply rotation about the Z axis to align the local +X towards (dirX, dirY).

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    The vector (dirX, dirY) must be a unit vector.

    Parameters

    • dirX: number
             the x component of the normalized direction
      
    • dirY: number
             the y component of the normalized direction
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateTranslation

  • rotateTranslation(ang: number, x: number, y: number, z: number, dest?: Matrix4): Matrix4
  • Apply rotation to this matrix, which is assumed to only contain a translation, by rotating the given amount of radians about the specified (x, y, z) axis and store the result in dest.

    This method assumes this to only contain a translation.

    The axis described by the three components needs to be a unit vector.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.

    Reference: http://en.wikipedia.org

    see

    #rotation(double, double, double, double)

    Parameters

    • ang: number
             the angle in radians
      
    • x: number
             the x component of the axis
      
    • y: number
             the y component of the axis
      
    • z: number
             the z component of the axis
      
    • Optional dest: Matrix4
             will hold the result
      

    Returns Matrix4

    dest

rotateX

  • Apply rotation about the X axis to this matrix by rotating the given amount of radians.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateXYZ

  • Apply rotation of angles.x radians about the X axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.z radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)

    Parameters

    Returns Matrix4

    this

  • Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)

    Parameters

    • angleX: number
             the angle to rotate about X
      
    • angleY: number
             the angle to rotate about Y
      
    • angleZ: number
             the angle to rotate about Z
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateY

  • Apply rotation about the Y axis to this matrix by rotating the given amount of radians.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateYXZ

  • Apply rotation of angles.y radians about the Y axis, followed by a rotation of angles.x radians about the X axis and followed by a rotation of angles.z radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)

    Parameters

    Returns Matrix4

    this

  • Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateY(angleY).rotateX(angleX).rotateZ(angleZ)

    Parameters

    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • angleZ: number
             the angle to rotate about Z
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateZ

  • Apply rotation about the Z axis to this matrix by rotating the given amount of radians.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotateZYX

  • Apply rotation of angles.z radians about the Z axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.x radians about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)

    Parameters

    Returns Matrix4

    this

  • Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

    This method is equivalent to calling: rotateZ(angleZ).rotateY(angleY).rotateX(angleX)

    Parameters

    • angleZ: number
             the angle to rotate about Z
      
    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

rotation

  • Set this matrix to a rotation transformation using the given {@link AxisAngle4}.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

    In order to apply the rotation transformation to an existing transformation, use {@link #rotate(AxisAngle4) rotate()} instead.

    Reference: http://en.wikipedia.org

    see

    #rotate(AxisAngle4)

    Parameters

    • angleAxis: AxisAngle4
           the {@link AxisAngle4} (needs to be {@link AxisAngle4#normalize() normalized})
      

    Returns Matrix4

    this

  • Set this matrix to the rotation - and possibly scaling - transformation of the given {@link Quaterniondc}.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

    In order to apply the rotation transformation to an existing transformation, use {@link #rotate(Quaterniondc) rotate()} instead.

    Reference: http://en.wikipedia.org

    see

    #rotate(Quaterniondc)

    Parameters

    Returns Matrix4

    this

  • Set this matrix to a rotation matrix which rotates the given radians about a given axis.

    The axis described by the axis vector needs to be a unit vector.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Parameters

    • angle: number
           the angle in radians
      
    • axis: Vector3
           the axis to rotate about
      

    Returns Matrix4

    this

  • Set this matrix to a rotation matrix which rotates the given radians about a given axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    From Wikipedia

    Parameters

    • angle: number
           the angle in radians
      
    • x: number
           the x-coordinate of the axis to rotate about
      
    • y: number
           the y-coordinate of the axis to rotate about
      
    • z: number
           the z-coordinate of the axis to rotate about
      

    Returns Matrix4

    this

rotationAround

  • Set this matrix to a transformation composed of a rotation of the specified {@link Quaterniondc} while using (ox, oy, oz) as the rotation origin.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)

    Reference: http://en.wikipedia.org

    Parameters

    • quat: Quaternion
           the {@link Quaterniondc}
      
    • ox: number
           the x coordinate of the rotation origin
      
    • oy: number
           the y coordinate of the rotation origin
      
    • oz: number
           the z coordinate of the rotation origin
      

    Returns Matrix4

    this

rotationTowards

  • rotationTowards(dir: Vector3, up: Vector3): Matrix4
  • rotationTowards(dirX: number, dirY: number, dirZ: number, upX: number, upY: number, upZ: number): Matrix4
  • Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with dir.

    In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}.

    This method is equivalent to calling: setLookAt(new Vector3d(), new Vector3d(dir).negate(), up).invertAffine()

    see

    #rotationTowards(Vector3dc, Vector3dc)

    see

    #rotateTowards(double, double, double, double, double, double)

    Parameters

    • dir: Vector3
               the direction to orient the local -z axis towards
      
    • up: Vector3
               the up vector
      

    Returns Matrix4

    this

  • Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with dir.

    In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}.

    This method is equivalent to calling: setLookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine()

    see

    #rotateTowards(Vector3dc, Vector3dc)

    see

    #rotationTowards(double, double, double, double, double, double)

    Parameters

    • dirX: number
               the x-coordinate of the direction to rotate towards
      
    • dirY: number
               the y-coordinate of the direction to rotate towards
      
    • dirZ: number
               the z-coordinate of the direction to rotate towards
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      

    Returns Matrix4

    this

rotationTowardsXY

  • rotationTowardsXY(dirX: number, dirY: number): Matrix4
  • Set this matrix to a rotation transformation about the Z axis to align the local +X towards (dirX, dirY).

    The vector (dirX, dirY) must be a unit vector.

    Parameters

    • dirX: number
             the x component of the normalized direction
      
    • dirY: number
             the y component of the normalized direction
      

    Returns Matrix4

    this

rotationX

  • Set this matrix to a rotation transformation about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      

    Returns Matrix4

    this

rotationXYZ

  • rotationXYZ(angleX: number, angleY: number, angleZ: number): Matrix4
  • Set this matrix to a rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: rotationX(angleX).rotateY(angleY).rotateZ(angleZ)

    Parameters

    • angleX: number
             the angle to rotate about X
      
    • angleY: number
             the angle to rotate about Y
      
    • angleZ: number
             the angle to rotate about Z
      

    Returns Matrix4

    this

rotationY

  • Set this matrix to a rotation transformation about the Y axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      

    Returns Matrix4

    this

rotationYXZ

  • rotationYXZ(angleY: number, angleX: number, angleZ: number): Matrix4
  • Set this matrix to a rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: rotationY(angleY).rotateX(angleX).rotateZ(angleZ)

    Parameters

    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • angleZ: number
             the angle to rotate about Z
      

    Returns Matrix4

    this

rotationZ

  • Set this matrix to a rotation transformation about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Reference: http://en.wikipedia.org

    Parameters

    • ang: number
             the angle in radians
      

    Returns Matrix4

    this

rotationZYX

  • rotationZYX(angleZ: number, angleY: number, angleX: number): Matrix4
  • Set this matrix to a rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: rotationZ(angleZ).rotateY(angleY).rotateX(angleX)

    Parameters

    • angleZ: number
             the angle to rotate about Z
      
    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      

    Returns Matrix4

    this

scale

  • Apply scaling to this matrix by scaling the base axes by the given xyz.x, xyz.y and xyz.z factors, respectively.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

    Parameters

    • xyz: Vector3
             the factors of the x, y and z component, respectively
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Apply scaling to this matrix by uniformly scaling all base axes by the given xyz factor.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

    see

    #scale(double, double, double)

    Parameters

    • xyz: number
             the factor for all components
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Apply scaling to this matrix by scaling the base axes by the given x, y and z factors.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

    Parameters

    • x: number
             the factor of the x component
      
    • y: number
             the factor of the y component
      
    • z: number
             the factor of the z component
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

scaleAround

  • scaleAround(sx: number, sy: number, sz: number, ox: number, oy: number, oz: number, dest?: Matrix4): Matrix4
  • scaleAround(factor: number, ox: number, oy: number, oz: number, dest?: Matrix4): Matrix4
  • Apply scaling to this matrix by scaling the base axes by the given sx, sy and sz factors while using (ox, oy, oz) as the scaling origin.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

    This method is equivalent to calling: translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz)

    Parameters

    • sx: number
             the scaling factor of the x component
      
    • sy: number
             the scaling factor of the y component
      
    • sz: number
             the scaling factor of the z component
      
    • ox: number
             the x coordinate of the scaling origin
      
    • oy: number
             the y coordinate of the scaling origin
      
    • oz: number
             the z coordinate of the scaling origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Apply scaling to this matrix by scaling all three base axes by the given factor while using (ox, oy, oz) as the scaling origin.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

    This method is equivalent to calling: translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz)

    Parameters

    • factor: number
             the scaling factor for all three axes
      
    • ox: number
             the x coordinate of the scaling origin
      
    • oy: number
             the y coordinate of the scaling origin
      
    • oz: number
             the z coordinate of the scaling origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

scaleAroundLocal

  • scaleAroundLocal(sx: number, sy: number, sz: number, ox: number, oy: number, oz: number, dest?: Matrix4): Matrix4
  • scaleAroundLocal(factor: number, ox: number, oy: number, oz: number, dest?: Matrix4): Matrix4
  • Pre-multiply scaling to this matrix by scaling the base axes by the given sx, sy and sz factors while using (ox, oy, oz) as the scaling origin.

    If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

    This method is equivalent to calling: new Matrix4d().translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz).mul(this, this)

    Parameters

    • sx: number
             the scaling factor of the x component
      
    • sy: number
             the scaling factor of the y component
      
    • sz: number
             the scaling factor of the z component
      
    • ox: number
             the x coordinate of the scaling origin
      
    • oy: number
             the y coordinate of the scaling origin
      
    • oz: number
             the z coordinate of the scaling origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Pre-multiply scaling to this matrix by scaling all three base axes by the given factor while using (ox, oy, oz) as the scaling origin.

    If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

    This method is equivalent to calling: new Matrix4d().translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz).mul(this, this)

    Parameters

    • factor: number
             the scaling factor for all three axes
      
    • ox: number
             the x coordinate of the scaling origin
      
    • oy: number
             the y coordinate of the scaling origin
      
    • oz: number
             the z coordinate of the scaling origin
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

scaleLocal

  • Pre-multiply scaling to this matrix by scaling the base axes by the given xyz factor.

    If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

    Parameters

    • xyz: number
             the factor of the x, y and z component
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

  • Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.

    If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

    Parameters

    • x: number
             the factor of the x component
      
    • y: number
             the factor of the y component
      
    • z: number
             the factor of the z component
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

scaleXY

  • Apply scaling to this matrix by scaling the X axis by x and the Y axis by y.

    If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

    Parameters

    • x: number
             the factor of the x component
      
    • y: number
             the factor of the y component
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

scaling

  • Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.

    In order to post-multiply a scaling transformation directly to a matrix, use {@link #scale(double) scale()} instead.

    see

    #scale(double)

    Parameters

    • factor: number
              the scale factor in x, y and z
      

    Returns Matrix4

    this

  • Set this matrix to be a simple scale matrix.

    Parameters

    • x: number
           the scale in x
      
    • y: number
           the scale in y
      
    • z: number
           the scale in z
      

    Returns Matrix4

    this

  • Set this matrix to be a simple scale matrix which scales the base axes by xyz.x, xyz.y and xyz.z, respectively.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.

    In order to post-multiply a scaling transformation directly to a matrix use {@link #scale(Vector3dc) scale()} instead.

    see

    #scale(Vector3dc)

    Parameters

    • xyz: Vector3
              the scale in x, y and z, respectively
      

    Returns Matrix4

    this

set

  • Set this matrix to be equivalent to the rotation - and possibly scaling - specified by the given {@link Quaterniondc}.

    This method is equivalent to calling: rotation(q)

    Reference: http://www.euclideanspace.com/

    see

    #rotation(Quaterniondc)

    Parameters

    Returns Matrix4

    this

  • Set the values within this matrix to the supplied double values. The matrix will look like this:

    m00, m10, m20, m30
    m01, m11, m21, m31
    m02, m12, m22, m32
    m03, m13, m23, m33

    Parameters

    • m00: number
           the new value of m00
      
    • m01: number
           the new value of m01
      
    • m02: number
           the new value of m02
      
    • m03: number
           the new value of m03
      
    • m10: number
           the new value of m10
      
    • m11: number
           the new value of m11
      
    • m12: number
           the new value of m12
      
    • m13: number
           the new value of m13
      
    • m20: number
           the new value of m20
      
    • m21: number
           the new value of m21
      
    • m22: number
           the new value of m22
      
    • m23: number
           the new value of m23
      
    • m30: number
           the new value of m30
      
    • m31: number
           the new value of m31
      
    • m32: number
           the new value of m32
      
    • m33: number
           the new value of m33
      

    Returns Matrix4

    this

  • Set the values in the matrix using a double array that contains the matrix elements in column-major order.

    The results will look like this:

    0, 4, 8, 12
    1, 5, 9, 13
    2, 6, 10, 14
    3, 7, 11, 15

    see

    #set(number[])

    Parameters

    • m: number[]
           the array to read the matrix values from
      
    • Optional off: number
           the offset into the array
      

    Returns Matrix4

    this

  • Set the four columns of this matrix to the supplied vectors, respectively.

    Parameters

    Returns Matrix4

    this

  • Store the values of the given matrix m into this matrix.

    see

    #Matrix4(Matrix4)

    see

    #get(Matrix)

    Parameters

    • m: Matrix4
           the matrix to copy the values from
      

    Returns Matrix4

    this

  • Set the matrix element at the given column and row to the specified value.

    Parameters

    • column: number
           the colum index in <code>[0..3]</code>
      
    • row: number
           the row index in <code>[0..3]</code>
      
    • value: number
           the value
      

    Returns Matrix4

    this

  • Store the values of the given matrix m into this matrix and set the other matrix elements to identity.

    see

    #Matrix4d(Matrix4x3dc)

    Parameters

    • m: Matrix3
           the matrix to copy the values from
      

    Returns Matrix4

    this

set3x3

  • Set the upper left 3x3 submatrix of this {@link Matrix4d} to that of the given {@link Matrix4dc} and don't change the other elements.

    Parameters

    • mat: Matrix3
           the {@link Matrix4dc}
      

    Returns Matrix4

    this

set4x3

  • Set the upper 4x3 submatrix of this {@link Matrix4d} to the given {@link Matrix4x3dc} and don't change the other elements.

    see

    Matrix4x3dc#get(Matrix4d)

    Parameters

    • mat: Matrix4
           the {@link Matrix4x3dc}
      

    Returns Matrix4

    this

setColumn

  • Set the column at the given column index, starting with 0.

    throws

    IndexOutOfBoundsException if column is not in [0..3]

    Parameters

    • column: number
           the column index in <code>[0..3]</code>
      
    • src: Vector4
           the column components to set
      

    Returns Matrix4

    this

setFromIntrinsic

  • setFromIntrinsic(alphaX: number, alphaY: number, gamma: number, u0: number, v0: number, imgWidth: number, imgHeight: number, near: number, far: number): Matrix4
  • Set this matrix to represent a perspective projection equivalent to the given intrinsic camera calibration parameters. The resulting matrix will be suited for a right-handed coordinate system using OpenGL's NDC z range of [-1..+1].

    See: https://en.wikipedia.org/

    Reference: http://ksimek.github.io/

    Parameters

    • alphaX: number
           specifies the focal length and scale along the X axis
      
    • alphaY: number
           specifies the focal length and scale along the Y axis
      
    • gamma: number
           the skew coefficient between the X and Y axis (may be <code>0</code>)
      
    • u0: number
           the X coordinate of the principal point in image/sensor units
      
    • v0: number
           the Y coordinate of the principal point in image/sensor units
      
    • imgWidth: number
           the width of the sensor/image image/sensor units
      
    • imgHeight: number
           the height of the sensor/image image/sensor units
      
    • near: number
           the distance to the near plane
      
    • far: number
           the distance to the far plane
      

    Returns Matrix4

    this

setFrustum

  • setFrustum(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be an arbitrary perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.

    In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustum(double, double, double, double, double, double, boolean) frustum()}.

    Reference: http://www.songho.ca

    see

    #frustum(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance along the x-axis to the left frustum edge
      
    • right: number
             the distance along the x-axis to the right frustum edge
      
    • bottom: number
             the distance along the y-axis to the bottom frustum edge
      
    • top: number
             the distance along the y-axis to the top frustum edge
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setFrustumLH

  • setFrustumLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system using OpenGL's NDC z range of [-1..+1].

    In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustumLH(double, double, double, double, double, double, boolean) frustumLH()}.

    Reference: http://www.songho.ca

    see

    #frustumLH(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance along the x-axis to the left frustum edge
      
    • right: number
             the distance along the x-axis to the right frustum edge
      
    • bottom: number
             the distance along the y-axis to the bottom frustum edge
      
    • top: number
             the distance along the y-axis to the top frustum edge
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setLookAlong

  • setLookAlong(dir: Vector3, up: Vector3): Matrix4
  • setLookAlong(dirX: number, dirY: number, dirZ: number, upX: number, upY: number, upZ: number): Matrix4
  • Set this matrix to a rotation transformation to make -z point along dir.

    This is equivalent to calling {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc) setLookAt()} with eye = (0, 0, 0) and center = dir.

    In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3dc, Vector3dc)}.

    see

    #setLookAlong(Vector3dc, Vector3dc)

    see

    #lookAlong(Vector3dc, Vector3dc)

    Parameters

    • dir: Vector3
             the direction in space to look along
      
    • up: Vector3
             the direction of 'up'
      

    Returns Matrix4

    this

  • Set this matrix to a rotation transformation to make -z point along dir.

    This is equivalent to calling {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()} with eye = (0, 0, 0) and center = dir.

    In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(double, double, double, double, double, double) lookAlong()}

    see

    #setLookAlong(double, double, double, double, double, double)

    see

    #lookAlong(double, double, double, double, double, double)

    Parameters

    • dirX: number
               the x-coordinate of the direction to look along
      
    • dirY: number
               the y-coordinate of the direction to look along
      
    • dirZ: number
               the z-coordinate of the direction to look along
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      

    Returns Matrix4

    this

setLookAt

  • setLookAt(eye: Vector3, center: Vector3, up: Vector3): Matrix4
  • setLookAt(eyeX: number, eyeY: number, eyeZ: number, centerX: number, centerY: number, centerZ: number, upX: number, upY: number, upZ: number): Matrix4
  • Set this matrix to be a "lookat" transformation for a right-handed coordinate system, that aligns -z with center - eye.

    In order to not make use of vectors to specify eye, center and up but use primitives, like in the GLU function, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()} instead.

    In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAt(Vector3dc, Vector3dc, Vector3dc) lookAt()}.

    see

    #setLookAt(double, double, double, double, double, double, double, double, double)

    see

    #lookAt(Vector3dc, Vector3dc, Vector3dc)

    Parameters

    • eye: Vector3
             the position of the camera
      
    • center: Vector3
             the point in space to look at
      
    • up: Vector3
             the direction of 'up'
      

    Returns Matrix4

    this

  • Set this matrix to be a "lookat" transformation for a right-handed coordinate system, that aligns -z with center - eye.

    In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt}.

    see

    #setLookAt(Vector3dc, Vector3dc, Vector3dc)

    see

    #lookAt(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      

    Returns Matrix4

    this

setLookAtLH

  • setLookAtLH(eye: Vector3, center: Vector3, up: Vector3): Matrix4
  • setLookAtLH(eyeX: number, eyeY: number, eyeZ: number, centerX: number, centerY: number, centerZ: number, upX: number, upY: number, upZ: number): Matrix4
  • Set this matrix to be a "lookat" transformation for a left-handed coordinate system, that aligns +z with center - eye.

    In order to not make use of vectors to specify eye, center and up but use primitives, like in the GLU function, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()} instead.

    In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAtLH(Vector3dc, Vector3dc, Vector3dc) lookAt()}.

    see

    #setLookAtLH(double, double, double, double, double, double, double, double, double)

    see

    #lookAtLH(Vector3dc, Vector3dc, Vector3dc)

    Parameters

    • eye: Vector3
             the position of the camera
      
    • center: Vector3
             the point in space to look at
      
    • up: Vector3
             the direction of 'up'
      

    Returns Matrix4

    this

  • Set this matrix to be a "lookat" transformation for a left-handed coordinate system, that aligns +z with center - eye.

    In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAtLH(double, double, double, double, double, double, double, double, double) lookAtLH}.

    see

    #setLookAtLH(Vector3dc, Vector3dc, Vector3dc)

    see

    #lookAtLH(double, double, double, double, double, double, double, double, double)

    Parameters

    • eyeX: number
               the x-coordinate of the eye/camera location
      
    • eyeY: number
               the y-coordinate of the eye/camera location
      
    • eyeZ: number
               the z-coordinate of the eye/camera location
      
    • centerX: number
               the x-coordinate of the point to look at
      
    • centerY: number
               the y-coordinate of the point to look at
      
    • centerZ: number
               the z-coordinate of the point to look at
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      

    Returns Matrix4

    this

setOrtho

  • setOrtho(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be an orthographic projection transformation for a right-handed coordinate system using the given NDC z range.

    In order to apply the orthographic projection to an already existing transformation, use {@link #ortho(double, double, double, double, double, double, boolean) ortho()}.

    Reference: http://www.songho.ca

    see

    #ortho(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setOrtho2D

  • setOrtho2D(left: number, right: number, bottom: number, top: number): Matrix4
  • Set this matrix to be an orthographic projection transformation for a right-handed coordinate system.

    This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrtho()} with zNear=-1 and zFar=+1.

    In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(double, double, double, double) ortho2D()}.

    Reference: http://www.songho.ca

    see

    #setOrtho(double, double, double, double, double, double)

    see

    #ortho2D(double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      

    Returns Matrix4

    this

setOrtho2DLH

  • setOrtho2DLH(left: number, right: number, bottom: number, top: number): Matrix4
  • Set this matrix to be an orthographic projection transformation for a left-handed coordinate system.

    This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrthoLH()} with zNear=-1 and zFar=+1.

    In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2DLH(double, double, double, double) ortho2DLH()}.

    Reference: http://www.songho.ca

    see

    #setOrthoLH(double, double, double, double, double, double)

    see

    #ortho2DLH(double, double, double, double)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      

    Returns Matrix4

    this

setOrthoLH

  • setOrthoLH(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number, zZeroToOne: boolean): Matrix4
  • Set this matrix to be an orthographic projection transformation for a left-handed coordinate system using the given NDC z range.

    In order to apply the orthographic projection to an already existing transformation, use {@link #orthoLH(double, double, double, double, double, double, boolean) orthoLH()}.

    Reference: http://www.songho.ca

    see

    #orthoLH(double, double, double, double, double, double, boolean)

    Parameters

    • left: number
             the distance from the center to the left frustum edge
      
    • right: number
             the distance from the center to the right frustum edge
      
    • bottom: number
             the distance from the center to the bottom frustum edge
      
    • top: number
             the distance from the center to the top frustum edge
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setOrthoSymmetric

  • setOrthoSymmetric(width: number, height: number, zNear: number, zFar: number, zZeroToOne: boolean): Matrix4
  • Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range.

    This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetric(double, double, double, double, boolean) orthoSymmetric()}.

    Reference: http://www.songho.ca

    see

    #orthoSymmetric(double, double, double, double, boolean)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setOrthoSymmetricLH

  • setOrthoSymmetricLH(width: number, height: number, zNear: number, zFar: number, zZeroToOne: boolean): Matrix4
  • Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range.

    This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with left=-width/2, right=+width/2, bottom=-height/2 and top=+height/2.

    In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double, boolean) orthoSymmetricLH()}.

    Reference: http://www.songho.ca

    see

    #orthoSymmetricLH(double, double, double, double, boolean)

    Parameters

    • width: number
             the distance between the right and left frustum edges
      
    • height: number
             the distance between the top and bottom frustum edges
      
    • zNear: number
             near clipping plane distance
      
    • zFar: number
             far clipping plane distance
      
    • zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setPerspective

  • setPerspective(fovy: number, aspect: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.

    In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(double, double, double, double, boolean) perspective()}.

    see

    #perspective(double, double, double, double, boolean)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setPerspectiveLH

  • setPerspectiveLH(fovy: number, aspect: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range of [-1..+1].

    In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveLH(double, double, double, double, boolean) perspectiveLH()}.

    see

    #perspectiveLH(double, double, double, double, boolean)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setPerspectiveOffCenter

  • setPerspectiveOffCenter(fovy: number, offAngleX: number, offAngleY: number, aspect: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be an asymmetric off-center perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.

    The given angles offAngleX and offAngleY are the horizontal and vertical angles between the line of sight and the line given by the center of the near and far frustum planes. So, when offAngleY is just fovy/2 then the projection frustum is rotated towards +Y and the bottom frustum plane is parallel to the XZ-plane.

    In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveOffCenter(double, double, double, double, double, double) perspectiveOffCenter()}.

    see

    #perspectiveOffCenter(double, double, double, double, double, double)

    Parameters

    • fovy: number
             the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
      
    • offAngleX: number
             the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes
      
    • offAngleY: number
             the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes
      
    • aspect: number
             the aspect ratio (i.e. width / height; must be greater than zero)
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setPerspectiveRect

  • setPerspectiveRect(width: number, height: number, zNear: number, zFar: number, zZeroToOne?: boolean): Matrix4
  • Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.

    In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveRect(double, double, double, double, boolean) perspectiveRect()}.

    see

    #perspectiveRect(double, double, double, double, boolean)

    Parameters

    • width: number
             the width of the near frustum plane
      
    • height: number
             the height of the near frustum plane
      
    • zNear: number
             near clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
      In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • zFar: number
             far clipping plane distance. This value must be greater than zero.
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
    • Optional zZeroToOne: boolean
             whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>

    Returns Matrix4

    this

setRotationXYZ

  • setRotationXYZ(angleX: number, angleY: number, angleZ: number): Matrix4
  • Set only the upper left 3x3 submatrix of this matrix to a rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Parameters

    • angleX: number
             the angle to rotate about X
      
    • angleY: number
             the angle to rotate about Y
      
    • angleZ: number
             the angle to rotate about Z
      

    Returns Matrix4

    this

setRotationYXZ

  • setRotationYXZ(angleY: number, angleX: number, angleZ: number): Matrix4
  • Set only the upper left 3x3 submatrix of this matrix to a rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Parameters

    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      
    • angleZ: number
             the angle to rotate about Z
      

    Returns Matrix4

    this

setRotationZYX

  • setRotationZYX(angleZ: number, angleY: number, angleX: number): Matrix4
  • Set only the upper left 3x3 submatrix of this matrix to a rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    Parameters

    • angleZ: number
             the angle to rotate about Z
      
    • angleY: number
             the angle to rotate about Y
      
    • angleX: number
             the angle to rotate about X
      

    Returns Matrix4

    this

setRow

  • Set the row at the given row index, starting with 0.

    throws

    IndexOutOfBoundsException if row is not in [0..3]

    Parameters

    • row: number
           the row index in <code>[0..3]</code>
      
    • src: Vector4
           the row components to set
      

    Returns Matrix4

    this

setRowColumn

  • setRowColumn(row: number, column: number, value: number): Matrix4
  • Set the matrix element at the given row and column to the specified value.

    Parameters

    • row: number
           the row index in <code>[0..3]</code>
      
    • column: number
           the colum index in <code>[0..3]</code>
      
    • value: number
           the value
      

    Returns Matrix4

    this

setTranslation

  • Set only the translation components (m30, m31, m32) of this matrix to the given values (x, y, z).

    To build a translation matrix instead, use {@link #translation(double, double, double)}. To apply a translation, use {@link #translate(double, double, double)}.

    see

    #translation(double, double, double)

    see

    #translate(double, double, double)

    Parameters

    • x: number
           the units to translate in x
      
    • y: number
           the units to translate in y
      
    • z: number
           the units to translate in z
      

    Returns Matrix4

    this

  • Set only the translation components (m30, m31, m32) of this matrix to the given values (xyz.x, xyz.y, xyz.z).

    To build a translation matrix instead, use {@link #translation(Vector3dc)}. To apply a translation, use {@link #translate(Vector3dc)}.

    see

    #translation(Vector3dc)

    see

    #translate(Vector3dc)

    Parameters

    • xyz: Vector3
           the units to translate in <code>(x, y, z)</code>
      

    Returns Matrix4

    this

setTransposed

  • Store the values of the transpose of the given matrix m into this matrix.

    Parameters

    • m: Matrix4
           the matrix to copy the transposed values from
      

    Returns Matrix4

    this

shadow

  • shadow(lightX: number, lightY: number, lightZ: number, lightW: number, a: number, b: number, c: number, d: number, dest: Matrix4): Matrix4
  • Apply a projection transformation to this matrix that projects onto the plane specified via the general plane equation xa + yb + z*c + d = 0 as if casting a shadow from a given light position/direction (lightX, lightY, lightZ, lightW).

    If lightW is 0.0 the light is being treated as a directional light; if it is 1.0 it is a point light.

    If M is this matrix and S the shadow matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the shadow projection will be applied first!

    Reference: ftp.sgi.com

    Parameters

    • lightX: number
           the x-component of the light's vector
      
    • lightY: number
           the y-component of the light's vector
      
    • lightZ: number
           the z-component of the light's vector
      
    • lightW: number
           the w-component of the light's vector
      
    • a: number
           the x factor in the plane equation
      
    • b: number
           the y factor in the plane equation
      
    • c: number
           the z factor in the plane equation
      
    • d: number
           the constant in the plane equation
      
    • dest: Matrix4

    Returns Matrix4

    this

sub

sub4x3

swap

  • Exchange the values of this matrix with the given other matrix.

    Parameters

    • other: Matrix4
           the other matrix to exchange the values with
      

    Returns Matrix4

    this

testAab

  • testAab(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): boolean
  • Parameters

    • minX: number
    • minY: number
    • minZ: number
    • maxX: number
    • maxY: number
    • maxZ: number

    Returns boolean

testPoint

  • testPoint(x: number, y: number, z: number): boolean

testSphere

  • testSphere(x: number, y: number, z: number, r: number): boolean

tile

  • tile(x: number, y: number, w: number, h: number, dest?: Matrix4): Matrix4
  • This method is equivalent to calling: translate(w-1-2x, h-1-2y, 0).scale(w, h, 1)

    If M is this matrix and T the created transformation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the created transformation will be applied first!

    Parameters

    • x: number
              the tile's x coordinate/index (should be in <code>[0..w)</code>)
      
    • y: number
              the tile's y coordinate/index (should be in <code>[0..h)</code>)
      
    • w: number
              the number of tiles along the x axis
      
    • h: number
              the number of tiles along the y axis
      
    • Optional dest: Matrix4

    Returns Matrix4

    this

toString

  • toString(formatter?: (x: number) => string): string
  • Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}.

    Parameters

    • Optional formatter: (x: number) => string
           the {@link NumberFormat} used to format the matrix values with
      
        • (x: number): string
        • Parameters

          • x: number

          Returns string

    Returns string

    the string representation

transform

transformAab

transformAffine

transformDirection

transformPosition

transformProject

transformTranspose

translate

  • Apply a translation to this matrix by translating by the given number of units in x, y and z and store the result in dest.

    If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

    In order to set the matrix to a translation transformation without post-multiplying it, use {@link #translation(Vector3)}.

    see

    #translation(Vector3)

    Parameters

    • offset: Vector3
           the number of units in x, y and z by which to translate
      
    • Optional dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

  • Apply a translation to this matrix by translating by the given number of units in x, y and z and store the result in dest.

    If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

    In order to set the matrix to a translation transformation without post-multiplying it, use {@link #translation(double, double, double)}.

    see

    #translation(double, double, double)

    Parameters

    • x: number
           the offset to translate in x
      
    • y: number
           the offset to translate in y
      
    • z: number
           the offset to translate in z
      
    • dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

translateLocal

  • Pre-multiply a translation to this matrix by translating by the given number of units in x, y and z and store the result in dest.

    If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

    In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(Vector3dc)}.

    see

    #translation(Vector3)

    Parameters

    • offset: Vector3
           the number of units in x, y and z by which to translate
      
    • dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

  • Pre-multiply a translation to this matrix by translating by the given number of units in x, y and z and store the result in dest.

    If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

    In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(double, double, double)}.

    see

    #translation(double, double, double)

    Parameters

    • x: number
           the offset to translate in x
      
    • y: number
           the offset to translate in y
      
    • z: number
           the offset to translate in z
      
    • dest: Matrix4
           will hold the result
      

    Returns Matrix4

    dest

translation

  • Set this matrix to be a simple translation matrix.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.

    Parameters

    • x: number
           the offset to translate in x
      
    • y: number
           the offset to translate in y
      
    • z: number
           the offset to translate in z
      

    Returns Matrix4

    this

  • Set this matrix to be a simple translation matrix.

    The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.

    Parameters

    • offset: Vector3
               the offsets in x, y and z to translate
      

    Returns Matrix4

    this

translationRotate

  • translationRotate(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number): Matrix4
  • translationRotate(tx: number, ty: number, tz: number, quat: Quaternion): Matrix4
  • Set this matrix to T * R, where T is a translation by the given (tx, ty, tz) and R is a rotation - and possibly scaling - transformation specified by the quaternion (qx, qy, qz, qw).

    When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(tx, ty, tz).rotate(quat)

    see

    #translation(double, double, double)

    see

    #rotate(Quaterniondc)

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • qx: number
           the x-coordinate of the vector part of the quaternion
      
    • qy: number
           the y-coordinate of the vector part of the quaternion
      
    • qz: number
           the z-coordinate of the vector part of the quaternion
      
    • qw: number
           the scalar part of the quaternion
      

    Returns Matrix4

    this

  • Set this matrix to T * R, where T is a translation by the given (tx, ty, tz) and R is a rotation - and possibly scaling - transformation specified by the given quaternion.

    When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(tx, ty, tz).rotate(quat)

    see

    #translation(double, double, double)

    see

    #rotate(Quaterniondc)

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • quat: Quaternion
           the quaternion representing a rotation
      

    Returns Matrix4

    this

translationRotateScale

  • translationRotateScale(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number): Matrix4
  • translationRotateScale(translation: Vector3, quat: Quaternion, scale: Vector3): Matrix4
  • translationRotateScale(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number): Matrix4
  • translationRotateScale(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, scale: number): Matrix4
  • translationRotateScale(translation: Vector3, quat: Quaternion, scale: number): Matrix4
  • Set this matrix to T * R * S, where T is a translation by the given (tx, ty, tz), R is a rotation transformation specified by the quaternion (qx, qy, qz, qw), and S is a scaling transformation which scales the three axes x, y and z by (sx, sy, sz).

    When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(tx, ty, tz).rotate(quat).scale(sx, sy, sz)

    see

    #translation(double, double, double)

    see

    #rotate(Quaterniondc)

    see

    #scale(double, double, double)

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • qx: number
           the x-coordinate of the vector part of the quaternion
      
    • qy: number
           the y-coordinate of the vector part of the quaternion
      
    • qz: number
           the z-coordinate of the vector part of the quaternion
      
    • qw: number
           the scalar part of the quaternion
      
    • sx: number
           the scaling factor for the x-axis
      
    • sy: number
           the scaling factor for the y-axis
      
    • sz: number
           the scaling factor for the z-axis
      

    Returns Matrix4

    this

  • Set this matrix to T * R * S, where T is the given translation, R is a rotation transformation specified by the given quaternion, and S is a scaling transformation which scales the axes by scale.

    When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(translation).rotate(quat).scale(scale)

    see

    #translation(Vector3dc)

    see

    #rotate(Quaterniondc)

    see

    #scale(Vector3dc)

    Parameters

    • translation: Vector3
           the translation
      
    • quat: Quaternion
           the quaternion representing a rotation
      
    • scale: Vector3
           the scaling factors
      

    Returns Matrix4

    this

  • Parameters

    • tx: number
    • ty: number
    • tz: number
    • qx: number
    • qy: number
    • qz: number
    • qw: number
    • sx: number
    • sy: number
    • sz: number

    Returns Matrix4

  • Set this matrix to T * R * S, where T is a translation by the given (tx, ty, tz), R is a rotation transformation specified by the quaternion (qx, qy, qz, qw), and S is a scaling transformation which scales all three axes by scale.

    When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(tx, ty, tz).rotate(quat).scale(scale)

    see

    #translation(double, double, double)

    see

    #rotate(Quaterniondc)

    see

    #scale(double)

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • qx: number
           the x-coordinate of the vector part of the quaternion
      
    • qy: number
           the y-coordinate of the vector part of the quaternion
      
    • qz: number
           the z-coordinate of the vector part of the quaternion
      
    • qw: number
           the scalar part of the quaternion
      
    • scale: number
           the scaling factor for all three axes
      

    Returns Matrix4

    this

  • Set this matrix to T * R * S, where T is the given translation, R is a rotation transformation specified by the given quaternion, and S is a scaling transformation which scales all three axes by scale.

    When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(translation).rotate(quat).scale(scale)

    see

    #translation(Vector3dc)

    see

    #rotate(Quaterniondc)

    see

    #scale(double)

    Parameters

    • translation: Vector3
           the translation
      
    • quat: Quaternion
           the quaternion representing a rotation
      
    • scale: number
           the scaling factors
      

    Returns Matrix4

    this

translationRotateScaleInvert

  • translationRotateScaleInvert(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number): Matrix4
  • translationRotateScaleInvert(translation: Vector3, quat: Quaternion, scale: Vector3): Matrix4
  • translationRotateScaleInvert(translation: Vector3, quat: Quaternion, scale: number): Matrix4
  • Set this matrix to (T * R * S)-1, where T is a translation by the given (tx, ty, tz), R is a rotation transformation specified by the quaternion (qx, qy, qz, qw), and S is a scaling transformation which scales the three axes x, y and z by (sx, sy, sz).

    This method is equivalent to calling: translationRotateScale(...).invert()

    see

    #translationRotateScale(double, double, double, double, double, double, double, double, double, double)

    see

    #invert()

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • qx: number
           the x-coordinate of the vector part of the quaternion
      
    • qy: number
           the y-coordinate of the vector part of the quaternion
      
    • qz: number
           the z-coordinate of the vector part of the quaternion
      
    • qw: number
           the scalar part of the quaternion
      
    • sx: number
           the scaling factor for the x-axis
      
    • sy: number
           the scaling factor for the y-axis
      
    • sz: number
           the scaling factor for the z-axis
      

    Returns Matrix4

    this

  • Set this matrix to (T * R * S)-1, where T is the given translation, R is a rotation transformation specified by the given quaternion, and S is a scaling transformation which scales the axes by scale.

    This method is equivalent to calling: translationRotateScale(...).invert()

    see

    #translationRotateScale(Vector3dc, Quaterniondc, Vector3dc)

    see

    #invert()

    Parameters

    • translation: Vector3
           the translation
      
    • quat: Quaternion
           the quaternion representing a rotation
      
    • scale: Vector3
           the scaling factors
      

    Returns Matrix4

    this

  • Set this matrix to (T * R * S)-1, where T is the given translation, R is a rotation transformation specified by the given quaternion, and S is a scaling transformation which scales all three axes by scale.

    This method is equivalent to calling: translationRotateScale(...).invert()

    see

    #translationRotateScale(Vector3dc, Quaterniondc, double)

    see

    #invert()

    Parameters

    • translation: Vector3
           the translation
      
    • quat: Quaternion
           the quaternion representing a rotation
      
    • scale: number
           the scaling factors
      

    Returns Matrix4

    this

translationRotateScaleMulAffine

  • translationRotateScaleMulAffine(translation: Vector3, quat: Quaternion, scale: Vector3, m: Matrix4): Matrix4
  • translationRotateScaleMulAffine(tx: number, ty: number, tz: number, qx: number, qy: number, qz: number, qw: number, sx: number, sy: number, sz: number, m: Matrix4): Matrix4
  • Set this matrix to T * R * S * M, where T is the given translation, R is a rotation - and possibly scaling - transformation specified by the given quaternion, S is a scaling transformation which scales the axes by scale and M is an {@link #isAffine() affine} matrix.

    When transforming a vector by the resulting matrix the transformation described by M will be applied first, then the scaling, then rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(translation).rotate(quat).scale(scale).mulAffine(m)

    see

    #translation(Vector3fc)

    see

    #rotate(Quaterniondc)

    see

    #mulAffine(Matrix4dc)

    Parameters

    • translation: Vector3
           the translation
      
    • quat: Quaternion
           the quaternion representing a rotation
      
    • scale: Vector3
           the scaling factors
      
    • m: Matrix4
           the {@link #isAffine() affine} matrix to multiply by
      

    Returns Matrix4

    this

  • Set this matrix to T * R * S * M, where T is a translation by the given (tx, ty, tz), R is a rotation - and possibly scaling - transformation specified by the quaternion (qx, qy, qz, qw), S is a scaling transformation which scales the three axes x, y and z by (sx, sy, sz) and M is an {@link #isAffine() affine} matrix.

    When transforming a vector by the resulting matrix the transformation described by M will be applied first, then the scaling, then rotation and at last the translation.

    When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

    This method is equivalent to calling: translation(tx, ty, tz).rotate(quat).scale(sx, sy, sz).mulAffine(m)

    see

    #translation(double, double, double)

    see

    #rotate(Quaterniondc)

    see

    #scale(double, double, double)

    see

    #mulAffine(Matrix4dc)

    Parameters

    • tx: number
           the number of units by which to translate the x-component
      
    • ty: number
           the number of units by which to translate the y-component
      
    • tz: number
           the number of units by which to translate the z-component
      
    • qx: number
           the x-coordinate of the vector part of the quaternion
      
    • qy: number
           the y-coordinate of the vector part of the quaternion
      
    • qz: number
           the z-coordinate of the vector part of the quaternion
      
    • qw: number
           the scalar part of the quaternion
      
    • sx: number
           the scaling factor for the x-axis
      
    • sy: number
           the scaling factor for the y-axis
      
    • sz: number
           the scaling factor for the z-axis
      
    • m: Matrix4
           the {@link #isAffine() affine} matrix to multiply by
      

    Returns Matrix4

    this

translationRotateTowards

  • translationRotateTowards(pos: Vector3, dir: Vector3, up: Vector3): Matrix4
  • translationRotateTowards(posX: number, posY: number, posZ: number, dirX: number, dirY: number, dirZ: number, upX: number, upY: number, upZ: number): Matrix4
  • Set this matrix to a model transformation for a right-handed coordinate system, that translates to the given pos and aligns the local -z axis with dir.

    This method is equivalent to calling: translation(pos).rotateTowards(dir, up)

    see

    #translation(Vector3dc)

    see

    #rotateTowards(Vector3dc, Vector3dc)

    Parameters

    • pos: Vector3
               the position to translate to
      
    • dir: Vector3
               the direction to rotate towards
      
    • up: Vector3
               the up vector
      

    Returns Matrix4

    this

  • Set this matrix to a model transformation for a right-handed coordinate system, that translates to the given (posX, posY, posZ) and aligns the local -z axis with (dirX, dirY, dirZ).

    This method is equivalent to calling: translation(posX, posY, posZ).rotateTowards(dirX, dirY, dirZ, upX, upY, upZ)

    see

    #translation(double, double, double)

    see

    #rotateTowards(double, double, double, double, double, double)

    Parameters

    • posX: number
               the x-coordinate of the position to translate to
      
    • posY: number
               the y-coordinate of the position to translate to
      
    • posZ: number
               the z-coordinate of the position to translate to
      
    • dirX: number
               the x-coordinate of the direction to rotate towards
      
    • dirY: number
               the y-coordinate of the direction to rotate towards
      
    • dirZ: number
               the z-coordinate of the direction to rotate towards
      
    • upX: number
               the x-coordinate of the up vector
      
    • upY: number
               the y-coordinate of the up vector
      
    • upZ: number
               the z-coordinate of the up vector
      

    Returns Matrix4

    this

transpose

transpose3x3

  • Transpose only the upper left 3x3 submatrix of this matrix.

    All other matrix elements are left unchanged.

    Parameters

    Returns Matrix4

    this

trapezoidCrop

  • trapezoidCrop(p0x: number, p0y: number, p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): Matrix4
  • Set this matrix to a perspective transformation that maps the trapezoid spanned by the four corner coordinates (p0x, p0y), (p1x, p1y), (p2x, p2y) and (p3x, p3y) to the unit square [(-1, -1)..(+1, +1)].

    The corner coordinates are given in counter-clockwise order starting from the left corner on the smaller parallel side of the trapezoid seen when looking at the trapezoid oriented with its shorter parallel edge at the bottom and its longer parallel edge at the top.

    Reference: Trapezoidal Shadow Maps (TSM) - Recipe

    Parameters

    • p0x: number
           the x coordinate of the left corner at the shorter edge of the trapezoid
      
    • p0y: number
           the y coordinate of the left corner at the shorter edge of the trapezoid
      
    • p1x: number
           the x coordinate of the right corner at the shorter edge of the trapezoid
      
    • p1y: number
           the y coordinate of the right corner at the shorter edge of the trapezoid
      
    • p2x: number
           the x coordinate of the right corner at the longer edge of the trapezoid
      
    • p2y: number
           the y coordinate of the right corner at the longer edge of the trapezoid
      
    • p3x: number
           the x coordinate of the left corner at the longer edge of the trapezoid
      
    • p3y: number
           the y coordinate of the left corner at the longer edge of the trapezoid
      

    Returns Matrix4

    this

unproject

unprojectInv

unprojectInvRay

  • unprojectInvRay(winX: number, winY: number, viewport: number[], originDest: Vector3, dirDest: Vector3): Matrix4

unprojectRay

  • unprojectRay(winX: number, winY: number, viewport: number[], originDest: Vector3, dirDest: Vector3): Matrix4

withLookAtUp

  • Apply a transformation to this matrix to ensure that the local Y axis (as obtained by {@link #positiveY(Vector3d)}) will be coplanar to the plane spanned by the local Z axis (as obtained by {@link #positiveZ(Vector3d)}) and the given vector up.

    This effectively ensures that the resulting matrix will be equal to the one obtained from {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc)} called with the current local origin of this matrix (as obtained by {@link #originAffine(Vector3d)}), the sum of this position and the negated local Z axis as well as the given vector up.

    This method must only be called on {@link #isAffine()} matrices.

    Parameters

    Returns Matrix4

    this

  • Apply a transformation to this matrix to ensure that the local Y axis (as obtained by {@link #positiveY(Vector3d)}) will be coplanar to the plane spanned by the local Z axis (as obtained by {@link #positiveZ(Vector3d)}) and the given vector (upX, upY, upZ).

    This effectively ensures that the resulting matrix will be equal to the one obtained from {@link #setLookAt(double, double, double, double, double, double, double, double, double)} called with the current local origin of this matrix (as obtained by {@link #originAffine(Vector3d)}), the sum of this position and the negated local Z axis as well as the given vector (upX, upY, upZ).

    This method must only be called on {@link #isAffine()} matrices.

    Parameters

    • upX: number
             the x coordinate of the up vector
      
    • upY: number
             the y coordinate of the up vector
      
    • upZ: number
             the z coordinate of the up vector
      
    • Optional dest: Matrix4

    Returns Matrix4

    dest

zero

Static projViewFromRectangle

  • Create a view and projection matrix from a given eye position, a given bottom left corner position p of the near plane rectangle and the extents of the near plane rectangle along its local x and y axes, and store the resulting matrices in projDest and viewDest.

    This method creates a view and perspective projection matrix assuming that there is a pinhole camera at position eye projecting the scene onto the near plane defined by the rectangle.

    All positions and lengths are in the same (world) unit.

    Parameters

    • eye: Vector3
           the position of the camera
      
    • p: Vector3
           the bottom left corner of the near plane rectangle (will map to the bottom left corner in window coordinates)
      
    • x: Vector3
           the direction and length of the local "bottom/top" X axis/side of the near plane rectangle
      
    • y: Vector3
           the direction and length of the local "left/right" Y axis/side of the near plane rectangle
      
    • nearFarDist: number
           the distance between the far and near plane (the near plane will be calculated by this method).
      If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
      If the special value {@link Double#NEGATIVE_INFINITY} is used, the near and far planes will be swapped and
      the near clipping plane will be at positive infinity.
      If a negative value is used (except for {@link Double#NEGATIVE_INFINITY}) the near and far planes will be swapped
    • zeroToOne: boolean
           whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
      or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
    • projDest: Matrix4
           will hold the resulting projection matrix
      
    • viewDest: Matrix4
           will hold the resulting view matrix
      

    Returns void

Generated using TypeDoc