cortesi

Spacecurve

2025-01-28

In 2024, I noticed that I'd let my blog languish. Since the issue was urgent, I made a firm new year's resolution to address the situation in 2025. Which is why, today, in January 2026, I'm writing this post.

I've just released spacecurve, a new just-for-fun space-filling curve project. It's is the latest symptom of a long preoccupation with these beautiuful mathematical objects. Over the years, this preoccupation yielded blog posts like malware visualisations, a portrait of the Hilbert curve and tools like binvis.io. I have a long list of related ideas I never got to but have to wanted to explore, and the first step is naturally to... rewrite it in Rust. This is just a starting point, a base for exploring ideas I have about visualisation, color spaces, and the qualities of the curves themselves.

As part of the rewrite we now have fast base implementations of the curves themselves in the spacecurve library, and a visual exploration tool for 2D and 3D curves in the scurve command-line tool. Thanks to egui, the visualiser runs both natively and in the browser.

Click through on the images below to see the web version.

Installation

spacecurve is a Rust library for generating a variety of space-filling curves, including Hilbert, Peano, Sierpinski, Moore, and Z-order curves.

cargo add spacecurve

scurve is a command-line tool for generating and visualizing space-filling curves.

cargo install scurve

It includes an egui interface for exploring the curves in 2D and 3D, which you can run like this:

scurve gui

spacecurve web

Because egui supports webassembly, I've also deployed the egui app to the web. Access it by clicking below, or on any of the images above.

Web Viewer