The Mandelbrot Set is the set of all complex numbers such that
Basically, you start with a number , and starting with 0, square what you have and add repeatedly. If it stays close to the origin forever, is in the Mandelbrot Set. If it goes off to infinity (i.e., the distance from the origin gets arbitratily large), it's not in the set.
It's pretty easy to prove that any point more than 2 units away from the origin is not in the set, so if a point is still close enough after a few hundred iterations it's assumed to be in the set.
Later, when I mention a point "grows large" or "passes the point of no return", this is what I'm referring to: it's further than 2 units from the origin, and therefore we can stop checking it.The pixels whose cooresponding points are in the set are colored black. The color outside the set indicates how quickly that point starts to go off to infinity. Red and orange points grow large very quickly, and points near the boundry take hundreds of iterations.
I wrote the main program in C++, which exports a set of images, and then I wrote a bash script to compile it into a movie.
The first thing I did was to make a .bmp
image class, that
you can initalize with the dimensions, assign color values to each
individial pixel, and save it as a valid .bmp
image.
Next I wrote code to calculate whether or not a point is in the Mandelbrot Set. Then the rest of development was adding miscellaneous features like exporting multiple images to make a move, antialiasing, adjusting the zoom location to stay interesting. (those two still need some work) and multithreading support.
Generating this movie took around 4-5 hours.