I'm working on a way of simulating orbits for a video game I'm making. It works by taking the apoapsis, periapsis and current distance and calculating from there the velocity, radial velocity, period etc. There are no vectors involved, as no 2D space is being simulated - only the numbers themselves. The simulation works well with the orbit put on rails, but I run into problems as soon as I change the orbital velocity, because I then need to re-calculate the apoapsis and periapsis based on this change.

I've tried a few methods, but they don't seem to be working due to the lack of vectors, which they all use. What's the correct way of doing this? If we say that I'm orbiting an object where mu is 10,000, my current distance from the object is 500 metres, the apoapsis is 700 metres, the periapsis is 300 metres and I accelerate by 20 m/s, what would be new apoapsis and periapsis be? Bearing in mind that this is intended for programming use so any pseudocode would also be appreciated.

  • $\begingroup$ Does it matter to you (it does in real world) where in the orbital position of what is by your description an elliptical orbit the orbit rising Hohmann transfer burn takes place, and for how long? If it doesn't and you're OK with approximation, then I'd suggest working with semi-major axis (r + 500 m in your case) and deriving a simple algorithm to compute for new altitude with new orbital speed using vis-viva. Would that work for you? $\endgroup$ – TildalWave Jun 30 '14 at 14:53
  • 2
    $\begingroup$ You say that you accelerate 20 m/s, but this isn't enough information to solve the problem. You need to know the direction, relative to the orbital direction, and relative to the direction of the planet. You can call that a "vector" or not, but you can only truly reduce the independent degrees of freedom so-much. $\endgroup$ – AlanSE Jun 30 '14 at 15:12
  • $\begingroup$ Please read Battin's book ("An introduction to the mathematics and methods of astrodynamics"); reinventing the bicycle is a good thing once you know an existing workable design. $\endgroup$ – Deer Hunter Jun 30 '14 at 17:37
  • 5
    $\begingroup$ "There are no vectors involved, as no 2D space is being simulated - only the numbers themselves". Then you're stuck. You have boxed yourself into a representation scheme that won't let you solve the problem. Let's take your example: First off, acceleration has units of length/time². I presume you meant an impulsive change in velocity, or Δv for short. In which direction? Along the velocity vector, against it, or in some other direction? Did this Δv occur while approaching apoapsis or periapsis? $\endgroup$ – David Hammen Jul 1 '14 at 0:43
  • $\begingroup$ Consider a point object of infinitessimal mass in relation to a point body about which an orbital state is to be determined. Given the mass of the body, distance between the centers of mass of object and body, and components of the object's velocity (1) along the line connecting the centers of mass and (2) perpendicular to that line, it should be possible to determine if the object is in an orbital trajectory vs escape trajectory and if in orbit, compute period, periapsis and apoapsis, and relationship between the object's current position and the points of periapsis/apoapsis. $\endgroup$ – Anthony X Jul 1 '14 at 14:08

It would really help you to represent this as a 3-d vector. It makes the math much simpler, and it allows for some interesting effects. I would translate this in game to the simplier representation of the maximum altitude, etc.

Given a position and velocity vector, one could calculate the TLE elements from this. You simply find the position and velocity at the time, add the new velocity component, and then re-calculate. We already have an excellent answer that shows how to convert position and velocity to the orbital elements.

If you want to simplify this, you could assume a 0 inclination orbit, which allows you to use a 2-d vector, and assume that all propulsion is either prograde or retrograde, adding or taking away from the velocity.

Good luck!

  • $\begingroup$ That excellent answer is excellent - thanks for adding the link! $\endgroup$ – uhoh Dec 27 '15 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.