Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently changing an existing computer game from a top-down view to an isometric view. The map consists of an infinite number of tiles. Only the tiles which are currently visible in the players window should be shown.

What i know is:

  • How many pixels the worldmap has been scrolled on x and y axis
  • The width and height of a single tile
  • The width and height of the players window

What i need to know is

  • The coordinates of the first tile to be shown
  • The amount of tiles that will fit in the players window

To visualize the old approach was something like this (the dashed square represents the players window):

enter image description here

So with the old approach this calculation was pretty simple.

The new one looks like this:

enter image description here

And this is where i'm stuck at the moment. I can't figure out how to calculate which tile is in the upper left corner of the players window and how many tiles fitting inside the players window on the two new axes.

Can anyone help me with that? If yes, it would be really nice if the solution also contains a short explanation.

Thanks a lot in advance.

share|cite|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.