FVector3 / FVector4

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: FVector2 does not exist in the Java edition. Only FVector3 and FVector4 are available.


FVector3

Single-precision 3-component float vector. Appears in vertex element data arrays for normals and tangents.

Constructor

SignatureDescription
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:

FieldTypeAccessDescription
xfloatv.xX component
yfloatv.yY component
zfloatv.zZ component

Methods

MethodReturn TypeDescription
normalize()FVector3Returns a unit-length copy
cross(FVector3 rhs)FVector3Cross product
dot(FVector3 rhs)floatDot product

FVector4

Single-precision 4-component float vector. The storage type of VertexElementFVector data.

Constructor

SignatureDescription
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:

FieldTypeAccessDescription
xfloatv.xX component
yfloatv.yY component
zfloatv.zZ component
wfloatv.wW 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

See Also