I have a frustum with left = 2
, right = 2
, close = 0.5
, far = 10
.
I've put the eye of the camera in (0, 0, 2.5)
looking directly at (0, 0, 0)
with up (0, 1, 0)
.
Suppose I want to place an object centered on z = 1
. I want to find the X
coordinate so that under this trunk appears exactly centered on the left edge of the screen.
I set up the following diagram to help me:
+ z

 /
X<_____________________/__________>X
__ x__  one /
 /
 /
l_  __ /
a  /  close to dist = n = 0.5
 / 
 2.5

z
To find X
I can use trig trigonometry simple. As tan a = l / n
Y tan a = x / 1.5
then the formula for X
is x = l / n * 1.5 = 2 / 0.5 * 1.5 = 6
.
But when I use this value of x to draw an object to the left of the center, it does not appear centered at the edge of the screen. What am I doing wrong?