progs/mandelbrot.scala
changeset 189 ff815ca0bbcf
parent 187 4d300409f2fe
child 191 f78b18c4c886
equal deleted inserted replaced
188:937c995b047a 189:ff815ca0bbcf
    96   // deltas for each grid step 
    96   // deltas for each grid step 
    97   val d_x = (end.re - start.re) / W
    97   val d_x = (end.re - start.re) / W
    98   val d_y = (end.im - start.im) / H
    98   val d_y = (end.im - start.im) / H
    99    
    99    
   100   for (y <- (0 until H)) {
   100   for (y <- (0 until H)) {
   101     for (x <- (0 until W)) {
   101     for (x <- (0 until W))) {
   102     
   102     
   103      val c = start + 
   103      val c = start + 
   104       (x * d_x + y * d_y * i)
   104       (x * d_x + y * d_y * i)
   105      val iters = iterations(c, max) 
   105      val iters = iterations(c, max) 
   106      val col = 
   106      val col = 
   146 
   146 
   147 // some more computations with example 3
   147 // some more computations with example 3
   148 
   148 
   149 val delta = (exc2 - exc1) * 0.0333
   149 val delta = (exc2 - exc1) * 0.0333
   150 
   150 
   151 
   151 /*
   152 time_needed(
   152 time_needed(
   153   for (n <- (0 to 12)) 
   153   for (n <- (0 to 12)) 
   154      mandelbrot(exc1 + delta * n, 
   154      mandelbrot(exc1 + delta * n, 
   155                 exc2 - delta * n, 100)) 
   155                 exc2 - delta * n, 100)) 
   156 
   156 */
   157 /*
   157 /*
   158 time_needed(
   158 time_needed(
   159   for (n <- (0 to 12)) 
   159   for (n <- (0 to 12)) 
   160      mandelbrot(exc1 + delta * n, 
   160      mandelbrot(exc1 + delta * n, 
   161                 exc2 - delta * n, 1000))
   161                 exc2 - delta * n, 1000))
   162 */
   162 */
   163 
   163 
   164 
   164 
       
   165 // Larry's example
       
   166 // example 2
       
   167 val exl1 = -0.74364990 + 0.13188204 * i
       
   168 val exl2 = -0.74291189 + 0.13262005 * i
       
   169 
       
   170 time_needed(mandelbrot(exl1, exl2, 1000))
       
   171