Giter Site home page Giter Site logo

gsim's Introduction

gsim

Toyful and simple 2D N-body simulation of gravitational systems written in C. Handles collisions and provides fun interactions you can play with. It implements the Barnes-Hut approximation algorithm for N-body simulations through the use of a QuadTree data structure, spatialy accelerating collisions and gravity calculations. It runs single threaded and does all computations on the CPU side, even the rendering. Built on top of my rendering engine, the simple pixel engine.

alt text

Controls

Click and drag the mouse on top of the background to move the camera. Click and drag on the bodies to move them.

Key Action
W Move camera up
S Move camera down
D Move camera to the right
A Move camera to the left
Z Zoom in
X Zoom out
O Decrease size of physics time step, slow down time
P Increase size of physics time step, speed up time
G Turn gravity on and off
Q Switch the rendering of the quadtree on and off
LShift Switch the rendering of trails on and off
Space Pause the time of the physics in the simulation
R Restart the simulation
Escape Quit

Third Party

spxe depends on OpenGL libraries to manage windows and render graphics independently of the platform.

Try it

If you have all third party dependencies installed on your system you can easily try gsim with the following commands:

git clone --recursive https://github.com/LogicEu/gsim.git
cd gsim
make # or ./build.sh
./gsim -help

Compile

Both build script currently work on Linux an MacOS. The compiled binary will be created at the root of the repository.

make # or ./build.sh

Make sure to clean after compiling.

make clean # or ./build.sh clean

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.