PlanetsFactory
Part of the Celestial project.
A Rust planet factory — classify, build, and catalogue planets for any star system. From terrestrial worlds and gas giants to lava worlds, ocean worlds, rogue planets, sub-Neptunes, and super-Earths, with full orbital mechanics, atmospheric physics, interior models, formation scenarios, evolution, observables, and procedural system generation. Pure procedural — no hardcoded presets, all parameters explicit.
Features
- Type system — 8 planet types with class-specific physics and builder pattern constructors
- Terrestrial planets — Iron core fraction, magnetic moment, tidal locking time, plate tectonics model
- Gas giants — Ring Roche limits, metallic hydrogen pressure, Kelvin-Helmholtz timescale, envelope opacity
- Ice giants — Ice/rock mantle partitioning, magnetic dipole offset, wind speed estimates
- Lava worlds — Dayside temperature, magma ocean depth, tidal lock factor, thermal emission
- Ocean worlds — Water mass fraction, ice layer depth, ocean pH model, habitability index
- Rogue planets — Unbound interstellar velocity, no orbital elements, internal heat budget
- Sub-Neptunes — Envelope fraction, core mass fraction, atmospheric escape rate, transit radius
- Super-Earths — Iron core fraction, volatile fraction, plate tectonics flag, surface pressure
- Gravitation — Surface acceleration, escape velocity, Hill sphere, Roche limit, Tisserand parameter, Laplace radius
- Atmospheres — Barometric law, Jeans escape rate, greenhouse effect, effective temperature, scale height
- Interior models — Core/mantle structure, central pressure, moment of inertia factor, Adams-Williamson density
- Orbital mechanics — Kepler solver, elements ↔ Cartesian, vis-viva, period, mean anomaly propagation
- Formation — Core accretion, disk instability, pebble accretion, snow line, isolation mass, MMSN density
- Evolution — Cooling luminosity, radius contraction, photo-evaporation, tidal migration, habitable zone boundaries
- System generator — Procedural systems via Titius-Bode spacing for solar-type and M-dwarf stars
- Photometry — Albedo conversion, flux ratios, equilibrium temperature, day-night contrast, bolometric magnitude
- Transits — Depth, duration, ingress/egress, impact parameter, limb darkening correction, TTV
- Radial velocity — Semi-amplitude K, minimum mass, Rossiter-McLaughlin effect, activity jitter
Quick Start
Examples
Testing
94 integration tests across types, physics, and engine modules.
Project Structure
src/
├── config/ # Physical constants, unit conversions, planetary mass/radius constants
├── types/ # Terrestrial, gas giant, ice giant, lava world, ocean world, rogue, sub-Neptune, super-Earth
├── physics/ # Gravitation, atmospheres, interior structure models
├── engine/ # Orbital mechanics, formation, evolution, system generator
├── observables/ # Photometry, transits, radial velocity
└── utils/ # Math helpers (lerp, RK4, Simpson), I/O
Dependencies
- sciforge — Physical constants, astronomical utilities
License
MIT — see LICENSE.