Professional Documents
Culture Documents
coded color
showing
progressi
on
Applications and mapping
algorithms
Both the true Hilbert curve and its
discrete approximations are useful
because they give a mapping between
1D and 2D space that preserves locality
fairly well.[4] This means that two data
points which are close to each other in
one-dimensional space are also close to
each other after folding. The converse
cannot always be true.
//convert (x,y) to d
int xy2d (int n, int x,
int y) {
int rx, ry, s, d=0;
for (s=n/2; s>0; s/=2)
{
rx = (x & s) > 0;
ry = (y & s) > 0;
d += s * s * ((3 *
rx) ^ ry);
rot(n, &x, &y, rx,
ry);
}
return d;
}
//convert d to (x,y)
void d2xy(int n, int d,
int *x, int *y) {
int rx, ry, s, t=d;
*x = *y = 0;
for (s=1; s<n; s*=2) {
rx = 1 & (t/2);
ry = 1 & (t ^ rx);
rot(s, x, y, rx,
ry);
*x += s * rx;
*y += s * ry;
t /= 4;
}
}
//rotate/flip a quadrant
appropriately
void rot(int n, int *x,
int *y, int rx, int ry) {
if (ry == 0) {
if (rx == 1) {
*x = n-1 - *x;
*y = n-1 - *y;
}
//Swap x and y
int t = *x;
*x = *y;
*y = t;
}
}
Representation as
Lindenmayer system
The Hilbert Curve can be expressed by a
rewrite system (L-system).
0:52
A → +BF−AFA−FB+
B → −AF+BFB+FA−
Other implementations
Graphics Gems II[15] discusses Hilbert
curve coherency, and provides
implementation.
The Hilbert Curve is commonly used
among rendering images or videos.
Common programs such as Blender and
Cinema 4D use the Hilbert Curve to trace
the objects, and render the scene.
See also
Hilbert curve Wikimedia
Commons
scheduling
has media
Hilbert R-tree related to
Hilbert
Locality of reference curve.
Locality-sensitive hashing
Moore curve
Murray polygon
Sierpiński curve
List of fractals by Hausdorff dimension
Notes
1. D. Hilbert: Über die stetige Abbildung
einer Linie auf ein Flächenstück. (htt
p://www.digizeitschriften.de/dms/im
g/?PPN=PPN235181684_0038&DMD
ID=dmdlog40) Mathematische
Annalen 38 (1891), 459–460.
Further reading
Warren Jr., Henry S. (2013). Hacker's
Delight (2 ed.). Addison Wesley –
Pearson Education, Inc. ISBN 978-0-
321-84268-8.
McKenna, Douglas M. (2019). Hilbert
Curves: Outside-In and Inside-Gone (htt
p://www.mathemaesthetics.com/Hilbe
rtCurves.html) . Mathemaesthetics,
Inc. ISBN 978-1-7332188-0-1.
External links
Dynamic Hilbert curve with JSXGraph
(http://jsxgraph.uni-bayreuth.de/wiki/in
dex.php/Hilbert_curve)
Three.js WebGL 3D Hilbert curve demo
(http://threejs.org/examples/webgl_lin
es_colors.html)
XKCD cartoon using the locality
properties of the Hilbert curve to
create a "map of the internet" (http://xk
cd.com/195/)
Gcode generator for Hilbert curve (htt
p://www.andyshelley.co.uk/axishilbert/
index.php)
Iterative algorithm for drawing Hilbert
curve in JavaScript (https://marcin-ch
wedczuk.github.io/iterative-algorithm-f
or-drawing-hilbert-curve)
Algorithm 781: generating Hilbert's
space-filling curve by recursion (ACM
Digital Library) (https://dl.acm.org/doi/
10.1145/290200.290219)
Retrieved from
"https://en.wikipedia.org/w/index.php?
title=Hilbert_curve&oldid=1171670620"