0

I'm attempting to calculate grid coordinates from mouse coordinates on a rectangular isometric grid (like below). The rendering is not in a diamond pattern but offset by a half tile on odd rows.

The origin point is at the top of the 0, 0 diamond.

My first attempt was trying to offset the diamond-grid rendering, which failed miserably. I've also tried an affine transformation approach, but that also seems to be for diamond-grid rendering and had the same problems.

Are there any formula for translating from a diamond grid to the type below, or other approaches to figure out which grid cell mouse coordinates intersect with?

Isometric grid

Darkzaelus
  • 2,059
  • 1
  • 15
  • 31
  • I think I would - add horizontal and vertical lines going through the centers of your tiles. This ovelays your grid by a grid of rectangles, each cut in half to form two triangles. - identify which rectangle a Point P is in, which is trivial. - decide if the diagonal goes up or down and - decide if P is in an upper or lower trianlge. - last step: translate the result in some, hopeflly less weird coordinate system.. – TaW Jun 24 '22 at 05:53
  • 1
    see these: https://stackoverflow.com/a/35917976/2521214 , https://stackoverflow.com/a/70696535/2521214 , https://stackoverflow.com/a/30024958/2521214 for some ideas how to deal with these programatically ... the main idea is to handle differently even and odd rows/columns ... – Spektre Jun 24 '22 at 08:28

0 Answers0