我开发了一个java应用程序来生成一个3D对象作为.obj文件。我想在导出它之前在我的应用程序的viewer3D中可视化这个对象,但我只有一个包含3D对象的面和顶点列表的java对象。从我的面和顶点列表中,我想创建一个javafx类型的Shape或MeshView。
事实上,我正在尝试将我的java对象转换为javafx 3D对象。
我实现了一个Face Object:
public class Face {
private int id, idVertice1, idVertice2, idVertice3;
public Face(int idVertice1, int idVertice2, int idVertice3) {
this.idVertice1 = idVertice1;
this.idVertice2 = idVertice2;
this.idVertice3 = idVertice3;
}
public int getIdVertice1() {
return idVertice1;
}
public int getIdVertice2() {
return idVertice2;
}
public int getIdVertice3() {
return idVertice3;
}
}
我也有一个Vertices类:
public class Vertices {
private double x, y, z;
public Vertices(double line, double height, double column) {
x = column;
y = height;
z = line;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
她是我的网格课程:
public class Mesh {
private TreeMap<Double, TreeMap<Double, Vertices>> setOfVertices;
private LinkedList<Face> setOfFaces;
public Mesh() {
setOfFaces = new LinkedList();
setOfVertices = new TreeMap<Double, TreeMap<Double, Vertices>>();
}
public TreeMap getSetOfVertices() {
return setOfVertices;
}
public LinkedList<Face> getSetOfFaces() {
return setOfFaces;
}
如何将此Mesh对象转换为JavaFX网格对象到我的查看器3D(我的查看器3D是一个subScene):
这可能吗?