Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gravity

Building

To get started, clone this repository with all the submodules:

git clone --recurse-submodules https://github.com/f01zy/Gravity gravity && cd gravity

If you have NixOS then run the nix-shell to load wayland, X11 and OpenGL dependencies:

nix-shell

And now build the project:

mkdir build && cd build
cmake ..
cmake --build .

Usage

To launch the simulation with a custom body, pass the initial parameters as command-line arguments:

./gravity <x y z> <vx vy vz> <mass> <radius> ...
  • x, y, z - Initial position coordinates (float).
  • vx, vy, vz - Initial velocity vector (float).
  • mass - Object mass (double, > 0).
  • radius - Physical radius of the body (double, > 0).

For example, a scene with Earth and the Moon:

./Debug/gravity 0.0 0.0 0.0 0.0 0.0 0.0 5.972e24 6371000 0.0 0.0 384400000.0 1018.0 0.0 0.0 7.35e22 1737500

Preview

preview

About

Gravity simulation, written in OpenGL

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages