Rather astonishingly, curves exist that fill the plane without leaving any gaps.
One such curve is the Hilbert curve.
If that isn't enough, it can also be proven that these curves are self-intersecting.
The following represents the *n*th approximation of a Hilbert curve for a square.
With higher values of *n*, more of the square is filled.

Jolly good, but does this have any real-world applications? Why, yes! The
Hilbert curve is a mapping between 1D and 2D space that preserves locality
quite well. This means that points near each other in terms of distance
along the curve will also be near each other on the 2D plane. For example,
colours of the rainbow can be plotted such that similar colours are always
near each other. Click *show colours* to see a demonstration below.

:

- A. Bogomolny, Plane Filling Curves from Interactive Mathematics Miscellany and Puzzles.
- The rainbow colouring example is based on Mike Bostock's Hilbert Tiles.
- This demonstration was written using D3.js and requires a browser with SVG support to view it.

© Jason Davies 2012.