Monday, March 25, 2019

gravity - Calculating Orbital Vectors in the Future


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μ(1e2) (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)=EesinE

  • 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

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...