Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


C++/Qt5 rewriting of Gravastre-2.0.

Main idea

Gravastre is a gravitationnal simulation where all agents (named Astres) interacts, no matter there distance or their mass. The Qt interface allow user to see and play with the simulation during the computations.


First, you will have to generate the builder Makefile:


(on some systems, qmake-qt5 replace qmake. On failure, detect which is the correct typo and modify the Makefile accordingly)

Then, go to build dir, build the project and launch it:

cd build

It's also possible to launch gravastre using a system defined in JSON file:

./gravastre mysystem.json

Take a look to data/ directory for JSON file example.


Currently, some interactions are implemented:

  • Mouse:
    • left click: create a new unamed astre (hold to define an initial speed)
    • right click: translation of the view (not properly working)
    • mouse wheel: zoom
  • Keyboard:
    • i/e: decrease or increase mass of next created astres
    • d: clear all universe
    • a/u: decrease or increase the new astre initial speed sensitivity
    • p: pausing simulation
    • space: recenter to and track the selected astre

After playing, you may want to take a look to:

  • main.cpp, where the initial system is defined
  • converters.h, where some constants including collision presence, pixel per UA and simulation speed are defined

You can also define your own systems using the JSON format. See data/ and usage.


  • complete and personalisable simulation
  • JSON configuration of systems
  • System: specify speed as double, not pair of double, and randomly place in orbit the subsystems
  • System,JSON: allow specifying an excentricity for the orbit, or any combination of valid parameters
  • zoom and translation in the world using the mouse
  • astre selection
  • config file for systems
  • options: show trajectory of selected Astre as an ellipse
  • astre realistic radius
  • player handling
  • token for replace astre when too far
  • creation of an Astre trajectory knowing (all?) Astres
  • print astre name when mouse over it (or its token)
  • config file for constants (+option for using hard-coded ones)
  • save systems
  • provides GUI for generation of systems
  • provides GUI for generating SPARQL queries and produce resulting systems
  • informations about selected astre in a dedicated widget: name, mass, orbit trajectory, link to wikipedia


See the converters.h header for units definitions and constants. Units used by the Astre class are real units ; conversions to non real units is done dynamically, when needed by the computations.

All positions and distances are given in Astronomical Unit. The reference, optionally shown as a white rectangle, is placed at (0;0).

Speeds are in meter per second.

Adapting the simulation

Function to the system you want to seek, you could want to modify values found in the options file.

By default, these values works well with a representation of the telluric planets of the solar system, but for other systems like TRAPPIST-1, you could want to tweak some values a little.

  • PIXEL_PER_AU: number of pixel in one astromical unit. Increase it for a larger world.
  • SIMULATION_SPEED: number of second passing between each computation step.
  • COLLISION: if set to true, when two astres collides (this is based on their radius), the heavier absorbs the other. Its speed is modified in consequence.
  • DEFAULT_RADIUS_BY_MASS_FACTOR: factor used for the computation of a radius from the mass. Useful to get radius giving an hint about mass. Increase it to get smaller radii.
  • RADIUS_TO_PIXEL_FACTOR: in case radius (km) is deduced from input file, it will be converted using PIXEL_PER_AU and this value. 1=realistic (but invisible in most cases), more=bigger radii.
  • ALWAYS_USE_DEFAULT_RADIUS: if set to true, ignore radius given in input file and use the function to mass radius.
  • VIEW_ENGINE_TIME_UPDATE: number of millisecond between each engine update/computation step.


Qt, C++, computations, geometry, graviationnal simulation







No releases published


No packages published