Hacker News new | ask | show | jobs
by Maelcum 1372 days ago
There's a lesser known optimization trick I haven't seen in a while, which is especially effective when a large portion of the Mandelbrot set is visible: there are no holes in it, i.e. it's a compact set.

From an optimization point of view, it means that if a rectangular area's edges contains only values reached the iteration limit without growing larger than the escape value, the entire area belongs to the Mandelbrot set.

3 comments

The term you're looking for is "simply-connected set."

Simply-connected sets and compact sets are both sometimes informally described as "sets with no holes," but the definition of "holes" is different in both cases.

A compact set contains all of its limiting points (i.e. limits of convergent sequences of points within the set). Therefore it may not have any point-shaped holes. But it may still have a hole shaped like, e.g. an open disc.

To rule out such large holes, you want a simply-connected set, which is a connected set in which any closed path can be continuously shrunk to a point.

Not sure I'd say "no holes", but yes there are no islands, the entire mandelbrot set is connected. However that does not mean that parts of the display that's interesting doesn't cover part of the set, that's not visible in any individual pixel.

For those that want to fly around in the mandelbrot set, even a 2015 desktop can easily keep up, I suggest Xaos which I believe includes all the common mandelbrot optimizations at https://xaos-project.github.io/

There's even a web version at the above URL. It's in most linux repos I tried apt or yum. I couldn't find any docs for what optimizations Xaos uses, but it seems plenty fast for real time zooming, even on old hardware.

How do you best use this in practice? Quadtree-split the rendering area while checking edges?
I used a recursive way: split the image area, calculate the edges for all, checking edges, and then either fill it, or call the function with the sub-areas's region.

Or you can set up a grid and calculate the chunks.

When I was learning a new language in my collage days, my helloworld used to be implementing a Mandelbrot/Julia set on the given language. A few months ago I decided to look into Rust and started to work on my helloworld in Rust, using RayLib :-)

Here's an example output from my version: https://ibb.co/p4bFF7S

> I used a recursive way…

There was a Mandelbrot/Julia set renderer on the Atari ST that did the exact same thing. Instead of waiting rather long for a pixel-perfect image you could see output immediately and it got more refined with each recursive stage. On a box with a 68000 CPU @ ~8 MHz and no FPU it made for a really nice effect.