# Find longitude intersection of given latitude at z=0 for a globe

I have a globe image that is centered at lat,lon. At this lat,lon, by definition x=0, y=0, z=1.

A line of latitude drawn on this map can either be completely visible (in which case it would be drawn as an oval like the 60°S line in the image below), or it can be completely hidden like the 60°N latitude in the picture (all points on the line are z < 0).

The third possibility is that a line of constant latitude has a start point at some longitude and an end point at some other longitude where z=0. How can I find these two longitudes?

For example if the center lat,lon is -50, -130 (between New Zealand and S. America), the line of latitude near 40°S starts near a longitude near Western Australia and ends in The Atlantic between S. America and Africa. But at what longitude does this line get to z=0 on both ends?

So in the picture below, the two red dots are on either side of the 40°S line. What are the two points of longitude? They will be at z=0, lat=-40 (in degrees) and long=???

In the picture below, gridlines are shown every 10 degrees with the center of the projection at Lat/Lon (-30,0). In this view, all latitude lines above 60N are invisible because they fall on the backside of the earth where z<0. All latitude lines below 60S are completely visible because the whole line in in an area where z>0.

The area between 60S and 60N has some of each latitude line visible. They end at the following longitudes (calculated by hand with trial and error and interpolation using excel):

``````60N   0.000
50N  46.523
40N  61.023
30N  70.529
20N  77.869
10N  84.157
Equ  90.000
10S  95.843
20S 102.130
30S 109.471
40S 118.977
50S 133.477
60S 180.000
``````

I need a formula to calculate these values.

Given: A latitude for the center of the projection (-30 in this case).

Given: A line of latitude (20 for example)

Find: The number of degrees E/W that the line remains visible (z>=0): 77.869 in this example.

SOLVED:

`W = (-sin(qLat) * sin(cLat)) / (cos(qLat) * cos(cLat))`

`lon = +/- acos(w)`

Where cLat is the center latitude of the globe sphere and qLat is the latitude of the line being checked.

If the entire latitude line is in negative z space, W will be > 1.

If the entire latitude line is in positive z space, W will be < -1.

For lines that cross z=0, the +/- acos(w) will work out.

Note that you could also use `W = -tan(qLat) * tan(cLat)` but `tan` is often slower then `sin/cos` if you are doing this in software.

• Good work! A good answer will have some explanation beyond just the solution. Or at least a reference. Also, you can accept your own answer to your own question instead of writing SOLVED. Welcome!
– Jon
Commented May 19, 2020 at 5:16
• You may wish to consider that the earth is ellipsoid and not spherical, and the lats/longs on an ellipsoid are actually geodetic and not geocentric. Commented May 19, 2020 at 5:39
• That's true, but at the level I am using, the non-spherical earth is not important - it's close enough to a sphere to make this work. Commented May 19, 2020 at 13:12