FVector3, FVector4 — Aspose.3D FOSS for Java
Paketas: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector šeima suteikia viengubo tikslumo (float) alternatyvas dvigubo tikslumo Vector tipų. Jos naudojamos viduje viršūnių elementų duomenų masyvuose, kad būtų kompaktiškai saugomi normalės, tangentai ir UV koordinatės.
Pastaba: FVector2 ne egzistuoja Java leidime. Tik FVector3 ir FVector4 yra prieinami.
FVector3
Viengubo tikslumo 3 komponentų slankaus kablelio vektorius. Pasirodo viršūnių elementų duomenų masyvuose normalių ir tangentų saugojimui.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Konstrukcijos iš trijų komponentų |
FVector3(Vector3 v) | Konstrukcijos iš dvigubo tikslumo Vector3 |
Vieši laukai
FVector3 naudoja vieši laukai komponentų prieigai:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponentas |
y | float | v.y | Y komponentas |
z | float | v.z | Z komponentas |
Example
| Example | Grąžinimo tipas | Example |
|---|---|---|
normalize() | FVector3 | Grąžina vienetinio ilgio kopiją |
cross(FVector3 rhs) | FVector3 | Kryžminis sandauga |
dot(FVector3 rhs) | float | Skaliarinė sandauga |
FVector4
Viengubo tikslumo 4 komponentų slankaus kablelio vektorius. Saugojimo tipas VertexElementFVector duomenys.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Konstrukcijos iš keturių komponentų |
FVector4(Vector4 v) | Konstrukcijos iš dvigubo tikslumo Vector4 |
Vieši laukai
FVector4 naudoja vieši laukai komponentų prieigai:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponentas |
y | float | v.y | Y komponentas |
z | float | v.z | Z komponentas |
w | float | v.w | W komponentas |
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