I am stuck on a problem that seems easy to solve but I can't seem to pinpoint the right formula.
I have a list of hexagon groups in a cube coordinate system. I know the cube coordinates of the groups but I need to calculate the "global" coordinate of a small hexagon in a given group.
For example, in the image below, I know the coordinates for GroupA (x=0, y=0, z=0)
and GroupB (x=-1, y=1, z=0)
. How can I calculate the coordinates of the center tile of GroupB given that each group has the same radius (in this case the radius is 1) and they don't overlap each other (let's see it as a tiling of groups starting from 0,0,0 that creates a hex grid)?
In this simple example, I know as a human being that the center tile of GroupB is (x=-1, y=3, z=-2)
but I need to code that logic in a way that a computer can calculate it for any given group on the map. I don't particularly need help on the code itself but the overall logic.
In this article, the author does the opposite (going from small hexagon and trying to find its group): https://observablehq.com/@sanderevers/hexagon-tiling-of-an-hexagonal-grid
Any help would be greatly appreciated! Thanks!