2020-10-18 Fractals

@neauoire’s dotgrid, and the C variant, seems to have inspired @l3kn to write a similar small C program called quad using the SDL library to create fractals. You can read more about the general idea on Leon’s blog post Quadtree Grammars. Anyway, I decided to download the program and give it a whirl!

@neauoire

dotgrid

C variant

@l3kn

quad

Quadtree Grammars

The first problem was that my laptop monitor is too small. I therefore had to halve the constants for SIZE, MENU_SIZE and MENU_WIDTH. (Note that this is now much improved: you can provide the size on the command line as an argument!)

The next problem was the user interface with no explanation. (Note that this is now also much improved!) You basically have to stare at the definition in the menu on the left and reproduce it in order to get it: start with the first square; into the four quadrants you either drag some patterns from above, or you drag one of the tiny squares from elsewhere in the menu, and do that recursively – in order to generate the sub-quadrants... recursively. It is a fractal, after all. Essentially, you have eight “rules” to generate the four quadrants and you start with the first one.

Here’s a little progression of increasingly complex fractals:

Image 1

Image 2

Image 3

As I recently mentioned Postscript, also note the Quadtree Grammars using Postscript blog post. So cool!

Quadtree Grammars using Postscript

​#Programming

Comments

(Please contact me if you want to remove your comment.)

Here’s a simple variant coded up as a web app: Sitelen Musi.

Sitelen Musi

– Alex Schroeder 2020-10-29 23:42 UTC

---

Things I’d like to add: png export at higher resolutions; recomputing as you type; export url.

– Alex Schroeder 2020-10-30 10:16 UTC