Git Product home page Git Product logo

solar-system-simulation's Introduction

Solar system simulation

A simple solar system simulation written in python and pygame. The simulation uses newton's laws of gravitation to calculate the forcces exterted on each planet for each frame, then I use an euler approximation method to simulate the position and velocity of the bodies based on the acceleration obtained from the force. This is an approximation since I am assuming the acceleration remains constant between the frames. This means a higher framrate results in a more accurate simulation

Installation

  • python 3 - get from python's main website
  • pygame Simply install pygame using pip as follows:
pip install pygame

Controls

  • use WASD keys to control the weird planet

  • use the shift modifer with WASD to accelerate the planet

  • p to pause

  • Hover over planets to get their info

  • If paused, planets may be dragged around - Note however they retain their initial velocities so you won't get the result your expecting yet :)

  • press delete to toggle the border, now planets will rebound off of the window's edges.

  • press x to toggle planet's trail. It only hides the trails, but they are still being processed behind the scenes

    To add planets or bodies

    Go to the file and navigate to where the bodies are being initialized. Use the commented template in the file to add the bodies with your custom settings

solar-system-simulation's People

Contributors

quantumzain avatar

Watchers

 avatar

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.