/particle-simulator

2D Elastic Collision Particle Simulator

Primary LanguagePythonApache License 2.0Apache-2.0

2D Elastic Collision Particle Simulator

All collisions are elastic and conserve kenetic energy and momentum. Particles deflect off of the walls of the screen accurately. Increasing the raddius of a particle also increases its mass (proportional to the radius squared).

To Use:

  • Run the evolve.py file.

  • Set the n variable to the number of bodies you want to simulate.

  • Set the act.h variable to the simulation step size.

  • Set the screen_width, screen_height variables to your resolution.

Controls:

  • Pressing the w/s keys (while mousing over circle) increases/decreases the circle's radius.

  • Pressing the a/d keys (while mousing over circle) decreases/increases the circle's speed.

  • Pressing the up arrow/down arrow keys increases/decreases all of the circles' radii.

  • Pressing the left arrow/right arrow keys decreases/increases all of the circles' speeds.

  • Pressing the q/e keys decreases/increases the time-step size of the simulation.