diff scraps/plot2.yeti @ 107:041c7f4aec2e

Plotting experiments
author Chris Cannam
date Thu, 28 Mar 2013 21:37:29 +0000
parents
children 8f6c2f87dc35
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scraps/plot2.yeti	Thu Mar 28 21:37:29 2013 +0000
@@ -0,0 +1,35 @@
+module plot2;
+
+import org.jzy3d.plot3d.builder: Mapper;
+import org.jzy3d.maths: Range;
+import org.jzy3d.plot3d.primitives: Shape;
+import org.jzy3d.chart: Chart, ChartLauncher;
+import org.jzy3d.plot3d.builder: Builder;
+import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid;
+import org.jzy3d.colors.colormaps: ColorMapRainbow;
+import org.jzy3d.colors: ColorMapper;
+import org.jzy3d.colors: Color;
+import org.jzy3d.plot3d.rendering.canvas: Quality;
+
+newMapper mapFunction =
+   (class YMapper extends Mapper
+        double f(double x, double y)
+            mapFunction x y
+    end;
+    new YMapper());
+
+range = new Range(-150, 150);
+steps = 50;
+
+mapper = newMapper do x y: 10 * sin(x / 10) * cos(y / 20) * x done;
+
+surface = 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, 0.5)));
+surface#setFaceDisplayed(true);
+surface#setWireframeDisplayed(false);
+surface#setWireframeColor(Color#BLACK);
+
+chart = new Chart(Quality#Advanced);
+chart#getScene()#getGraph()#add(surface);
+ChartLauncher#openChart(chart);
+