# Trying to subdivide an ISO tile

I have code that calculates where the user clicked inside an iso tile in an isometric map. The tile has a width of 1 unit and a height of 0.5 units. My code calculates where they touched inside the tile in these same units. The goal is to then decide where that click falls if you sub-divided the iso tile into a 4x4 grid. The picture below shows how all this is supposed to look.

I have found ascreen co-ordinates to iso formula and it makes sense but for whatever reason, when I try to use it with my data above I get wrong outputs. When clicking from the top corner to the right corner, only the X iso output should change but both the X and the Y change.

I feel like this should be pretty simple but after hours of banging my head against this I can't figure out what I am doing wrong.

Source for screen to iso formula: How would I translate screen coordinates to Isometric coordinates?

Any help would be greatly appreciated.

float touchedX;
float touchedY;
//below 0.125 represents the tile height because the whole thing
// is 0.5 and its 4 tiles high so 0.125, 0.5 is 2*width which
//is (1 / 4.0) * 2
float gridPointLedftDown = (touchedY / 0.125f) + (touchedX / 0.5f);
float gridPointRightDown = (touchedY / 0.125f) - (touchedX / 0.5f);

• hint: when you have both iso-coordinates and screen-coordinates in the same project, calling both x and y can become quite confusing. In one project where I used iso-coordinates I used the convention to call the axis' of the iso-coordinate system l and r (for left-down and right-down) instead. That really helped me a lot to keep my code understandable. – Philipp Feb 7 '17 at 10:29
• Updated the code to reflect that. – user2292539 Feb 7 '17 at 15:28