Ok a few things on trajectories of celestial bodies. It is nearly impossible to compute systems with serveral bodies influencing each other. Your only option is to simulate the system **UNLESS** you simplify the problem to a simple **two-body-** or **one-body-problem**s.

Kerbal Space Program does the latter. It uses **spheres of influence** (SOI)](Sphere of influence - Kerbal Space Program Wiki) for planets which indicates how far a certain body attracts others. Read: Patched Conic Approximation.

So for example if a spaceship is in earth’s SOI, you only have to calculate spaceship to earth attraction which can be solved using kepler orbit equations given an initial state.. As soon as you leave earth’s SOI, you take the next bigger SOI, which would be the sun. If you fly into moon’s SOI however, you would take moon’s SOI and completely ignore equations with the earth.

The only thing you have to consider, is inheriting velocities. So every object that is orbiting around earth, has to inherit earth’s orbit velocity around the sun. Objects orbiting moon, would have to inherit moon’s velocity around earth (and moon has to inherit earth’s velocity around the sun).

So you have to do a bit of orbit transformation when you enter/leave SOI’s. Also SOI priorities are needed to make it easier to check which is current SOI if you are in serveral SOI’s (example moon and earth).

On top of that, I believe that Kerbal Space Program calculates their orbits using Apsis which allows to store orbit information in 2 points (Apoapsis and Periapsis + Velocities at those points + time at which the object reaches those points). This allows you to pretty much derive every position of this object for every given time.

As far as visualization goes, I would go for splines, since they give you the most reliable outcome.

**TL;DR**:

- give every planet a sphere of influence
- only calculate orbit for objects in the SOI and ingore all other objects
- objects orbiting other objects have to inherit their velocities to make a working star system
- Calculate trajectory using kepler’s planetary motion equations.

That said, I played the **** out of KSP and loved it I actually went to implement my star system because of KSP. But I didn’t bother with drawing predicted trajectories, because I knew it would take quite a bit of time and work to get this right, but I guess I have the theory down nonetheless.