Skip to content

Vedant9500/CelestialSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ORBITAL // N-Body Simulator

A high-performance gravitational N-Body simulation written in pure HTML5, CSS, and Vanilla JavaScript.

Features

  • Custom Physics Engine: Built from scratch using a highly stable Runge-Kutta 4th Order (RK4) integrator, providing astronomically precise planetary orbits without standard Euler degeneration.
  • Momentum Conservation: Bodies undergo perfect inelastic collisions, correctly calculating and inheriting new center-of-mass vectors and mass totals.
  • Flawless UI Synchronization: A custom decoupled mathematical Camera class handles true CSS-to-World coordinate mappings, allowing pixel-perfect orbit tracing and mouse-drag placements at any zoom level, immune to high-DPI scaling artifacts.
  • Sci-Fi Aesthetic: A "Digital Dossier" aesthetic featuring glassmorphism, glowing orbital paths, dynamic telemetry data, and bespoke cyberpunk control sliders.

Usage

Simply clone the repository and open web/index.html in your favorite web browser. No native build steps or package managers are required.

Controls

  • Left Click & Drag: Slingshot a new planetary body into the system. The length and direction of your drag determine the resulting orbital velocity.
  • Right Click & Drag: Pan the camera across the vacuum of space.
  • Scroll Wheel: Zoom into the action or pan out to observe the entire solar system.

Roadmap & Architecture

Version 2.0 represents a complete teardown and architectural rewrite to eliminate accumulated technological debt and UI inconsistencies from earlier iterations.

The application strictly separates responsibilities:

  1. Vector2D.js - Immutable vector math
  2. Camera.js - Pure Coordinate Transformation maps
  3. PhysicsEngine.js - Heavy lifting math computation
  4. Renderer.js - Canvas2D Drawing instructions
  5. UIManager.js - DOM Event Listeners & Glassmorphism Updates
  6. App.js - The Master Orchestrator Tying it all together

About

CelestialSim is a web-based tool for simulating and visualizing gravitational interactions between celestial bodies in real-time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors