Posted By

hasantayyar on 07/06/09


Tagged

fractal pseudocode madelbrot


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hasantayyar


Mandelbrot set (pseudocode)


 / Published in: Other
 

URL: http://en.wikipedia.org/wiki/Mandelbrot_set

  1. For each pixel on the screen do:
  2. {
  3. x0 = x co-ordinate of pixel
  4. y0 = y co-ordinate of pixel
  5.  
  6. x = 0
  7. y = 0
  8.  
  9. iteration = 0
  10. max_iteration = 1000
  11.  
  12. while ( x*x y*y <= (2*2) AND iteration < max_iteration )
  13. {
  14. xtemp = x*x - y*y x0
  15. y = 2*x*y y0
  16.  
  17. x = xtemp
  18.  
  19. iteration = iteration 1
  20. }
  21.  
  22. if ( iteration == max_iteration )
  23. then
  24. color = black
  25. else
  26. color = iteration
  27.  
  28. plot(x0,y0,color)
  29. }

Report this snippet  

You need to login to post a comment.