I figured it out. For anyone else in the future I followed the posts by Sander Evers that amitp suggested (thanks both of you), just the small_to_big and center_of functions in combination will give you the relative coordinate. One thing to note is the functions will tile the map with the southern mirror shifted right (and other mirrors following suit). Previously I had been assuming it'd be shifted left so It meant I had to tweak a couple of things in the rest of my code. Here's my implementation in c++:
//returns center coordinate of a large hex region with given radius r at cube coordinate (i,j,k)
int_triple center_of(int i, int j, int k, int r)
{
return int_triple{
(r + 1) * i - r * k,
(r + 1)* j - r * i,
(r + 1)* k - r * j
};
}
//returns the coordinate of the large hex region with given radius r containing cube coordinate (x,y,z)
int_triple small_to_big(int x, int y, int z, int r)
{
int area = (3 * r * r) + (3 * r) + 1;
int shift = (3 * r) + 2;
int xh = divide_floor(y + shift * x, area);
int yh = divide_floor(z + shift * y, area);
int zh = divide_floor(x + shift * z, area);
return int_triple{
divide_floor(1 + xh - yh,3),
divide_floor(1 + yh - zh,3),
divide_floor(1 + zh - xh,3)
};
}
//returns the realative coordinate to the center of the hex region of size r containint the coordinate
int_triple rel_coords(int x, int y, int z, int r)
{
int_triple smallToBig = small_to_big(x,y,z,r);
int_triple centerOf = center_of(smallToBig.x,smallToBig.y,smallToBig.z,r);
return int_triple{
x - centerOf.x,
y - centerOf.y,
z - centerOf.z
};
}