please excuse if this is not an advanced topic.
I am simulating a basketball with x and y cordinates at zero, and it is translating directly towards the eye, along the -z axis (i.e., it does not follow a parabolic path).
After each refresh, the basketball travels some distance along the z axis, depending on its speed. I want the basketball to be simulated at its actual visual angle for each distance on the z axis. So, if I am sitting at a fixed 60cm away from the screen, I want the basketball to be simulated at its correct visual angle.
I’ve looked at the red-book, which does discuss this issue (p. 133-134), but I do not understand how calculating the visual angle of an object that I know the size of (e.g., the diameter of a basketball is 24cm), is translated to the angle variable in gluPerspective.
For example, I know that if the basketball’s diameter (D) is 24cm, and its distance (Z) is 60cm, then its visual angle (theta) is:
theta = 2 * atan ((D*0.5)/Z)
= 2 * atan (12/60)
= 2 * 0.197
= 0.394 RADIANS
= 22.61 degrees
So I now know that the correct angle for the object at that distance, but how should this be used for the field of view (fovy) variable in gluPerspective(fovy, apect, Znear, Zfar)?
Can anyone provide an explanation please or point me to a good reference for this topic?
thanks in advance,