FVector3, FVector4 — Aspose.3D FOSS for Java
Pakotne: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector ģimene nodrošina vienkāršas precizitātes (float) alternatīvas dubultprecizitātei Vector tipi. Tie tiek izmantoti iekšēji virsotnes elementu datu masīvos, lai kompakti glabātu normāles, tangentes un UV koordinātas.
Piezīme: FVector2 ne eksistē Java izdevumā. Tikai FVector3 un FVector4 ir pieejami.
FVector3
Vienas precizitātes 3-komponentu float vektors. Parādās virsotnes elementu datu masīvos, lai glabātu normāles un tangentes.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Konstrukcijas no trim komponentiem |
FVector3(Vector3 v) | Konstrukcijas no dubultprecizitātes Vector3 |
Publiskie lauki
FVector3 izmanto publiskie lauki komponentu piekļuvei:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponents |
y | float | v.y | Y komponents |
z | float | v.z | Z komponents |
Example
| Example | Atgriešanas tips | Example |
|---|---|---|
normalize() | FVector3 | Atgriež vienības garuma kopiju |
cross(FVector3 rhs) | FVector3 | Krustprodukts |
dot(FVector3 rhs) | float | Skalarprodukts |
FVector4
Vienkāršas precizācijas 4-komponentu float vektors. Glabāšanas tips VertexElementFVector dati.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Izveido no četriem komponentiem |
FVector4(Vector4 v) | Konstrukcijas no dubultprecizitātes Vector4 |
Publiskie lauki
FVector4 izmanto publiskie lauki komponentu piekļuvei:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponents |
y | float | v.y | Y komponents |
z | float | v.z | Z komponents |
w | float | v.w | W komponents |
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