[HN Gopher] Hilbert curve: The space filling curve drawn with Ja...
       ___________________________________________________________________
        
       Hilbert curve: The space filling curve drawn with JavaScript
        
       Author : susam
       Score  : 81 points
       Date   : 2023-10-26 12:01 UTC (10 hours ago)
        
 (HTM) web link (jsxgraph.uni-bayreuth.de)
 (TXT) w3m dump (jsxgraph.uni-bayreuth.de)
        
       | gus_massa wrote:
       | It took me a while to see the slide just below the graphic. I was
       | expecting to click or press space to get the next level.
       | 
       | There is some infesting/weird aliasing at the 8 and 9 level (at
       | least in my screen). I'm almost sure it's aliasing, not a real
       | density difference.
        
         | red_trumpet wrote:
         | I'm not so sure. Some of what looks like an artifact on level 8
         | is already more clearly visible on level 7 as a density
         | difference. Do we talk about the same thing, some white lines
         | which are not often crossed?
        
           | gus_massa wrote:
           | The definition of the Hilbert curve is a line of width 0, so
           | my question makes no theoretical sense.
           | 
           | Anyway, a real example has a line of non zero width, let's
           | asume 1/2^n. Centered? How even is the average dendity
           | distribution? Are the crosses real or an artifact of the
           | pixels in my screen? I don't know and I'm curious?
        
       | chertoleg wrote:
       | I worked at that chair at Uni Bayreuth for a while. Here is the
       | github repo (webpage is hugged to death)
       | https://github.com/jsxgraph/jsxgraph
       | 
       | Shoutout to Prof. Wassermann for keeping up the good work.
        
       | ipsin wrote:
       | Some time ago I made an animation of a Hilbert curve with
       | sections transitioning between levels. As simple as it is, it's
       | kind of fun to watch.
       | 
       | https://ehq.com/rloop2.svg
        
       | wccrawford wrote:
       | I first heard about this the other day when Clough42 (on Youtube)
       | was talking about using the Hilbert curve setting for the bottom
       | layer of a 3d print to make that layer look better for his final
       | product. I haven't tried it on my own prints, but mine typically
       | don't show the lines on the first layer, so I'm not sure it would
       | make a difference in my prints. But maybe I'm over-extruding a
       | bit there.
        
       | rented_mule wrote:
       | In 1990, I included the Hilbert Curve in my senior thesis for my
       | BS in Math, which I presented to all the professors in our math
       | department. Years later, one of those professors became a family
       | friend. He was an incredibly supportive mentor to multiple people
       | in our family. After he passed away last year, I learned that his
       | great-great grandfather was David Hilbert, creator of this curve.
       | It must have been fun to see some of his family's work displayed
       | in one of his student's theses.
       | 
       | https://www.hmc.edu/in-memoriam/hank-krieger/
        
         | throw_pm23 wrote:
         | You realize it was his _mathematical_ great-great grandfather,
         | right?
         | 
         | That means, his PhD advisor's advisor's advisor's advisor.
         | There are a few thousand mathematicians who can claim that:
         | https://www.mathgenealogy.org/id.php?id=7298
        
           | NoMoreNicksLeft wrote:
           | Silly me, I thought mathematicians reproduced by budding. I
           | assumed that's what they did while reclusing in their
           | mountain shacks between public appearances.
        
       | OscarCunningham wrote:
       | I once made a visualisation of the Hilbert curve evaluated at
       | 2048 random points:
       | https://mathstodon.xyz/@OscarCunningham/108889112101425236
        
         | hasoleju wrote:
         | Your post sent me down a rabbit hole, thanks!
        
       | graypegg wrote:
       | I made a little hilbert curve demo for an interview take home
       | test a while ago!
       | 
       | https://graypegg.com/hilbert
       | 
       | (https://github.com/graypegg/hilbertcurveplayground)
       | 
       | Maps weather data, sorted by date onto the curve. Makes the
       | seasons obvious since they get grouped together!
        
       | readyplayernull wrote:
       | This curve always reminds me of isometric embeddings:
       | 
       | https://medium.com/coffee-shop-math/coffee-shop-math-isometr...
        
       | fishtoaster wrote:
       | I love putting hilbert curves into various simulation and
       | building games - you often get interesting results! And if you
       | don't, it at least looks cool.
       | 
       | One time I wrote some ruby and some lua to generate a hilbert
       | curve in Factorio - I'm pretty happy with the result:
       | https://github.com/kkuchta/factorio_hilbert
        
       | foresto wrote:
       | Related:
       | 
       | Google's S2, geometry on the sphere, cells and Hilbert curve
       | 
       | https://news.ycombinator.com/item?id=10066616
       | 
       | I've always thought S2 was a clever name for something built with
       | the Hilbert curve. (Look at the shape of the glyphs.)
        
       | plumeria wrote:
       | A fun aspect of this _space filling curve_ is that it can be used
       | for the infill pattern of a 3D print.
        
         | nomel wrote:
         | Can, but I can't imagine there's a metric that's outperformed
         | by the Hilbert curve, compared to the usual infill patterns.
        
         | dheera wrote:
         | I never really got the point of doing that as opposed to just a
         | regular linear 100% fill which is a lot less stress on the
         | motors and belts.
        
       | ceautery wrote:
       | It's nice to see just how popular Hilbert curves are. For me it
       | touches the same nerve that Conway's Game of Life does.
       | 
       | I threw together a hacky demo of the Hilbert curve and some other
       | l-system curve for a middle school computer club I ran way back
       | when. Not the best UI in the world, but it shows you either the
       | string substitutions following each l-system ruleset, or with
       | "show canvas" checked each click draws the next generation.
       | 
       | https://autery.net/pages/l-systems.html
        
       | roombarampage wrote:
       | I also have one of those: https://jonathan-
       | potter.github.io/hilbert-curve/
        
       | oneearedrabbit wrote:
       | Not long ago, I went down the rabbit hole of space-filling
       | curves, and learned about an obscure paper by Rolf Niedermeier,
       | Klaus Reinhardt, and Peter Sanders that introduced a rather
       | peculiar curve with an unfortunate name: H-curve [1]. The paper
       | mentions that H-curve preserves better locality properties
       | compared to Hilbert curve. It fills the space with H-like shapes,
       | hence the name. Also, like the Moore curve, it generates a loop.
       | 
       | Space-filling curves are ridiculously easy to implement with
       | L-system rules, and I spent a few days developing a set of axioms
       | to express it in a rewrite system. This was a fun puzzle [2].
       | A => BF-F-BFFFC-F-FC+F+BF-F-BFFFC-F-FC       B => BFFFC-F-FC+F+B
       | C => C+F+BF-F-BFFFC
       | 
       | [1]
       | https://www.sciencedirect.com/science/article/pii/S0166218X0...
       | 
       | [2] https://kruzenshtern.org/25-h-curve.html
        
         | jethkl wrote:
         | Cool! Obligatory https://xkcd.com/195/
         | 
         | Its locality properties provide a practical alternative to the
         | Hilbert curve for this type of map. Also interesting that it is
         | loopy.
        
         | thechao wrote:
         | This is the space-filling curve we used for the last-level
         | (4x4/16x16) tiles in the _very_ early Larrabee work. It 's a
         | great curve!
        
       | cobbal wrote:
       | There's a simple way to draw the curve at full precision using
       | SVG:                  <rect x="0" y="0" width="1" height="1" />
        
       ___________________________________________________________________
       (page generated 2023-10-26 23:01 UTC)