FVector3, FVector4 — Aspose.3D FOSS for Java
包:: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector 该系列提供单精度 (float) 替代双精度 Vector 类型。它们在顶点元素数据数组内部用于紧凑存储法线、切线和 UV 坐标。.
注意:: FVector2 不 存在 在 Java 版中。仅 FVector3 和 FVector4 可用。.
FVector3
单精度 3 分量浮点向量。出现在用于法线和切线的顶点元素数据数组中。.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | 由三个组件构成 |
FVector3(Vector3 v) | 由双精度构成 Vector3 |
公共字段
FVector3 使用 公共字段 用于组件访问::
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X 组件 |
y | float | v.y | Y 分量 |
z | float | v.z | Z 分量 |
Example
| Example | 返回类型 | Example |
|---|---|---|
normalize() | FVector3 | 返回一个单位长度的副本 |
cross(FVector3 rhs) | FVector3 | 叉积 |
dot(FVector3 rhs) | float | 点积 |
FVector4
单精度 4 分量浮点向量。存储类型为 VertexElementFVector 数据。.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | 由四个组件构成的构造 |
FVector4(Vector4 v) | 从双精度构造 Vector4 |
公共字段
FVector4 使用 公共字段 用于组件访问::
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X 组件 |
y | float | v.y | Y 组件 |
z | float | v.z | Z 组件 |
w | float | v.w | W 组件 |
Example
import com.aspose.threed.*;
// Create from components
FVector3 normal = new FVector3(0.0f, 1.0f, 0.0f);
// Convert from double-precision
Vector3 dir = new Vector3(3.0, 4.0, 0.0);
FVector3 fDir = new FVector3(dir);
// Normalize
FVector3 unit = fDir.normalize();
System.out.println(unit.x); // 0.6f
System.out.println(unit.y); // 0.8f