# Interactive Explorations of Hilbert Curves

One of the most famous and elegant constructions in mathematics is Hilbert’s space-filling curve. A nice description of Hilbert curves can be seen in Grant Sanderson’s (@3Blue1Brown) video “Hilbert’s Curves: Is Infinite Math Useful?” These curves have an impressive number of applications such as tilings, paper-folding, number systems, and art just to name a few. They can even be used to find locations on a game map such as in “Zelda: Breath of the Wild” as showcased in blog post, in spatial indexing for data applications that rely on locations (e.g. Zenly as described by Alex Sitton), and to visualize the similarities between a human’s and a chimp’s genome (as described by Martin Krzywinski).

is a unique app authored and illustrated by Doug McKenna in the form of a book that shows, explains, and lets you explore and play with, you guessed it, Hilbert curves. It is designed for high-school or college students, math professionals, and any math-curious person interested in two-dimensional design patterns and space-filling curves and/or fractals. The app presents you with over 130 illustrations in the form of a 160-page electronic document entitled “Outside-In and Inside-Gone”.

The idea of an interactive and highly visual book is super exciting to me. So, I decided to chat with the author to talk about his experiences and inspirations in the realm of interactive visualizations. McKenna’s made his first discoveries of space-filling curves constructions in 1978 and worked as Benoit Mandelbrot’s two full-time research programmer/illustrators, working on pictures for his influential treatise “The Fractal Geometry of Nature” in 1980. In the decades since, he has built both research and commercial software, and has explored various visual mathematical ideas related to recursive geometries, tilings, and fractals.

VRQ: In a few sentences, how would you describe yourself?

Doug McKenna: “I have always been interested in visual math, algorithms, software, user interfaces, computer languages, simplicity, self-similarity, fractals, music, creativity, discovery, and generally How Things Work or How Can They Work Be. I find it super-satisfying to discover or construct simple, never-before-seen mathematical patterns, such as the new tendril-based, half-domino curves I present in this eBook/app. So I think of myself as a software developer and mathemæsthetic explorer who relies upon my computer programming skills to find and/or illustrate and/or play with interesting, infinitely detailed, geometric forms uniquely suited to being drawn only with automated tools.”

The book’s mathematical content was inspired by his collaboration with Dr. Erez Lieberman’s group who had previously used space-filling curves in 3 dimensions to model DNA and was interested in space-filling curves with fuzzy, fractal borders as a better model. As a consultant for the group, he used his previous experience of tuning and/or maximizing the fractal dimension of a space-filling curve’s border. The group’s eventualstudied the distribution and mechanism ofin DNA, and only his Meta-Hilbert construction (called the “Inside-Out Curve” in the paper) was included. His motivation for this book/app stems from multiple reasons, one of them being sharing his beautiful results with a wider audience.

VRQ: What inspired you to write this book? Why  did you choose this particular format?

Doug McKenna: “When one has performed a comprehensive study of the ways one can generalize a highly visual (and famous) mathematical idea, you want others to see it and learn from it. I wanted to publish an account of some new, very cool, and both mathematically and aesthetically beautiful results that I have recently devised/discovered for a wider mathematical audience than just academic journal readers. After my collaboration with the DNA project,  I was left with my notes having over 100 highly detailed illustrations (hand-programmed in PostScript) that documented my findings and journey to the constructions of maximally “fuzzy” space-filling curves in the plane. Space-filling curves created interesting technical problems under the usual forms of publishing.  I set out to create a custom electronic book with dynamic content and excellent mathematical typesetting that I had been imagining for a while.  And I expect and hope it can be made useful to other authors as well as myself. Eventually, I hope to port this publishing system to other platforms.”

VRQ: What is personally your favorite aspect of the book?

Doug McKenna: “Ouch!  This is a little like asking which of one’s children one likes the best!  Some highlights that I’m proud of are getting to discover, report, and give animated life to a visually rich world of half-domino space-filling curves, whose boundaries are self-similar, self-negative, infinitely detailed, and sometimes beautiful and eye-catching forms that live between the linear and the fractal worlds.

Fig. 1: Examples of the author’s favorite pairs of order-12 half-domino curves at stage2. a) Navajo rug pattern. b) Anasazi pottery pattern. c) Ancient greek pattern.

Also, some of the self-negative half-domino motifs  are reminiscent of indigenous craft designs like you might find in a Navajo rug or Anasazi pottery  or an ancient Greek vase (see Fig.1).  The human eye has been fascinated by self-negative forms for millennia. Finally, the reader/user of my eBook/app can see and explore one of these mandala patterns (see Fig.2) as a second approximation to its space-filling curve.  That approximate fractal mandala is a filled polygon built from $92^4$ (over 71 million) tiny, piecewise-connected, self-avoiding line segments, all accurately drawn in front of the reader’s eyes, all of it magnifiable to view any part.  It might be the most detailed geometric illustration ever to be made in any math book. Rather than asking, is it art or is it math, the answer is really both. They are beautiful either way.”

Fig. 2. Illustration of the mandala-like patterns as a second approximation to its space-filling curve.

As Jeffrey Ventrella mentions in his blog post,

“McKenna’s newer curves extend the basic concept of the Hilbert curve, making it just one instance of a larger class of curves. Even within the square, there is an infinite variety of plane-filling sweeps. But some of these curves bust out of their square homes and push the fractal dimension of their boundaries to the point of them becoming their own space-filling curves. That’s meta! ” – Jeffrey Ventrella

This book/app showcases the intersection of math, art, and technology in a very innovative way. The number and quality of the illustrations are astonishing. What I’ve enjoyed most about the book/app is that in the interactive figures, you can do an animated infinite zoom into its construction, or explore the mapping at different levels of precision. If you are a space-filling curve enthusiast this book/app is a great way to explore their beauty and the math behind them.

Do you have suggestions of topics you would like us to consider covering in upcoming posts? Reach out to us in the comments below or let us know on Twitter (@MissVRiveraQ)