Skip to content

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues Unlicense License LinkedIn


Gravitational Forces Simulation

A simulation of Gravitational Forces applied on flying object using Raylib.
Explore the files »

Report Bug · Request Feature

Table of Contents
  1. Usage
  2. About The Project
  3. Getting Started
  4. Contributing
  5. License
  6. Contact

Usage

This program uses F as following, to calculate the force applied on the flying objects.

$$F = G. \frac{m_1.m_2}{d²} $$

The point is to simulate how gravitational forces are moving objects through space. Two Spatial Bodies are displayed on the screen while flying objects go through $$x$$ and are being pulled by their gravitational forces. You can adjust the numbers of objects, the speed of the objects, the constant $$G$$, and the mass and coordonates of each spatial body.

back to top

Demonstration

DemoGravitationalForces.mp4

Built With :

gcc C Raylib
Gcc as the compiler, C as the programming language and Raylib as the graphical library.

back to top

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • on Arch Linux : Gcc and make are already installed.
  • on Ubuntu : Verify that gcc and make are installed:
    sudo apt install build-essential git

Installation

  1. Clone the repo
    git clone https://github.com/MountainEnjoyer/GravitationalForces.git
  2. Install Raylib
  • On Arch linux:
    sudo pacman -S raylib
  • On Ubuntu:
    sudo apt install raylib
  1. Change the values of the simulation:
     #define WIDTH 1200
     #define HEIGHT 900
     #define FPS 60
     #define OBJ 100
     #define R_OBJ 2
     #define MASS_OBJ 10
     #define XSPEED_OBJ 10
     #define YSPEED_OBJ 0
     #define BODY 2
     #define MASS1 100
     #define MASS2 500
     #define G 0.6 // supposed to be 6.67*powf(10,-11);
     #define L_TRAIL 250
  2. Comile and execute by running:
     make
  3. You can press ENTER to replay the simulation and ESC to exit it.

back to top

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Top contributors:

contrib.rocks image

back to top

License

Distributed under the Unlicense License. See LICENSE.txt for more information.

back to top

Contact

Zakary CHAUVE - contact@zakary.xyz

Project Link: https://github.com/MountainEnjoyer/GravitationalForces

back to top

About

A Graphical simulation of gravitaional forces from Celestial Bodies on moving objects.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Contributors

Languages