Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.22 KB

README.md

File metadata and controls

42 lines (27 loc) · 1.22 KB

nbody

This is a simulation of the n-body problem in physics. It is written in C and it uses the library Raylib for the GUI.

Quick Start

Install Raylib

Compile

$ git clone https://github.com/pedropesserl/nbody.git
$ make

Usage

  • $ ./nbody - Make an empty space and fill it with bodies by clicking the screen.

  • $ ./nbody -n <number_of_bodies> - Pre-fill the space with bodies by writing the data about them in stdin: mass, density, position (x), position (y), velocity (x), velocity (y).

Note: Mass and density must be greater than zero. The radius of each body is calculated as the cube root of its volume (mass/density), to emulate the square-cube law.

Keyboard shortcuts

  • Play/pause simulation
  • a Toggle arrows
  • t Toggle trails
  • Rewind
  • Fast forward

Sources