Saturday, May 26, 2012

Mandelbrot fractal viewer

One of the first things I did when I got my computer was to render the Mandelbrot Set fractal. This was centuries ago, and I did it in C using DOS Borland-C++ and its fabulous (for me at that time) graphics library. I played a lot plotting lines and points on the screen those days. I don't know why exactly but this program has been always in my heart, maybe due to the colorful images it gave me:


So I was feeling that it was time to revive this code, and make it usable again, this time in Flash for the web. It runs surprisingly fast, and does a bit more than my initial version:


Click the above area and use the arrows to move the zoom area (a white rectangle would appear), press ENTER or SPACE to redraw the zoom area. BACKSPACE returns to the previous view. You can press F4 for some of my favorite coloring palettes or F5 for more random ones. The number of iterations steps to compute a fractal point is 256, you can increase this with PAGEUP an decrease it with PAGEDOWN (this could be useful if you see many black spots at higher zoom factors or if your computer is taking a lot of time to draw the fractal, more steps would mean higher precision but also more time to draw the fractal on screen). HOME returns to the default initial area.

In trouble check the source code here so you can look for the additional options this little program has. And for the sake of archeology, here is some code of mine of the old days.

No comments:

Post a Comment