Hilbert Curve: Implementing for N-Dimensions

839 Views Asked by At

The Hilbert curve Wikipedia article includes some C code that shows how to map coordinates to the curve but it only works for two-dimensions. I'm having trouble finding any examples that work for N-dimensions (curve examples are plentiful but not the mapping function). Does someone have any code or the description of an algorithm for doing so that they can share?

I'm currently blocked on the rotation function. I can guess, but since I can't find any sort of paper or other description using language that I can understand I can't be confident of what I end-up with.

Note that I'd love to see something that's as simple as the Wikipedia version. It seems like the mutation that I'm going for should also be very simple. I found the SO post at Mapping N-dimensional value to a point on Hilbert curve but it's so complex and such a foreign design to the one I started with (even though both are non-recursive so it seems like they should be more similar) that it looks totally opaque to me.

0

There are 0 best solutions below