Re:One-Hour Mandelbrot: Creating a Fractal on the Vintage Xe...
by HarryHirsch on Monday June 19, 2017 @03:35PM
(#14589743)
I remember their demos. Their secret sauce was in the algorithm, which somehow would spend little time on the featureless parts.
[ Parent
| on HN ]
Re:One-Hour Mandelbrot: Creating a Fractal on the Vintage Xe...
by bonzini on Monday June 19, 2017 @05:35PM
(#14590657)
One simple way is to start with a largish square, say 8x8 pixels, and evaluate the Mandelbrot set at the corners. If you get the same color, paint the square in a single color. Otherwise split it in 4 smaller blocks, evaluating the set at a 3x3 grid (which is not really correct, the four squares don't actually have any corner in common, but it's twice as fast). Again if any small square has the same color at the corners, fill the block with one color.
One improvement for accuracy is, if you find all four corners have the same color (no matter if it's an 8x8 or 4x4 block), pick another pixel and iterate that one; if the color doesn't match, skip the optimization. That is more expensive, up to 25%, but it can avoid mistakes in the chaotic areas of the set.
And of course, the large cardioid in the center has an analytic expression, and you can skip pixels inside that area, or a conservative approximation of the area.