# Calculate Argument of periapsis of orbit given focus and two points on ellipse

Given that I know the coordinates of one focus (the central body) and two points on the orbit (two vectors) how do I calculate the argument of periapsis? And Longitude of the ascending node as well? All of this in 3D space. The reference plane is the plane z = 0 and the reference direction is the x-axis.

What I want to accomplish is to draw the ellipse in 3D and for that, I need the Keplerian elements. I have followed the direction on Lambert's Problem to calculate the semi-major axis and eccentricity. From my own geometry knowledge, I have calculated the inclination. The remaining ones are the Longitude of the ascending nodeand the Argument of periapsis both of which I have tried to find a way to calculate but to no success. Both of them seem to require a vector pointing to the ascending node and one of them requires a vector pointing to the periapsis. It's here where I'm getting stuck on how to calculate those two vectors given just two points on the ellipse (and not a position and velocity).

From comment:

Yes, I do know the travel time and the mass of the central body. I know basically everything except the argument of periapsis and the longitude of the ascending node.

Clarification: Velocity vectors at the two points are also unknown.

• Of course, you are so true ;-) – Hugo Gransträm Jul 22 '19 at 16:28
• Do you also have time stamps at the known positions? I've done some (more) analysis and realized that there is not a unique solution based on positions alone. You need the time stamps to determine how fast you have to orbit and thus how much gravity is acting before you can pinpoint the ellipse. – Oscar Lanzi Jul 29 '19 at 13:25
• Yes, I do know the travel time and the mass of the central body. I know basically everything except the argument of periapsis and the longitude of the ascending node. I guess there could still exist multiple solutions but they should be lower in number now ;-) – Hugo Gransträm Jul 30 '19 at 17:39
• @HugoGransträm I've moved your response back into the question. Since many readers will skip the comments it's always best to edit and include all relevant information back into the original post. Please have a look and feel free to adjust the wording. Thanks! – uhoh Jul 30 '19 at 21:50
• @OscarLanzi I've added a bounty... – uhoh Jul 31 '19 at 3:24

Ok since you know everything except those two parameters, you should be able to calculate either of your two position vectors into your orbit-fixed frame. What this allows you to do is solve for elements within your direction cosine matrix relating the orbit and the inertial frame (which is what I assume your two position vectors are in). How you do that is as followed:

1. Calculate the velocity vector at a specific point where you are given your position vector.
2. From your velocity and position vector, you can calculate your angular momentum vector which is given by h = r x v. After normalizing your angular momentum vector, you can construct a PART of your DCM, but do not worry, since you do not need that much information to extract the information you need.

Expanding upon step two: The DCM relating the orbit and inertial frames are given by a body-two 3-1-3 sequence (http://www.dept.aoe.vt.edu/~cdhall/courses/aoe4140/kinem.pdf page 3-9). The columns of the DCM are defined in your orbit frame (r_hat, theta_hat, h_hat) in Cartesian coordinates. By definition from a 3-1-3, you can geometrically discern that this is associated with with the orbital parameters of RAAN, inclination, and the third angle is the true anomaly minus the argument of periapsis. This will then lead to the following expression in the third column. From here you can calculate the RAAN from elements 1 and 2. NOTE: MAKE SURE TO CALCULATE BOTH AND CONFIRM. ARCSIN AND ARCCOS ARE DOUBLE VALUED.

In order to get argument of periapsis, you can look at the rest of your DCM and see that the most trivial way to get that is by using elements (3,1) and (3,2) as shown below: As I mentioned previously, the columns are defined by your orbit frame represented in Cartesian coordinates. You know your r vector in inertial coordinates already, and you can normalize it to get r_hat, then take the cross product of h_hat and r_hat to find theta_hat, since the orbit frame is orthonormal. And similarly to the RAAN, you can solve for theta (and noting the double-value of these trig functions). Subtracting the true anomaly from the solved for theta will yield your argument of periapsis.

• Thank you for the thorough answer :-) maybe a dumb question but how would I calculate the velocity vector at my positions? – Hugo Gransträm Jul 31 '19 at 14:56
• @HugoGransträm Not a dumb question at all... I do not know off the top of my head to be honest, I thought you had that information easily accessible. Give me some time and I will update my answer. – aaastro Jul 31 '19 at 18:53
• I wasn't really clear about it 😅. I appreciate the effort you are putting down ;-) – Hugo Gransträm Jul 31 '19 at 19:28
• @HugoGransträm Do you have the magnitude of the angular momentum? If so you can calculate the flight path angle of the spacecraft at a particular point and find the velocity vector in the orbit frame and then convert to cartesian coordinates. – aaastro Aug 6 '19 at 14:49
• @HugoGransträm I do not know what you meant by arbitrary, but the angular momentum magnitude should be easy to solve for. Since you know the energy of the orbit and the perigee distance, you can find the velocity magnitude at perigee using vis-viva. You also know that at perigee, your flight path angle is 0 degrees, so you can use the equation h = rv cos(gamma) to find your h magnitude. Gamma is the flight path angle.(It will reduce down to h = rv). – aaastro Aug 7 '19 at 13:24