# How to convert 3d co ords to 2d orthographic?

1. Dec 6, 2011

### rollcast

I'm still looking into this prior to my older thread and someone has told me of a method that I have quoted below;

"
All measurements are assuming that the pixel width/height is one)

Let fov = the field of view, you can decide how much field of view your user will have from the target viewing point. For example, if you look at your screen and say that there is 30 degrees between the edges of your screen from the target viewing area, then 30 is your fov.

Let d = (screen width / tan(fov)) to the nearest integer.

Given the 3D point [x,y,z]

Your 2D point is [x * d/z, y * d/z] where z is the pixels from 0 being the screen to 1000 being A kilometer away from your screen (of course, all virtually) Here's in example:

Let my screen be 20 pixels wide.

Make a V with my hands by placing my palms together, point the edges of my hands to the edges of my screen as shown on my computer monitor, and estimate the angle to be thirty degrees (Of course this will be different with different monitors, so there should be a suggested monitor width) Then:

d = 20 / tan 30 ~= 35 (This should be pretty close to the actual distance the user is from the screen!)

Now, Given the point [x,y,z]

My 2D point is [x * 35 / z, y * 35 / z]

"

Will this work or does it have any limitations?

Thanks
AL

2. Dec 6, 2011

### HallsofIvy

Staff Emeritus
Yes, that will that will work but I don't quite see why you are doing it. You appear to be calculating the distance from the screen by using a given angle. It is the distance from the screen that is the more direct measurement and one would normally calculate the "fov" from that.