Mandelbrot Set Plotter

The Mandelbrot Set is a fractal set in the complex plain. A point c is in the set if the equation z = z2 + c does not diverge when iterated. Since the Mandelbrot Set is a fractal, it has an infinite perimeter and no matter how far it is zoomed, always has interesting features.

This program calculates and displays the Mandelbrot set using C++ and the SDL graphics library. White points are in the set, and black points are not in the set.

The Project

Challenges

Because the governing equation is iterative, any pixel’s color may require hundreds of calculations to determine. The first version of the Mandelbrot Plotter took a little more than 3 minutes to plot the function entirely, with that time increasing the further zoomed the function gets. Using a few optimizations in the code, Bryson was able to decrease this base time to only about 15 seconds.

The Mandelbrot Set on its own is pretty interesting, but the images produced are more interesting and aesthetic when the points outside of the set are colored with a gradient based on how many iterations they take to reach the escape radius, or the point at which the equation is sure to diverge.

Shown here is a rendering of the Mandelbrot set with points outside the set colored according to their escape time. The result is an incredibly pleasing aesthetic.

Another challenge is zooming in. Originally, when a section which does not conform the the window shape is chosen to zoom in, it was deformed obviously as shown. Bryson determined scaling equations which maintained a zoomed section’s width-height ratio regardless of the shape of the zoomed section.

The white box in this image shows a section which will be zoomed in on. The results of the zoom before and after the scaling equations were applied.
Before
Mandelbrot3
After
This image shows the quasi-self-similarity of the Mandelbrot set. The set has small copies of itself within itself, however these copies become more complex around their boundaries the more zoomed the image becomes.