https://github.com/kgabis/gravitysim
Gravity simulation in C using Barnes-Hut algorithm.
https://github.com/kgabis/gravitysim
Last synced: 6 months ago
JSON representation
Gravity simulation in C using Barnes-Hut algorithm.
- Host: GitHub
- URL: https://github.com/kgabis/gravitysim
- Owner: kgabis
- Created: 2013-03-19T13:57:34.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-04-02T09:08:20.000Z (over 8 years ago)
- Last Synced: 2025-03-26T10:03:38.562Z (6 months ago)
- Language: C
- Homepage:
- Size: 107 KB
- Stars: 18
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About
GravitySim is a gravity simulator (duh) written in C, using the [Barnes-Hut](http://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation) algorithm to approximate gravity interactions between objects. The only dependency is the [GLFW2 library](https://github.com/glfw/glfw-legacy), you shoud be able to install it using either apt-get on linux or homebrew on OSX.##### Installing GLFW2 on OSX
```
brew tap homebrew/versions
brew install --build-bottle --static glfw2
```## Usage
Compile with ```make mac``` for OSX or ```make linux``` for linux (only tested on ubuntu). Now you should be able to run it using ```./gravitysim```.
To customize simulation you can call it with different arguments.
```
./gravitysim number_of_galaxies objects_per_galaxy galaxy_size
```
For instance:
```./gravitysim 10 1000 100``` creates 10 galaxies with 1000 objects per galaxy and diameter 100 pixels.
```./gravitysim 10000 1 1``` creates 10000 galaxies with one object per galaxy and diameter 1 pixel.
You could also customize a lot of options using build_config.h file (such as G constant, sd treshold, max speed or max mass), but it requires rebuilding whole project.
Have fun.## Screenshots


## License
[The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)