Trouble with Isometric Coordinates

closed account (3qX21hU5)
So I have been trying to learn about Isometric views and the math that goes with them and have been having some troubles with it. The main trouble I am having is getting a 2D Isometric world coordinate from a 2D screen coordinate. I would like to create a helper method in a class of mine to convert a screen space coordinate into a world space coordinate but I am struggling with it.

For example lets look at the cursor. If I have the cursor at lets say (100, 100) in screen space how would I find out what that would be in 2D Isometric world space?

Here is a screenshot of what I am talking about if it helps http://tinypic.com/r/24fy0ba/5 . It was made with C# and XNA and the map was loaded with XTiled which is a map loader for tmx tile maps. Sadly XTiled doesn't provide a screen to world method which I can reference.

I can provide some code if that is needed (It would be in C# though) but I am more concentrated on understanding the math behind it so I can implement it myself.

I will be honest in that my maths skills are really sub par when it comes to game programming and I am completely lost on this and would love to understand how it works.

Thanks in advance for any help.
Let's say that:
1. The screen y axis is positive downwards.
2. The world y axis is positive towards the upper right corner of the screen.
3. The world x axis is positive towards the lower right corner.
Then f:S->W is an invertible linear transformation such that f(x, y) = (x + y/2, x - y/2)(x * x0 + y * y0, x * x0 - y * y0). The camera offset is not included in the transform.

x0 = sqrt(3/2)
y0 = sqrt(1/2)

EDIT: Fixed multipliers. Guess it's been longer than I thought since my last technical drawing.
Last edited on
Topic archived. No new replies allowed.