Skip to content

A simulation of the newtonian n-body problem, GUI made with Raylib

Notifications You must be signed in to change notification settings

pedropesserl/nbody

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simulation of the newtonian n-body problem, GUI made with Raylib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published