Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Generalized Hilbert Curves (jakubcerveny.github.io)
2 points by abetusk on Feb 12, 2024 | hide | past | favorite | 4 comments


For those interested, I have a C implementation of Jakub Červený's Gilbert2D, with Python bindings, at https://hg.sr.ht/~dalke/rectfillcurve, along with a few other rectangle-filling curves.


Very awesome!

Note that there are now some reference implementations in C and JS in Červený's now [0], which also include 3D Gilbert curves in addition to the 2D. It looks like you only provide 2D implementations?

Also, do you have any sense of whether its possible to make some "Hilbert-like" space filling curve in an arbitrary rectangular or cuboid region without any "Z-kinks"?

[0] https://github.com/jakubcerveny/gilbert/tree/master/ports


Yes, I only needed 2D so that's all I did.

I looked at the C code in [0]. It looks like it goes to/from the x,y,z coordinates each time, which certainly works, but is not all that fast, and I was interested in higher performance.

If you haven't read it, take a look at Hacker's Delight, which goes into space-filling curves.

I believe the Perdacher et al. code handles 2D generalized Hilbert curves without a kink, but it doesn't look as nice. That's the code I link to at https://gitlab.cs.univie.ac.at/martinp16cs/mortonlu/-/blob/m... but in the HILLOOP code. You'll also need the .c file next to it.

It's not easy to extract. I've mostly ported it to standalone C. Try http://dalkescientific.com/hilbert8.c . I last touched it last summer and don't recall the status.

What I remember was it wasn't as evenly distributed as the gilbert code, and for my code I wanted to prefer nearness over strict neighborhoods.


Awesome, thank you. I managed to find a paper by Bohm, Perdacher and Plant [0] which looks to describe what's in that repo and also looks to answer my basic question.

[0] ttps://eprints.cs.univie.ac.at/5726/1/loops.pdf




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: