1D Collision Simulator

Category:
Experimental, Python
DATE:

A simplistic 1D collision simulator based on the law of conservation of momentum and the transfer of kinetic energy.

Simple 1D simulations of two or more objects colliding with each other. The user may control the program using the following controls:

  • Space can be used to pause and unpause the simulation.
  • R resets the simulation entirely.
  • Pressing P will bring up a menu in the console, where the user can change statistics such as the coefficient of restitution, the presence of walls or text above objects, and also add in new objects.
  • Clicking an object will bring up its statistics, including mass, size, x position, and velocity. Any of these can be edited, and the object can be removed as well through this menu.

When an edit is done to the simulation from its initial state (after R is pressed), then that new setup becomes the simulation's initial state. However, if an edit is done mid-simulation, then that edit is not preserved if the simulation is brought back to its initial state.

Image: Flaticon