The Hilbert Curve

//To draw the Hilbert Curve of order 1 to 6

Right-click here to download this page and the Java Class File.

The Java applet above draws the Hilbert curve of order n = 1 to 8.
Each order of the Hilbert curve consists of 4 copies of the curve of the previous order replicated on a smaller scale.
orderlength of Hilbert Curve
13/21.5
2(4 x 3 + 3)/4 = 15/43.75
3(4 (4 x 3 + 3) + 3)/8 = 63/87.875
4(4 (4 (4 x 3 + 3) + 3) + 3)/16 = 255/1615.9375
5(4 (4 (4 (4 x 3 + 3) + 3) + 3) + 3)/32 = 1023/3231.96875
64095/6463.984
716383/128127.992
865535/256255.996
:::
n(4n - 1)/2n:

The length of the Hilbert curve of order n approaches infinity as n approaches infinity.
As n approaches infinity, we obtain the Hilbert space-filling curve, a continuous curve passing through every point of the enclosing square.