Construya un diagrama de superficie 3D usando coordenadas xyz con jzy3d
He estado buscando una manera de enviar una lista de coord (x, y, z) a jzy3d. Pero sin éxito
La única forma que encontré es usar un "generador" con una lista de "coord3d" y un "tesselator", pero en realidad no funciona.
¿Realmente no entiendo el significado del Tesselator de hecho?
Aquí está el código que probé:
public Chart getChart(){
List<Coord3d> coordinates = new ArrayList<Coord3d>();
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;
}
¿Podría alguien decirme cómo alimentar mi gráfico con muchas coordenadas XYZ para que pueda obtener un diagrama de superficie en 3D como este:
Un diagrama de superficie 3d http://martin.pernollet.free.fr/cv/projects/jzy3d/demo_surface.jp