FVector3, FVector4 — Aspose.3D FOSS for Java
Package: com.aspose.threed (aspose-3d-foss 26.1.0)
The FVector family provides single-precision (float) alternatives to the double-precision Vector types. They are used internally by vertex element data arrays for compact storage of normals, tangents, and UV coordinates.
Note:
FVector2does not exist in the Java edition. OnlyFVector3andFVector4are available.
FVector3
Single-precision 3-component float vector. Appears in vertex element data arrays for normals and tangents.
Constructor
| Signature | Description |
|---|---|
FVector3() | Constructs (0, 0, 0) |
FVector3(float x, float y, float z) | Constructs from three components |
FVector3(Vector3 v) | Constructs from a double-precision Vector3 |
Public Fields
FVector3 uses public fields for component access:
| Field | Type | Access | Description |
|---|---|---|---|
x | float | v.x | X component |
y | float | v.y | Y component |
z | float | v.z | Z component |
Methods
| Method | Return Type | Description |
|---|---|---|
normalize() | FVector3 | Returns a unit-length copy |
cross(FVector3 rhs) | FVector3 | Cross product |
dot(FVector3 rhs) | float | Dot product |
FVector4
Single-precision 4-component float vector. The storage type of VertexElementFVector data.
Constructor
| Signature | Description |
|---|---|
FVector4() | Constructs (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Constructs from four components |
FVector4(Vector4 v) | Constructs from a double-precision Vector4 |
Public Fields
FVector4 uses public fields for component access:
| Field | Type | Access | Description |
|---|---|---|---|
x | float | v.x | X component |
y | float | v.y | Y component |
z | float | v.z | Z component |
w | float | v.w | W component |
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