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.

Quick quiz

Test yourself on hilbert-curve

6 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.The Hilbert curve is an example of a:

  2. Q2.Hausdorff dimension of the (limit) Hilbert curve is:

  3. Q3.What's the main practical use of Hilbert curves in computing?

  4. Q4.David Hilbert introduced the curve in:

  5. Q5.The Hilbert L-system has axiom A with rules A → +BF-AFA-FB+ and B → -AF+BFB+FA- with angle:

  6. Q6.Hilbert curve is closely related to which other space-filling curve?

0 of 6 answered