# How to find the parameters necessary for drawing the lines of latitude and longitude of a spherical orthographic projection as partial ellipses?

I recently asked this question, which is a preface to this one. In that one I explain roughly what I'm attempting to achieve, but I realized that once I found that cutoff angle I still didn't have a good way of drawing the lines of latitude and longitude in terms of partial ellipses like I want to.

As mentioned in the comments of the accepted answer, I could still draw a lot of individual points and lines between them, but what I'd prefer would be to draw partial ellipses parametrized by their center, width, height, and where to start and stop drawing them in terms of radians. Translating from specific points of projection to such ellipses is the difficulty I'm facing; finding the cutoff for each line of latitude and longitude in terms of the other was meant to help find where to start and stop drawing the ellipses, but I struggle to actually do that, and I also struggle to find the other parameters (centers, heights, widths).

Here's an image showing what I'm after, the only differences being that I'm only ever going to tilt the central latitude, not the longitude, I'm not going to show the hidden parts of the ellipses (but as you can see from that image, you'd still have to know where along the ellipse you have to change the stroke), I'm going to parametrize how many divisions of longitude and latitude (typically I will have lines that are 1 degree apart pre-projection, as shown in the image I linked to in the original question), and I'm probably going to highlight the equatorial latitude with a different color.

I don't know how exactly you implemented the drawings. I'd suggest to leave the projection plane fixed to the $$yz$$ plane, and rotate instead the sphere with all its curves.

In practice, meridians and parallel can be derived from the same parametric equation, which for a non-rotated sphere is:

$$\pmatrix{x\\ y\\ z}=\cases{ \cos\phi\cos\theta\\ \\ \sin\phi\cos\theta\\ \\ \sin\theta}$$

where $$\phi\in[0,2\pi]$$ is the longitude and $$\theta\in[-\pi/2,\pi/2]$$ is the latitude. To draw a parallel we must fix the latitude and let the longitude vary, to draw a meridian we must fix the longitude and let the latitude vary.

To draw the projections of those curves on plane $$yz$$ we consider only the $$y$$ and $$z$$ coordinates of the above curve. To hide those parts of the curve which are not visible we must discard the points for which the $$x$$ value is negative. That is, we must choose the limits of the varying parameter such that $$\cos\phi\cos\theta\ge0$$.

Of course the above setting is not so useful, because all parallels degenerate into straight segments. But it is not difficult to rotate the above curve about the $$y$$ axis by an angle $$\alpha$$, here's the result:

$$\pmatrix{x\\ y\\ z}=\cases{ \cos\alpha\cos\phi\cos\theta+\sin\alpha\sin\theta\\ \\ \sin\phi\cos\theta\\ \\ \cos\alpha\sin\theta-\sin\alpha\cos\phi\cos\theta}$$ As before, you should plot only the $$y$$ and $$z$$ components, with the bound: $$\cos\alpha\cos\phi\cos\theta+\sin\alpha\sin\theta\ge0.$$ Suppose for instance you want to draw a parallel, corresponding to a latitude $$\theta$$. The curve to draw is: $$\pmatrix{y(t)\\ z(t)}=\cases{ \sin t\cos\theta\\ \\ \cos\alpha\sin\theta-\sin\alpha\cos t\cos\theta}$$ with the bounds on $$t$$ derived from: $$\cos\alpha\cos t \cos\theta+\sin\alpha\sin\theta\ge0.$$ If $$\cos\alpha \cos\theta>0$$ this can be written as $$\cos t \ge-{\tan\alpha\tan\theta},$$ that is: $$-\arccos(-\tan\alpha\tan\theta)\le t \le\arccos(-\tan\alpha\tan\theta),$$ where the $$\arccos$$ should default to $$\pm\pi$$ if its argument is $$>1$$ or $$<-1$$.

For a meridian the choice of the limits is slightly trickier, but should be manageable.

• Sorry, but I don't think this answers the question at all. The entire point is that I'm seeking the simplicity of drawing the curves as partial ellipses. I don't maintain any 3D model that I can rotate. Maybe I'm misunderstanding what you're saying, but you end up talking about curves to draw, when the point is that from looking at it all those curves are partial ellipses, and thus I'd like to draw them using a partial ellipse primitive. Please feel free to expand if you think I'm just misunderstanding you. Mar 19, 2023 at 19:23
• The curve given above IS a partial ellipse. What do you mean by "partial ellipse primitive"? Mar 19, 2023 at 19:43
• Well, naturally it has to be a partial ellipse, I already know this from observation; but it's not parametrized as such in terms of the parameters I requested in the question: center, width, height, and where to start and stop drawing the ellipse in terms of radians (0 being the ellipse's right extreme, pi/2 being the bottom extreme, pi being the left extreme, and 3pi/2 being the right extreme). Or if it is, then how exactly you go from the function you've written to those parameters is not clear to me at all. Mar 19, 2023 at 20:25