Vector4 — Aspose.3D FOSS for Java

Enumerations

Vector4 double-precision 4-komponensű vektor. Ez a tárolótípus a háló vezérlőpontjaihoz (ahol w = 1.0 pozíciókhoz) VertexElementNormal rétegekben (ahol w nem használatos).

Enumerations: com.aspose.threed

import com.aspose.threed.*;

Vector4 point = new Vector4(1.0, 2.0, 3.0, 1.0);

Enumerations

EnumerationsEnumerations
Vector4()Enumerations (0, 0, 0, 1)
Vector4(double x, double y, double z, double w)Négy komponensből épít
Vector4(double x, double y, double z)Létrehozza a w = 1.0
Vector4(Vector3 v3)Létrehozza egy Vector3 val w = 1.0
Vector4(Vector4 other)Másoló konstruktor

Publikus mezők

Vector4 használ publikus mezőket az összetevők eléréséhez (nem getter/setter metódusok):

EnumerationsEnumerationsEnumerationsEnumerations
xdoublev.xX komponens
ydoublev.yY komponens
zdoublev.zZ komponens
wdoublev.wW komponens (homogén koordináta)

Enumerations

EnumerationsVisszatérési típusEnumerations
set(double x, double y, double z, double w)voidBeállítja a négy összetevőt
toVector3()Vector3Visszaad egy Vector3(x, y, z) kihagyva a w komponens

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

Lásd még

 Magyar