I am trying to plot an orbit and am having some success. I have directly calculated the orbital parameters so I am able to plot the ellipse. I am also plotting a path of the orbit as a sanity check. The ellipse from orbital parameters is red and the sanity check is white.
When I only apply tangential velocity such that
vp.x=0, things match up exactly.
However, when I add some radial velocity, such that
vp.x>0, I have a bit of an issue. It rotates correctly with the "Argument of Periapsis" and maintains the same shape but I need to shift the ellipse to match what I should be getting in white.
Can anyone advise how to calculate the x and y shift required so the red ellipse matches the white?
I am making use of the code shown in the following question and answer to calculate orbital parameters so I can plot the orbital ellipse (in red).