HilVert  1v2
A demo of the Hilbert Curve in SVG.
Documentation for HilVert.

HilVert is a command line application that uses the SVG file format to draw Hilbert Curves (HCs) of 12th. order or below. To learn more about the HC either google or try -

https://en.wikipedia.org/wiki/Hilbert_curve

As noted there, efficient code for the production of HCs uses iteration. HilVert uses recursion purely because I find it easier to understand. Your mileage may vary. However, HCs do have a compact representation in SVG. Even HC(6) weighs only 9 kB uncompressed, or 1164 bytes as .svgz.

For any HC of order 2, 3, 4, .... n, the recursive algorithm may be easily understood as producing just three line segments directly. These are drawn in the same direction as a first order curve (n = 1), but are not contiguous. The remaining segments are drawn indirectly, via four recursive calls, as additional, complete HCs, each of order n - 1, and with appropriate rotation and reflection. The three segments of the parent HC are interleaved with the the sub-HCs and all seven parts are concatenated to draw the desired HC(n). See HilVert::draw() for details.

You can also use HilVert programmatically as a stand-alone class in your own code forming part of a larger C++ project. Why might your program need to generate HCs? Do say. Is a three hour long `SMIL` animation the answer to your insomnia?.

There is no make file. Try -

$ g++ -std=c++17 hilVert.cpp main.cpp -o hvt
$ ./hvt

See main() for usage.

RAC
October 2020