0

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:

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

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.

  • What is Sol ? The Sun ? – Jean Marie Mar 17 '23 at 18:43
  • Is "the angular distance between separate points" the shortest arc length distance measured on a sphere, or are you really interested in the changes in latitude and longitude between two points? If the latter, plotting level sets of $\phi$ and $\lambda$ as functions of $(x,y)$ will give you the gridlines you want. – MathFont Mar 17 '23 at 18:49
  • @MathWonk: I'm trying to draw a grid which can be arbitrarily divided into e.g. lines with 1 degree between them, or 2 degrees between them, or 0.5 degrees between them and so on, by simply changing a small parameter, since this way it's easy to quickly see roughly what the angular distance between two points are, and I already accomplished this as per the first part of the question; but now I also want to project actual latitude considering the current tilt of Sol as seen from Earth (currently a bit over 7 degrees), and it's this that led me to what the entire post is about. – Outis Nemo Mar 17 '23 at 19:49
  • You might want to be more specific about what you mean by "lines with $1$ degree between them." First of all, where are the "lines"--on the Sun, or on the plane of projection? And at what point does the distance between lines subtend $1$ degree--are they $1$ degree apart as viewed from the center of the Sun, or from some other point? – David K Mar 18 '23 at 01:30
  • @DavidK: I'm talking about 1 degree (or 2, or 0.5, or whatever division I might choose) apart on the actual surface of Sol. In other words the lines don't look that many degrees apart on the projection itself (and Sol itself only spans ~0.5 degrees as seen from Earth anyway, so I don't see how that would make sense anyway); that's also rather obvious given how lines closer to ~90 degrees of longitude on either side get squashed. As for where the lines are, look at the last image in the original post and imagine lines drawn across all the longitudes and latitudes that the points are occupying. – Outis Nemo Mar 18 '23 at 02:22
  • So, lines of latitude and longitude at one-degree intervals (or some other uniform spacing)? – David K Mar 18 '23 at 02:46
  • @DavidK: Yes. As I mentioned in the first part of the post, achieving such an orthographic projection intuitively using just some simple sines and cosines was very easy, and I already have such a grid that works perfectly well for that purpose. The problem only arose when I wanted to include the tilt so that one could see exactly which latitudes the different features of Sol were located on too. That's when I looked into using the actual formulae for projecting points orthographically, and ran into the problems described above. – Outis Nemo Mar 18 '23 at 03:21
  • In other words, is your question "What is the angle subtended at center of a sphere by a great circle segment drawn between two given points?" ... if so, a formula can be derived. – Narasimham Mar 18 '23 at 05:37
  • A picture is indeed worth 1000 words. So, something like https://math.stackexchange.com/questions/4586204/perspective-view-of-longitudinal-great-circles-ellipses-inside-a-circle but orthographically projected rather than in perspective.? – David K Mar 18 '23 at 06:26
  • @DavidK: Yes, pretty much exactly like that, except the challenge in this case is only latitudes, since I won't be shifting the center longitudinally. If the solution happens to apply to the longitudinal ellipses too that's of course nice, but it's finding these varying latitudinal ellipses that's the problem; they will all be of different sizes, and they will have different cutoff points (what the question was originally about). Finding their widths and centers and the angle they're cut off at due to being behind the sphere for each latitude is ultimately what I'm looking for. – Outis Nemo Mar 18 '23 at 07:14

1 Answers1

1

I will work this problem from a pure mathematical perspective for the most part (using an abstract sphere rather than the Sun and radians rather than degrees), but at the end we can relate it to your specific problem.

A key fact in this answer is that the points on a sphere that project onto the circumference of the sphere's image in an orthogonal projection are a great circle on the sphere, specifically, the great circle you get when you slice the sphere with a plane that passes through the sphere's center and is parallel to the projection plane. So your question comes down to, if we know the latitude of a point on that great circle, what is the longitude of that point?

Let's start by defining coordinates $\theta$ and $\lambda$ on the surface of the sphere. For consistency with mathematical formulas derived elsewhere, we will define $\theta$ as the colatitude (the angle measured along the surface from the "north pole" of the sphere) and $\lambda$ as the longitude (the angle that the point's line of longitude makes from the line of zero longitude). Working with colatitude rather than latitude may seem a little unusual, but that's the way many spherical geometry formulas are written, and it's easy to convert between colatitude and latitude when we need to.

In these coordinates, one equation describing a great circle (adapted from a post on MathOverflow) is

$$ \cot\theta = -\tan\theta_0 \cos(\lambda - \lambda_0) $$

where $\theta_0$ and $\lambda_0$ are the colatitude and longitude of a pole of the great circle. (A pole of a great circle is a point that has the same relation to the great circle as the north and south poles have to the equator. The right-hand side of the equation changes sign from the MathOverflow example because in this question we are "tilting" the axes in the opposite direction.)

Now, since we actually want to work with latitude rather than colatitude, we define the latitude $\phi$ as the angular distance on the sphere from the equator, so $\phi = \frac\pi2 - \theta$ and $\phi_0 = \frac\pi2 - \theta_0.$ With these substitutions, the equation of the great circle is

$$ \tan\phi = -\cot\phi_0 \cos(\lambda - \lambda_0). \tag1$$

So, given the latitude $\phi$ of a line of latitude on the sphere, we can solve Equation $(1)$ for $\lambda$:

\begin{align} \cos(\lambda - \lambda_0) &= -\tan\phi_0 \tan\phi, \\ \lambda - \lambda_0 &= 2\pi n \pm \arccos(-\tan\phi_0 \tan\phi) && \text{where $n$ is an integer}, \\ \lambda &= 2\pi n + \lambda_0 \pm \arccos(-\tan\phi_0 \tan\phi) && \text{where $n$ is an integer}. \\ \end{align}

The reason for the multiple solutions is that there are two longitudes where the line of latitude intersects the great circle, and the longitude can be measured in various ways. You might like to choose $n$ in such a way that $-\pi \leq \lambda \leq \pi,$ as we usually measure longitudes from $180$ degrees west to $180$ degrees east.

You actually have two choices for how to measure $\phi_0$ and $\lambda_0,$ because every great circle has two poles; but let's use the pole that we want to make visible in the projection. That is, $\phi_0$ and $\lambda_0$ are the latitude and longitude of the point that is projected into the exact center of the circle onto which the sphere is projected. Note that for a sphere with no axial tilt relative to the projection plane (so the equator projects to a straight line), $\phi_0 = 0$; if you tilt the axis so that the north pole is visible in the projection, then $\phi_0 > 0$; and if you tilt the axis so that the south pole is visible in the projection, then $\phi_0 < 0.$ In the image in the question, for example, $\phi_0 < 0.$

You might also want to take into account the fact that when the axis of the sphere is not parallel to the plane of projection, the projections of the poles will be inside the circle onto which the sphere is projected, and you will want to plot one of those poles (whichever one is "visible" to the observer) at the correct projected point.

At the point where that pole is projected, the projected images of $360$ degrees' worth of lines of longitude should all meet. That is, you want it to look something like this image from stackoverflow:

sphere with lines of latitude and longitude, north pole tilted toward the observer

In order to avoid projecting parts of lines of latitude from the "non-visible" side of the sphere onto the projected image, you will want to cut off the image of every line of longitude at the same great circle where the lines of latitude are cut off.

That is, given the longitude $\lambda$ of a particular line of longitude, you want to solve for $\phi$ in Equation $(1)$ in order to find the latitude where the line of longitude has to be cut off:

$$ \phi = -\arctan(\cot\phi_0 \cos(\lambda - \lambda_0)). $$

David K
  • 108,155
  • Thanks for taking the time; this is a great answer and does address what I've been asking. However, I'm still stuck on a couple of points.
    1. I've come to realize that I'm going to have to do something similar for lines (curves in the projection) of longitude as well, because they also get partially hidden, and I'm not sure if that's straightforward to derive from the same equation.

    2. More importantly: I'm still stuck on how exactly to translate this to actually plotting these lines with partial ellipses; I thought it'd be simple, but it seems harder than I thought.

    – Outis Nemo Mar 18 '23 at 22:02
  • 1
    I did talk about the lines of longitude too, but I just realized that getting the latitude from Equation (1) isn't as obvious as I thought. I've added the explicit formula. You're also right that plotting the ellipses is an additional challenge. The linked stackoverflow question (which I forgot to link to, but that's also fixed now) has advice about that if you're using Unity; how to do it depends on what software you're using. – David K Mar 18 '23 at 23:06
  • Thanks; you're right that it should have been quite obvious. This question as it stands has been answered by now, so I'll mark it as such, and then I'll probably open up a new question for how to use this information to actually draw the lines using simple primitives (doesn't have to be partial ellipses, but I figure that's what fits the bill the best considering how all the curves end up being exactly that). I couldn't really make sense of the answer in the other question. – Outis Nemo Mar 19 '23 at 00:54
  • Perspective is very different from orthographic projection, so I think a new question makes a lot of sense. I couldn't see how to easily adapt the answers to the other question to yours either. You're right, everything is partial ellipses, and it does seem more elegant to work out the geometry of the ellipse and let software figure out the details of plotting it than to create a zillion short little line segments. – David K Mar 19 '23 at 01:37
  • Yes, exactly; I realize now that with finding the answer to this question all I know is the point I'd start at so I don't need to approximate that, but I'd still have to use points and lines rather than my preferred method of partial ellipses. Knowing that angle is itself useful for some other things, though (e.g. knowing how many extra degree returning sunspot regions have to travel before reappearing). As for perspective vs. orthographic projection, I'm not sure that's the issue here; I'm still looking for the latter, because at the distance of Sol that's a good enough approximation anyway. – Outis Nemo Mar 19 '23 at 11:56
  • I've now asked a new question for this here:

    https://math.stackexchange.com/questions/4662124/how-to-find-the-parameters-necessary-for-drawing-the-lines-of-latitude-and-longi

    – Outis Nemo Mar 19 '23 at 12:13