FVector3, FVector4 — Aspose.3D FOSS for Java
Pachet: com.aspose.threed (aspose-3d-foss 26.1.0)
Example FVector familia oferă precizie simplă (float) alternative la precizia dublă Vector tipuri. Ele sunt utilizate intern de către matricile de date ale elementelor de vârf pentru stocarea compactă a normalelor, tangenților și coordonatelor UV.
Notă: FVector2 nu există în ediția Java. Doar FVector3 și FVector4 sunt disponibile.
FVector3
Vector float cu precizie simplă, cu 3 componente. Apare în matricile de date ale elementelor de vârf pentru normale și tangente.
Example
| Example | Example |
|---|---|
FVector3() | Example (0, 0, 0) |
FVector3(float x, float y, float z) | Construit din trei componente |
FVector3(Vector3 v) | Construit din precizie dublă Vector3 |
Câmpuri publice
FVector3 utilizează câmpuri publice pentru acces la componente:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | Componenta X |
y | float | v.y | Componenta Y |
z | float | v.z | Componenta Z |
Example
| Example | Tip de returnare | Example |
|---|---|---|
normalize() | FVector3 | Returnează o copie de lungime unitate |
cross(FVector3 rhs) | FVector3 | Produs vectorial |
dot(FVector3 rhs) | float | Produs scalar |
FVector4
Vector float cu 4 componente, precizie simplă. Tipul de stocare al VertexElementFVector datele.
Example
| Example | Example |
|---|---|
FVector4() | Example (0, 0, 0, 0) |
FVector4(float x, float y, float z, float w) | Construiește din patru componente |
FVector4(Vector4 v) | Construiește dintr‑o precizie dublă Vector4 |
Câmpuri publice
FVector4 utilizări câmpuri publice pentru accesul la componentă:
| Example | Example | Example | Example |
|---|---|---|---|
x | float | v.x | componenta X |
y | float | v.y | componenta Y |
z | float | v.z | componenta Z |
w | float | v.w | componenta W |
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