A Simple Gravity Model

Another experiment with processing I did in the last 2 days. This time it is an interactive visualization of newton’s law of gravity applied over a bunch of objects. It is a simple demonstration of the gravity model showing the force between objects based on their mass and distance. Orange dots depict an object with mass equivalent to their area and the white line drawn between them shows the force between two objects. Though it is not a perfectly detailed model, the results are quite stunning visually when there is a large number of objects with distinct clusters. The instructions are as below,

  • Click the canvas to add an object.
  • Click a existing objectto select it
  • Click and drag an existing object to move it around the canvas
  • When selected, the size of an object can be increased or decreased by pressing ‘+’ and ‘-‘ key in the keyboard
  • Objects can be deselected by pressing ‘d’ key
  • The whole sketch can be reset with the ‘r’ key.

You can click the image to go to the interactive demo or follow the link here: http://balaspa.50webs.com/processing/gravity/

One thought on “A Simple Gravity Model”

Leave a Reply