Skip to content
/ Orbit Public

A physically-accurate orbital simulator and visualization tool built with Python, Flask, and JS, powered by a stable Velocity-Verlet physics engine.

License

Notifications You must be signed in to change notification settings

Root3141/Orbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orbit2.0 🌌

License: MIT Python

A modular, minimalistic, and physically accurate orbital simulator.
Experience as a modern interactive web app or classic desktop Python/matplotlib animation. Powered by symplectic Velocity-Verlet integration, Flask, and vanilla JS.


Table of Contents


Overview

Orbit2.0 simulates orbital motion using energy-conserving Velocity-Verlet integration for long-term orbital stability. Built around a lightweight, performance-focused architecture designed for clarity, efficiency, and a seamless user experience while avoiding unnecessary complexity.

Experience it as:

  • 🖥️ Desktop: Python + Matplotlib animation (for research, teaching, or offline demos).
  • 🌐 Web: Flask backend + HTML/JS/CSS frontend (modern interactive simulation).

Both interfaces use the same NumPy-based simulation core for scientific consistency.


Screenshots / GIFs

Demo
Web demo

Web Selection Screen
Body Selection Screen

Desktop Matplotlib view
Matplotlib simulation


Features

Physics Engine

  • Symplectic Velocity-Verlet integration (replaces semi-implicit Euler), numerically stable for long-term orbits.
  • Planetary/body data stored in editable bodies.json.

Web / UI

  • Dynamic body selection via interactive cards.
  • Real-time Canvas animation with buffering and interpolation.
  • Server-Sent Events (SSE) for low-latency updates.
  • Play/Pause toggle, zoom in/out, configurable trails, starry background, and auto pause on tab change.

Backend & Architecture

  • Modular OOP physics core (simulation.py).
  • Flask backend serves snapshots to web; Matplotlib mode remains fully supported.

Other

  • Fully responsive design for desktop & mobile.
  • Clean separation of code, data, and UI for maintainability.
  • Open-source.

Quickstart

Clone & Install

git clone https://github.com/Root3141/Orbit.git
cd Orbit
pip install -r requirements.txt

Run Web App

python app.py

Open http://localhost:5000 or view the live demo here↗.

Desktop (Matplotlib) Mode

python sim.py

Architecture

   [bodies.json]
        |
+---------------------+
|   simulation.py     |  <-- Shared OOP simulation engine (NumPy + Verlet)
+---------------------+
      |            |
[Matplotlib]  [Flask backend/API]
                   |
             [HTML/JS frontend]

Editing or Adding Bodies

All celestial object data lives in bodies.json.
Add, remove, or edit entries - changes are reflected instantly in both interfaces.


What's New in 2.0

Feature v1.0 v2.0 (Current)
Integration Semi-implicit Euler Velocity-Verlet
Data Hardcoded Editable JSON file
Visualization Matplotlib only Web + Matplotlib
Architecture Flat script Modular, shared core, clean separation
UI/UX Static plots Modern, animated, interactive web UI

Educational Value

Orbit2.0 is ideal for learning:

  • Visualizes Newtonian mechanics and orbital dynamics.
  • Helps students experiment with orbital parameters and see real-time effects.
  • Encourages hands-on learning with minimal setup.

Future Work

  • Modularize frontend JS/CSS for maintainability
  • Expose user-configurable options (timestep, colors, trail memory)
  • Expand bodies.json to include moons, comets, dwarf planets
  • Optional: Web Workers/WebGL support for performance
  • Add multi-user support

Known Issues

  • On the deployed web version (Render), resuming a paused simulation may occasionally jump ahead instead of continuing from the pause point before proceeding smoothly. This does not occur when running locally, where it resumes as expected.

Contributing

Pull requests are welcome!
For major changes, please open an issue first to discuss what you’d like to improve.

License

MIT License


Credits

Developed by Aaryan Aaloke

About

A physically-accurate orbital simulator and visualization tool built with Python, Flask, and JS, powered by a stable Velocity-Verlet physics engine.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published