Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Sample SurfacePlotter program

View SampleSurface.scala
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// Quick demo of SurfacePlotter [ http://code.google.com/p/surfaceplotter ]
import scala.swing._
 
import net.ericaro.surfaceplotter.{ProgressiveSurfaceModel, JSurfacePanel, Mapper}
 
val model = new ProgressiveSurfaceModel
val surfacePanel = new JSurfacePanel
surfacePanel.setModel(model)
 
model.setMapper(new Mapper {
def f1(x:Float, y:Float) = {
val r = x*x + y*y
if (r == 0 ) 1f else (Math.sin(r)/r).toFloat
}
def f2(x:Float, y:Float) = {
(Math.sin(x*y)).toFloat
}
})
 
model.plot.execute
 
new MainFrame {
contents = new Component {
override lazy val peer = surfacePanel
}
visible = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.