The class representing a 4x4 matrix.

Constructors

  • Create a 4x4 matrix with the given arguments in row-major order. If no arguments are provided, the constructor initializes the Matrix4 to the 4x4 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

    • Optionaln14: number

      Input element in the first row and the forth 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

    • Optionaln24: number

      Input element in the second row and the forth 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

    • Optionaln34: number

      Input element in the third row and the forth column

    • Optionaln41: number

      Input element in the forth row and the first column

    • Optionaln42: number

      Input element in the forth row and the second column

    • Optionaln43: number

      Input element in the forth row and the third column

    • Optionaln44: number

      Input element in the forth row and the forth column

    Returns AcGeMatrix3d

Properties

elements: number[]

A column-major list of matrix values.

IDENTITY: Readonly<AcGeMatrix3d>

Identity matrix.

Methods

  • Set this matrix to the transformation composed of position, quaternion and scale.

    Parameters

    Returns this

    Return this matrix

  • Copy the elements of matrix m into this matrix.

    Parameters

    Returns this

    Return this matrix

  • Copy the translation component of the supplied matrix m into this matrix's translation component.

    Parameters

    Returns this

    Return this matrix

  • Decompose this matrix into its position, quaternion and scale components.

    Note: Not all matrices are decomposable in this way. For example, if an object has a non-uniformly scaled parent, then the object's world matrix may not be decomposable, and this method may not be appropriate.

    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

  • Extracts the rotation component of the supplied matrix m into this matrix's rotation component.

    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) offset into the array. Default is 0.

    Returns this

  • Get the maximum scale value of the 3 axes.

    Returns number

    Return the maximum scale value of the 3 axes.

  • Reset this matrix to the 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

  • Construct a rotation matrix, looking from eye towards target oriented by the up vector.

    Parameters

    Returns this

    Return this matrix

  • Set this matrix as rotation transform around axis by theta radians.

    Parameters

    • axis: AcGeVector3d

      Input rotation axis, should be normalized.

    • angle: number

      Input rotation angle in radians.

    Returns this

    Return this matrix

  • Set the rotation component of this matrix to the rotation specified by q

    Parameters

    Returns this

    Return this matrix

  • Set this matrix as a rotational transformation around the X axis by theta (θ) radians.

    Parameters

    • theta: number

      Input rotation angle in radians.

    Returns this

    Return this matrix

  • Set this matrix as a rotational transformation around the Y axis by theta (θ) radians.

    Parameters

    • theta: number

      Input rotation angle in radians.

    Returns this

    Return this matrix

  • Set this matrix as a rotational transformation around the Z axis by theta (θ) radians.

    Parameters

    • theta: number

      Input rotation angle in radians.

    Returns this

    Return this matrix

  • Set this matrix as scale transform.

    Parameters

    • x: number

      Input x scale

    • y: number

      Input y scale

    • z: number

      Input z scale

    Returns this

    Return this matrix

  • Set this matrix as a shear transform.

    Parameters

    • xy: number

      Input the amount to shear X by Y.

    • xz: number

      Input the amount to shear X by Z.

    • yx: number

      Input the amount to shear Y by X.

    • yz: number

      Input the amount to shear Y by Z.

    • zx: number

      Input the amount to shear Z by X.

    • zy: number

      Input the amount to shear Z by Y.

    Returns this

    Return this matrix

  • Set this matrix as a translation transform from vector v, or numbers x, y and z.

    Parameters

    • x: number | AcGeVector3d

      Input one vector or one number

    • Optionaly: number

      Input one number

    • Optionalz: number

      Input one number

    Returns this

    Return this matrix

  • Post-multiply 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 a scalar value s.

    Parameters

    • s: number

      Input one scalar value

    Returns this

    Return this matrix

  • Pre-multiply this matrix by m.

    Parameters

    Returns this

    Return this matrix

  • Multiply the columns of this matrix by vector v.

    Parameters

    Returns this

    Return this matrix

  • Set the elements of this matrix to the supplied row-major values n11, n12, ... n44.

    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

    • n14: number

      Input element in the first row and the forth 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

    • n24: number

      Input element in the second row and the forth 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

    • n34: number

      Input element in the third row and the forth column

    • n41: number

      Input element in the forth row and the first column

    • n42: number

      Input element in the forth row and the second column

    • n43: number

      Input element in the forth row and the third column

    • n44: number

      Input element in the forth row and the forth column

    Returns this

    Return this matrix

  • Create transform matrix according to the given the normalized extrusion vector

    Parameters

    • extrusion: AcGeVector3d

      Input the normalized extrusion vector

    Returns this

    Return this matrix

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

    Parameters

    Returns this

    Return this matrix

  • Set the position component for this matrix from vector v, without affecting the rest of the matrix.

    Parameters

    • x: number | AcGeVector3d

      Input one number or one vector

    • y: number

      Input one number

    • z: number

      Input one number

    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.

    • Optionaloffset: number

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

    Returns number[]

    Return an array in column-major format by writing the elements of this matrix to it

  • Transposes this matrix.

    Returns this

    Return this matrix