https://thoughtstreams.io/jtauber/hex-map-addressing/Hex Map Addressingjtauber2015-02-17T01:52:33Zhttps://thoughtstreams.io/jtauber/hex-map-addressing/#card-7614The difference between a GBT approach...2015-02-17T01:52:33Z2015-02-17T01:52:33Z
The difference between a GBT approach and what I was working on above is that I have lower-level hexes on the *edges* whereas GBT has lower-level hexes on the vertices.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-7613Just discovered [General_Balanced_Ter...2015-02-17T01:40:53Z2015-02-17T01:40:53Z
Just discovered [General_Balanced_Ternary_(GBT)_Arithmetic](http://www.pyxisinnovation.com/pyxwiki/index.php?title=General_Balanced_Ternary_(GBT)_Arithmetic) which seems highly related.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-7612* from `.1` you can only go `3`, `4`,...2015-02-17T01:17:51Z2015-02-17T01:17:51Z
* from `.1` you can only go `3`, `4`, `5`
* from `.2` you can only go `4`, `5`, `6`
* from `.3` you can only go `5`, `6`, `1`
* from `.4` you can only go `6`, `1`, `2`
* from `.5` you can only go `1`, `2`, `3`
* from `.6` you can only go `2`, `3`, `4`
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-1610See <http://www.redblobgames.com/grid...2013-05-16T05:23:22Z2013-05-16T05:23:22Z
See <http://www.redblobgames.com/grids/hexagons/> (also via Luke Hatcher)
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-2I've actually started going down path...2012-09-11T16:53:44Z2012-09-11T16:53:44Z
I've actually started going down path of each level overlapping the hexes of the previous level:
![overlapping hexes](http://f.cl.ly/items/1x2T2J3F391L3Y2Z011c/Screen%20Shot%202012-08-16%20at%201.09.57%20AM.png)
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-125Luke Hatcher pointed me to [Amit's Th...2012-09-01T11:49:13Z2012-09-01T11:49:13Z
Luke Hatcher pointed me to [Amit's Thoughts on Grids](http://www-cs-students.stanford.edu/~amitp/game-programming/grids/) which is highly relevant here (although taking a different , more general and single level approach).
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-68I'm wondering if another way to look ...2012-08-26T23:05:34Z2012-08-26T23:05:34Z
I'm wondering if another way to look at it is, from
the `.1` version of a hex's name, you can only go next in the direction `3`, `4` or `5`. If you want to go in the direction `1`, `2` or `6`, you have to use the `.4` version of the name.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-67It seems that `1.4.1` and `1.0.4` are...2012-08-26T22:44:55Z2012-08-26T22:44:55Z
It seems that `1.4.1` and `1.0.4` are fine but should never be called `0.1.1`.
The heuristic is that `0.1.1` isn't under `0` so should not be a valid name. We just need to make that more concrete.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-66These two names come about not becaus...2012-08-26T22:44:53Z2012-08-26T22:44:53Z
These two names come about not because of overlapping parents (`.0` hexes don't have overlapping parents) but because the single parent has two names due to *its* overlapping parents.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-65`1.4.1` and `1.0.4` is a distinction ...2012-08-26T22:44:51Z2012-08-26T22:44:51Z
`1.4.1` and `1.0.4` is a distinction we like because it gives us a name for the edge from either side.
As you can see in the diagram above, the issue is the two names for the `.0` hex: `0.1.0`/`1.4.0`.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-64![three levels of hex showing ambiguo...2012-08-26T22:40:03Z2012-08-26T22:40:03Z
![three levels of hex showing ambiguous naming](http://f.cl.ly/items/3V2H1t3Q2I32432v2z2i/Screen%20Shot%202012-08-26%20at%206.39.04%20PM.png)
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-63Actually, `1.4.1` seems to have only ...2012-08-26T22:40:01Z2012-08-26T22:40:01Z
Actually, `1.4.1` seems to have only one other name: `1.0.4`.
So `1.4.1`, `0.1.1` and `1.0.4` are the same hex.
The `1.4.1` vs `1.0.4` distinction is just the usual one of being named after one of the overlapped parents.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-62is `1.4.1` and `0.1.1` being the same...2012-08-26T22:40:00Z2012-08-26T22:40:00Z
is `1.4.1` and `0.1.1` being the same *in addition* to the non-`0` hexes having two names anyway? So there are actually *four* names for `1.4.1`?
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-59![two levels of hex showing addresses...2012-08-26T11:19:53Z2012-08-26T11:19:53Z
![two levels of hex showing addresses](http://f.cl.ly/items/3D0M1B3G3r0f3X1n3N1x/Screen%20Shot%202012-08-26%20at%207.18.00%20AM.png)
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-58There's something a little weird abou...2012-08-26T10:40:46Z2012-08-26T10:40:46Z
There's something a little weird about the "two addresses".
Now `0.1` and `1.4` are the same, which means that `0.1.4` and `1.4.4` are the same and `0.1.1` and `1.4.1` are the same.
What's "weird" is that `1.4.4` is entirely enclosed in `0` not `1` and `0.1.1` is entirely enclosed in `1` not `0`.
Which means you can't rely on prefix alone for containment.
I wonder if that makes this whole idea a non-starter.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-56I have this crazy idea to cast all th...2012-08-26T10:18:46Z2012-08-26T10:18:46Z
I have this crazy idea to cast all this in a fantasy settings with mages deriving all this in some conlang of terminology.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-55At some point, might want to explore ...2012-08-26T10:17:39Z2012-08-26T10:17:39Z
At some point, might want to explore using `-3`, `-2`, `-1`, `1`, `2`, `3` as the directions rather than `1`, `2`, `3`, `4`, `5`, `6`.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-54The "opposite" scenario we described ...2012-08-26T10:16:27Z2012-08-26T10:16:27Z
The "opposite" scenario we described above is actually just:
* if (t - d) == 3, result is 0
* if (t - d) == -3, result is 0
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-51* if direction <= 3, opposite = direc...2012-08-26T10:12:27Z2012-08-26T10:12:27Z
* if direction <= 3, opposite = direction + 3
* if direction > 3, opposite = direction - 3
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-53If we call the tail address `t` and t...2012-08-26T10:12:25Z2012-08-26T10:12:25Z
If we call the tail address `t` and the direction `d` then:
* if (t - d) == 2, result is d + 1 (== t - 1)
* if (t - d) == -2, result is d - 1 (== t + 1)
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-52Notice that direction `5` from the `....2012-08-26T10:12:23Z2012-08-26T10:12:23Z
Notice that direction `5` from the `.1` hex in is the same as direction `1` from the `.5` hex.
In this, and other similar cases, the result is just the number "in between", with the proviso that `6` is between `5` and `1` and `1` is between `6` and `2`.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-50In the diagram above, by considering ...2012-08-26T10:06:52Z2012-08-26T10:06:52Z
In the diagram above, by considering the inverse we can see that if the hex addresses ends in a number that is the "opposite" of the direction we want to go, the new address just replaces the last digit with a `0`.
By opposite here, we mean:
1 <-> 4
2 <-> 5
3 <-> 6
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-49 __________
/\ ...2012-08-26T10:05:58Z2012-08-26T10:05:58Z
__________
/\ /\
/ \ 6 / \
/ \____/ \
/ 5 / \ 1 \
/_____/ 0 \_____\
\ \ / /
\ 4 \____/ 2 /
\ / \ /
\ / 3 \ /
\/________\/
#
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-48In one case, this is still trivial. I...2012-08-26T09:52:52Z2012-08-26T09:52:52Z
In one case, this is still trivial. If we're on a hex ending in a `0` the same-level hex in direction `d` has an address just replacing the `0` with `d`. For example: the hex in direction `2` from `[3, 5, 0]` is `[3, 5, 2]`.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-47To find the sub-hex (i.e. the hex one...2012-08-26T09:52:51Z2012-08-26T09:52:51Z
To find the sub-hex (i.e. the hex one level finer) in any direction is trivial. The sub-hex in the `3` direction from `[4, 2]` is `[4, 2, 3]`.
A more involved question is what's the same-level hex's address in a given direction?
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-42Just realized, starting to implement ...2012-08-26T02:24:47Z2012-08-26T02:24:47Z
Just realized, starting to implement this, that each hex actually has two addresses, each one based on one of the two "parents" it overlaps.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-33Going to start coding some of this up...2012-08-26T01:22:09Z2012-08-26T01:22:09Z
Going to start coding some of this up at https://github.com/jtauber/hexlib
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-5A hex can then be identified by a dot...2012-08-25T20:43:24Z2012-08-25T20:43:24Z
A hex can then be identified by a dotted-path such as `3.5.0.2.1`.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-6This scheme may allow for partitionin...2012-08-25T01:05:20Z2012-08-23T08:49:42Z
This scheme may allow for partitioning of maps across servers while, as a result of the overlap, provide a basis by which information about adjacent hexes can be shared between those servers.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-4So each hex has *7* children, the cen...2012-08-25T01:04:52Z2012-08-23T08:35:51Z
So each hex has *7* children, the central one (we'll call **0**) and *6* others which we can number clockwise from top right **1**-**6**.
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-1Trying to work out how the hexagonal ...2012-08-25T01:02:09Z2012-08-23T04:09:36Z
Trying to work out how the hexagonal equivalent of a [quadtree](http://en.wikipedia.org/wiki/Quadtree) works (visually).
https://thoughtstreams.io/jtauber/hex-map-addressing/#card-3What's neat about that is each *edge*...2012-08-25T00:59:55Z2012-08-23T08:35:48Z
What's neat about that is each *edge* gets hex at the finer level (potentially useful for some of the applications I have in mind)