Cairo-fortran offers Fortran bindings for the Cairo vector graphics library. It was originally created by @brocolis as a lightweight gtk-fortran derived project. I have decided to adopt the orphan and updated it with Cairo 1.17.8. I have also modified the three examples to respectively generate a PNG, a SVG and a PDF files. And added a purple logo…

The hat_polykite toy project generates a SVG file including a batch of hat polykites, using the cairo-fortran bindings as a fpm dependency. The ultimate goal will be to use laser cutting to create an aperiodic puzzle.

On March 20, 2023, David Smith and mathematicians Joseph Samuel Myers, Craig S. Kaplan and Chaim Goodman-Strauss posted a preprint on ArXiv describing a monotile with 13 sides that, used with its reflected version, admits aperiodic tilings of the plane: the “hat” polykite.

I have created two more small fpm projects using cairo-fortran to explore two good old recursive algorithms and see what SVG vector drawing can bring.

The first one draws a von Koch snowflake, using the classical recursive algorithm: https://github.com/vmagnin/von_koch_snowflake

The second one draws a Penrose tiling (aperiodic tiling of the plane with two tiles): https://github.com/vmagnin/penrose_tiling

The algorithm is interesting as it uses two interlaced recursive procedures: A calls A & A & B, and B calls A & B.

Drawing a fractal in a SVG file is interesting as you can zoom at several scales. But the drawback is that SVG is rather verbose (it is an XML format): for example a line segment is coded with ~200 bytes (and whatever its length!). In the von Koch case, the SVG file is growing like 3 \times 4^n where n is the number of recursions. And with Penrose tiling, it is growing like the Fibonacci sequence. **Be careful with the number of recursions,** your SVG viewer might not appreciate a 100 Mio SVG file!