Skip to content

ycatsh/physics-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Physics Simulation

Modelling and simulating physics via C++ and Python to explore and better understand the beauty of the physical world.


N-body Simulation

Approximating Gravity in C++ using the Barnes-Hut Algorithm. Using Quadtrees, gravity for far off clusters of particles that are close together are grouped and treated like bigger particles for which gravity is applied (just an approximation). This allows for O(N logN) time complexity making the simulation viable for huge number of particles.

Run

  1. The simulation is currently under development, however you can still run N-body Simulation/bin/main.exe to view the progress


Projectile Motion

Projectile motion is a type of motion that occurs when an object moves in a gravitational field. In this simulation, a particle's trajectory is modeled based on user-defined attributes. These attributes determine the behavior of the ball during its motion. The simulation calculates the ball's trajectory at intervals of 0.2 seconds slowing the simulation for better visibility.

Run

  1. In Projectile Motion/ run pip3 install -r requirements.txt to install the dependencies
  2. To start the simulation run the python file main.py with: python3 main.py <initial_speed> <acceleration_due_to_gravity> <angle_of_projection>

Note: It's pip and python on windows systems