javamavenplotjzy3d

Does JZY3D-API support "plot3(...)" function in Matlab?


Matlab support 3D line plotting with plot3 function. But I want to do this with JZY3D API. Does JZY3D api support this operation like matlab? If it is, which method does this line plotting? Please help me!!

Thank you


Solution

  • It can be done using LineStrip shape like this:

    public class LineTest extends AbstractAnalysis {
    
        public static void main(String[] args) throws Exception {
            AnalysisLauncher.open(new LineTest());
        }
    
        @Override
        public void init() throws Exception {
            chart = AWTChartComponentFactory.chart(Quality.Fastest, getCanvasType());
            LineStrip lineStrip = new LineStrip(
                new Point(new Coord3d(0.0, 1.0, 3.0)),
                new Point(new Coord3d(1.0, 2.0, 3.0))
        );
            lineStrip.setWireframeColor(Color.RED);
            chart.getScene().getGraph().add(lineStrip);
        }
    }
    

    It shows only 2D plane with line on it, but if you add more 3d-shapes to your scene, you will find out that line is 3-dimensional.