When x, y, and z go like in the image below, and x = longitude 0, and y = longitude 90 degrees, then for arbitrary latitude and longitude:

x = r * sin(longitude) * cos(latitude)

y = r * cos(longitude) * cos(latitude)

z = r * sin(latitude)

.. where r = radius of ball.

When you add the eye (watching point) to the image, then for arbitrary point

**a**in coordinates (xa, ya, za), you can calculate point**a'**(xa', ya') in the plane between eye and ball.The next image helps understand how you calculate ya' in the plane:

xa' = ya/(d-xa)

ya' = za/(d-xa)

ya' = za/(d-xa)

.. or if you want to put little less perspective, you can do:

xa' = arctan(ya/(d-xa))

ya' = arctan(za/(d-xa))

The point

**a'**(xa', ya') is input for the XY chart.
## 2 comments:

How do you handle literal lat long like a globe - for example 0 latitude being at the equator and 90 being the top of the pole?

Use radians with sin(), cos() and tan()--not degrees. To get radians, multiply by PI()/180. For example 90 degrees = 90*PI()/180 = PI()/2 radians.

Was this helpful to you?

Post a Comment