# Apparent Centering Problem When Using the Perifocal System to Draw Orbital Ellipses

I am attempting to render orbital ellipses in software. Given a set of orbital elements, I am using the Perifocal system to determine a set of points along the curve of the ellipse. I am using the equation:

r = r cos(v) P + r sin(v) Q,

where v is the angle, P and Q are the perifocal vectors correspondent to I and J, and r is the polar equation of the conic:

r = p / 1 + e cos(v),

where p is the semi-latus rectum, e is eccentricity, and v, in both equations, is the angle.

I am determining the vectors P and Q using the following equations:

Pi =   cos (lan) cos (aop) - sin (lan) cos (inc) sin (aop)
Pj =   sin (lan) cos (aop) + cos (lan) cos (inc) sin (aop)
Pk =   sin (inc) cos (aop)

Qi = - cos (lan) sin (aop) - sin (lan) cos (inc) cos (aop)
Qj = - sin (lan) sin (aop) + cos (lan) cos (inc) cos (aop)
Qk =   sin (inc) cos (aop)



where lan is the Longitude of Ascending Node, aop is the Argument of Periapsis, and inc is the inclination.

This process yields the correct ellipse! However, the ellipse does not seem to be centered correctly on its focus; the focus appears to be far too close to the center of the ellipse. Here is an example:

You can see that these two highly eccentric ellipses have their shared center of mass at their centers - not at their respective foci.

Is there some step in my process that I'm missing? I could just apply an offset to the ellipses, but that would be a hack, I want to solve the problem.

Any help is appreciated! Thank you!

QUESTION EDITS AND CLARIFICATIONS:

This image is taken from a vantage point nearly normal to the orbital plane; there is almost no perspective here.

Second, a helpful user has pointed out an issue in the equation for Pk. The correct expression is:

Pk = sin (inc) sin (aop)

Unfortunately, this was correct in my code - so while the correction was a good one, it was not the source of my problems.

• Perhaps have a look at answers to Why does Earth not appear to be at the focus of TESS' elliptical orbit in this video? and then see if this is what's happening here. The answer there is related to projection and viewing at an angle. The quickest way to check here would be for you to adjust your view direction so that it looks straight down along the normal to the orbital plane. btw it is certainly okay to post an answer to your own question in Stack Exchange if you figure it out!
– uhoh
Aug 18 '20 at 22:37
• @uhoh - this is a really good insight, but in the software, I am able to maneuver the camera about freely, and can assume a normal view of the orbital plane. This view, while at a slight perspective, is actually pretty close to normal. Perspective is unfortunately not the issue Aug 18 '20 at 23:55
• @uhoh updated question Aug 19 '20 at 0:07
• Looks great, thanks!
– uhoh
Aug 19 '20 at 0:10

According the definition of the Perifocal Frame on wikipedia, the equation of Pk needs an adjustment. I am not sure if that is the source of the error you observe through.

Pk = sin (inc) cos (aop)

Wikipedia says:

Pk = sin (inc) sin (aop)

• Ah, really good eye. In my code, I actually have this the correct way - in writing my post here on SE, I wrote it incorrectly. So unfortunately it isn't the source of my issue. Though it certainly would be the source of AN issue, if it was what my code looked like. Aug 18 '20 at 23:52
• @uhoh updated question Aug 19 '20 at 0:07

I solved the issue.

Everything I posted in the OP was correct; I made a simple, stupid sign error when transcribing the expressions into code.

It should also be noted that in the OP, the expression for Pk is wrong. The correct expression is

Pk = sin (inc) sin (aop)

Just in case anybody is trying to pull this off themselves!

Thanks for the ideas everyone!

Correct Orbits: