Skip to content

DOsinga/kantlaplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Kant-Laplace Nebular Hypothesis Simulation

An interactive simulation of planetary formation based on the Kant-Laplace nebular hypothesis. Watch thousands of rocks orbit a sun, collide, and merge to form planets over millions of years.

Kant-Laplace Simulation

Demo

Try it live at douwe.com/projects/kantlaplace

Features

  • Newtonian physics: Realistic orbital mechanics with gravity from both the sun and rock-to-rock interactions
  • Collision detection: Spatial hashing for efficient O(n) collision detection
  • Mass conservation: Rocks merge on collision, conserving momentum
  • Configurable rock counts: 3k, 10k, 30k, or 100k initial rocks
  • Real units: Mass displayed in Earth masses, distances in millions of km
  • Speed control: Exponential speed slider from 1x to 25,000x
  • Overview mode: Hold Shift to see the top 25 largest bodies with orbit trails
  • State persistence: Simulation auto-saves to localStorage

Controls

  • Drag: Pan the view
  • Scroll: Zoom in/out
  • Click: Select a rock to see details
  • Space: Pause/resume
  • Shift: Overview mode (shows largest bodies with trails)
  • R: Reset view
  • F: Fullscreen

Physics

The simulation models:

  • Central star gravity: a = G * M / r²
  • Rock-to-rock microgravity with softening to prevent numerical slingshots
  • Inelastic collisions with momentum conservation
  • Center of mass calculation for merged bodies

Total system mass is approximately 30 Earth masses, enough to form gas giant cores.

Files

  • world.js - Physics simulation (Rock class, World class, collision detection)
  • view.js - Rendering and UI (canvas drawing, controls, HUD)

License

MIT

About

Kant-La Place style simulation of the planetary system coming into being

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors