The Hilbert curve is a Lindenmayer system invented by Hilbert (1891) whose limit is a plane-filling
function which fills a square. Traversing the polyhedron
vertices of an -dimensional
hypercube in Gray code
order produces a generator for the -dimensional Hilbert curve. The Hilbert curve can be simply
encoded with initial string "L", string
rewriting rules "L" -> "+RF-LFL-FR+", "R"
-> "-LF+RFR+FL-", and angle (Peitgen and Saupe 1988, p. 278). The th iteration of this Hilbert curve is implemented in the Wolfram Language as HilbertCurve[n].
A related curve is the Hilbert II curve, shown above (Peitgen and Saupe 1988, p. 284). It is also a Lindenmayer system and the curve
can be encoded with initial string "X", string
rewriting rules "X" -> "XFYFX+F+YFXFY-F-XFYFX", "Y"
-> "YFXFY-F-XFYFX+F+YFXFY", and angle . The th iteration of this curve is implemented in the Wolfram
Language as PeanoCurve[n].
A three-dimensional analog of the Hilbert curve can also be generated (Trott 2004, pp. 93-97).