Elliptical orbits

The orbiting bodies are pulled toward the middle of the stationary body according to Newton's law of gravitation - the acceleration toward the stationary body is proportional to the product of the masses and inversely proportional to the square of the distance between them. This example also uses vector reflection to bounce small bodies off the surface of the large one.

Planets.java

Circle.java

Vec2.java