A famous problem in the field of classical mechanics is the three-body problem: what are the motions of three objects under the influence of gravity? For example, what is the motion of the Sun, Earth, and Moon system? It turns out that the three-body problem can’t be solved analytically except in special cases so has to be simulated.

That simulation can take an infinite variety of forms but the form chosen here highlights the space between the planets and their configuration rather than their orbits, as are typically visualized. The resulting work seems to be a glitch version of op-art, with the patterning resulting from the finite resolution of the screen and the way in which lines are drawn on pixellated surfaces.

This project uses a very simple simulator of motion (written in Processing) of three bodies moving on a torus. (I chose a torus so that the bodies wrap around from top to bottom and left to right instead of heading off to infinity.) Instead of showing the positions of the bodies, the three points are drawn as a triangle and the triangle is superimposed on the previous triangles to build an ever-developing image. Furthermore, the triangles are drawn as the difference in color between the new triangle and the background image, to give lots of very interesting optical effects as the bodies gravitate around each other.

You can see a single run of the code in the video below.

You can download the code at: https://github.com/physicsdavid/threebody