The class representing a 3x3 matrix.

Constructors

  • Create a 3x3 matrix with the given arguments in row-major order. If no arguments are provided, the constructor initializes the Matrix3 to the 3x3 identity matrix.

    Parameters

    • Optionaln11: number

      Input element in the first row and the first column

    • Optionaln12: number

      Input element in the first row and the second column

    • Optionaln13: number

      Input element in the first row and the third column

    • Optionaln21: number

      Input element in the second row and the first column

    • Optionaln22: number

      Input element in the second row and the second column

    • Optionaln23: number

      Input element in the second row and the third column

    • Optionaln31: number

      Input element in the third row and the first column

    • Optionaln32: number

      Input element in the third row and the second column

    • Optionaln33: number

      Input element in the third row and the third column

    Returns AcGeMatrix2d

Properties

elements: number[]

A column-major list of matrix values.

IDENTITY: Readonly<AcGeMatrix2d>

Identity matrix.

Methods

  • Creates a new 3x3 matrix and with identical elements to this one.

    Returns AcGeMatrix2d

    Return the cloned matrix

  • Copy the elements of matrix m into this matrix.

    Parameters

    Returns this

    Return this matrix

  • Compute and return the determinant of this matrix.

    Returns number

    Return the determinant of this matrix

  • Return true if this matrix and m are equal.

    Parameters

    Returns boolean

    Return true if this matrix and m are equal.

  • Extracts the basis of this matrix into the three axis vectors provided

    Parameters

    Returns this

    Return this matrix

  • Set the elements of this matrix based on an array in column-major format.

    Parameters

    • array: number[]

      Input the array to read the elements from.

    • Optionaloffset: number

      Input (optional) index of first element in the array. Default is 0.

    Returns this

    Return this matrix

  • Sets this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal matrix is the inverse transpose of the matrix m.

    Parameters

    Returns this

    Return this matrix

  • Reset this matrix to the 3x3 identity matrix:

    Returns this

    Return this matrix

  • Invert this matrix, using the analytic method. You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead.

    Returns this

    Return this matrix

  • Set this matrix as a 2D rotational transformation by theta radians

    Parameters

    • theta: number

      Input rotation angle in radians. Positive values rotate counterclockwise.

    Returns this

    Return this matrix

  • Set this matrix as a 2D scale transform

    Parameters

    • x: number

      Input the amount to scale in the X axis.

    • y: number

      Input the amount to scale in the Y axis.

    Returns this

    Return this matrix

  • Set this matrix as a 2D translation transform:

    Parameters

    • x: number | AcGeVector2d

      Input one 2d vector or one number

    • y: number

      Input one number

    Returns this

    Return this matrix

  • Post-multiplies this matrix by m.

    Parameters

    Returns this

    Return this matrix

  • Set this matrix to a x b.

    Parameters

    Returns this

    Return this matrix

  • Multiply every component of the matrix by the scalar value s.

    Parameters

    • s: number

      Input one scalar value

    Returns this

    Return this matrix

  • Pre-multiplies this matrix by m.

    Parameters

    Returns this

    Return this matrix

  • Rotate this matrix by the given angle (in radians).

    Parameters

    • theta: number

      Input one angle in radians

    Returns this

    Return this matrix

  • Scale this matrix with the given scalar values.

    Parameters

    • sx: number

      Input one scalar value

    • sy: number

      Input one scalar value

    Returns this

    Return this matrix

  • Set the 3x3 matrix values to the given row-major sequence of values.

    Parameters

    • n11: number

      Input element in the first row and the first column

    • n12: number

      Input element in the first row and the second column

    • n13: number

      Input element in the first row and the third column

    • n21: number

      Input element in the second row and the first column

    • n22: number

      Input element in the second row and the second column

    • n23: number

      Input element in the second row and the third column

    • n31: number

      Input element in the third row and the first column

    • n32: number

      Input element in the third row and the second column

    • n33: number

      Input element in the third row and the third column

    Returns this

    Return this matrix

  • Set this matrix to the upper 3x3 matrix of the Matrix4 m.

    Parameters

    Returns this

    Return this matrix

  • Set the UV transform matrix from offset, repeat, rotation, and center.

    Parameters

    • tx: number

      Input offset x

    • ty: number

      Input offset y

    • sx: number

      Input repeat x

    • sy: number

      Input repeat y

    • rotation: number

      Input rotation, in radians. Positive values rotate counterclockwise

    • cx: number

      Input center x of rotation

    • cy: number

      Input center y of rotation

    Returns this

    Return this matrix

  • Write the elements of this matrix to an array in column-major format.

    Parameters

    • Optionalarray: number[]

      Input (optional) array to store the resulting vector in. If not given a new array will be created.

    • Optionaloffset: number

      Input (optional) offset in the array at which to put the result.

    Returns number[]

    Return this matrix

  • Translate this matrix by the given scalar values.

    Parameters

    • tx: number

      Input one scalar value

    • ty: number

      Input one scalar value

    Returns this

    Return this matrix

  • Transpose this matrix in place.

    Returns this

    Return this matrix

  • Set this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal matrix is the inverse transpose of the matrix m.

    Parameters

    Returns this

    Return this matrix