I have the following example image of my hexagon "grid":
Each Hexagon has a column and row. The coordinate system I am choosing for my hex layout is an X,Y coordinate system, with the X coordinates landing across the red lines and the Y coordinates simply equal to the row. In my image I have the X,Y coordinate for each hex displayed in the middle in the middle of the hex.
My Question: Given the row and column of a hex, how do you calculate the X,Y coordinate of the hex (or more simply, how do you calculate the X coordinate, since the Y coord = row number)?
I have tried to come up with various equations that work for each hex but no luck yet. An equation that comes close is:
x = Math.floor(column/2) + (row%2)
But that doesn't satisfy all the hex's. I think I am on the right track.
Also, please assume that the hex grid continues infinitely down and to the right.