FVector3, FVector4 — Aspose.3D FOSS for Java
Paketti: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector perhe tarjoaa yksittäistarkkuus (float) vaihtoehtoja kaksoistarkkuudelle Vector tyyppejä. Niitä käytetään sisäisesti vertex-elementtien data-taulukoissa normaalien, tangenttien ja UV-koordinaattien tiiviiseen tallennukseen.
Huomautus: FVector2 ei ole olemassa versiossa Java. Vain FVector3 ja FVector4 ovat saatavilla.
FVector3
Yksittäistarkkuuden 3-komponenttinen float-vektori. Esiintyy vertex-elementtien tietotauluissa normaalien ja tangenttien osalta.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Rakenteet kolmesta komponentista |
FVector3(Vector3 v) | Rakenteet kaksoistarkkuudesta Vector3 |
Julkiset kentät
FVector3 käyttää julkiset kentät komponenttien käyttöön:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X‑komponentti |
y | float | v.y | Y‑komponentti |
z | float | v.z | Z‑komponentti |
Example
| Example | Palautustyyppi | Example |
|---|---|---|
normalize() | FVector3 | Palauttaa yksikköpituuden kopion |
cross(FVector3 rhs) | FVector3 | Ristitulo |
dot(FVector3 rhs) | float | Pistetulo |
FVector4
Yhden tarkkuuden 4-komponenttinen float-vektori. Tietojen tallennustyyppi VertexElementFVector tietoja.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Rakentaa neljästä komponentista |
FVector4(Vector4 v) | Rakentaa kaksoistarkkuudesta Vector4 |
Julkiset kentät
FVector4 käyttää julkisia kenttiä komponenttien käyttöön:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X-komponentti |
y | float | v.y | Y-komponentti |
z | float | v.z | Z-komponentti |
w | float | v.w | W-komponentti |
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