2
$\begingroup$

I'm a developer very bad in math, and I got a problem that I'm not able to solve.

I got a grid each cell got a position X and Y like shown in the picture below

diagram

Actually I got the red coordinates, I need the green ones...
My cells are in diagonal so it takes the diagonal line as center.

If I do X - Y it would be good for the first col, but the second one will have 1 too much.

I don't have many clues

Sorry if I put the wrong tags but I don't have many ideas of where to put it.

Thank you for your help.

1 Answers 1

2

Call the red coordinates $X$ and $Y$, and the green coordinates $X'$ and $Y'$. Then

$X' = (Y+X)/2,$

$Y' = (Y-X)/2.$

You can think of this as the result of applying a rotation of $45^\circ$ clockwise to the vector $(X,Y)$, then normalizing the result.

  • 0
    Oh I found it `X' - Y' = X` and `X' + Y' = Y`2012-05-13