# Space-Filling Curve

## Peano Curve

math, so, is this curve 1 dimensional or 2 dimensional?

GraphicsGrid[(Partition[#1, 2] & )[Table[Graphics[{Red, Thick, PeanoCurve[n]}], {n, 4}]]]

clearly, it's just 1D, because it's just a line that meanders about. But, it fills a plane? So it's 2D?

In mathematical analysis, a space-filling curve is a curve whose range contains the entire 2-dimensional unit square (or more generally an n-dimensional hypercube).

Because Giuseppe Peano (1858–1932) was the first to discover one, space-filling curves in the 2-dimensional plane are sometimes called Peano curves, but that phrase also refers to the Peano curve, the specific example of a space-filling curve found by Peano.

[from Wikipedia, Space-filling curve]

the interesting thing about this is that it made us rethink what it means to be a line or plane. Or, the dimension of a thing.

In 1890, Peano discovered a densely self-intersecting curve, now called the Peano curve, that passes through every point of the unit square. His purpose was to construct a continuous mapping from the unit interval onto the unit square. Peano was motivated by Georg Cantor's earlier counterintuitive result that the infinite number of points in a unit interval is the same cardinality as the infinite number of points in any finite-dimensional manifold, such as the unit square. The problem Peano solved was whether such a mapping could be continuous; i.e., a curve that fills a space.

It was common to associate the vague notions of thinness and 1-dimensionality to curves; all normally encountered curves were piecewise differentiable (that is, have piecewise continuous derivatives), and such curves cannot fill up the entire unit square. Therefore, Peano's space-filling curve was found to be highly counterintuitive.

## Hilbert Curve

GraphicsGrid[(Partition[#1, 3] & )[Table[Graphics[{Red, Thick, HilbertCurve[n]}], {n, 6}]]]

A Hilbert curve (also known as a Hilbert space-filling curve) is a continuous fractal space-filling curve first described by the German mathematician David Hilbert in 1891, as a variant of the space-filling curves discovered by Giuseppe Peano in 1890.

Because it is space-filling, its Hausdorff dimension is 2 (precisely, its image is the unit square, whose dimension is 2 in any definition of dimension; its graph is a compact set homeomorphic to the closed unit interval, with Hausdorff dimension 2).

H[n] is the n th approximation to the limiting curve. The Euclidean length of H[n] is

`2^n - 1/(2^n)`

i.e., it grows exponentially with n, while at the same time always being bounded by a square with a finite area.

[Wikipedia Hilbert curve]

These don't fill space, but more beautiful.

GraphicsGrid@ ((Partition[#,2]) &) @ Table[Graphics[PeanoCurve[n]] /. Line -> BSplineCurve, {n, 4}]

GraphicsGrid[(Partition[#1, 3] & )[Table[Graphics[HilbertCurve[n]] /. Line -> BSplineCurve, {n, 6}]]]