News for hackers. Stuff that matters.
Re:Hexagonal Grids by virtualritz on Friday October 20, 2023 @03:47PM (#37960676)
This is critically missing spiral hex coordinates which require only a single coordinate, not two.

I think the original idea is from Paul Bourke. He calls it a Spiral Honeycomb Mosaic (SHM).

See his "Tiling on The Plane" page [1]. Scroll down to the section titled "Hexagonal Lattice" (contains links to source code with coordinate conversions).

Here is a Rust implementation of a different variant of the same idea [2].

[1] http://paulbourke.net/geometry/tilingplane/

[2] https://crates.io/crates/hex-spiral

Re:Hexagonal Grids by pohl on Friday October 20, 2023 @04:07PM (#37960907)
That's pretty sweet. I tried to work something like that out on my own while I was using this resource to do some spiral iteration on a Tonnetz[1] I was making in SwiftUI. (Janky screenshot[2]) I ended up retreating from that approach — but now I might give it another go. Thanks for the links!

[1] https://en.wikipedia.org/wiki/Tonnetz

[2] https://hachyderm.io/@pohl/110918457500286347

Re:Hexagonal Grids by stcg on Friday October 20, 2023 @04:54PM (#37961394)
There is a note on another page about it:

https://www.redblobgames.com/grids/parts/#more

> Spiral Honeycomb Mosaic [0] (search the page for "Spiral Honeycomb Mosaic") is an interesting way to assign numbers to hexagons in a hexagonal grid. It results in bizarre properties.

[0] http://paulbourke.net/geometry/tilingplane/

Re:Hexagonal Grids by amitp on Friday October 20, 2023 @05:07PM (#37961535)
Spiral and other coordinate systems are on my list of things to add to the page. In addition to the Paul Bourke page, I have these bookmarked:

- https://gamedev.stackexchange.com/questions/71785/converting...

- https://tex.stackexchange.com/questions/275490/is-there-an-e...

- https://github.com/cooscoos/spiral_cube

- https://web.archive.org/web/20160309172431/http://www.pyxisi...

- https://www.sciencedirect.com/science/article/pii/0166218X92...

- https://thoughtstreams.io/jtauber/hex-map-addressing/

- http://tzaphiriron.sidemoon.net/static/hex/hex.html

- https://tilde.zone/@misterdave/109736460410840020

There's so much more to add to the page, and I keep adding over time. Thanks for the link to the hex-spiral crate; I'll add it to my bookmarks.