For the 2D space simulator that I am writing (please note, it is not at all homework), I require formulas that will give me the location and velocity of a spaceship, relative to the parent celestial body, at a specific time in the future.
There is only one planetary mass that provides a gravitational attraction for the spaceship, and the spaceship's mass is negligible. From the initial →r and →v relative to the planet, I already know how to compute many things, such as:
- standard gravitation parameter μ=GM
- eccentricity e
- specific angular momentum h
- semi-major axis a=h2μ(1−e2) (is this even correct?)
- longitude of periapsis ϖ
- eccentric anomoly E from true anomaly θ (an angle the describes an offset from ϖ), and vice versa
So using all these values, or possible more (or less), what formulas can I use to compute the position and velocity in t seconds? I have already tried using the following formulas to compute the position in the future:
- mean anomaly M(E)=E−esinE
- mean anomaly at periapsis M0=M(E=θ=0)
- mean anomaly at a certain time M(t)=M0+t√μa3
However, those formulas don't work for certain orbits (such as hyperbolic orbits, where a<0). Also, I may have just programmed the formulas incorrectly, but using mean anomaly, my simulator does not correctly determine position in the future.
So, I have already tried several approaches to computing position and velocity in the future, and they didn't work. What are the correct formulas?
Thanks!
No comments:
Post a Comment