# Calculate length of isometric line

In my isometric game the user can draw a line of arbitrary length, and I need to calculate the "unprojected length" of the same line. Users can only draw lines in 6 directions (4 isometric directions and vertically)

How do I calculate the given BLUE line provided I have the given RED line?

Ray/plane intersection seems to be overkill for such a simple calculation. My isometric angles are 30 degrees, exactly as shown in the image below.

Edit: Assuming a 3D object is projected with isometric projection, it becomes a bit smaller in screen coordinates, no? So what would be the original 3D length before "isometric projection"? Since the user is drawing lines on an already "projected" isometric view, the length cannot be the simple length.

• What do you mean by "unprojected length"? How is it different from the simple Pythagorean calculation: SQRT( SQR(X2-X1) + SQR(Y2-Y1) )? – Pieter Geerkens Jul 16 '16 at 14:43
• @PieterGeerkens - Assuming a 3D object is projected with isometric projection, it becomes a bit smaller in screen coordinates, no? So what would be the original 3D length before "isometric projection"? Since the user is drawing lines on an already "projected" isometric view, the length cannot be the simple length. Sorry but I can hardly explain what I need. – Robinicks Jul 16 '16 at 16:48
• If you are drawing a 3d object then you'll probably need ray/plane intersection fro this. If you're only drawing on the "ground" then you can unproject the screen coordinates back to world coordinates and then calculate distance in world space. – amitp Jul 16 '16 at 22:01

Assuming a 3D object is projected with isometric projection, it becomes a bit smaller in screen coordinates, no?

Maybe not quite the way you think, if you're using a true isometric projection.

"Isometric" comes from Greek terms for "equal measure," referring to the fact that the six axes you describe are all equally foreshortened.

Eg. If I took six identical rods, pointing up, down, north, south, east, west, and rendered them with an isometric projection (say, looking from the south-east corner), each rod's projection on my screen would be the same size as all the others, no matter where I placed them in my scene.

So, if you're using isometric projection, all you need to do is measure the line in screenspace (using Pythagorean theorem for diagonals), then divide it by your screen-pixels-per-world-unit scaling value (ie. your zoom factor).

The wrinkle comes in the fact that we're really sloppy about how we use the term "isometric" in games. It's frequently used to describe the dimetric projection in games with 2:1 diamond-shaped tiles, or even more generally for any view angle that's "vaguely corner-on"...

If you're using one of these almost-isometric projections, then it gets a bit more complicated. You'll need to edit your question to give us more details about how you're constructing your projection so we can identify the appropriate scaling to apply.

I believe you can analyze the distance the user drew on screen, and the distance between the camera and the platform, as well as the FOV of the camera. Using this info, you could use some geometry to figure out the length relative to the platform the user drew on. I made this graphic below- is this what you're asking?