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 positionht.Math.Vector3 位置
quaternionht.Math.Quaternion 四元数
scaleht.Math.Vector3 缩放
Returns:
ht.Math.Matrix4 -
composeFromArray(position, quaternion, scale) → {ht.Math.Matrix4}
-
Parameters:
Name Type Attributes Description positionArray.<number> <optional>
quaternionArray.<number> <optional>
scaleArray.<number> <optional>
Returns:
ht.Math.Matrix4 -
copy(Matrix4) → {ht.Math.Matrix4}
-
将矩阵 Matrix4 的元素复制到当前矩阵中
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
copyPosition(Matrix4) → {ht.Math.Matrix4}
-
将给定矩阵 Matrix4 的平移分量拷贝到当前矩阵中
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
decompose(position, quaternion, scale) → {ht.Math.Matrix4}
-
将当前矩阵分解到给定的平移、旋转和缩放分量中
Parameters:
Name Type Description positionht.Math.Vector3 位置
quaternionht.Math.Quaternion 四元数
scaleht.Math.Vector3 缩放
Returns:
ht.Math.Matrix4 -
determinant() → {number}
-
返回当前矩阵的行列式
Returns:
number -行列式
-
equals(Matrix4) → {boolean}
-
如果矩阵 Matrix4 与当前矩阵所有对应元素相同则返回true
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
boolean -
extractRotation(Matrix4) → {ht.Math.Matrix4}
-
将给定矩阵 Matrix4 的旋转分量提取到该矩阵的旋转分量中
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
fromArray(Array, offset) → {ht.Math.Matrix4}
-
使用列优先数组来设置当前矩阵
Parameters:
Name Type Attributes Description ArrayArray.<Object> 矩阵列优先数组
offsetnumber <optional>
数组的偏移量,默认值为 0
Returns:
ht.Math.Matrix4 -
getElements() → {Array.<number>}
-
返回矩阵列优先数组
Returns:
Array.<number> -
getInverse(Matrix4) → {ht.Math.Matrix4}
-
将当前矩阵设置为 Matrix4 矩阵的逆矩阵
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 -
getPosition(position) → {ht.Math.Vector3}
-
返回当前矩阵的位置分量
Parameters:
Name Type Attributes Description positionht.Math.Vector3 <optional>
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 eyeht.Math.Vector3 摄像机
centerht.Math.Vector3 目标点
upht.Math.Vector3 摄像机正上方向
Returns:
ht.Math.Matrix4 -
lookAtDirection(direction, up) → {ht.Math.Matrix4}
-
Parameters:
Name Type Attributes Description directionht.Math.Vector3 upht.Math.Vector3 <optional>
Returns:
ht.Math.Matrix4 -
makeRotationAxis(axis, rotation) → {ht.Math.Matrix4}
-
设置当前矩阵为围绕轴 axis 旋转 rotation 弧度
Parameters:
Name Type Description axisht.Math.Vector3 旋转轴
rotationnumber 旋转量(弧度制)
Returns:
ht.Math.Matrix4 -
makeRotationAxis(Euler) → {ht.Math.Matrix4}
-
将传入的欧拉角转换为该矩阵的旋转分量, 矩阵的其余部分被设为单位矩阵
Parameters:
Name Type Description Eulerht.Math.Euler 欧拉角
Returns:
ht.Math.Matrix4 -
makeRotationFromEuler(euler) → {ht.Math.Matrix4}
-
将传入的欧拉角转换为该矩阵的旋转分量(左上角的3x3矩阵)。 矩阵的其余部分被设为单位矩阵。根据欧拉角euler的旋转顺序order,总共有六种可能的结果
Parameters:
Name Type Description eulerht.Math.Euler Returns:
ht.Math.Matrix4 -
makeRotationFromQuaternion(Quaternion) → {ht.Math.Matrix4}
-
将这个矩阵的旋转分量设置为四元数指定的旋转, 矩阵的其余部分被设为单位矩阵
Parameters:
Name Type Description Quaternionht.Math.Quaternion 四元数
Returns:
ht.Math.Matrix4 -
multiply(Matrix4) → {ht.Math.Matrix4}
-
将当前矩阵乘以矩阵 Matrix4
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
multiply(a, b) → {ht.Math.Matrix4}
-
设置当前矩阵为矩阵 a 乘以 矩阵 b
Parameters:
Name Type Description aht.Math.Matrix4 bht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
multiplyMatrices(a, b) → {ht.Math.Matrix4}
-
设置当前矩阵为矩阵a x 矩阵b
Parameters:
Name Type Description aht.Math.Matrix4 bht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
multiplyScalar(scale) → {ht.Math.Matrix4}
-
当前矩阵所有的元素乘以该缩放值 scale
Parameters:
Name Type Description scalenumber Returns:
ht.Math.Matrix4 -
premultiply(Matrix4) → {ht.Math.Matrix4}
-
将矩阵 Matrix4 乘以当前矩阵
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Matrix4 -
rotate(r) → {ht.Math.Matrix4}
-
在当前值基础上设置旋转值
Parameters:
Name Type Description rnumber Returns:
ht.Math.Matrix4- Since:
- 7.7.0
-
scale(scale3d) → {ht.Math.Matrix4}
-
在当前值基础上增加缩放值
Parameters:
Name Type Description scale3dPoint3d Returns:
ht.Math.Matrix4 -
scale(Vector3) → {ht.Math.Matrix4}
-
将该矩阵的列向量乘以对应向量 Vector3 的分量
Parameters:
Name Type Description Vector3ht.Math.Vector3 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 n11number n12number n13number n14number n21number n22number n23number n24number n31number n32number n33number n34number n41number n42number n43number n44number Returns:
ht.Math.Matrix4 -
setPosition(position) → {ht.Math.Matrix4}
-
设置当前矩阵的位置分量
Parameters:
Name Type Description positionht.Math.Vector3 | Point3d 位置
Returns:
ht.Math.Matrix4 -
toArray(array, offset) → {Array.<number>}
-
使用列优先格式将此矩阵的元素写入数组中
Parameters:
Name Type Attributes Description arrayArray.<Object> <optional>
用于存储矩阵元素的数组,如果未指定会创建一个新的数组
offsetnumber <optional>
数组中元素的偏移量
Returns:
Array.<number> -
transpose() → {ht.Math.Matrix4}
-
将该矩阵转置
Returns:
ht.Math.Matrix4- Since:
- 7.7.0