I'm developing an app that contains a 3D scene which the user can navigate. As the user moves it gives the illusion that you are browsing a real landscape but for the illusion to work I need to know two things:
- How to calculate the angular sizes of all the objects relative to their distances from the observer.
- How to calculate the center of all the objects relative to the focal point as the user moves.
The first one is easy but the second one still baffles me and I have no idea where to look for the answer. Let's examine the second one:
As the user navigates towards the focal point, the center of the object moves across the line that is created between the focal point and it's center.
Focal Point = $FP(x_0, y_0)$
Center 1 = $C_1(x_1, y_1)$
Center 2 = $C_2(x_2, y_2)$
The equation of the line is:
$y-y_0 = m(x-x_0)$ where $m=(y_1-y_0)/(x_1-x_0)$
The center 1 $(x_1,y_1)$ is known because it is the starting center.
Let's say the the object moved a distance $d$ from center1 to center 2.
(1) (2) = ... you can find $y_2$ and $x_2$ if you know $d$.
Can you find $d$ from the illustration? Is there any other method?