Skip to content

qb40/gravity-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Particle gravity simulation with velocity colored traces in DOS.

Particles are randomly created (random initial mass, position and velocity) for the simulation, based on supplied statistics. Simulation is performed by calculation acceleration of all particicles in a given situation using Newton's law of universal gravitation. The new position and velocity of particles is calculated based on this acceleration for a small time value. This process is repeated again and again.

Simulation of gravity is interesting in that even simple simulations like these show how the solar system, and its planets might have formed. The movement trace of the particles is indeed both wierd and elegant. The number of particles used in the simulation can be changed, but as expected it will slow down the simulation. Also the particles which move too close to each other afre assumed to collide 100% inelastically. The net momentum of the particles is conserved.



Gravity Simulation configuration menu.


Particle count is the initial number of particles.
Gravity factor is the strength factor of gravity.
Time delta is the time difference between each simulation iteration.
Matter density is used to determine the size of particles for given mass.
Max. velocity is the maximum possible velocity of particles.
Max. range is the maximum possible position difference between particles.
Max. mass is the maximum possible mass of particles.
controls
WASD - camera move
QE - camera zoom






Simulation results.

qb40