Chris@108: module yetilab.plot.plot; Chris@108: Chris@108: import org.jzy3d.plot3d.builder: Mapper; Chris@108: import org.jzy3d.maths: Range; Chris@108: import org.jzy3d.plot3d.primitives: Shape; Chris@108: import org.jzy3d.chart: Chart, ChartLauncher; Chris@108: import org.jzy3d.plot3d.builder: Builder; Chris@108: import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid; Chris@108: import org.jzy3d.colors.colormaps: ColorMapRainbow; Chris@108: import org.jzy3d.colors: ColorMapper; Chris@108: import org.jzy3d.colors: Color; Chris@108: import org.jzy3d.plot3d.rendering.canvas: Quality; Chris@108: Chris@108: newMatrixMapper matrix = Chris@108: (class MMapper extends Mapper Chris@108: double f(double x, double y) Chris@108: matrix.getAt y x Chris@108: end; Chris@108: new MMapper()); Chris@108: Chris@108: newMatrixLogMapper matrix = Chris@108: (class MMapper extends Mapper Chris@108: double f(double x, double y) Chris@108: ln (matrix.getAt y x) Chris@108: end; Chris@108: new MMapper()); Chris@108: Chris@108: newMapper mapFunction = Chris@108: (class FMapper extends Mapper Chris@108: double f(double x, double y) Chris@108: mapFunction x y Chris@108: end; Chris@108: new FMapper()); Chris@108: Chris@108: plot matrix = Chris@108: (mapper = newMatrixLogMapper matrix; Chris@108: size = matrix.size; Chris@108: xrange = new Range(1, size.columns - 1); Chris@108: yrange = new Range(1, size.rows - 1); Chris@108: grid = new OrthonormalGrid(xrange, size.columns, yrange, size.rows); Chris@112: println "Matrix size: \(size)"; Chris@110: surface = Builder#buildOrthonormalBig(grid, mapper); //??? big? Chris@111: surface#setFaceDisplayed(false); Chris@108: surface#setWireframeDisplayed(true); Chris@108: surface#setWireframeColor(Color#BLACK); Chris@112: // chart = new Chart(Quality#Fastest, "swing"); Chris@112: chart = new Chart(Quality#Nicest); Chris@108: chart#getScene()#getGraph()#add(surface); Chris@108: ChartLauncher#openChart(chart)); Chris@108: Chris@110: plotStructure structure = Chris@110: case structure of Chris@110: Grid matrix: Chris@110: plot matrix; Chris@110: //!!! Chris@110: _: failWith "Cannot plot this structure (only grids implemented so far)"; Chris@110: esac; Chris@108: Chris@110: { plot, plotStructure } Chris@110: