Fractal Lab

Space-filling

Hilbert curve

David Hilbert introduced this space-filling curve in 1891, a year after Peano’s original construction. The Hilbert curve has a cleaner recursive geometry and excellent locality preservation, making it the canonical example in modern computer science.

Hilbert curve at iteration 5, drawn by an L-system turtle. The limit fills the unit square.

At a glance

DesignerDavid Hilbert, 1891
Hausdorff dimension2 (space-filling)
Topological dimension1 at each finite step
L-systemAxiom A; A → +BF−AFA−FB+, B → −AF+BFB+FA−
Angle90°

Construction

Take a U-shape connecting four cells of a 2 × 2 grid. To refine, replace each cell with a 2 × 2 sub-grid and connect them with rotated U-shapes so the result is still a single Jordan curve. Iterate. The limit maps [0, 1] continuously onto [0, 1] × [0, 1].

Locality preservation

For two points in [0, 1] at distance t, their Hilbert-curve images are at most C √t apart in the plane. This is the best possible scaling for any space-filling curve and gives Hilbert ordering its practical edge over row-major traversal: nearby parameters map to nearby points.

Applications

References

Try it

Run an interactive playground at /tools/lsystems.

Test Your Knowledge

Quick MCQ check on this topic (6 questions)

Start Quiz →

AI Summary

Summarize this page in your favorite LLM