I'm trying to compute a grid that's orthographically projected onto a sphere for the purposes of overlaying onto images of Sol (which is so far away that this is a good approximation), so that one can quickly see roughly the angular distance between certain points.
At first I wrote a simple program using basic knowledge of sines and cosines, and got a useful grid; however, the only reason this worked is because I did a projection centered on (0, 0), so I didn't have to account for tilt at all, and in that case all latitudes will simply have half of their longitudes visible.
This works perfectly fine for what I was trying to do, because the angular distances will still all be the same. That being said, now I've been trying to use the actual formulae for an orthographic projection so that I can incorporate tilt, since Sol's axis is tilted ~7.25 degrees with respect to the ecliptic. There's no need to adjust for longitudinal variation, because the images of Sol are all already rotated to account for this.
So, on this Wikipedia page I found the following:
I wrote up a program to project that, and this worked fine. I was still using a λ_0 and φ_0 of 0, so even without cutting off any points that are hidden behind the sphere it looked like the points were in the right places (since those behind simply overlapped with those in front). Then I adjusted λ_0 a little bit (again, φ_0 will remain 0 throughout all of this anyway), and could see how the points behind the sphere were visible. Thus I proceeded to the next part:
I implemented that too, and it worked perfectly, just as expected. All good so far, no problems at all. However, then I realized that what I wanted was a grid, not all these separate points. I tried for a bit to simply use a large number of points and draw lines between them, but this turned out to be a highly complicated endeavor due to the order the points get arranged in when projecting the original latitudes and longitudes in order, with a lot of lines cropping up that were not supposed to be there. In addition I thought this was a rather ugly solution anyway, even if I could work out the kinks, because my original grid had simply used curved lines (drawn as part of ellipses) and only needed a few different points defined for each line of latitude and longitude.
So then I read further down to this:
At first I thought that this was of no use to me, since this was (as far as I could tell) just a way of recovering the original grid of latitudes and longitudes from points that had already been projected. However, underneath I read this:
Now this seems to address the problem I'm encountering, but I couldn't, and still can't, understand exactly how. Essentially what I'm trying to do is, for any given latitude, I want to know what the cutoff angle is for a given latitude (λ), assuming a φ_0 of 0 and a given λ_0. That way I can simply draw partial ellipses based on this. However, now that I've though more about it, even this is further complicated by how the actual width of the whole ellipse I'm drawing parts of would also be significantly changed; if e.g. λ_0 is slightly positive, so the sphere is tilted upward, i.e. so you can see the south pole but not the north pole, then due to more longitudes being visible at lower latitudes, the ellipse widths there are smaller. Here's an image of what I mean, which I've generated using points:
In any case, I hope this is sufficient material to explain what I'm trying to achieve, i.e. to draw a grid with as few defined points as possible for each latitude and longitude given a certain tilt of central latitude (λ_0). To draw the original grid all I needed for each line was a partial ellipse defined by its center, width, height, and where to start and stop drawing along it, so something similar would be ideal, unless someone has better suggestions.
Edit:
To clarify due to what's being asked in some comments, this is the type of grid I made intuitively using some simple sines and cosines at first, since the special case of being centered on (0, 0) simplifies a lot of things (and this works well for that original purpose):
https://i.postimg.cc/1sxvmRDz/solgrid.png
The problems arise when trying to incorporate the tilt, and to then still find simple parameters for drawing the partial ellipses that make up the "lines" (on the projection I guess they are better described as "curves" to be strict), rather than calculate a huge amount of points to try and draw straight lines between them in order to approximate both the edge and the curves.
Final edit:
The solution to this problem has been found, but I'm still trying to find the parameters for the resulting partial ellipses, so I've asked a new question for it here.





