HilbertCurve
✖
HilbertCurve
Details and Options

- HilbertCurve is also known as Hilbert space-filling curve.
- HilbertCurve[n] returns a Line primitive corresponding to a path that starts at {0,0}, then joins all integer points in the 2n-1 by 2n-1 square, and ends at {2n-1,0}. »
- HilbertCurve takes a DataRange option that can be used to specify the range the coordinates should be assumed to occupy.

Examples
open allclose allBasic Examples (2)Summary of the most common use cases

https://wolfram.com/xid/0cpt0d0p0wqs3y-e0oufp

Lengths of the approximations to the Hilbert curve:

https://wolfram.com/xid/0cpt0d0p0wqs3y-btyad4


https://wolfram.com/xid/0cpt0d0p0wqs3y-b7k7lx

Visualize the Hilbert curve in 2D with splines:

https://wolfram.com/xid/0cpt0d0p0wqs3y-pd44os

Scope (8)Survey of the scope of standard use cases
Curve Specification (4)
Curve Styling (4)
Hilbert curves with different thicknesses:

https://wolfram.com/xid/0cpt0d0p0wqs3y-bq85gl


https://wolfram.com/xid/0cpt0d0p0wqs3y-ifj0kj


https://wolfram.com/xid/0cpt0d0p0wqs3y-fh1qpo

Thickness in printer's points:

https://wolfram.com/xid/0cpt0d0p0wqs3y-kyrge4


https://wolfram.com/xid/0cpt0d0p0wqs3y-sjd36


https://wolfram.com/xid/0cpt0d0p0wqs3y-bq2qbc


https://wolfram.com/xid/0cpt0d0p0wqs3y-oxjl5

Generalizations & Extensions (2)Generalized and extended use cases
Options (1)Common values & functionality for each option
DataRange (1)
DataRange allows you to specify the range of mesh coordinates to generate:

https://wolfram.com/xid/0cpt0d0p0wqs3y-ewpnb1


https://wolfram.com/xid/0cpt0d0p0wqs3y-fl0z4t

Applications (4)Sample problems that can be solved with this function
HilbertCurve is constructed recursively by transforming cups into four cups linked together by lines:

https://wolfram.com/xid/0cpt0d0p0wqs3y-13fyon

https://wolfram.com/xid/0cpt0d0p0wqs3y-2gys50


https://wolfram.com/xid/0cpt0d0p0wqs3y-v6b49h

https://wolfram.com/xid/0cpt0d0p0wqs3y-qi9fw9

Visualize the Hilbert curve in 2D:

https://wolfram.com/xid/0cpt0d0p0wqs3y-22pjxu


https://wolfram.com/xid/0cpt0d0p0wqs3y-3jablb


https://wolfram.com/xid/0cpt0d0p0wqs3y-qy8xih


https://wolfram.com/xid/0cpt0d0p0wqs3y-o08fvf

Build a polygon from the Hilbert curve:

https://wolfram.com/xid/0cpt0d0p0wqs3y-6z9a5

Apply a Hilbert curve texture to a surface:

https://wolfram.com/xid/0cpt0d0p0wqs3y-m00bp0

Properties & Relations (3)Properties of the function, and connections to other functions
HilbertCurve consists of lines:

https://wolfram.com/xid/0cpt0d0p0wqs3y-mnr925

Find the perimeter of the 2D Hilbert curve:

https://wolfram.com/xid/0cpt0d0p0wqs3y-ji00t5


https://wolfram.com/xid/0cpt0d0p0wqs3y-bac1jt


https://wolfram.com/xid/0cpt0d0p0wqs3y-ltfk9


https://wolfram.com/xid/0cpt0d0p0wqs3y-fmpnsn


https://wolfram.com/xid/0cpt0d0p0wqs3y-gz6a76


https://wolfram.com/xid/0cpt0d0p0wqs3y-san95

DataRangerange is equivalent to using RescalingTransform[{…},range]:

https://wolfram.com/xid/0cpt0d0p0wqs3y-37ymx

Use RescalingTransform:

https://wolfram.com/xid/0cpt0d0p0wqs3y-dydlva

https://wolfram.com/xid/0cpt0d0p0wqs3y-bu4y1v

Possible Issues (2)Common pitfalls and unexpected behavior
By default, the coordinates of the Hilbert curve are not in the unit square:

https://wolfram.com/xid/0cpt0d0p0wqs3y-dauf9b

Using DataRange to generate the Hilbert curve in the unit square:

https://wolfram.com/xid/0cpt0d0p0wqs3y-sco19

HilbertCurve can be too large to generate:

https://wolfram.com/xid/0cpt0d0p0wqs3y-frq6rm



Wolfram Research (2017), HilbertCurve, Wolfram Language function, https://reference.wolfram.com/language/ref/HilbertCurve.html.
Text
Wolfram Research (2017), HilbertCurve, Wolfram Language function, https://reference.wolfram.com/language/ref/HilbertCurve.html.
Wolfram Research (2017), HilbertCurve, Wolfram Language function, https://reference.wolfram.com/language/ref/HilbertCurve.html.
CMS
Wolfram Language. 2017. "HilbertCurve." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HilbertCurve.html.
Wolfram Language. 2017. "HilbertCurve." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HilbertCurve.html.
APA
Wolfram Language. (2017). HilbertCurve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HilbertCurve.html
Wolfram Language. (2017). HilbertCurve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HilbertCurve.html
BibTeX
@misc{reference.wolfram_2025_hilbertcurve, author="Wolfram Research", title="{HilbertCurve}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/HilbertCurve.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_hilbertcurve, organization={Wolfram Research}, title={HilbertCurve}, year={2017}, url={https://reference.wolfram.com/language/ref/HilbertCurve.html}, note=[Accessed: 25-March-2025
]}