Vector4 — Aspose.3D FOSS for Java
Enumerations
Vector4 è un vettore a doppia precisione a 4 componenti. È il tipo di memorizzazione per i punti di controllo della mesh (dove w = 1.0 per le posizioni) VertexElementNormal livelli (dove w non è usato).
Enumerations: com.aspose.threed
import com.aspose.threed.*;
Vector4 point = new Vector4(1.0, 2.0, 3.0, 1.0);Enumerations
| Enumerations | Enumerations |
|---|---|
Vector4() | Enumerations (0, 0, 0, 1) |
Vector4(double x, double y, double z, double w) | Costruisce da quattro componenti |
Vector4(double x, double y, double z) | Costruisce con w = 1.0 |
Vector4(Vector3 v3) | Costruisce da un Vector3 con w = 1.0 |
Vector4(Vector4 other) | Costruttore di copia |
Campi Pubblici
Vector4 usa campi pubblici per l’accesso ai componenti (non metodi getter/setter):
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
x | double | v.x | Componente X |
y | double | v.y | Componente Y |
z | double | v.z | Componente Z |
w | double | v.w | Componente W (coordinata omogenea) |
Enumerations
| Enumerations | Tipo di ritorno | Enumerations |
|---|---|---|
set(double x, double y, double z, double w) | void | Imposta tutti e quattro i componenti |
toVector3() | Vector3 | Restituisce un Vector3(x, y, z) rimuovendo il w componente |
Enumerations
import com.aspose.threed.*;
Mesh mesh = new Mesh();
// Add control points (w=1.0 for positions)
mesh.getControlPoints().add(new Vector4(0.0, 0.0, 0.0, 1.0));
mesh.getControlPoints().add(new Vector4(1.0, 0.0, 0.0, 1.0));
mesh.getControlPoints().add(new Vector4(0.5, 1.0, 0.0, 1.0));
mesh.createPolygon(0, 1, 2);
// Convert to Vector3
Vector4 v4 = new Vector4(1.0, 2.0, 3.0, 1.0);
Vector3 v3 = v4.toVector3(); // Vector3(1.0, 2.0, 3.0)
// Construct from Vector3
Vector3 pos = new Vector3(5.0, 0.0, 0.0);
Vector4 homogeneous = new Vector4(pos); // w = 1.0