FVector3, FVector4 — Aspose.3D FOSS for Java
Paket: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector Familie bietet Einzelpräzision (float) Alternativen zur Doppelpräzision Vector Typen. Sie werden intern von Vertex-Element-Datenarrays für die kompakte Speicherung von Normalen, Tangenten und UV-Koordinaten verwendet.
Hinweis: FVector2 gibt nicht existieren in der Java Ausgabe. Nur FVector3 und FVector4 sind verfügbar.
FVector3
Einzelpräzisions‑3‑Komponenten‑Float‑Vektor. Er erscheint in Vertex‑Elementdaten‑Arrays für Normalen und Tangenten.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Konstrukte aus drei Komponenten |
FVector3(Vector3 v) | Konstrukte aus einer doppelten Genauigkeit Vector3 |
Öffentliche Felder
FVector3 verwendet öffentliche Felder für den Zugriff auf Komponenten:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X‑Komponente |
y | float | v.y | Y‑Komponente |
z | float | v.z | Z‑Komponente |
Example
| Example | Rückgabetyp | Example |
|---|---|---|
normalize() | FVector3 | Gibt eine Kopie mit Einheitslänge zurück |
cross(FVector3 rhs) | FVector3 | Kreuzprodukt |
dot(FVector3 rhs) | float | Skalarprodukt |
FVector4
Einzelpräzisions-4-Komponenten-Float-Vektor. Der Speichertyp von VertexElementFVector Daten.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Konstruiert aus vier Komponenten |
FVector4(Vector4 v) | Konstruiert aus einer Doppelpräzision Vector4 |
Öffentliche Felder
FVector4 verwendet öffentliche Felder für den Komponenten‑Zugriff:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X‑Komponente |
y | float | v.y | Y‑Komponente |
z | float | v.z | Z‑Komponente |
w | float | v.w | W‑Komponente |
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