Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace mat2

Index

Functions

LDU

  • LDU(L: ReadonlyMat2, D: ReadonlyMat2, U: ReadonlyMat2, a: ReadonlyMat2): ReadonlyMat2[]
  • Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix

    Parameters

    • L: ReadonlyMat2

      the lower triangular matrix

    • D: ReadonlyMat2

      the diagonal matrix

    • U: ReadonlyMat2

      the upper triangular matrix

    • a: ReadonlyMat2

      the input matrix to factorize

    Returns ReadonlyMat2[]

add

  • add(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2
  • Adds two mat2's

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    Returns mat2

    out

adjoint

  • adjoint(out: mat2, a: ReadonlyMat2): mat2
  • Calculates the adjugate of a mat2

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the source matrix

    Returns mat2

    out

clone

  • clone(a: ReadonlyMat2): mat2
  • Creates a new mat2 initialized with values from an existing matrix

    Parameters

    • a: ReadonlyMat2

      matrix to clone

    Returns mat2

    a new 2x2 matrix

copy

  • copy(out: mat2, a: ReadonlyMat2): mat2
  • Copy the values from one mat2 to another

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the source matrix

    Returns mat2

    out

create

  • Creates a new identity mat2

    Returns mat2

    a new 2x2 matrix

determinant

  • determinant(a: ReadonlyMat2): number
  • Calculates the determinant of a mat2

    Parameters

    • a: ReadonlyMat2

      the source matrix

    Returns number

    determinant of a

equals

  • equals(a: ReadonlyMat2, b: ReadonlyMat2): boolean
  • Returns whether or not the matrices have approximately the same elements in the same position.

    Parameters

    • a: ReadonlyMat2

      The first matrix.

    • b: ReadonlyMat2

      The second matrix.

    Returns boolean

    True if the matrices are equal, false otherwise.

exactEquals

  • exactEquals(a: ReadonlyMat2, b: ReadonlyMat2): boolean
  • Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)

    Parameters

    • a: ReadonlyMat2

      The first matrix.

    • b: ReadonlyMat2

      The second matrix.

    Returns boolean

    True if the matrices are equal, false otherwise.

frob

  • frob(a: ReadonlyMat2): number
  • Returns Frobenius norm of a mat2

    Parameters

    • a: ReadonlyMat2

      the matrix to calculate Frobenius norm of

    Returns number

    Frobenius norm

fromRotation

  • fromRotation(out: mat2, rad: number): mat2
  • Creates a matrix from a given angle This is equivalent to (but much faster than):

    mat2.identity(dest);
    mat2.rotate(dest, dest, rad);
    

    Parameters

    • out: mat2

      mat2 receiving operation result

    • rad: number

      the angle to rotate the matrix by

    Returns mat2

    out

fromScaling

  • fromScaling(out: mat2, v: ReadonlyVec2): mat2
  • Creates a matrix from a vector scaling This is equivalent to (but much faster than):

    mat2.identity(dest);
    mat2.scale(dest, dest, vec);
    

    Parameters

    • out: mat2

      mat2 receiving operation result

    • v: ReadonlyVec2

      Scaling vector

    Returns mat2

    out

fromValues

  • fromValues(m00: number, m01: number, m10: number, m11: number): mat2
  • Create a new mat2 with the given values

    Parameters

    • m00: number

      Component in column 0, row 0 position (index 0)

    • m01: number

      Component in column 0, row 1 position (index 1)

    • m10: number

      Component in column 1, row 0 position (index 2)

    • m11: number

      Component in column 1, row 1 position (index 3)

    Returns mat2

    out A new 2x2 matrix

identity

  • Set a mat2 to the identity matrix

    Parameters

    • out: mat2

      the receiving matrix

    Returns mat2

    out

invert

  • invert(out: mat2, a: ReadonlyMat2): mat2
  • Inverts a mat2

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the source matrix

    Returns mat2

    out

mul

  • mul(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2
  • Multiplies two mat2's

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    Returns mat2

    out

multiply

  • multiply(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2
  • Multiplies two mat2's

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    Returns mat2

    out

multiplyScalar

  • multiplyScalar(out: mat2, a: ReadonlyMat2, b: number): mat2
  • Multiply each element of the matrix by a scalar.

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the matrix to scale

    • b: number

      amount to scale the matrix's elements by

    Returns mat2

    out

multiplyScalarAndAdd

  • multiplyScalarAndAdd(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2, scale: number): mat2
  • Adds two mat2's after multiplying each element of the second operand by a scalar value.

    Parameters

    • out: mat2

      the receiving vector

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    • scale: number

      the amount to scale b's elements by before adding

    Returns mat2

    out

rotate

  • rotate(out: mat2, a: ReadonlyMat2, rad: number): mat2
  • Rotates a mat2 by the given angle

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    Returns mat2

    out

scale

  • scale(out: mat2, a: ReadonlyMat2, v: ReadonlyVec2): mat2
  • Scales the mat2 by the dimensions in the given vec2

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the matrix to rotate

    • v: ReadonlyVec2

      the vec2 to scale the matrix by

    Returns mat2

    out

set

  • set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2
  • Set the components of a mat2 to the given values

    Parameters

    • out: mat2

      the receiving matrix

    • m00: number

      Component in column 0, row 0 position (index 0)

    • m01: number

      Component in column 0, row 1 position (index 1)

    • m10: number

      Component in column 1, row 0 position (index 2)

    • m11: number

      Component in column 1, row 1 position (index 3)

    Returns mat2

    out

str

  • str(a: ReadonlyMat2): string
  • Returns a string representation of a mat2

    Parameters

    • a: ReadonlyMat2

      matrix to represent as a string

    Returns string

    string representation of the matrix

sub

  • sub(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2
  • Subtracts matrix b from matrix a

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    Returns mat2

    out

subtract

  • subtract(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2
  • Subtracts matrix b from matrix a

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the first operand

    • b: ReadonlyMat2

      the second operand

    Returns mat2

    out

transpose

  • transpose(out: mat2, a: ReadonlyMat2): mat2
  • Transpose the values of a mat2

    Parameters

    • out: mat2

      the receiving matrix

    • a: ReadonlyMat2

      the source matrix

    Returns mat2

    out