view scraps/plot2.yeti @ 173:2cb4c78d42db

Another test
author Chris Cannam
date Thu, 02 May 2013 17:38:23 +0100
parents 098b4efde5b1
children
line wrap: on
line source
module scraps.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);

println "Z Bounds: \(surface#getBounds()#getZmin()) -> \(surface#getBounds()#getZmax())";

chart = new Chart(Quality#Nicest);
chart#getScene()#getGraph()#add(surface);
ChartLauncher#openChart(chart);