FVector3, FVector4 — Aspose.3D FOSS for Java
Paket: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector familija pruža jednostruku preciznost (float) alternative za dvostruku preciznost Vector tipovi. Interno se koriste u nizovima podataka elementa vrha za kompaktno skladištenje normala, tangensa i UV koordinata.
Napomena: FVector2 radi ne postoji u Java izdanju. Samo FVector3 i FVector4 su dostupni.
FVector3
Vektor jednostruke preciznosti sa 3 komponente (float). 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 duple preciznosti Vector3 |
Javna polja
FVector3 koristi javna 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 | Povratni tip | Example |
|---|---|---|
normalize() | FVector3 | Vraća kopiju jedinične dužine |
cross(FVector3 rhs) | FVector3 | Vektorski proizvod |
dot(FVector3 rhs) | float | Skalarni proizvod |
FVector4
Jednostruko precizni vektor od 4 float komponente. Tip skladištenja 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) | Kreira iz duple preciznosti Vector4 |
Javna polja
FVector4 koristi javna 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 |
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