2D Particle Collision Simulation
This is just a fun project exploring the physics simulations.
A limited capability 2D particle collision simulator.
Modeling of particle collisions in a 2D space under the following assumptions:
- Perfectly Elastic Collisions
- The box has infinite mass
- Particles have no acceleration
- The number of particles have to be kept <= 20 to keep the simulation smooth,
since the current collision checking is a brute force method and takes O(n^2) time.
- Only round particles has been modeled as other geometries are complex to model.
- Annealing is not accounted for , sometimes the particles are able to escape the box between 2 update steps, so be it.
- Models the box which contains the particles.
- Models the basic properties of particle
- Derived from BaseParticle , models a round particle
- Generates the values for a creating a particle with random position, velocity , mass and color.
- Models the collision dynamics of the particles in a 2D space.
- Generates the visual output of the collision using OpenCV .
- Handles the creation of simulation entities and manages the simulation loop
apt install libeigen3-dev
apt install libopencv-dev
Building and Running
cd ParticleSimulator mkdir build cd build cmake .. make # running ./simulator