I am trying to plot a 3d path given a set of coordinates. From jzy3d's demo application, I've found that this is possible through their BernsteinInterpolator
and LineStripInterpolated
classes.
With the help of their source code, my attempt to reproduce this is as follows:
public static void main(String[] args) {
BernsteinInterpolator interp = new BernsteinInterpolator();
List<Coord3d> controlCoords = new ArrayList<>();
controlCoords.add(new Coord3d(0.0, 0.0, 0.0));
controlCoords.add(new Coord3d(1.0, 0.0, 1.0));
controlCoords.add(new Coord3d(1.0, 0.0, 2.0));
controlCoords.add(new Coord3d(1.0, 1.0, 2.0));
controlCoords.add(new Coord3d(0.0, 1.0, 2.0));
controlCoords.add(new Coord3d(3.0, 2.0, -1.0));
LineStripInterpolated line = new LineStripInterpolated(interp, controlCoords, 30);
Chart chart = new AWTChart(Quality.Intermediate);
chart.add(line);
chart.open("chart test", 600, 600);
}
This is what I would expect to get, according to the demo application -> DemoPlot
Unfortunately, the above only renders a blank window with no errors or exceptions. Does anyone have any idea what went wrong? Your help is greatly appreciated!
So I digged a little deeper into the source code and found that there is a way to bypass the
LineStripInterpolated
class as follows:Hope this helps anyone else with the same problem. I'm still curious as to why my previous method didn't work though. :(