FVector3 / FVector4

FVector3, FVector4 — Aspose.3D FOSS for Java

包:: com.aspose.threed (aspose-3d-foss 26.1.0)

Example FVector 该系列提供单精度 (float) 替代双精度 Vector 类型。它们在顶点元素数据数组内部用于紧凑存储法线、切线和 UV 坐标。.

注意:: FVector2存在 在 Java 版中。仅 FVector3FVector4 可用。.


FVector3

单精度 3 分量浮点向量。出现在用于法线和切线的顶点元素数据数组中。.

Example

ExampleExample
FVector3()Example (0, 0, 0)
FVector3(float x, float y, float z)由三个组件构成
FVector3(Vector3 v)由双精度构成 Vector3

公共字段

FVector3 使用 公共字段 用于组件访问::

ExampleExampleExampleExample
xfloatv.xX 组件
yfloatv.yY 分量
zfloatv.zZ 分量

Example

Example返回类型Example
normalize()FVector3返回一个单位长度的副本
cross(FVector3 rhs)FVector3叉积
dot(FVector3 rhs)float点积

FVector4

单精度 4 分量浮点向量。存储类型为 VertexElementFVector 数据。.

Example

ExampleExample
FVector4()Example (0, 0, 0, 0)
FVector4(float x, float y, float z, float w)由四个组件构成的构造
FVector4(Vector4 v)从双精度构造 Vector4

公共字段

FVector4 使用 公共字段 用于组件访问::

ExampleExampleExampleExample
xfloatv.xX 组件
yfloatv.yY 组件
zfloatv.zZ 组件
wfloatv.wW 组件

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

另请参见

 中文