What's wrong with my Hilbert curve?

888 Views Asked by At

I have a Javascript library to plot points on a Hilbert curve, but something's wrong with the point determination.

I've written a test page that plots 256 points on a path. While it should look like this, instead it's coming out like this:

There appears to be some discontinuity.

You can inspect the source behind the page at http://jsbin.com/oheloc/1/edit (for kicks, unlock the recursion depth and raise it higher than the points exponent to see the whole path get WAY more deformed).

What's wrong with this picture? I think it's something to do with (at least) one of the quadrant transformations being incorrect, but I can't figure out what it should be.

0

There are 0 best solutions below