Example
Vector3 是一个双精度的三分量向量,具有 x, y,,以及 z 分量。它在整个 Aspose.3D 中用于位置、方向、法线和缩放值。所有算术运算都会返回新的 Vector3 实例;原始实例不会被修改。.
Example
| Example | Example |
|---|
Vector3() | 构造零向量 (0, 0, 0) |
Vector3(double x, double y, double z) | 从三个分量构造 |
Vector3(Vector3 other) | 拷贝构造函数 |
公共字段
Vector3 使用 公共字段 用于分量访问(而非 getter/setter 方法)::
| Example | Example | Example | Example |
|---|
x | double | v.x | X 分量 |
y | double | v.y | Y 分量 |
z | double | v.z | Z 分量 |
计算属性
| Example | Example | Example | Example |
|---|
length | double | getLength() | 欧几里得长度 (sqrt(x^2+y^2+z^2)), 只读 |
length2 | double | getLength2() | 平方长度,只读;比 getLength() 仅在需要比较时 |
静态字段
| Example | Example | Example |
|---|
ZERO | Vector3 | Vector3(0, 0, 0) |
ONE | Vector3 | Vector3(1, 1, 1) |
UNIT_X | Vector3 | Vector3(1, 0, 0) |
UNIT_Y | Vector3 | Vector3(0, 1, 0) |
UNIT_Z | Vector3 | Vector3(0, 0, 1) |
Example
| Example | 返回类型 | Example |
|---|
set(double x, double y, double z) | void | 就地设置所有三个分量 |
dot(Vector3 rhs) | double | 与另一个的点积 Vector3 |
cross(Vector3 rhs) | Vector3 | 叉积 – 返回一个垂直于两个操作数的向量 |
normalize() | Vector3 | 返回一个单位长度的副本;如果长度为零则返回零向量 |
angleBetween(Vector3 dir) | double | 此向量与…之间的弧度角 dir |
angleBetween(Vector3 dir, Vector3 up) | double | 在由…定义的平面上投影的有符号弧度角 up |
sin() | Vector3 | 逐分量正弦 |
cos() | Vector3 | 逐分量余弦 |
compareTo(Vector3 other) | int | 字典序比较:返回 -1、0 或 1 |
Vector3.parse(String s) | Vector3 | 静态。解析 "x y z" 字符串表示 |
Example
另见