@neauoire And useful for so many things! :)
@jack What could I use it for? The only reason I ever had to use it in kind of practical application was for raycasting, is there other practical purposes for it?
@neauoire They can used wherever a quadtree can be used, for one example. This makes them good for geospatial applications (they’re used inside Google maps, or at least were). In image processing they’re useful for dithering, compression, and I’ve gotten good results training image models on an HC representation rather than a grid. In short, anywhere that maintaining coherence between neighbouring pixels is beneficial.
@neauoire @jack best use I've ever had was rearranging the pixels of Jimbo Wales' face: https://joshuahhh.com/projects/jimbo2/
@jack Brings back faint memories of trying to use it for image compression—followed by a calculating differences between pixels that are adjacent on the curve—to benefit from locality. Didn’t get any mind blowing results, but it was good fun.
@jack May I ask what you're using to draw it? I've been looking for a simple drawing lib to play around with for Clojure for a while
@derpapa69 Clojure2D
@jack thanks mate! Can't believe I've never come across that lol
@derpapa69 I look forward to seeing what you draw with it
@jack I haven't forgotten this
Where's this algorithm from? Closest I could find to it was https://dl.acm.org/doi/10.1145/290200.290219
@jack I need to think about why this algorithm is the same as the L-system based version in Wikipedia.
(Who needs eso-langs, computing is plenty esoteric to begin with.)
@akkartik @jack Two alternative versions that may aid your understanding... #1 chooses what I think are better variable names, since the xs & ys are mixed up in the original version. #2 uses vector operations. It would look a lot better with overloaded operators... but it's helpful anyway to see that the program is really operating on the vector level.
@akkartik @jack Cool! I can also use some human words and say: (x, y) is the top-left of the curve's square, (x1, y1) is a vector from the top-left to the bottom-left, and (x2, y2) is a vector from the top-left to the top-right. So you're taking a big square and sub-dividing it into smaller squares, in a particular order & with particular orientations.
@qualmist @akkartik @jack
Vector math with overloaded operators? Obligatory #CuttleXYZ code component port.
https://cuttle.xyz/@forresto/Hilbert-Curve-onUfgB7vfXq2
@qualmist @akkartik This implementation was hacked together while making this logo. The complete source for which is here:
https://github.com/nextjournal/clerk-demo/blob/main/notebooks/logo.clj
They are absolutely vector operations, but I was trying to make things brief without adding a dep on a vector lib. I couldn’t avoid vector multiply though.