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.
Another way to look at it is a plane going through the sphere's origin as well as 60N and 60S... then determine at what longitude(s) this plane intersects some latitude (20N for example... in which case it will be +/-77.869 from the central meridian).
Any ideas?


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)buttanis often slower thensin/cosif you are doing this in software.