Exploring OpenGL and Vispy through Bubble Interactions
Explore the docs »
Report Bug
•
Request Feature
The "Bubble" project is more than a mere simulation; it's an experimental foray into OpenGL and Vispy, aiming to create a visually appealing interaction of bubbles in a 2D space. The physical concepts in this simulation are largely approximated, serving as a learning and exploration platform rather than a precise physical simulation.
The bubbles interact through a simplified physics model, where collisions can result in bubbles splitting based on an approximated energy transfer model. This approach, while not physically accurate, provides an interesting and aesthetically pleasing visual display of interacting bubbles, offering a foundation upon which further refinements and features can be built.
- Python 3.x
- pip
- Clone the repository:
git clone https://github.com/VictorGoubet/Bubble cd Bubble
- Set up a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
- Run the simulation:
python3 simulation.py
Several hyperparameters govern the behavior and visual appearance of the simulation and bubbles:
n
: Number of bubbles in the simulation.width
&height
: Width and height of the simulation window.min_radius
&max_radius
: Minimum and maximum allowable radii for the bubbles.max_speed
: Maximum allowable speed for the bubbles.mode
: Interaction mode ("split", "merge", "overlap", or "bounce").
density
: Density of the bubbles, affecting their weight.max_speed
: Maximum speed of a bubble.
In the context of a collision, kinetic energy is transferred between bubbles. Each bubble has a resistance, and if the energy transferred surpasses this resistance, the bubble "breaks", splitting into two smaller bubbles. New properties (e.g., radius, position, and speed) for the resulting bubbles are calculated, maintaining a semblance of energy conservation in the system.
- Bubble Merging: Implement a "merge" mode, where bubbles coalesce like water bubbles, forming larger structures instead of splitting.
Victor Goubet - LinkedIn - victorgoubet@orange.fr