Skip to content

How to choose the parameters for a collision free comet trajectory

An answer to this question on the Scientific Computing Stack Exchange.

Question

I implemented a simple simulation of a comet flying through space being deflected by the gravity of randomly generated planets for art purposes. My problem with that simulation is, that there are many "boring" simulations in which the comet instantly collides with a planet or is deflected to leave the viewport without an interesting trajectory.

Is there an efficient way to compute the initial values (gravitiy of the planets and initial velocity of the comet) for a simulation, in which the comet does not collide (early) with planets and possibly has an interesting trajectory (being deflected more often, slingshots, etc.)?

As I want to use it for art, there is no problem if the algorithm has constraints like only working for integer valued planet gravity or similar restrictions.

My current approach is using brute-force by simulating sets of parameters until I get an acceptable trajectory, which is rather slow.

Things I probably need (please comment to suggest others):

  • Points the comet should not cross (i.e planets)
  • Points with a specified velocity (e.g. near planets to deflect the trajectory from a collision course)
  • Maybe way points to guide the trajectory

The parameters should not be arbitrary (the comet does not have a motor), but boundary conditions for choosing planet gravity and the initial velocity of the comet. If it's useful, the comet's mass can be chosen as well. Currently I assume the comet to be massless, which probably approximates the reality quite good.

Answer

You're trying to solve the n-body problem, which has some known approximations that can be used to accelerate computation; however, it's still unclear how you can turn these into artistically interesting orbits.

Some thoughts:

Place the comet near the edge of one of your planet's hill spheres with a velocity just slightly above the planet's escape velocity and, possibly, near, but under, your solar system's escape velocity. This will give you a comet with a relatively stable orbit capable of traversing, and being perturbed by, most of the system.

Alternatively, you could set up an Hohmann transfer orbit between two planets in your system, but perturb the velocity so that your comet "misses" the intended orbit.

For more complex patterns, you could figure out how to use the General Mission Analysis Tool to multi-planet assists. You could also look into the Interplanetary Transport Network.