Coder Social home page Coder Social logo

pylanets's Introduction

pylanets

A gravitational field simulator in Python. Install numpy and pygame then run main.py.

Controls

  • use the mouse wheel to zoom.
  • use q/a to switch between objects to follow.
  • use z to switch to free roam mode.
  • use w/s to speed the simulation up/down.
  • use d/e to change the drawing size of the objects.

pylanets's People

Contributors

zac-garby avatar joey-einerhand avatar tikki avatar illlin avatar

Stargazers

James avatar

Watchers

James Cloos avatar  avatar

pylanets's Issues

Dynamically fetch relative positions of bodies

Randomly positioning bodies at the start of the simulation is inaccurate, as the planets have specific orbits which most likely will not pass through these random positions. Thus, we should dynamically fetch the actual distances/angles when the program starts in order to set the correct orbits.

If this is not possible or feasible, it would suffice to get the positions at one point in time and hardcode these into the program, causing it to always start at the state. (After this, it could simulate thousands of years without rendering, to essentially randomize the starting positions but keeping them in the right orbits, but this isn't really necessary.)

Initialise planets at correct rotations around the sun

Right now, all the planets start lined up vertically. Of course, this is unrealistic, and is especially a problem around Neptune and Pluto, which are very close to each other.

Ideally, this would be solved by finding the relative angles to the sun at a specific time and initialising the planets at these positions, though this might turn out to be problematic (I've no idea how I would go about finding the angles of planets from the sun) so another solution might be to put them at random angles.

Don't render text if two bodies are too close

When two bodies are very close, much like the relationship between the moon and the Earth, their name labels can intersect with one another, making both impossible to read. It would be preferable to render only the label of the largest body.

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.