FVector3, FVector4 — Aspose.3D FOSS for Java
Pacchetto: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector la famiglia fornisce precisione singola (float) alternative alla doppia precisione Vector tipi. Vengono usati internamente dagli array di dati degli elementi dei vertici per la memorizzazione compatta di normali, tangenti e coordinate UV.
Nota: FVector2 non esiste nella versione Java. Solo FVector3 e FVector4 sono disponibili.
FVector3
Vettore float a precisione singola a 3 componenti. Compare negli array di dati degli elementi vertex per normali e tangenti.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Costrutti da tre componenti |
FVector3(Vector3 v) | Costrutti da una doppia precisione Vector3 |
Campi pubblici
FVector3 utilizza campi pubblici per l’accesso ai componenti:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | componente X |
y | float | v.y | componente Y |
z | float | v.z | componente Z |
Example
| Example | Tipo di ritorno | Example |
|---|---|---|
normalize() | FVector3 | Restituisce una copia di lunghezza unitaria |
cross(FVector3 rhs) | FVector3 | Prodotto vettoriale |
dot(FVector3 rhs) | float | Prodotto scalare |
FVector4
Vettore float a precisione singola a 4 componenti. Il tipo di memorizzazione di VertexElementFVector dati.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Costruisce da quattro componenti |
FVector4(Vector4 v) | Costruisce da una precisione doppia Vector4 |
Campi pubblici
FVector4 utilizza campi pubblici per l’accesso ai componenti:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | componente X |
y | float | v.y | componente Y |
z | float | v.z | componente Z |
w | float | v.w | componente 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