This project simulates a 3D elastic collision between balls inside a closed box conserving the kinetic energy.
These instructions will get you a copy of the project and it's dependencies. As well as how to run it on your local system.
You will need to install:
- Git
- Python 3.6+
- PyOpenGL
On Linux:
sudo apt install python3-pip (If You don't have pip installed)
pip3 install pyopengl
sudo apt-get install freeglut3-dev
On Windows:
Download PyOpenGL Windows
And then:
pip install path-to-the-whl-file-that-you-downloaded
Clone the repository:
git clone https://github.com/MatheusBurda/BallCollision.git
Linux:
pyhton3 BallCollision.py
Windows:
py BallCollision.py
Optional arguments:
usage: BallCollision.py [-h] [--width WIDTH] [--height HEIGHT]
[-n NUM_BALLS] [-r RADIUS] [-v MAX_VELOCITY]
[--no-color] [-s SIZE]
optional arguments:
-h, --help show this help message and exit
--width WIDTH screen width. Defaults to 800
--height HEIGHT screen height. Defaults to 600
-n NUM_BALLS, --num-balls NUM_BALLS
amount of balls used in the simulation. Defaults to 15
-r RADIUS, --radius RADIUS
radius of balls. Defaults to 0.45
-v MAX_VELOCITY, --max-velocity MAX_VELOCITY
max velocity allowed. Defaults to 0.005
--no-color toggle colored balls off
-s SIZE, --size SIZE size of the cube that contains the balls. Defaults to 4
A window should pop up with the simulation.
To stop the simulation just close the window.
- Matheus Burda - start to end
- Vinícius Couto - FPS counter and argument parser
This project is licensed under the MIT License - see the LICENSE.md file for details