The Matrix4x4 class is used to create 4x4 matrices.

Matrix4x4 类用于创建4x4矩阵。

实现

  • IClone

构造函数

  • 参数

    • m11: number = 1
    • m12: number = 0
    • m13: number = 0
    • m14: number = 0
    • m21: number = 0
    • m22: number = 1
    • m23: number = 0
    • m24: number = 0
    • m31: number = 0
    • m32: number = 0
    • m33: number = 1
    • m34: number = 0
    • m41: number = 0
    • m42: number = 0
    • m43: number = 0
    • m44: number = 1
    • elements: Float32Array = null

    返回 Matrix4x4

    Constructor method.

    构造方法

属性

elements: Float32Array

Matrix elements array.

矩阵元素数组。

DEFAULT: Readonly<Matrix4x4> = ...

Default matrix. Do not modify.

默认矩阵,禁止修改。

DEFAULTINVERT: Readonly<Matrix4x4> = ...

Inverse of the default matrix. Do not modify.

默认值的逆矩阵,禁止修改。

TEMP: Matrix4x4 = ...

Temporary matrix for internal calculations.

用于内部计算的临时矩阵。

ZERO: Readonly<Matrix4x4> = ...

Default matrix. Do not modify.

默认矩阵,禁止修改。

方法

  • 参数

    • destObject: Float32Array

      The Float32Array to clone from

    返回 void

    Clone the matrix from a Float32Array

    从Float32Array克隆矩阵

  • 参数

    • translation: Vector3

      The translation vector.

    • rotationMatrix: Matrix4x4

      The rotation matrix.

    • scale: Vector3

      The scale vector.

    返回 boolean

    Whether the decomposition was successful.

    Decompose the matrix into translation vector, rotation matrix, and scale vector.

    分解矩阵为平移向量、旋转矩阵、缩放向量。

  • 参数

    • translation: Vector3

      The translation vector.

    • rotation: Quaternion

      The rotation quaternion.

    • scale: Vector3

      The scale vector.

    返回 boolean

    Whether the decomposition was successful.

    Decompose the matrix into translation vector, rotation quaternion, and scale vector.

    分解矩阵为平移向量、旋转四元数、缩放向量。

  • 参数

    • yawPitchRoll: Vector3

      Vector3 to store the resulting Euler angles (in radians).

    返回 void

    Decompose the rotation matrix into Yaw-Pitch-Roll Euler angles.

    分解旋转矩阵为Yaw-Pitch-Roll欧拉角。

  • 参数

    • other: Matrix4x4

      The other 4x4 matrix to compare.

    返回 boolean

    True if the matrices are equal, false otherwise.

    Determine if two 4x4 matrices have equal values.

    判断两个4x4矩阵的值是否相等。

  • 返回 boolean

    True if the matrix is inverted, false otherwise

    Determine if this matrix is an inverted matrix

    判断此矩阵是否是反向矩阵

  • 参数

    • out: Vector3

      The output vector to store the translation

    返回 void

    Get the translation vector from the matrix

    获取矩阵中的平移向量

  • 参数

    • translate: Vector3

      The vector representing the translation

    返回 void

    Set the translation vector of the matrix

    设置矩阵的平移向量

  • 参数

    • objectPosition: Vector3

      The position of the object

    • cameraPosition: Vector3

      The position of the camera

    • cameraUp: Vector3

      The up vector of the camera

    • cameraForward: Vector3

      The forward vector of the camera

    • mat: Matrix4x4

      The transformation matrix to store the result

    返回 void

    Calculate the Billboard matrix

    计算Billboard矩阵

  • 参数

    • left: number

      The left boundary of the frustum.

    • right: number

      The right boundary of the frustum.

    • bottom: number

      The bottom boundary of the frustum.

    • top: number

      The top boundary of the frustum.

    • znear: number

      The near boundary of the frustum.

    • zfar: number

      The far boundary of the frustum.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Calculate the orthographic projection matrix.

    计算正交投影矩阵。

  • 参数

    • fov: number

      The field of view in radians.

    • aspect: number

      The aspect ratio (width / height).

    • znear: number

      The near clipping plane.

    • zfar: number

      The far clipping plane.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Create a perspective projection matrix using FOV.

    通过FOV创建透视投影矩阵。

  • 参数

    • left: number

      The left boundary of the frustum.

    • right: number

      The right boundary of the frustum.

    • bottom: number

      The bottom boundary of the frustum.

    • top: number

      The top boundary of the frustum.

    • znear: number

      The near boundary of the frustum.

    • zfar: number

      The far boundary of the frustum.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Create a perspective projection matrix.

    创建透视投影矩阵。

  • 参数

    • axis: Vector3

      The rotation axis, assumed to be normalized.

    • angle: number

      The rotation angle.

    • result: Matrix4x4

      The output result matrix.

    返回 void

    Create a rotation matrix from an axis and an angle.

    通过旋转轴和旋转角度计算旋转矩阵。

  • 参数

    • rad: number

      The rotation angle.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Create a rotation matrix around the X axis.

    创建绕X轴旋转的矩阵。

  • 参数

    • rad: number

      The rotation angle.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Create a rotation matrix around the Y axis.

    创建绕Y轴旋转的矩阵。

  • 参数

    • yaw: number

      The rotation angle around the vertical axis (Y-axis).

    • pitch: number

      The rotation angle around the transverse axis (X-axis).

    • roll: number

      The rotation angle around the longitudinal axis (Z-axis).

    • result: Matrix4x4

      The output result matrix.

    返回 void

    Create a rotation matrix from yaw, pitch, and roll angles.

    通过yaw、pitch、roll角度创建旋转矩阵。

  • 参数

    • rad: number

      The rotation angle.

    • out: Matrix4x4

      The output matrix.

    返回 void

    Create a rotation matrix around the Z axis.

    创建绕Z轴旋转的矩阵。