ht.Math.Matrix4()

new Matrix4()

Members

el :Array.<number>

矩阵列优先数组

isMatrix4 :boolean

是否为 Matrix4

Default Value:
  • true

Methods

clone() → {ht.Math.Matrix4}

创建一个相同的矩阵

Returns:
ht.Math.Matrix4

compose(position, quaternion, scale) → {ht.Math.Matrix4}

设置当前矩阵为由位置、四元数和缩放组合变换的矩阵

Parameters:
Name Type Description
position ht.Math.Vector3

位置

quaternion ht.Math.Quaternion

四元数

scale ht.Math.Vector3

缩放

Returns:
ht.Math.Matrix4

copy(Matrix4) → {ht.Math.Matrix4}

将矩阵 Matrix4 的元素复制到当前矩阵中

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4

copyPosition(Matrix4) → {ht.Math.Matrix4}

将给定矩阵 Matrix4 的平移分量拷贝到当前矩阵中

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4

decompose(position, quaternion, scale) → {ht.Math.Matrix4}

将当前矩阵分解到给定的平移、旋转和缩放分量中

Parameters:
Name Type Description
position ht.Math.Vector3

位置

quaternion ht.Math.Quaternion

四元数

scale ht.Math.Vector3

缩放

Returns:
ht.Math.Matrix4

determinant() → {number}

返回当前矩阵的行列式

Returns:
number -

行列式

equals(Matrix4) → {boolean}

如果矩阵 Matrix4 与当前矩阵所有对应元素相同则返回true

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
boolean

extractRotation(Matrix4) → {ht.Math.Matrix4}

将矩阵 Matrix4 的旋转分量提取到当前矩阵中

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4

fromArray(Array, offset) → {ht.Math.Matrix4}

使用列优先数组来设置当前矩阵

Parameters:
Name Type Attributes Description
Array Array.<Object>

矩阵列优先数组

offset number <optional>

数组的偏移量,默认值为 0

Returns:
ht.Math.Matrix4

getElements() → {Array.<number>}

返回矩阵列优先数组

Returns:
Array.<number>

getInverse(Matrix4) → {ht.Math.Matrix4}

将当前矩阵设置为 Matrix4 矩阵的逆矩阵

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4 -

取逆的矩阵

getPosition() → {ht.Math.Vector3}

返回当前矩阵的位置分量

Returns:
ht.Math.Vector3

identity() → {ht.Math.Matrix4}

将当前矩阵重置为单位矩阵

Returns:
ht.Math.Matrix4

invert() → {ht.Math.Matrix4}

矩阵翻转

Returns:
ht.Math.Matrix4

lookAt(eye, center, up) → {ht.Math.Matrix4}

构造一个旋转矩阵,从 eye 指向 center,由向量 up 定向

Parameters:
Name Type Description
eye ht.Math.Vector3

摄像机

center ht.Math.Vector3

目标点

up ht.Math.Vector3

摄像机正上方向

Returns:
ht.Math.Matrix4

makeRotationAxis(axis, rotation) → {ht.Math.Matrix4}

设置当前矩阵为围绕轴 axis 旋转 rotation 弧度

Parameters:
Name Type Description
axis ht.Math.Vector3

旋转轴

rotation number

旋转量(弧度制)

Returns:
ht.Math.Matrix4

makeRotationFromEuler(euler) → {ht.Math.Matrix4}

将传入的欧拉角转换为该矩阵的旋转分量(左上角的3x3矩阵)。 矩阵的其余部分被设为单位矩阵。根据欧拉角euler的旋转顺序order,总共有六种可能的结果

Parameters:
Name Type Description
euler ht.Math.Euler
Returns:
ht.Math.Matrix4

makeRotationFromQuaternion(Quaternion) → {ht.Math.Matrix4}

将这个矩阵的旋转分量设置为四元数指定的旋转, 矩阵的其余部分被设为单位矩阵

Parameters:
Name Type Description
Quaternion ht.Math.Quaternion

四元数

Returns:
ht.Math.Matrix4

multiply(Matrix4) → {ht.Math.Matrix4}

将当前矩阵乘以矩阵 Matrix4

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4

multiplyMatrices(a, b) → {ht.Math.Matrix4}

设置当前矩阵为矩阵a x 矩阵b

Parameters:
Name Type Description
a ht.Math.Matrix4
b ht.Math.Matrix4
Returns:
ht.Math.Matrix4

multiplyScalar(scale) → {ht.Math.Matrix4}

当前矩阵所有的元素乘以该缩放值 scale

Parameters:
Name Type Description
scale number
Returns:
ht.Math.Matrix4

premultiply(Matrix4) → {ht.Math.Matrix4}

将矩阵 Matrix4 乘以当前矩阵

Parameters:
Name Type Description
Matrix4 ht.Math.Matrix4
Returns:
ht.Math.Matrix4

rotate(r) → {ht.Math.Matrix4}

在当前值基础上设置旋转值

Parameters:
Name Type Description
r number
Returns:
ht.Math.Matrix4
Since:
  • 7.7.0

scale(x, y) → {ht.Math.Matrix4}

在当前值基础上增加缩放值

Parameters:
Name Type Description
x number
y number
Returns:
ht.Math.Matrix4

set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) → {ht.Math.Matrix4}

将传入的数值以行优先的格式设置给该矩阵

Parameters:
Name Type Description
n11 number
n12 number
n13 number
n14 number
n21 number
n22 number
n23 number
n24 number
n31 number
n32 number
n33 number
n34 number
n41 number
n42 number
n43 number
n44 number
Returns:
ht.Math.Matrix4

setPosition(position) → {ht.Math.Matrix4}

设置当前矩阵的位置分量

Parameters:
Name Type Description
position ht.Math.Vector3

位置

Returns:
ht.Math.Matrix4

toArray(array, offset) → {Array.<number>}

使用列优先格式将此矩阵的元素写入数组中

Parameters:
Name Type Attributes Description
array Array.<Object> <optional>

用于存储矩阵元素的数组,如果未指定会创建一个新的数组

offset number <optional>

数组中元素的偏移量

Returns:
Array.<number>

transpose() → {ht.Math.Matrix4}

将该矩阵转置

Returns:
ht.Math.Matrix4
Since:
  • 7.7.0