I'm trying to make an orbit simulator, and I want to draw the orbit of a satellite given its position and velocity vectors in a 2-D plane. I found this other question which tells how to calculate eccentricity and semimajor axis, but how do I figure out the orientation of the major axis (if e > 0)?
-
$\begingroup$ At some point you just want to either compute or look-up the closed form solution. See any upper-division or graduate mechanics text. From there it should be pretty clear how to proceed as you can find the angular dependence of the radial velocity and radial distance. $\endgroup$– dmckee --- ex-moderator kittenCommented Sep 22, 2013 at 14:50
-
$\begingroup$ I found a couple of pdf files on orbital mechanics, the problem is that when they mention an angle, I'm not sure if it's the same angle as the one I'm talking about. $\endgroup$– Jason SCommented Sep 22, 2013 at 14:51
-
$\begingroup$ ...and I don't have a textbook. (not taking a class or anything, just fooling around with HTML5 animation and differential equation solving) $\endgroup$– Jason SCommented Sep 22, 2013 at 14:52
-
$\begingroup$ So is there a conventional term for what I'm looking for? If I knew what it was called, I could look it up. $\endgroup$– Jason SCommented Sep 22, 2013 at 14:56
-
$\begingroup$ Is it "argument of periapsis"? en.wikipedia.org/wiki/Orbital_parameters $\endgroup$– Jason SCommented Sep 22, 2013 at 14:59
1 Answer
ah, I found it -- what I really want to calculate is the eccentricity vector.
This lecture notes also helped. I just tried implementing it in Javascript and it worked correctly on the first try! :-)
Here's what worked for me:
$$ \begin{eqnarray} \vec{h} &=& \vec{r} \times \vec{v} \\ \mu\vec{e} &=& \vec{v} \times \vec{h} - \frac{\mu}{r}\vec{r} \\ \vec{r}_{orbit}(\theta) &=& \frac{|h|^2 \hat{u}(\theta)}{\mu + \mu\vec{e}\cdot\hat{u}(\theta) } \end{eqnarray}$$
where $\vec{h}$ is the angular momentum, $\mu \vec{e}$ is the Laplace vector ($\mu = MG$, and $\vec{e}$ is the eccentricity vector), and $\hat{u}(\theta) = \hat{u}_x \cos \theta + \hat{u}_y \sin \theta$ is the unit vector in the orbital plane, as a function of $\theta$, which represents the angle in polar coordinates used to draw the orbit.