progs/mandelbrot.scala
changeset 137 53c769a78a1e
parent 136 c08ba57a7f53
child 143 11396c17cd8b
equal deleted inserted replaced
136:c08ba57a7f53 137:53c769a78a1e
    73   viewer.clearCanvas(black)
    73   viewer.clearCanvas(black)
    74    
    74    
    75   val delta_x = (end.a - start.a) / W
    75   val delta_x = (end.a - start.a) / W
    76   val delta_y = (end.b - start.b) / H
    76   val delta_y = (end.b - start.b) / H
    77    
    77    
    78   for (y0 <- (0 until H).par) {
    78   for (y0 <- (0 until H)) {
    79     for (x0 <- (0 until W).par) {
    79     for (x0 <- (0 until W)) {
    80     
    80     
    81      val c = start + Complex(x0 * delta_x, y0 * delta_y)
    81      val c = start + Complex(x0 * delta_x, y0 * delta_y)
    82 
    82 
    83      def iters(z: Complex, it: Int) : Color = {
    83      def iters(z: Complex, it: Int) : Color = {
    84        if (it < level && z.abs < 2) iters(z * z + c, it + 1) else 
    84        if (it < level && z.abs < 2) iters(z * z + c, it + 1) else