Dylan-B-Johnson / particle-simulator

2D Elastic Collision Particle Simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

2D Elastic Collision Particle Simulator

License:Apache License 2.0


Languages

Language:Python 100.0%