Generate the Hilbert curve?

Hi all,

I was wondering how to generate the Hilbert Curve for a square three-dimensional lattice L x L x L, where L is the linear size.
I would like to have sizes with L even (let’s say L = 2,4,6,8,10). I tried the command

HilbertCurve[n,3]

and it works well for n=1,2, by representing correctly the Hilbert Curve for the 3D lattice with L = 2, 4 respectively. However, if I put n=3, I got the Hilbert Curve for the 8x8x8 lattice. I don’t know how it works for the 6x6x6 lattice.

Any advice?

Thanks a lot,
G.

Hello Giuseppe,

Hilbert Curves by definition always have an edge length of 2^n. Thus, it would be impossible to have a 6 by 6 by 6 cube. Hope this helps!

From,

Srinath

Generate the Hilbert curve?

Hello Srinath,

Thank you very much for your answer. Do you know if there exist generalizations of the Hilbert Curve (in 3-dimensions) for avoiding this constraint?

Thanks, Giuseppe

The only thing I can think of is generating a Hilbert curve cube with side length 2^n and changing the dimensions of your Graphics3D object. Thus, it could fill a 6 by 6 by 6 space but it would still look like a n-ordered pseudo Hilbert 3D curve.