CometsFactory
Procedural comet generator for the Celestial Bodies ecosystem.
Build, classify, and catalogue comets of every dynamical family — from Jupiter-family short-period comets to interstellar visitors.
Architecture
| Module | File(s) | Purpose |
|---|---|---|
| config | parameters.rs |
Physical constants, orbital helpers, sublimation constants |
| types | short_period.rs, long_period.rs, halley_type.rs, sungrazer.rs, interstellar.rs, main_belt_comet.rs, centaur_transition.rs, extinct.rs |
8 comet types with builder pattern |
| physics | gravity.rs, sublimation.rs |
Binding energy, tides, Roche limit, sublimation rates, gas production, non-grav acceleration |
| engine | orbits.rs, evolution.rs, coma.rs |
Keplerian propagation, mantle growth, spin-up, coma/tail modelling |
| observables | photometry.rs, tail.rs |
Total/nuclear magnitudes, Afρ, dust/ion tail orientation, disconnection events |
| utils | helpers.rs, io.rs |
Angle conversions, summary lines for all 8 types |
Comet Types
| # | Type | Key Features |
|---|---|---|
| 1 | ShortPeriod | Jupiter-family comets, P < 20 yr, 2 < T_J < 3 |
| 2 | LongPeriod | Oort Cloud origin, P > 200 yr, dynamically new flag |
| 3 | HalleyType | 20 < P < 200 yr, T_J < 2, retrograde detection |
| 4 | Sungrazer | Kreutz/Marsden/Kracht/Meyer groups, tidal disruption |
| 5 | Interstellar | Hyperbolic orbits (e > 1), excess velocity |
| 6 | MainBeltComet | Asteroid-like orbits (T_J > 3), sublimation-driven activity |
| 7 | CentaurTransition | CO-driven outbursts, giant-planet region, dynamical lifetime |
| 8 | Extinct | Dormant/extinct states, mantle thickness, reactivation potential |
All types expose a builder pattern: new() → with_*() chainable methods.
Usage
use *;
let jfc = new
.with_density
.with_inclination
.with_active_fraction;
assert!;
assert!;
use sublimation;
let q = gas_production_rate;
assert!;
Tests
73 tests across 3 test suites:
- types_tests — 38 tests (builders, orbital properties, classifications)
- physics_tests — 14 tests (gravity, sublimation, thermal)
- engine_tests — 21 tests (orbits, evolution, coma)
Examples
| Example | Description |
|---|---|
generation |
Creates all 8 comet types, exercises enum dispatch |
physics |
Gravity + sublimation computations on a Jupiter-family comet |
observables |
Photometry, Afρ, dust/ion tails, disconnection events |
License
MIT — Copyright (c) 2026 Rayan Morel