rm-hull / hilbert-curve.cljs
Last updated

A Hilbert space-filling curve is a fractal first discovered by German mathematician David Hilbert in 1891. It is commonly used in mapping applications because they give a mapping between 1D and 2D space that fairly well preserves locality. Michelle Brush gave an excellent talk at Strangeloop 2014 entitled Practical Fractals in Space (https://www.youtube.com/watch?v=uEBzS9tpmTo) which in part inspired this gist, although I had previously used an L-system to describe the Hilbert Curve with the following production rules: $A → − B F + A F A + F B −$ and $B → + A F − B F B − F A +$ (see: http://lindenmayer-systems.destructuring-bind.org/explorer/5 for an SVG representation). Mouse over the canvas below and the colour changes indicating which areas are classed as local - red is hot/near to the cursor, blue is cold/far.

Fork me on GitHub!