/pyGravity

Simple Python implementation of gravity simulation for PocketCosmos App aka PlanetAppV2

Primary LanguagePython

PyGravity

Some experimental gravity engines using Newton's formula to calculate forces between bodies.

The intention of this code is NOT to use it in prduction as python is not knwon for doing such calculation in a fast manner. It was rather written to understand the underlying algorithms and to have a working sketch for transposing into a more performant language, namely C.

Currently implemented:

More links!

Installation

Requirements and module itself:

pip install -r requirements.txt
python setup.py install

CyGravity

Cythonzied versions of PyGravity engine(s). Runs much faster due to static typing and less calls into python. Still not really production capable but rather easy to write.

Pygame visuals

Simple visualization using pygame for Barnes-Hut, run after installation:

pygravity

...or much faster...

cygravity
  • LEFT CLICK more bodies
  • RIGHT CLICK show Barnes-Hut tree