@openhps/core
    Preparing search index...

    Class Matrix4

    Serializable THREE.js Matrix4

    Hierarchy (View Summary)

    • Matrix4
    Index
    • Constructs a new 4x4 matrix. This constructor initializes the matrix as an identity matrix.

      Returns Matrix4

    • Constructs a new 4x4 matrix. The arguments are supposed to be in row-major order.

      Parameters

      • Optionaln11: number

        1-1 matrix element.

      • Optionaln12: number

        1-2 matrix element.

      • Optionaln13: number

        1-3 matrix element.

      • Optionaln14: number

        1-4 matrix element.

      • Optionaln21: number

        2-1 matrix element.

      • Optionaln22: number

        2-2 matrix element.

      • Optionaln23: number

        2-3 matrix element.

      • Optionaln24: number

        2-4 matrix element.

      • Optionaln31: number

        3-1 matrix element.

      • Optionaln32: number

        3-2 matrix element.

      • Optionaln33: number

        3-3 matrix element.

      • Optionaln34: number

        3-4 matrix element.

      • Optionaln41: number

        4-1 matrix element.

      • Optionaln42: number

        4-2 matrix element.

      • Optionaln43: number

        4-3 matrix element.

      • Optionaln44: number

        4-4 matrix element.

      Returns Matrix4

    elements: Matrix4Tuple

    A column-major list of matrix values.

    • Returns a matrix with copied values from this instance.

      Returns this

      A clone of this instance.

    • Sets this matrix to the transformation composed of the given position, rotation (Quaternion) and scale.

      Parameters

      • position: Vector3

        The position vector.

      • quaternion: Quaternion

        The rotation as a Quaternion.

      • scale: Vector3

        The scale vector.

      Returns this

      A reference to this matrix.

    • Copies the values of the given matrix to this instance.

      Parameters

      • m: Matrix4

        The matrix to copy.

      Returns this

      A reference to this matrix.

    • Copies the translation component of the given matrix into this matrix's translation component.

      Parameters

      • m: Matrix4

        The matrix to copy the translation component.

      Returns this

      A reference to this matrix.

    • Decomposes this matrix into its position, rotation and scale components and provides the result in the given objects.

      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

      • position: Vector3

        The position vector.

      • quaternion: Quaternion

        The rotation as a Quaternion.

      • scale: Vector3

        The scale vector.

      Returns this

      A reference to this matrix.

    • Computes and returns the determinant of this matrix.

      Based on the method outlined here.

      Returns number

      The determinant.

    • Computes and returns the determinant of the 4x4 matrix, but assumes the matrix is affine, saving some computations.

      For affine matrices (like an object's world matrix), this value equals the full 4x4 Matrix4#determinant but is cheaper to compute.

      Assumes the bottom row is [0, 0, 0, 1].

      Returns number

      The determinant of the matrix.

    • Returns true if this matrix is equal with the given one.

      Parameters

      • matrix: Matrix4

        The matrix to test for equality.

      Returns boolean

      Whether this matrix is equal with the given one.

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

      Parameters

      • xAxis: Vector3

        The basis's x axis.

      • yAxis: Vector3

        The basis's y axis.

      • zAxis: Vector3

        The basis's z axis.

      Returns this

      A reference to this matrix.

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

      Note: This method does not support reflection matrices.

      Parameters

      • m: Matrix4

        The matrix.

      Returns this

      A reference to this matrix.

    • Sets the elements of the matrix from the given array.

      Parameters

      • array: ArrayLike<number>

        The matrix elements in column-major order.

      • Optionaloffset: number

        Index of the first element in the array.

      Returns this

      A reference to this matrix.

    • Gets the maximum scale value of the three axes.

      Returns number

      The maximum scale.

    • Sets this matrix to the 4x4 identity matrix.

      Returns this

      A reference to this matrix.

    • Inverts 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

      A reference to this matrix.

    • Sets the rotation component of the transformation matrix, looking from eye towards target, and oriented by the up-direction.

      Parameters

      • eye: Vector3

        The eye vector.

      • target: Vector3

        The target vector.

      • up: Vector3

        The up vector.

      Returns this

      A reference to this matrix.

    • Sets the given basis vectors to this matrix.

      Parameters

      • xAxis: Vector3

        The basis's x axis.

      • yAxis: Vector3

        The basis's y axis.

      • zAxis: Vector3

        The basis's z axis.

      Returns this

      A reference to this matrix.

    • Creates a orthographic projection matrix. This is used internally by OrthographicCamera#updateProjectionMatrix.

      Parameters

      • left: number

        Left boundary of the viewing frustum at the near plane.

      • right: number

        Right boundary of the viewing frustum at the near plane.

      • top: number

        Top boundary of the viewing frustum at the near plane.

      • bottom: number

        Bottom boundary of the viewing frustum at the near plane.

      • near: number

        The distance from the camera to the near plane.

      • far: number

        The distance from the camera to the far plane.

      • OptionalcoordinateSystem: CoordinateSystem

        The coordinate system.

      • OptionalreversedDepth: boolean

        Whether to use a reversed depth.

      Returns this

      A reference to this matrix.

    • Creates a perspective projection matrix. This is used internally by PerspectiveCamera#updateProjectionMatrix.

      Parameters

      • left: number

        Left boundary of the viewing frustum at the near plane.

      • right: number

        Right boundary of the viewing frustum at the near plane.

      • top: number

        Top boundary of the viewing frustum at the near plane.

      • bottom: number

        Bottom boundary of the viewing frustum at the near plane.

      • near: number

        The distance from the camera to the near plane.

      • far: number

        The distance from the camera to the far plane.

      • OptionalcoordinateSystem: CoordinateSystem

        The coordinate system.

      • OptionalreversedDepth: boolean

        Whether to use a reversed depth.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a rotational transformation around the given axis by the given angle.

      This is a somewhat controversial but mathematically sound alternative to rotating via Quaternions. See the discussion here.

      Parameters

      • axis: Vector3

        The normalized rotation axis.

      • angle: number

        The rotation in radians.

      Returns this

      A reference to this matrix.

    • Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given Euler angles. The rest of the matrix is set to the identity. Depending on the Euler#order, there are six possible outcomes. See this page for a complete list.

      Parameters

      • euler: Euler

        The Euler angles.

      Returns this

      A reference to this matrix.

    • Sets the rotation component of this matrix to the rotation specified by the given Quaternion as outlined here The rest of the matrix is set to the identity.

      Parameters

      • q: Quaternion

        The Quaternion.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a rotational transformation around the X axis by the given angle.

      Parameters

      • theta: number

        The rotation in radians.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a rotational transformation around the Y axis by the given angle.

      Parameters

      • theta: number

        The rotation in radians.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a rotational transformation around the Z axis by the given angle.

      Parameters

      • theta: number

        The rotation in radians.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a scale transformation.

      Parameters

      • x: number

        The amount to scale in the X axis.

      • y: number

        The amount to scale in the Y axis.

      • z: number

        The amount to scale in the Z axis.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a shear transformation.

      Parameters

      • xy: number

        The amount to shear X by Y.

      • xz: number

        The amount to shear X by Z.

      • yx: number

        The amount to shear Y by X.

      • yz: number

        The amount to shear Y by Z.

      • zx: number

        The amount to shear Z by X.

      • zy: number

        The amount to shear Z by Y.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a translation transform from the given vector.

      Parameters

      • v: Vector3

        A translation vector.

      Returns this

      A reference to this matrix.

    • Sets this matrix as a translation transform from the given vector.

      Parameters

      • x: number

        The amount to translate in the X axis.

      • y: number

        The amount to translate in the Y axis.

      • z: number

        The amount to translate in the z axis.

      Returns this

      A reference to this matrix.

    • Post-multiplies this matrix by the given 4x4 matrix.

      Parameters

      • m: Matrix4

        The matrix to multiply with.

      Returns this

      A reference to this matrix.

    • Multiples the given 4x4 matrices and stores the result in this matrix.

      Parameters

      • a: Matrix4

        The first matrix.

      • b: Matrix4

        The second matrix.

      Returns this

      A reference to this matrix.

    • Multiplies every component of the matrix by the given scalar.

      Parameters

      • s: number

        The scalar.

      Returns this

      A reference to this matrix.

    • Pre-multiplies this matrix by the given 4x4 matrix.

      Parameters

      • m: Matrix4

        The matrix to multiply with.

      Returns this

      A reference to this matrix.

    • Multiplies the columns of this matrix by the given vector.

      Parameters

      • v: Vector3

        The scale vector.

      Returns this

      A reference to this matrix.

    • Sets the elements of the matrix.The arguments are supposed to be in row-major order.

      Parameters

      • Optionaln11: number

        1-1 matrix element.

      • Optionaln12: number

        1-2 matrix element.

      • Optionaln13: number

        1-3 matrix element.

      • Optionaln14: number

        1-4 matrix element.

      • Optionaln21: number

        2-1 matrix element.

      • Optionaln22: number

        2-2 matrix element.

      • Optionaln23: number

        2-3 matrix element.

      • Optionaln24: number

        2-4 matrix element.

      • Optionaln31: number

        3-1 matrix element.

      • Optionaln32: number

        3-2 matrix element.

      • Optionaln33: number

        3-3 matrix element.

      • Optionaln34: number

        3-4 matrix element.

      • Optionaln41: number

        4-1 matrix element.

      • Optionaln42: number

        4-2 matrix element.

      • Optionaln43: number

        4-3 matrix element.

      • Optionaln44: number

        4-4 matrix element.

      Returns this

      A reference to this matrix.

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

      Parameters

      • m: Matrix3

        The 3x3 matrix.

      Returns this

      A reference to this matrix.

    • Sets the position component for this matrix from the given vector, without affecting the rest of the matrix.

      Parameters

      • v: Vector3

        The vector object.

      Returns this

      A reference to this matrix.

    • Sets the position component for this matrix from the given vector, without affecting the rest of the matrix.

      Parameters

      • x: number

        The x component of the vector.

      • y: number

        The y component of the vector.

      • z: number

        The z component of the vector.

      Returns this

      A reference to this matrix.

    • Writes the elements of this matrix to the given array. If no array is provided, the method returns a new instance.

      Type Parameters

      • TArray extends ArrayLike<number> = Matrix4Tuple

      Parameters

      • Optionalarray: TArray

        The target array holding the matrix elements in column-major order.

      • Optionaloffset: number

        Index of the first element in the array.

      Returns TArray

      The matrix elements in column-major order.

    • Transposes this matrix in place.

      Returns this

      A reference to this matrix.

    • Create a rotation matrix from euler angles

      Type Parameters

      Parameters

      • vector: Vector3

        Vector

      • angle: number

        Angle

      Returns T

      Rotation matrix

    • Create a rotation matrix from euler angles

      Type Parameters

      Parameters

      • euler: Euler

        Euler angles

      Returns T

      Rotation matrix

    • Create a rotation matrix from quaternion

      Type Parameters

      Parameters

      • quat: Quaternion

        Quaternion

      Returns T

      Rotation matrix