thetabe the latitude (where 0 is the equator, +90 degrees is the north pole, and -90 degrees is the south pole).
phibe the longitude (with 0 being the prime meridian).
rbe the radius of the sphere where the camera may be.
x = sin(theta) cos(phi)
y = sin(phi)
z = cos(theta) cos(phi)
Vbe the direction vector. Thus,
V3are the x, y, and z components of the vector, and its magnitude
|V| = sqrt(V1^2 + V2^2 + V3^2).
x = rV1 ÷ |V|
y = rV2 ÷ |V|
z = rV3 ÷ |V|
Remember that if you're using degrees, you'd want to use theThanks so much for taking the time to detail all this, it's very much appreciated. I've been trying the trigonometry based with some success but haven't quite cracked it. I might well give the vector based approach a whirl too to see how I fare there. Thanks again.
dcos, dsinfunctions, not the
cos, sinfunctions, which work on an input of radians.