Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Matrix

Represents 4x4 matrix.

Hierarchy

Index

Constructors

constructor

  • Constructor to generate an instance

    Parameters

    • Optional arr: IArray

      Array of components

    Returns Matrix

Properties

rawElements

rawElements: IArray

Accessors

ColmunCount

  • get ColmunCount(): number

ElementCount

  • get ElementCount(): number
  • Element count of this matrix. Must be 16.

    Returns number

    [description]

RowCount

  • get RowCount(): number

Methods

equalWith

  • equalWith(m: Matrix): boolean
  • Compare this matrix with the other instance

    Parameters

    • m: Matrix

      the other matrix to compare

    Returns boolean

    The result of comparation

getAt

  • getAt(row: number, colmun: number): number
  • Obtain a component of matrix at the spcecific index calculated from row index and column index

    Parameters

    • row: number

      row index 0 to 3

    • colmun: number

      column index 0 to 3

    Returns number

    the component

getBySingleIndex

  • getBySingleIndex(index: number): number

getColmun

  • Get column Vector at the column

    Parameters

    • col: number

      column index 0 to 3

    Returns Vector4

    Column vector

getRotation

  • Get rotation quaternion from this matrix.

    Returns Quaternion

    Rotation represented in quaternion

getRow

  • Get row vector at the row

    Parameters

    • row: number

      row index 0 to 3

    Returns Vector4

    Row vector

getScaling

  • Get scaling vector from this matrix.

    Returns Vector3

    Scaling represented in vector

getTranslation

  • Get translation vector from this matrix.

    Returns Vector3

    Translation represented in vector

multiplyWith

  • Multiply this matrix with the other instance.

    Parameters

    • m: Matrix

      the other matrix to multiply

    Returns Matrix

    Calculated matrix

setAt

  • setAt(row: number, colmun: number, val: number): void
  • Mutate a component of matrix at the specific index calculated from row index and column index

    Parameters

    • row: number

      row index 0 to 3

    • colmun: number

      column index 0 to 3

    • val: number

      the value to set

    Returns void

toString

  • toString(): string
  • Get expression as string of this matrix

    Returns string

Static Protected ___elementEquals

Static add

  • Add each component of matrix.

    Parameters

    Returns Matrix

    The result of calculation.

Static determinant

  • determinant(m: Matrix): number
  • Retrieve determinant of passed matrix

    Parameters

    Returns number

Static equals

  • Compare given matrices.

    Parameters

    Returns boolean

    the result

Static fromElements

  • fromElements(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): Matrix
  • Instanciate matrix in row major.

    Parameters

    • 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

    Returns Matrix

    [description]

Static fromFunc

  • fromFunc(f: function): Matrix
  • Instanciate matrix by generator.

    Parameters

    • f: function
        • (w: number, h: number): number
        • Parameters

          • w: number
          • h: number

          Returns number

    Returns Matrix

    A matrix instance.

Static frustum

  • frustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix
  • Generate frustum matrix.

    Parameters

    • left: number

      Left clip coordinate

    • right: number

      Right clip coordinate

    • bottom: number

      Bottom clip coordinate

    • top: number

      Top clip coordinate

    • near: number

      Near clip coordinate

    • far: number

      Far clip coordinate

    Returns Matrix

    Frustum matrix

Static identity

Static inverse

Static lookAt

Static multiply

  • Multiply 2 matrices

    Parameters

    • m1: Matrix

      A matrix to multiply

    • m2: Matrix

      A matrix to multiply

    Returns Matrix

    The result of calculation

Static negate

Static ortho

  • ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix
  • Generate orthogonal matrix.

    Parameters

    • left: number

      Left clip coordinate

    • right: number

      Right clip coordinate

    • bottom: number

      Bottom clip coordinate

    • top: number

      Top clip coordinate

    • near: number

      Near clip coordinate

    • far: number

      Far clip coordinate

    Returns Matrix

    Orthogonal matrix

Static perspective

  • perspective(fovy: number, aspect: number, near: number, far: number): Matrix
  • Generate perspective matrix.

    Parameters

    • fovy: number

      fovy angle of perspective in radians

    • aspect: number

      aspect ratio

    • near: number

      Near clip disntance

    • far: number

      Far clip disntance

    Returns Matrix

    perspective matrix

Static rotateX

  • rotateX(angle: number): Matrix
  • Instanciate a matrix representing X-axis rotation.

    Parameters

    • angle: number

      Angle of rotation in radians.

    Returns Matrix

    Rotation matrix

Static rotateY

  • rotateY(angle: number): Matrix
  • Instanciate a matrix representing Y-axis rotation.

    Parameters

    • angle: number

      Angle of rotation in radians.

    Returns Matrix

    Rotation matrix

Static rotateZ

  • rotateZ(angle: number): Matrix
  • Instanciate a matrix representing Z-axis rotation.

    Parameters

    • angle: number

      Angle of rotation in radians.

    Returns Matrix

    Rotation matrix

Static rotationQuaternion

  • Instanciate a matrix representing rotation converted from a given quaternion.

    Parameters

    Returns Matrix

    Rotation matrix

Static scalarMultiply

  • Multiply a given scalar value to each components of matrix..

    Parameters

    • s: number

      A scalar to multiply

    • m: Matrix

      A matrix to be multiplied

    Returns Matrix

    The result of calculation

Static scale

Static subtract

  • Subtract each component of matrix.

    Parameters

    • m1: Matrix

      A matrix to subtract.

    • m2: Matrix

      A matrix to subtract.

    Returns Matrix

    The result of calculation.

Static transform

  • Transform a Vector4 by given matrix.

    Parameters

    • m: Matrix

      A matrix representing a transform.

    • t: Vector4

      A vector to transform

    Returns Vector4

    Transformed vector

Static transformNormal

  • Transform a vector representing direction by given matrix.

    Parameters

    • m: Matrix

      A matrix representing a transform.

    • t: Vector3

      A vector representing direction.

    Returns Vector3

    Transformed direction

Static transformPoint

  • Transform a vector representing coordinate by given matrix.

    Parameters

    • m: Matrix

      A matrix representing a transform.

    • t: Vector3

      A vector representing coordinate.

    Returns Vector3

    Transformed coordinate

Static translate

Static transpose

Static trs

Static zero

Generated using TypeDoc