Methods
Quaternion 表示一个用于编码 3D 旋转的单位四元数。与欧拉角不同,四元数避免了万向锁并且能够平滑插值。该 Transform.rotation 场景节点上的属性存储一个 Quaternion.
组件被存储为 (w, x, y, z) 其中 w 是标量部分,且 (x, y, z) 构成向量部分。.
Methods: aspose.threed.utilities
Methods
| Methods | Methods |
|---|
Quaternion() | 单位四元数 (w=1, x=0, y=0, z=0) |
Quaternion(w, x, y, z) | 显式分量构造函数 |
Methods
| Methods | Methods | Methods |
|---|
w | float | 标量(实部) |
x | float | 向量 x 分量 |
y | float | 向量 y 分量 |
z | float | 向量 z 分量 |
length | float | 四元数的模 |
静态工厂方法
| Methods | 返回类型 | Methods |
|---|
Quaternion.from_euler_angle(pitch, yaw, roll) | Quaternion | 从弧度制的欧拉角构造(俯仰=X,偏航=Y,滚转=Z)。也接受一个 Vector3 作为第一个参数 |
Quaternion.from_angle_axis(angle, axis) | Quaternion | 从角度(弧度)和一个 Vector3 轴 |
Quaternion.from_rotation(orig, dest) | Quaternion | 从方向的最短弧旋转 orig 到方向 dest |
Quaternion.interpolate(t, from_q, to_q) | Quaternion | SLERP 插值;; t 在 [0, 1] |
Quaternion.slerp(t, v1, v2) | Quaternion | 别名为 interpolate |
实例方法
| Methods | 返回类型 | Methods |
|---|
normalize() | Quaternion | 返回一个单位长度的副本 |
conjugate() | Quaternion | 返回共轭 (w, -x, -y, -z) |
inverse() | Quaternion | 返回乘法逆元;抛出 ValueError 如果长度为零 |
dot(q) | float | 与另一个四元数的点积 |
concat(rhs) | Quaternion | Hamilton乘积(两个旋转的组合) |
euler_angles() | Vector3 | 提取欧拉角(弧度)为 Vector3(roll, pitch, yaw) |
to_matrix(translation=None) | Matrix4 | 转换为 4×4 旋转矩阵;可选地嵌入平移 Vector3 |
to_angle_axis(angle, axis) | None | 分解为角度(弧度)和轴;结果写入单元素列表 angle[0] 和 axis[0] |
Methods
另请参阅