RSX Code Reference
    Preparing search index...

    Class Matrix3

    The Matrix3 implements a 3x3 matrix that can be used for non-homogenous transformations of three dimensional vectors and points.

    The class follows the 'copy-on-write' pattern, which means that every operation such as Matrix3.multiply returns a copy of the matrix with updated values. It also implies that the values of the matrix cannot be directly modified.

    The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

    The matrix storage is "row-major" meaning that elements [0...2] represents the first row. The first column is represented by the elements [0, 3, 6]

    Index
    • Parameters

      • Optionalm00: number
      • Optionalm01: number
      • Optionalm02: number
      • Optionalm10: number
      • Optionalm11: number
      • Optionalm12: number
      • Optionalm20: number
      • Optionalm21: number
      • Optionalm22: number

      Returns Matrix3

    identity: Immutable<Matrix3>

    Identity matrix.

    A matrix with all zero values.

    • get m00(): number

      Returns number

    • set m00(m00: number): void

      Parameters

      • m00: number

      Returns void

    • get m01(): number

      Returns number

    • set m01(m01: number): void

      Parameters

      • m01: number

      Returns void

    • get m02(): number

      Returns number

    • set m02(m02: number): void

      Parameters

      • m02: number

      Returns void

    • get m10(): number

      Returns number

    • set m10(m10: number): void

      Parameters

      • m10: number

      Returns void

    • get m11(): number

      Returns number

    • set m11(m11: number): void

      Parameters

      • m11: number

      Returns void

    • get m12(): number

      Returns number

    • set m12(m12: number): void

      Parameters

      • m12: number

      Returns void

    • get m20(): number

      Returns number

    • set m20(m20: number): void

      Parameters

      • m20: number

      Returns void

    • get m21(): number

      Returns number

    • set m21(m21: number): void

      Parameters

      • m21: number

      Returns void

    • get m22(): number

      Returns number

    • set m22(m22: number): void

      Parameters

      • m22: number

      Returns void

    • Calculates the matrix determinant.

      Returns number

      Determinant of the matrix.

    • Clones this instance and returns a new Matrix3 with identical values.

      Returns Matrix3

    • Calculates an inverse of the matrix if it exists.

      Parameters

      • Optionaltolerance: number

      Returns boolean

    • Returns a transpose of the matrix (switched columns and rows).

      Returns void

    • Gets a specific column in the matrix.

      Parameters

      • columnIndex: number

        Index of the column in range [0, 2].

      Returns Vector3

      The column as Vector3.

    • Gets the value of the specified element in the matrix.

      Parameters

      • row: number

        Row index of the element to retrieve.

      • column: number

        Column index of the element to retrieve.

      Returns number

      Value of the element.

    • Value of the specified element in the matrix using a linear index. Linear index can be calculated using the following formula: idx = row * 3 + column.

      Parameters

      • index: number

        Linear index to get the value of.

      Returns number

      Value of the element.

    • Decompose a matrix to rotation and scale components. Matrix must consist only of rotation and uniform scale transformations, otherwise accurate results are not guaranteed. Applying non-uniform scale guarantees results will not be accurate.

      Returns { rotation: Quaternion; scale: Vector3 }

      An anonymous object with the following members

      • rotation, the rotation quaternion.
      • scale, the scale factors.
    • Calculates the inverse of the matrix if it exists.

      Returns Matrix3

      Inverse of the matrix.

    • Decomposes the matrix into a set of values.

      Returns { matQ: Matrix3; vecD: Vector3; vecU: Vector3 }

      An object containing the following objects:

      • matQ Columns form orthonormal bases. If your matrix is affine and doesn't use non-uniform scaling this matrix will be the rotation part of the matrix.
      • vecD If the matrix is affine these will be scaling factors of the matrix.
      • vecU If the matrix is affine these will be shear factors of the matrix.
    • Sets values of a specific column in the matrix.

      Parameters

      • columnIndex: number

        Index of the column in range [0, 2].

      • column: Immutable<Vector3>

        Values to set in the column.

      Returns Matrix3

    • Sets the value of the specified element in the matrix.

      Parameters

      • row: number

        Row index of the element to retrieve.

      • column: number

        Column index of the element to retrieve.

      • value: number

      Returns void

      Value of the element.

    • Sets value of the specified element in the matrix using a linear index. Linear index can be calculated using the following formula: idx = row * 4 + column.

      Parameters

      • index: number

        Linear index to gsetet the value of.

      • value: number

        New value of the element.

      Returns void

    • Converts an orthonormal matrix to axis angle representation.

      Returns { angle: rsx.Degree; axis: Vector3 }

      An anonymous object with the following members:

      • axis Axis around which the rotation is performed.
      • angle Amount of rotation.
    • Converts an orthonormal matrix to euler angle (pitch/yaw/roll) representation with YXZ intrinsic order (RSX's default).

      Returns Vector3

      Euler angles in degrees representing the rotation in this matrix.

    • Converts an orthonormal matrix to quaternion representation.

      Returns Quaternion

      Quaternion representing the rotation in this matrix.

    • Returns string

    • Transforms the given vector by this matrix and returns the newly transformed vector.

      Parameters

      Returns Vector3

      Vector transformed by the matrix.

    • Calculates the transpose of the matrix.

      Returns Matrix3

    • Creates a rotation matrix from a quaternion rotation.

      Parameters

      Returns Matrix3

      rotation matrix containing the equivalent rotation of the provided quaternion.

    • Creates a rotation matrix from axis/angle rotation.

      Parameters

      Returns Matrix3

      rotation matrix that can rotate an object around the specified axis for the specified amount.

    • Creates a new matrix with the specified elements.

      Parameters

      • m00: number
      • m01: number
      • m02: number
      • m10: number
      • m11: number
      • m12: number
      • m20: number
      • m21: number
      • m22: number

      Returns Matrix3

    • Creates a rotation matrix from the provided euler angle (pitch/yaw/roll) rotation.

      Parameters

      Returns Matrix3

      rotation matrix that can rotate an object to the specified angles.

    • Creates a rotation matrix from the provided euler angle (pitch/yaw/roll) rotation.

      Parameters

      Returns Matrix3

      rotation matrix that can rotate an object to the specified angles.

      Angles are applied in YXZ intrinsic order (RSX's default euler order).

    • Creates a rotation matrix from the provided euler angle (pitch/yaw/roll) rotation.

      Parameters

      Returns Matrix3

      rotation matrix that can rotate an object to the specified angles.

      Angles are applied in YXZ intrinsic order (RSX's default euler order).

    • Creates a rotation matrix from the provided euler angle (pitch/yaw/roll) rotation.

      Parameters

      Returns Matrix3

      rotation matrix that can rotate an object to the specified angles.

      Angles are applied in YXZ intrinsic order (RSX's default euler order).