Ancestors

Toot

Written by Jack Rusher on 2025-01-17 at 17:24

(hilbert-curve 0 0 800 0 0 800 5)

[#]clojure

=> View attached media

=> More informations about this toot | More toots from jack@berlin.social

Descendants

Written by Jack Rusher on 2025-01-17 at 17:26

And the source code to the function above…

=> View attached media

=> More informations about this toot | More toots from jack@berlin.social

Written by Josh Horowitz on 2025-01-18 at 02:40

@jack lovely! here's my JS port of your code...

=> View attached media

=> More informations about this toot | More toots from qualmist@assemblag.es

Written by Devine Lu Linvega on 2025-01-17 at 17:28

@jack that's such a lovely pattern 🖤

=> View attached media

=> More informations about this toot | More toots from neauoire@merveilles.town

Written by Jack Rusher on 2025-01-17 at 17:39

@neauoire And useful for so many things! :)

=> More informations about this toot | More toots from jack@berlin.social

Written by Devine Lu Linvega on 2025-01-17 at 17:40

@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?

=> More informations about this toot | More toots from neauoire@merveilles.town

Written by Jack Rusher on 2025-01-17 at 18:16

@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.

=> More informations about this toot | More toots from jack@berlin.social

Written by Josh Horowitz on 2025-01-18 at 02:41

@neauoire @jack best use I've ever had was rearranging the pixels of Jimbo Wales' face: https://joshuahhh.com/projects/jimbo2/

=> More informations about this toot | More toots from qualmist@assemblag.es

Written by Jack Rusher on 2025-01-18 at 08:48

@qualmist @neauoire 😆

=> More informations about this toot | More toots from jack@berlin.social

Written by Jan Stępień on 2025-01-17 at 17:41

@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.

=> More informations about this toot | More toots from jstepien@mastodon.social

Written by DerPapa69 on 2025-01-17 at 19:45

@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

=> More informations about this toot | More toots from derpapa69@mastodon.social

Written by Jack Rusher on 2025-01-17 at 20:08

@derpapa69 Clojure2D

=> More informations about this toot | More toots from jack@berlin.social

Written by DerPapa69 on 2025-01-17 at 21:23

@jack thanks mate! Can't believe I've never come across that lol

=> More informations about this toot | More toots from derpapa69@mastodon.social

Written by Jack Rusher on 2025-01-18 at 08:47

@derpapa69 I look forward to seeing what you draw with it 😊

=> More informations about this toot | More toots from jack@berlin.social

Written by Kartik Agaram on 2025-01-20 at 07:58

@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

@neauoire @qualmist

=> View attached media | View attached media | View attached media

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Jack Rusher on 2025-01-20 at 09:48

@akkartik @neauoire @qualmist From? I improvised it while live coding 🤷🏻‍♂️

=> More informations about this toot | More toots from jack@berlin.social

Written by Kartik Agaram on 2025-01-20 at 16:44

@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.)

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Josh Horowitz on 2025-01-21 at 03:44

@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.

=> View attached media | View attached media

=> More informations about this toot | More toots from qualmist@assemblag.es

Written by Kartik Agaram on 2025-01-21 at 04:15

@qualmist Ahh, the first version in particular helps a lot! I still don't understand why it works, but at least I have more of an intuition now of what the variables are.

@jack

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Josh Horowitz on 2025-01-21 at 05:25

@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.

=> More informations about this toot | More toots from qualmist@assemblag.es

Written by Kartik Agaram on 2025-01-21 at 05:30

@qualmist That does help. Do top/bottom/left/right rotate through the recursive calls?

@jack

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Josh Horowitz on 2025-01-21 at 06:11

@akkartik @jack yeah, they gotta for the ends of the curves to join up!

=> More informations about this toot | More toots from qualmist@assemblag.es

Written by Jack Rusher on 2025-01-21 at 10:05

@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. 😆

=> View attached media

=> More informations about this toot | More toots from jack@berlin.social

Written by Kartik Agaram on 2025-01-21 at 04:17

(hilbert-curve 0 0 800 0 0 800 5)

@jack It's interesting that I get back jank if I replace the (... n 0 0 n ...) pattern with other possibilities.

Does the hilbert curve logo thing you made with curved lines start out from this version?

@qualmist

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Kartik Agaram on 2025-01-21 at 05:22

@jack Visualizing leaf calls. x, y in red, xi/yi/xj/yj in green.

@qualmist

=> View attached media

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Kartik Agaram on 2025-01-21 at 05:33

@jack I better handle when the debug information collides.

@qualmist

=> View attached media

=> More informations about this toot | More toots from akkartik@merveilles.town

Written by Kartik Agaram on 2025-01-21 at 05:41

@jack Even better, show which direction the base vs control points are used in.

@qualmist

=> View attached media

=> More informations about this toot | More toots from akkartik@merveilles.town

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113844859331620557
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
350.933011 milliseconds
Gemini-to-HTML Time
8.915943 milliseconds

This content has been proxied by September (3851b).