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@117: result = matrix.getAt y x; Chris@117: println "f(\(x),\(y)) -> \(result)"; Chris@117: result 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@115: plotMatrix matrix = Chris@117: (mapper = newMatrixMapper 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@117: surface = Builder#buildOrthonormal(grid, mapper); //??? big? Chris@117: println "Z Bounds: \(surface#getBounds()#getZmin()) -> \(surface#getBounds()#getZmax())"; 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@115: ChartLauncher#openChart(chart); Chris@115: ()); Chris@108: Chris@110: plotStructure structure = Chris@110: case structure of Chris@110: Grid matrix: Chris@115: plotMatrix matrix; Chris@110: //!!! Chris@110: _: failWith "Cannot plot this structure (only grids implemented so far)"; Chris@110: esac; Chris@108: Chris@115: { Chris@115: plotMatrix, Chris@115: plotStructure Chris@115: } Chris@110: