# Kepler orbit : get position on the orbit over time

I'm developing a space-simulation related game, and I am having some trouble implementing the movement of binary stars, like this:

The two stars orbit their centroid, and their trajectories are ellipses.

I basically know how to determine the angular velocity at any position, but not the angular velocity over time. So, for a given angle, I can very easily compute the stars position (cf. http://en.wikipedia.org/wiki/Orbit_equation).

I'd want to get the stars position over time. The parametric equations of the ellipse works but doesn't give the correct speed : { X(t) = a×cos(t) ; Y(t) = b×sin(t) }.

Is it possible, and how can it be done?

• It could be done by simulating gravity which is fairly simple (add a force dependent on the mass * sqrt( distance ) and do simple physics) – Elva Apr 14 '11 at 13:18
• No don't do simple physics! Orbits are numerically unstable and everything will implode or explode. – Jonas Bötel Apr 14 '11 at 14:46