Options
All
  • Public
  • Public/Protected
  • All
Menu

Module mat4

Index

Functions

adjoint

clone

  • Creates a new mat4 initialized with values from an existing matrix

    Parameters

    Returns IArray

    a new 4x4 matrix

copy

create

determinant

  • determinant(a: IArray): number
  • Calculates the determinant of a mat4

    Parameters

    Returns number

    determinant of a

frob

  • Returns Frobenius norm of a mat4

    Parameters

    • a: IArray

      the matrix to calculate Frobenius norm of

    Returns number

    Frobenius norm

fromQuat

fromRotationTranslation

  • Creates a matrix from a quaternion rotation and vector translation This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, vec);
    var quatMat = mat4.create();
    quat4.toMat4(quat, quatMat);
    mat4.multiply(dest, quatMat);
    

    Parameters

    • out: IArray

      mat4 receiving operation result

    • q: IArray

      Rotation quaternion

    • v: IArray

      Translation vector

    Returns IArray

    out

fromRotationTranslationScale

  • Creates a matrix from a quaternion rotation, vector translation and vector scale.

    This is equivalent to (but much faster than):

    mat4.identity(dest);
    mat4.translate(dest, vec);
    var quatMat = mat4.create();
    quat4.toMat4(quat, quatMat);
    mat4.multiply(dest, quatMat);
    mat4.scale(dest, scale)
    

    Parameters

    • out: IArray

      mat4 receiving operation result

    • q: IArray

      Rotation quaternion

    • v: IArray

      Translation vector

    • s: IArray

      Scale vector

    Returns IArray

    out

frustum

  • frustum(out: IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): IArray
  • Generates a frustum matrix with the given bounds

    Parameters

    • out: IArray

      mat4 frustum matrix will be written into

    • left: number

      Left bound of the frustum

    • right: number

      Right bound of the frustum

    • bottom: number

      Bottom bound of the frustum

    • top: number

      Top bound of the frustum

    • near: number

      Near bound of the frustum

    • far: number

      Far bound of the frustum

    Returns IArray

    out

getRotation

getScaling

getTranslation

identity

invert

lookAt

  • Generates a look-at matrix with the given eye position, focal point, and up axis

    Parameters

    • out: IArray

      mat4 frustum matrix will be written into

    • eye: IArray

      Position of the viewer

    • center: IArray

      Point the viewer is looking at

    • up: IArray

      vec3 pointing up

    Returns IArray

    out

mul

multiply

ortho

  • ortho(out: IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): IArray
  • Generates a orthogonal projection matrix with the given bounds

    Parameters

    • out: IArray

      mat4 frustum matrix will be written into

    • left: number

      Left bound of the frustum

    • right: number

      Right bound of the frustum

    • bottom: number

      Bottom bound of the frustum

    • top: number

      Top bound of the frustum

    • near: number

      Near bound of the frustum

    • far: number

      Far bound of the frustum

    Returns IArray

    out

perspective

  • perspective(out: IArray, fovy: number, aspect: number, near: number, far: number): IArray
  • Generates a perspective projection matrix with the given bounds

    Parameters

    • out: IArray

      mat4 frustum matrix will be written into

    • fovy: number

      Vertical field of view in radians

    • aspect: number

      Aspect ratio. typically viewport width/height

    • near: number

      Near bound of the frustum

    • far: number

      Far bound of the frustum

    Returns IArray

    out

rotate

  • Rotates a mat4 by the given angle

    Parameters

    • out: IArray

      the receiving matrix

    • a: IArray

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    • axis: IArray

      the axis to rotate around

    Returns IArray

    out

rotateX

  • Rotates a matrix by the given angle around the X axis

    Parameters

    • out: IArray

      the receiving matrix

    • a: IArray

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    Returns IArray

    out

rotateY

  • Rotates a matrix by the given angle around the Y axis

    Parameters

    • out: IArray

      the receiving matrix

    • a: IArray

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    Returns IArray

    out

rotateZ

  • Rotates a matrix by the given angle around the Z axis

    Parameters

    • out: IArray

      the receiving matrix

    • a: IArray

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    Returns IArray

    out

scale

  • Scales the mat4 by the dimensions in the given vec3

    Parameters

    • out: IArray

      the receiving matrix

    • a: IArray

      the matrix to scale

    • v: IArray

      the vec3 to scale the matrix by

    Returns IArray

    out

str

  • Returns a string representation of a mat4

    Parameters

    • mat: IArray

      matrix to represent as a string

    Returns string

    string representation of the matrix

translate

transpose

Generated using TypeDoc