当前位置: 首页 > 工具软件 > Jzy3D > 使用案例 >

Java3d获取坐标_java-使用带有xzyz坐标和jzy3d的3d表面图

须彭亮
2023-12-01

我一直在寻找一种将coord(x,y,z)列表发送到jzy3d的方法.但是没有成功.

我发现的唯一方法是使用带有列表“ coord3d”和“ tesselator”的“ builder”,但实际上不起作用.

我真的不了解Tesselator的意思吗?

这是我尝试的代码:

public Chart getChart(){

List coordinates = new ArrayList();

for(int i=0; i<200; i++)

coordinates.add( new Coord3d(5, 10, 15) );

Tesselator tesselator = new Tesselator() {

@Override

public AbstractComposite build(float[] x, float[] y, float[] z) {

return null;

}

};

tesselator.build(coordinates);

org.jzy3d.plot3d.primitives.Shape surface = (Shape)Builder.build(coordinates, tesselator);

/*/ Define a function to plot

Mapper mapper = new Mapper(){

public double f(double x, double y) {

return 10*Math.sin(x/10)*Math.cos(y/20)*x;

}

};*/

// Define range and precision for the function to plot

// Range range = new Range(-150,150);

// int steps = 50;

// Create the object to represent the function over the given range.

// org.jzy3d.plot3d.primitives.Shape surface = (Shape)Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);

//surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1,1,1,.5f)));

// surface.setWireframeDisplayed(true);

// surface.setWireframeColor(Color.BLACK);

//surface.setFace(new ColorbarFace(surface));

//surface.setFaceDisplayed(true);

//surface.setFace2dDisplayed(true); // opens a colorbar on the right part of the display

// Create a chart

Chart chart = new Chart("swing");

chart.getScene().getGraph().add(surface);

return chart;

}

有人可以告诉我如何用许多XYZ坐标系喂我的图形,以便我可以像这样获得3d表面图:

 类似资料: