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

76 Views Asked by At

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.

1

There are 1 best solutions below

3
On

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.