I need to set a coordinate system fro a triangular grid so I did this:
X=========X=========X=====
\ -1, 0 / \ 1, 0 / \
\ / \ / \
\ / \ / \
\ / 0, 0 \ / 2, 0 \
=====X=========X=========X
/ \ 0, 1 / \ 2, 1 /
/ \ / \ /
/ \ / \ /
/ -1, 1 \ / 1, 1 \ /
X=========X=========X======
(The pattern continues in each direction)
Basically I converted the triangular grid to rectangular grid with the axe system:
+======> X
|
|
V Y
But another axe system can be used:
X'
/
/
/
x
\__
\__
\__ Y'
Which is the same thing rotated 60 degrees counter clockwise, and is symmetric to the first because the triangles are regular = symmetric in 60 degrees.
This produces the following coordinates:
X=========X=========X=====
\ 1, -1 / \ 2, 0 / \
\ / \ / \
\ / \ / \
\ / 1, 0 \ / 2, 1 \
=====X=========X=========X
/ \ 0, 0 / \ 1, 1 /
/ \ / \ /
/ \ / \ /
/ -1, 0 \ / 0, 1 \ /
X=========X=========X======
That creates two coordinate systems. How can I convert a pair of coordinates $(x, y)$ in the first coordinate system to a pair of coordinates $(x', y')$ in the second coordinate system?