<p>Being masochistic, I guess, I took on this very endeavour “by hand” a few months ago, as I didn’t want to use “ready-made” solutions—the best way to understand something is to study its insides! Three major points come out:</p>
<ul>
<li>The projection of an ellipse is always an ellipse (or a circle, which is a special case of an ellipse)</li>
<li>The only dimension in common between the true ellipse and the projected ellipse is the apsidal axis</li>
<li>The <em>center</em> of both the true ellipse and the projected ellipse is the same—but <em>not</em> the foci!</li>
</ul>
<p>To find the projected ellipse from the true ellipse, or vice versa, you have to build an auxiliary ellipse, the calculation of which is rather long and convoluted. If you want to be as “masochistic” as I am, I’ll be happy to share my results (inspired by Jeremy Tatum’s notes at <a href="http://astrowww.phys.uvic.ca/%7Etatum/celmechs.html" rel="nofollow noreferrer">http://astrowww.phys.uvic.ca/~tatum/celmechs.html</a> and Esmat Bekir’s article at <a href="https://dergipark.org.tr/tr/download/article-file/568547" rel="nofollow noreferrer">https://dergipark.org.tr/tr/download/article-file/568547</a>).</p>

CC BY-SA 4.0
2021-04-10T18:50:00.147Z
If we rotate around the minor axis, the projected major axis shrinks.
PM 2Ring
CC BY-SA 4.0
2021-04-10T19:06:24.650Z
@PM2Ring: You are right! My mistake, sorry! I have edited my answer; it is the apsidal axis that remains the same.
Pierre Paquette
CC BY-SA 4.0
2021-04-10T18:44:08.563Z
2021-04-10T19:05:53.080Z
2021-04-10T19:05:53.080Z
Pierre Paquette
<p>Yes, the 2D projection of a 3D ellipse (or circle) is always an ellipse (or circle). However, in general, the various elements of the 3D ellipse do not project to the corresponding elements of the 2D ellipse.</p>
<p>A simple parameterization of the 2D ellipse uses the <a href="https://en.wikipedia.org/wiki/Eccentric_anomaly" rel="nofollow noreferrer">eccentric anomaly</a>. For an ellipse centred on the origin, let <span class="math-container">$a$</span> be the semimajor axis, aligned with the X axis, <span class="math-container">$b$</span> the semiminor axis, aligned with the Y axis, and <span class="math-container">$\theta$</span> the eccentric anomaly. Then
<span class="math-container">$$x = a\cos(\theta)$$</span>
<span class="math-container">$$y = b\sin(\theta)$$</span>
Note that <span class="math-container">$\theta$</span> is <em>not</em> the central angle of the ellipse, it's the central angle of the auxiliary circles associated with the ellipse. Here's a diagram, courtesy of Wikipedia (click the image for an SVG version):
<a href="https://upload.wikimedia.org/wikipedia/commons/7/72/Eccentric_and_True_Anomaly.svg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/riGbU.png" alt="Eccentric anomaly" /></a></p>
<blockquote>
<p>The eccentric anomaly of point P is the angle E. The center of the ellipse is point C, and the focus is point F.</p>
</blockquote>
<p>The blue circle provides the X coordinate of P, and the green circle provides its Y coordinate.</p>
<p>The vertices of an ellipse are the points where the major axis crosses the ellipse, the co-vertices are the points where the minor axis crosses the ellipse. The focal points lie on the major axis at a distance <span class="math-container">$f=ae$</span> from the origin, where <span class="math-container">$e$</span> is the eccentricity. Note that <span class="math-container">$a^2=b^2 + f^2$</span>.</p>
<p>If we rotate the ellipse in 3D around the X axis by <span class="math-container">$\gamma$</span> and project it back onto the XY plane, the projected ellipse has the same semimajor axis, but its semiminor axis shrinks to <span class="math-container">$b\cos\gamma$</span>. Similarly, if we rotate it around the Y axis by <span class="math-container">$\beta$</span>, the semiminor axis is preserved, but the semimajor axis shrinks to <span class="math-container">$a\cos\beta$</span>. With more complex rotations, things get complicated...</p>
<p>We can represent rotations using <a href="https://en.wikipedia.org/wiki/Rotation_matrix" rel="nofollow noreferrer">rotation matrices</a>. This is useful because we can combine rotations by multiplying their matrices. Please see the Wikipedia article for details.</p>
<p>Using rotation matrices, we can produce parametric equations for the general 3D ellipse. I won't reproduce those equations here, since they're a bit messy. But using those equations we can show that the projected ellipse is, in fact, an ellipse.</p>
<p>Below is a Sage / Python script which creates an interactive 3D plot of a rotated ellipse and its projection onto the XY plane. I use the same conventions as that Wikipedia article: I use a right-handed coordinate system, with angles <span class="math-container">$\alpha, \beta, \gamma$</span> representing anticlockwise rotations (in degrees) around the Z, Y, X axes, respectively. (If you &quot;grab&quot; an axis with your right hand, with your thumb pointing in the positive direction, then your fingers curl in the positive angle direction).</p>
<p>The <span class="math-container">$z=0$</span> XY plane is rendered in translucent grey. I plot the vertices, co-vertices, and foci of the 3D ellipse in primary colours, and use the same colours for the projections of those elements onto the 2D ellipse. The major axis is red, the minor axis is blue, the foci and the 3D ellipse itself are green. I also plot the actual vertices, co-vertices, and foci of the 2D ellipse: magenta for the major, cyan for the minor, and pale green for the foci and the 2D ellipse. When one of these points coincide with a projected point, the graphics system &quot;decides&quot; which one to render.</p>
<p>I also add grey lines connecting each point of the 3D ellipse to its projected point in the 2D ellipse.</p>
<pre><code>&quot;&quot;&quot; Plot an ellipse in 3D &amp; its projection onto the XY plane
    Written by PM 2Ring 2021.04.11
    Updated 2021.07.15
&quot;&quot;&quot;

from math import radians
var('t')

# Project a 3D vector to the z=0 plane
Z0 = diagonal_matrix((1, 1, 0), sparse=False)

ps = 8
# Plot a 3D line &amp; its endpoints
# The line may contain multiple segments
def pline(pts, color):
    return point3d(pts, size=ps, color=color) + line3d(pts, color=color)

# Plot a line and its projection on the z=0 plane
def pline_proj(pts, color):
    # Project the points
    pts0 = [Z0 * u for u in pts]
    # Draw the line &amp; its projection
    P = pline(pts, color) + pline(pts0, color)
    if do_connected:
        # Connect each point in pts with its projection
        P += sum(line3d(u, color=&quot;#aaa&quot;) for u in zip(pts, pts0))
    return P

@interact
def main(ecc=ContinuousSlider((0, 1), stepsize=0.05, default=0.6),
  alpha=ContinuousSlider((-180, 180), stepsize=5, default=0),
  beta=ContinuousSlider((-180, 180), stepsize=5, default=20),
  gamma=ContinuousSlider((-180, 180), stepsize=5, default=20),
  connect=True, frame=False, perspective=False, auto_update=False):
    global do_connected
    do_connected = connect

    a = 1
    f = a * ecc
    b = sqrt(a^2 - f^2)
    print(&quot;b =&quot;, b)

    # Build rotation matrices
    alpha = radians(alpha)
    beta = radians(beta)
    gamma = radians(gamma)
    Rx = matrix(RR, [
     [1, 0, 0],
     [0, cos(gamma), -sin(gamma)],
     [0, sin(gamma), cos(gamma)]])
    Ry = matrix(RR, [
     [cos(beta), 0, sin(beta)],
     [0, 1, 0],
     [-sin(beta), 0, cos(beta)]])
    Rz = matrix(RR, [
     [cos(alpha), -sin(alpha), 0],
     [sin(alpha), cos(alpha), 0],
     [0, 0, 1]])
    R = Rz * Ry * Rx

    # The z=0 plane, origin, &amp; axes
    P = plot3d(lambda x,y: 0, (-a, a), (-a, a), color=&quot;#888&quot;, opacity=0.2)
    P += point3d([(0,0,0)], size=ps, color=&quot;#666&quot;)
    P += line3d([(-a, 0, 0), (a, 0, 0)], color=&quot;#aaa&quot;)
    P += line3d([(0, -a, 0), (0, a, 0)], color=&quot;#aaa&quot;)

    # The 3D ellipse
    fxyz = R * vector((a*cos(t), b*sin(t), 0))
    fxy0 = Z0 * fxyz
    P += parametric_plot3d(fxyz, (t, 0, 2*pi), color = &quot;green&quot;)
    # The projected ellipse
    P += parametric_plot3d(fxy0, (t, 0, 2*pi), color = &quot;#7f7&quot;)

    # The vertices &amp; co-vertices of the 3D ellipse and their projections
    # Major
    vx0, vx1 = fxyz(t=0), fxyz(t=pi)
    P += pline_proj([vx0, vx1], &quot;red&quot;)

    # Minor
    vy0, vy1 = fxyz(t=pi/2), fxyz(t=3*pi/2)
    P += pline_proj([vy0, vy1], &quot;blue&quot;)

    # The foci of the 3D ellipse and their projections
    f0 = R * vector((-f, 0, 0))
    f1 = R * vector((f, 0, 0))
    P += pline_proj([f0, f1], &quot;green&quot;)

    # Find the true vertices &amp; co-vertices of the projected ellipse
    # rf is the radius function of the projected ellipse
    rf = abs(fxy0)
    # Major
    ap, t0 = find_local_maximum(rf, 0, pi)
    _, t2 = find_local_maximum(rf, pi, 2*pi)
    vpx0, vpx1 = fxy0(t=t0), fxy0(t=t2)
    P += pline([vpx0, vpx1], &quot;magenta&quot;)

    # Minor
    bp, t1 = find_local_minimum(rf, 0, pi)
    _, t3 = find_local_minimum(rf, pi, 2*pi)
    P += pline([fxy0(t=t1), fxy0(t=t3)], &quot;cyan&quot;)

    # Find true foci of the projected ellipse
    eccp = sqrt(ap^2 - bp^2) / ap
    P += pline([vpx0*eccp, vpx1*eccp], &quot;#7f7&quot;)

    P.show(frame=frame, projection=&quot;perspective&quot;
      if perspective else &quot;orthographic&quot;)

</code></pre>
<p>Here's a screenshot:
<a href="https://i.sstatic.net/uALH5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uALH5.png" alt="3D ellipse" /></a></p>
<p>It's a bit hard to see what's going on in that screenshot. It's a lot easier in the <a href="https://sagecell.sagemath.org/?z=eJylV9tu4zYQffdXDBSgK3vlrOx0E2MBA0W72LcARpqiFyNr0BJlcyGJLEU5dr6-wyFl07cWbRPD4WUuZ84Mh0wURTArpQFWAy9LoRoOooa7z_AdCNOA0vIbz4yQNcjaSDBrDr_9DqpkNe8B_vyqhTG8huUOZo8wfhL1CsbpeHSbfn87GpHILypnhud--eF29LEXRVGvV2hZQcXMGkSlpDagWS5Y3fQ2TMfvzLt-r3cDMwcAmMW0wZHU4HG8TVMP5I8UpoC6K1mzcoEmtdjG8SgB_KT9BBrFdMOnX1jZcLSqGhSfWOMUubVcipr7kHmdKylq06DAM7qhrYrtIEMGGJJTtaURquTQ8FXFrWDOC0SCcrEyTYKCpdT9TxS85qbVNZDFu9ztN-KNT1UnOHXi8J48dTLhVu8AlcCwOj9Pzgkle0gLK3WO68Cs1fMB2w2UtGzOkdMBtFAg360tCVx_8ZqfNXsltYC1AxYSmqGJM0YwxP1a2i2SuCgglwskuEYbPHcQnbOf3CJwlq0dTo8GXoUtnXPfzv_7KTRtFXtO247R6IYxFvUPcb0J5TBaUP1-mLRZr_cD-uOaZYYIrTD9Mc-yKYIyom5l2_xcipzrOMZ4RrbSDFeU3vQ2_ZgAKjGsFpzd9xM0zUq1Zhe0h6OJNTBJQxOhPmkvufkvymOnvWJV9T_UfXKmz7rlCRSaVf5AIXNcN8omYLNfYq2Ri5YOvj92LqerUi5ZeZRsWg8XsHT8uEd7DBdcJylwxLAsMQU0X-K8-VObmH0dwxCKr2OXP6UxbXGE21ECy37P1-2PrShz0NIwOjPUJzLuyp4yg-Z8D4pp7qxZ2oMdO3UbxGiwQ3O39bTFdd-Inp4SmLvKnNuGhJ-XxM_pGHSaCQwbLDA3CUUOq6H4y4v3tbvsy0oSWPJpbdAsNDwKsQz3IqSwV9_7ebvux9HlA-gmB9Phaih-RITFs_eFrtDfwAaHX9suhc9hk0tAarESdYI9iG19Il3nkbbZlqxa5gy2ye6TNR4PGRZmPxh0LWEymWChSMUyYXZ4WH0ZURPpOvccjzj-In2n_Tu6ub-_jwIV33Pm5Cd1V1DcDV9OOtEFNZQjTauGY3ZRLSAE7y9_d7tTst3ZTD0hce7CjGM2sKwbNLgc2FzYUdfsUNw2fOr3VjUIndlTbg_JwjNq9xGUoVjGAyU6EtFAtNKc1z4gB8w3ZjzSIb7rttOrtm8eiofjoDdcG3t6MfeZHO5nsqCb6UAJ3Za4JHRwTzTe0CP7JjWNN1v0utmO0JkNMqae2w0RS4D8cKvOOy3MTqR5fkD4KOrOsI1qswsMK_FhfLB9N6D5Ffte2dpfli0_pqCQmfhXARfpSV0MC1-VvhRGJ_vH22fwCtwsCFyXe4_ui3AYwOBt8Q-pulwkN6ALEA1J2P7aNlC0tX_s_J2ipkti2VA99c_yzFQCxtJQIMRFKTN6MG5FhW8F7cLtsr1AyfF1SSV8mbo0KyoF1VVQiqk1voRofJZizO5ex1JYsRU-JtmlGlpa0KMTKKK-BvruuuQx6BBMh3MUYL6zbSfKduwstTatYfldzgXe02p_RSu6o5f4pw8fMA8X6RhYFccJDa3_8OzPbpu1fI3d84O-k6DKp1HwFIn8YxDflsEq4sMjEuG_G2u50kytRRb1_wK9R9GX&amp;lang=sage" rel="nofollow noreferrer">interactive 3D view</a>. This view is created using three.js, and responds to the usual OrbitControls: you can pan &amp; rotate the camera using the mouse, use the mouse wheel to zoom. On a touch screen, one finger rotates, use two fingers to pan &amp; zoom.</p>
<hr />
<p>The script now allows you to easily set the frame off or on, and to choose between a perspective or orthographic camera. Also, you can edit the eccentricity and angle values by clicking on the number shown at the right of the slider.</p>

CC BY-SA 4.0
2021-04-10T18:40:04.860Z
Thanks, @Connor! It's great fun being able to do that 3D stuff. And with SageMathCell I can do it all on my phone, although it's probably a Good Idea to use a desktop or laptop for longer programs. :) Sage uses matplotlib for 2D graphics, which is designed to be matlab-like. It uses three.js for the 3D stuff. It only exposes a tiny bit of the power of three.js, but it's a lot easier to use than working directly in three.js (plus I prefer writing Python to JavaScript).
PM 2Ring
CC BY-SA 4.0
2021-04-11T00:19:43.733Z
ellipses stay as ellipses for both perspective and orthographic projections. I think astronomers are loath to use perspective but GUI's often default to perspective for "realism" so it's important to keep track of the distinction. Your math is for orthographic but your image shows perspective; the edges of the black bounding box are not parallel.
uhoh
CC BY-SA 4.0
2021-04-11T02:51:54.030Z
for python's matplotlib for example one used to have to [hack it](https://stackoverflow.com/a/23840781/3904031) to stop the perspective, but more recently they've [added an orthographic option](https://matplotlib.org/stable/users/prev_whats_new/whats_new_2.1.0.html#orthographic-projection-for-mplot3d)
uhoh
CC BY-SA 4.0
2021-04-11T08:55:01.820Z
@uhoh It definitely makes sense to use an orthographic view for this task, so I've updated the script to use it as the default, but you can select perspective if you want. I also added a toggle to turn the frame on & off (it's now off by default).
PM 2Ring
CC BY-SA 4.0
2021-07-14T16:55:42.420Z
@uhoh The projection of the 3D ellipse to the XY plane is certainly an orthographic operation, but that doesn't affect the validity of the final rendered image. However, I do agree that it's useful to view this scene with an orthographic projection; OTOH, a perspective projection is more natural.
PM 2Ring
CC BY-SA 4.0
2021-07-14T16:56:36.737Z
@uhoh BTW, I've just made a few more minor improvements to the script.
PM 2Ring
CC BY-SA 4.0
2021-07-15T01:39:21.607Z
Cool, I'll give it a try tonight, thanks!
uhoh
CC BY-SA 4.0
2021-04-10T17:59:19.357Z
2021-07-14T16:46:55.377Z
2021-07-14T16:46:55.377Z
PM 2Ring
<p>In ProfRob's excellent answer to <a href="https://astronomy.stackexchange.com/questions/43244/is-s2-still-the-fastest-known-star-in-the-galaxy/43246#43246">Is S2 still the fastest known star in the galaxy?</a>, he posted a figure of the orbital paths of stars passing close to the supermassive black hole near the center of the galaxy, which I am re-posting here:</p>
<p><a href="https://i.sstatic.net/Tg43O.png" rel="noreferrer"><img src="https://i.sstatic.net/Tg43O.png" alt="enter image description here" /></a></p>
<p>This figure caused some confusion in the comments, especially concerning the fact that there doesn't seem to be a common focus for all the ellipses in the image, as might be expected by <a href="https://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion#First_law" rel="noreferrer">Kepler's First Law</a>.  ProfRob reminded the other users that the figure was a projection of the orbits in 3D onto the plane of the sky.</p>
<p><strong>Question:</strong> How are the geometric properties of orbits conserved (or not) when projected onto a plane?</p>
<p>Specifically:</p>
<ol>
<li>Are the 2D projections of ellipses also ellipses?</li>
<li>Do the ellipse projections all contain the corresponding projection of the central mass?</li>
<li>Why don't the ellipse projections share a focus?</li>
<li>Under what conditions (if any) will the projections share a focus?</li>
</ol>

CC BY-SA 4.0
2021-04-10T06:51:53.263Z
From the consideration of what image a thin disk will create which we look-at initially face-on, we see that we can reduce either axis by projection or both, depending on how we turn the disk. As location of the ellipse foci depend on the eccentricity, it follows that the foci can shift either direction, depending on how we project the ellipse. So only the trivial projection (no change) leaves foci unchanged.
planetmaker
CC BY-SA 4.0
2021-04-10T07:34:03.913Z
I'm not able to write a full answer, but per [my answer](https://space.stackexchange.com/a/26588/12102) to *Why does Earth not appear to be at the focus of TESS' elliptical orbit in this video?* we can see that projective transformations of conic sections are still conic sections, but that's about all that's necessarily preserved. The projections will not generally *look like* 2D orbits about the original central body any more. I've also linked there to [Homography between ellipses](https://math.stackexchange.com/q/654275) in Math SE.
uhoh
CC BY-SA 4.0
2021-04-10T07:42:52.603Z
Not necessarily a duplicate since your question is more general: [Why does the closest approach of star S2 to Sgr A* not appear to be near the focus of its elliptical orbit?](https://astronomy.stackexchange.com/q/35836/7982)
uhoh
CC BY-SA 4.0
2021-04-10T07:53:15.470Z
Helpful and very interesting [comment](https://astronomy.stackexchange.com/questions/32793/how-did-they-measure-the-distance-to-the-center-of-our-galaxy-to-0-3-accuracy#comment60627_32795) by ProfRob which suggests that whenever your de-projection of the observed ellipse gets the central body to the focus of the ellipse, you have found at least some of the orbital elements.
uhoh
CC BY-SA 4.0
2021-04-10T09:07:21.133Z
Consider a perfectly circular orbit of radius 1, centred at the origin, in the XY plane (z=0). If we rotate it by $\gamma$ around the X axis, its projection back onto the z=0 plane it gets squashed into an ellipse with X semiaxis of 1, Y semiaxis of $\cos(\gamma)$, and foci at $(\pm\sin(\gamma), 0, 0)$.
PM 2Ring
CC BY-SA 4.0
2021-07-14T16:57:24.960Z
You may like to check the updated version of my script.
PM 2Ring
<orbital-mechanics>
Orbital path projections onto a 2D plane
Connor Garcia
# Orbital path projections onto a 2D plane

(Asked by: username_0 on 2021-04-10)

In ProfRob's excellent answer to [Is S2 still the fastest known star in the galaxy?](https://astronomy.stackexchange.com/questions/43244/is-s2-still-the-fastest-known-star-in-the-galaxy/43246#43246), he posted a figure of the orbital paths of stars passing close to the supermassive black hole near the center of the galaxy, which I am re-posting here:

[![enter image description here](https://i.sstatic.net/Tg43O.png)](https://i.sstatic.net/Tg43O.png)

This figure caused some confusion in the comments, especially concerning the fact that there doesn't seem to be a common focus for all the ellipses in the image, as might be expected by [Kepler's First Law](https://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion#First_law). ProfRob reminded the other users that the figure was a projection of the orbits in 3D onto the plane of the sky.

**Question:** How are the geometric properties of orbits conserved (or not) when projected onto a plane?

Specifically:

1. Are the 2D projections of ellipses also ellipses?
2. Do the ellipse projections all contain the corresponding projection of the central mass?
3. Why don't the ellipse projections share a focus?
4. Under what conditions (if any) will the projections share a focus?

**Tags:** orbital-mechanics

> **Comments:**
> **username_1**: From the consideration of what image a thin disk will create which we look-at initially face-on, we see that we can reduce either axis by projection or both, depending on how we turn the disk. As location of the ellipse foci depend on the eccentricity, it follows that the foci can shift either direction, depending on how we project the ellipse. So only the trivial projection (no change) leaves foci unchanged.  
> **username_2**: I'm not able to write a full answer, but per [my answer](https://space.stackexchange.com/a/26588/12102) to *Why does Earth not appear to be at the focus of TESS' elliptical orbit in this video?* we can see that projective transformations of conic sections are still conic sections, but that's about all that's necessarily preserved. The projections will not generally *look like* 2D orbits about the original central body any more. I've also linked there to [Homography between ellipses](https://math.stackexchange.com/q/654275) in Math SE.  
> **username_2**: Not necessarily a duplicate since your question is more general: [Why does the closest approach of star S2 to Sgr A* not appear to be near the focus of its elliptical orbit?](https://astronomy.stackexchange.com/q/35836/7982)  
> **username_2**: Helpful and very interesting [comment](https://astronomy.stackexchange.com/questions/32793/how-did-they-measure-the-distance-to-the-center-of-our-galaxy-to-0-3-accuracy#comment60627_32795) by ProfRob which suggests that whenever your de-projection of the observed ellipse gets the central body to the focus of the ellipse, you have found at least some of the orbital elements.  
> **username_3**: Consider a perfectly circular orbit of radius 1, centred at the origin, in the XY plane (z=0). If we rotate it by $\gamma$ around the X axis, its projection back onto the z=0 plane it gets squashed into an ellipse with X semiaxis of 1, Y semiaxis of $\cos(\gamma)$, and foci at $(\pm\sin(\gamma), 0, 0)$.  
> **username_3**: You may like to check the updated version of my script.  

---

## 2 answers

### Answer by username_3 on 2021-04-10. Score: 5 | Accepted answer

Yes, the 2D projection of a 3D ellipse (or circle) is always an ellipse (or circle). However, in general, the various elements of the 3D ellipse do not project to the corresponding elements of the 2D ellipse.

A simple parameterization of the 2D ellipse uses the [eccentric anomaly](https://en.wikipedia.org/wiki/Eccentric_anomaly). For an ellipse centred on the origin, let $a$ be the semimajor axis, aligned with the X axis, $b$ the semiminor axis, aligned with the Y axis, and $\theta$ the eccentric anomaly. Then
$$x = a\cos(\theta)$$
$$y = b\sin(\theta)$$
Note that $\theta$ is *not* the central angle of the ellipse, it's the central angle of the auxiliary circles associated with the ellipse. Here's a diagram, courtesy of Wikipedia (click the image for an SVG version):
[![Eccentric anomaly](https://i.sstatic.net/riGbU.png)](https://upload.wikimedia.org/wikipedia/commons/7/72/Eccentric_and_True_Anomaly.svg)

> The eccentric anomaly of point P is the angle E. The center of the ellipse is point C, and the focus is point F.

The blue circle provides the X coordinate of P, and the green circle provides its Y coordinate.

The vertices of an ellipse are the points where the major axis crosses the ellipse, the co-vertices are the points where the minor axis crosses the ellipse. The focal points lie on the major axis at a distance $f=ae$ from the origin, where $e$ is the eccentricity. Note that $a^2=b^2 + f^2$.

If we rotate the ellipse in 3D around the X axis by $\gamma$ and project it back onto the XY plane, the projected ellipse has the same semimajor axis, but its semiminor axis shrinks to $b\cos\gamma$. Similarly, if we rotate it around the Y axis by $\beta$, the semiminor axis is preserved, but the semimajor axis shrinks to $a\cos\beta$. With more complex rotations, things get complicated...

We can represent rotations using [rotation matrices](https://en.wikipedia.org/wiki/Rotation_matrix). This is useful because we can combine rotations by multiplying their matrices. Please see the Wikipedia article for details.

Using rotation matrices, we can produce parametric equations for the general 3D ellipse. I won't reproduce those equations here, since they're a bit messy. But using those equations we can show that the projected ellipse is, in fact, an ellipse.

Below is a Sage / Python script which creates an interactive 3D plot of a rotated ellipse and its projection onto the XY plane. I use the same conventions as that Wikipedia article: I use a right-handed coordinate system, with angles $\alpha, \beta, \gamma$ representing anticlockwise rotations (in degrees) around the Z, Y, X axes, respectively. (If you "grab" an axis with your right hand, with your thumb pointing in the positive direction, then your fingers curl in the positive angle direction).

The $z=0$ XY plane is rendered in translucent grey. I plot the vertices, co-vertices, and foci of the 3D ellipse in primary colours, and use the same colours for the projections of those elements onto the 2D ellipse. The major axis is red, the minor axis is blue, the foci and the 3D ellipse itself are green. I also plot the actual vertices, co-vertices, and foci of the 2D ellipse: magenta for the major, cyan for the minor, and pale green for the foci and the 2D ellipse. When one of these points coincide with a projected point, the graphics system "decides" which one to render.

I also add grey lines connecting each point of the 3D ellipse to its projected point in the 2D ellipse.

```
""" Plot an ellipse in 3D & its projection onto the XY plane
    Written by PM username_3 2021.04.11
    Updated 2021.07.15
"""

from math import radians
var('t')

# Project a 3D vector to the z=0 plane
Z0 = diagonal_matrix((1, 1, 0), sparse=False)

ps = 8
# Plot a 3D line & its endpoints
# The line may contain multiple segments
def pline(pts, color):
    return point3d(pts, size=ps, color=color) + line3d(pts, color=color)

# Plot a line and its projection on the z=0 plane
def pline_proj(pts, color):
    # Project the points
    pts0 = [Z0 * u for u in pts]
    # Draw the line & its projection
    P = pline(pts, color) + pline(pts0, color)
    if do_connected:
        # Connect each point in pts with its projection
        P += sum(line3d(u, color="#aaa") for u in zip(pts, pts0))
    return P

@interact
def main(ecc=ContinuousSlider((0, 1), stepsize=0.05, default=0.6),
  alpha=ContinuousSlider((-180, 180), stepsize=5, default=0),
  beta=ContinuousSlider((-180, 180), stepsize=5, default=20),
  gamma=ContinuousSlider((-180, 180), stepsize=5, default=20),
  connect=True, frame=False, perspective=False, auto_update=False):
    global do_connected
    do_connected = connect

    a = 1
    f = a * ecc
    b = sqrt(a^2 - f^2)
    print("b =", b)

    # Build rotation matrices
    alpha = radians(alpha)
    beta = radians(beta)
    gamma = radians(gamma)
    Rx = matrix(RR, [
     [1, 0, 0],
     [0, cos(gamma), -sin(gamma)],
     [0, sin(gamma), cos(gamma)]])
    Ry = matrix(RR, [
     [cos(beta), 0, sin(beta)],
     [0, 1, 0],
     [-sin(beta), 0, cos(beta)]])
    Rz = matrix(RR, [
     [cos(alpha), -sin(alpha), 0],
     [sin(alpha), cos(alpha), 0],
     [0, 0, 1]])
    R = Rz * Ry * Rx

    # The z=0 plane, origin, & axes
    P = plot3d(lambda x,y: 0, (-a, a), (-a, a), color="#888", opacity=0.2)
    P += point3d([(0,0,0)], size=ps, color="#666")
    P += line3d([(-a, 0, 0), (a, 0, 0)], color="#aaa")
    P += line3d([(0, -a, 0), (0, a, 0)], color="#aaa")

    # The 3D ellipse
    fxyz = R * vector((a*cos(t), b*sin(t), 0))
    fxy0 = Z0 * fxyz
    P += parametric_plot3d(fxyz, (t, 0, 2*pi), color = "green")
    # The projected ellipse
    P += parametric_plot3d(fxy0, (t, 0, 2*pi), color = "#7f7")

    # The vertices & co-vertices of the 3D ellipse and their projections
    # Major
    vx0, vx1 = fxyz(t=0), fxyz(t=pi)
    P += pline_proj([vx0, vx1], "red")

    # Minor
    vy0, vy1 = fxyz(t=pi/2), fxyz(t=3*pi/2)
    P += pline_proj([vy0, vy1], "blue")

    # The foci of the 3D ellipse and their projections
    f0 = R * vector((-f, 0, 0))
    f1 = R * vector((f, 0, 0))
    P += pline_proj([f0, f1], "green")

    # Find the true vertices & co-vertices of the projected ellipse
    # rf is the radius function of the projected ellipse
    rf = abs(fxy0)
    # Major
    ap, t0 = find_local_maximum(rf, 0, pi)
    _, t2 = find_local_maximum(rf, pi, 2*pi)
    vpx0, vpx1 = fxy0(t=t0), fxy0(t=t2)
    P += pline([vpx0, vpx1], "magenta")

    # Minor
    bp, t1 = find_local_minimum(rf, 0, pi)
    _, t3 = find_local_minimum(rf, pi, 2*pi)
    P += pline([fxy0(t=t1), fxy0(t=t3)], "cyan")

    # Find true foci of the projected ellipse
    eccp = sqrt(ap^2 - bp^2) / ap
    P += pline([vpx0*eccp, vpx1*eccp], "#7f7")

    P.show(frame=frame, projection="perspective"
      if perspective else "orthographic")

```

Here's a screenshot:
[![3D ellipse](https://i.sstatic.net/uALH5.png)](https://i.sstatic.net/uALH5.png)

It's a bit hard to see what's going on in that screenshot. It's a lot easier in the [interactive 3D view](https://sagecell.sagemath.org/?z=eJylV9tu4zYQffdXDBSgK3vlrOx0E2MBA0W72LcARpqiFyNr0BJlcyGJLEU5dr6-wyFl07cWbRPD4WUuZ84Mh0wURTArpQFWAy9LoRoOooa7z_AdCNOA0vIbz4yQNcjaSDBrDr_9DqpkNe8B_vyqhTG8huUOZo8wfhL1CsbpeHSbfn87GpHILypnhud--eF29LEXRVGvV2hZQcXMGkSlpDagWS5Y3fQ2TMfvzLt-r3cDMwcAmMW0wZHU4HG8TVMP5I8UpoC6K1mzcoEmtdjG8SgB_KT9BBrFdMOnX1jZcLSqGhSfWOMUubVcipr7kHmdKylq06DAM7qhrYrtIEMGGJJTtaURquTQ8FXFrWDOC0SCcrEyTYKCpdT9TxS85qbVNZDFu9ztN-KNT1UnOHXi8J48dTLhVu8AlcCwOj9Pzgkle0gLK3WO68Cs1fMB2w2UtGzOkdMBtFAg360tCVx_8ZqfNXsltYC1AxYSmqGJM0YwxP1a2i2SuCgglwskuEYbPHcQnbOf3CJwlq0dTo8GXoUtnXPfzv_7KTRtFXtO247R6IYxFvUPcb0J5TBaUP1-mLRZr_cD-uOaZYYIrTD9Mc-yKYIyom5l2_xcipzrOMZ4RrbSDFeU3vQ2_ZgAKjGsFpzd9xM0zUq1Zhe0h6OJNTBJQxOhPmkvufkvymOnvWJV9T_UfXKmz7rlCRSaVf5AIXNcN8omYLNfYq2Ri5YOvj92LqerUi5ZeZRsWg8XsHT8uEd7DBdcJylwxLAsMQU0X-K8-VObmH0dwxCKr2OXP6UxbXGE21ECy37P1-2PrShz0NIwOjPUJzLuyp4yg-Z8D4pp7qxZ2oMdO3UbxGiwQ3O39bTFdd-Inp4SmLvKnNuGhJ-XxM_pGHSaCQwbLDA3CUUOq6H4y4v3tbvsy0oSWPJpbdAsNDwKsQz3IqSwV9_7ebvux9HlA-gmB9Phaih-RITFs_eFrtDfwAaHX9suhc9hk0tAarESdYI9iG19Il3nkbbZlqxa5gy2ye6TNR4PGRZmPxh0LWEymWChSMUyYXZ4WH0ZURPpOvccjzj-In2n_Tu6ub-_jwIV33Pm5Cd1V1DcDV9OOtEFNZQjTauGY3ZRLSAE7y9_d7tTst3ZTD0hce7CjGM2sKwbNLgc2FzYUdfsUNw2fOr3VjUIndlTbg_JwjNq9xGUoVjGAyU6EtFAtNKc1z4gB8w3ZjzSIb7rttOrtm8eiofjoDdcG3t6MfeZHO5nsqCb6UAJ3Za4JHRwTzTe0CP7JjWNN1v0utmO0JkNMqae2w0RS4D8cKvOOy3MTqR5fkD4KOrOsI1qswsMK_FhfLB9N6D5Ffte2dpfli0_pqCQmfhXARfpSV0MC1-VvhRGJ_vH22fwCtwsCFyXe4_ui3AYwOBt8Q-pulwkN6ALEA1J2P7aNlC0tX_s_J2ipkti2VA99c_yzFQCxtJQIMRFKTN6MG5FhW8F7cLtsr1AyfF1SSV8mbo0KyoF1VVQiqk1voRofJZizO5ex1JYsRU-JtmlGlpa0KMTKKK-BvruuuQx6BBMh3MUYL6zbSfKduwstTatYfldzgXe02p_RSu6o5f4pw8fMA8X6RhYFccJDa3_8OzPbpu1fI3d84O-k6DKp1HwFIn8YxDflsEq4sMjEuG_G2u50kytRRb1_wK9R9GX&lang=sage). This view is created using three.js, and responds to the usual OrbitControls: you can pan & rotate the camera using the mouse, use the mouse wheel to zoom. On a touch screen, one finger rotates, use two fingers to pan & zoom.

---

The script now allows you to easily set the frame off or on, and to choose between a perspective or orthographic camera. Also, you can edit the eccentricity and angle values by clicking on the number shown at the right of the slider.

> **Comments:**
> **username_3**: Thanks, @username_0! It's great fun being able to do that 3D stuff. And with SageMathCell I can do it all on my phone, although it's probably a Good Idea to use a desktop or laptop for longer programs. :) Sage uses matplotlib for 2D graphics, which is designed to be matlab-like. It uses three.js for the 3D stuff. It only exposes a tiny bit of the power of three.js, but it's a lot easier to use than working directly in three.js (plus I prefer writing Python to JavaScript).  
> **username_2**: ellipses stay as ellipses for both perspective and orthographic projections. I think astronomers are loath to use perspective but GUI's often default to perspective for "realism" so it's important to keep track of the distinction. Your math is for orthographic but your image shows perspective; the edges of the black bounding box are not parallel.  
> **username_2**: for python's matplotlib for example one used to have to [hack it](https://stackoverflow.com/a/23840781/3904031) to stop the perspective, but more recently they've [added an orthographic option](https://matplotlib.org/stable/users/prev_whats_new/whats_new_2.1.0.html#orthographic-projection-for-mplot3d)  
> **username_3**: @username_2 It definitely makes sense to use an orthographic view for this task, so I've updated the script to use it as the default, but you can select perspective if you want. I also added a toggle to turn the frame on & off (it's now off by default).  
> **username_3**: @username_2 The projection of the 3D ellipse to the XY plane is certainly an orthographic operation, but that doesn't affect the validity of the final rendered image. However, I do agree that it's useful to view this scene with an orthographic projection; OTOH, a perspective projection is more natural.  
> **username_3**: @username_2 BTW, I've just made a few more minor improvements to the script.  
> **username_2**: Cool, I'll give it a try tonight, thanks!  

---

### Answer by username_4 on 2021-04-10. Score: 3

Being masochistic, I guess, I took on this very endeavour “by hand” a few months ago, as I didn’t want to use “ready-made” solutions—the best way to understand something is to study its insides! Three major points come out:

* The projection of an ellipse is always an ellipse (or a circle, which is a special case of an ellipse)
* The only dimension in common between the true ellipse and the projected ellipse is the apsidal axis
* The *center* of both the true ellipse and the projected ellipse is the same—but *not* the foci!

To find the projected ellipse from the true ellipse, or vice versa, you have to build an auxiliary ellipse, the calculation of which is rather long and convoluted. If you want to be as “masochistic” as I am, I’ll be happy to share my results (inspired by Jeremy Tatum’s notes at [http://astrowww.phys.uvic.ca/~tatum/celmechs.html](http://astrowww.phys.uvic.ca/%7Etatum/celmechs.html) and Esmat Bekir’s article at <https://dergipark.org.tr/tr/download/article-file/568547>).

> **Comments:**
> **username_3**: If we rotate around the minor axis, the projected major axis shrinks.  
> **username_4**: @username_3: You are right! My mistake, sorry! I have edited my answer; it is the apsidal axis that remains the same.  

---

