FVector3, FVector4 — Aspose.3D FOSS for Java
Paket: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector obitelj pruža jednostruku preciznost (float) alternative dvostruke preciznosti Vector tipova. Interno se koriste u nizovima podataka elemenata vrha za kompaktno pohranjivanje normala, tangensa i UV koordinata.
Napomena: FVector2 ne postoji u Java izdanju. Samo FVector3 i FVector4 su dostupni.
FVector3
Single-precision 3-komponentni float vektor. Pojavljuje se u nizovima podataka elementa vrha za normale i tangense.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Konstrukcije od tri komponente |
FVector3(Vector3 v) | Konstrukcije od dvostruke preciznosti Vector3 |
Javna polja
FVector3 koristi javni polja za pristup komponenti:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponenta |
y | float | v.y | Y komponenta |
z | float | v.z | Z komponenta |
Example
| Example | Tip povratne vrijednosti | Example |
|---|---|---|
normalize() | FVector3 | Vraća kopiju jedinične duljine |
cross(FVector3 rhs) | FVector3 | Vektorski produkt |
dot(FVector3 rhs) | float | Skalarni produkt |
FVector4
Jednostruka preciznost 4-komponentni float vektor. Tip pohrane za VertexElementFVector podatke.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Kreira iz četiri komponente |
FVector4(Vector4 v) | Konstrukcije iz dvostruke preciznosti Vector4 |
Javna polja
FVector4 koristi javna polja za pristup komponentama:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | X komponenta |
y | float | v.y | Y komponenta |
z | float | v.z | Z komponenta |
w | float | v.w | W komponenta |
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