Initial project setup: Rust/WASM solar system simulator with SvelteKit frontend

- Rust workspace with 4 crates: orbital-mechanics, mass-driver-core, mass-driver-wasm, mass-driver-backend
- Keplerian orbital mechanics engine with JPL elements for 14 bodies (Sun, 8 planets, Pluto, Ceres, Europa, Titan, Ganymede)
- Kepler equation solver and orbital position computation compiled to WASM
- SvelteKit frontend with Tailwind CSS, Canvas2D renderer showing animated solar system
- Orbit ellipses, planet dots with labels, Sun glow, grid, scale bar, pan/zoom controls
- Time controls (play/pause, 5 speed levels, date picker) driving live simulation
- 2D/3D view toggle (3D placeholder for Threlte integration)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 22:06:30 -07:00
commit 5efe0736ac
45 changed files with 4626 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
pub mod station;
pub mod route;

View File

@@ -0,0 +1,24 @@
use serde::{Deserialize, Serialize};
/// A single leg of a route between two stations.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RouteLeg {
pub from_station: usize,
pub to_station: usize,
/// Departure week index (0 = first week of simulation)
pub departure_week: u32,
/// Arrival week index
pub arrival_week: u32,
/// Weeks spent waiting at departure station before this leg
pub wait_weeks: u32,
}
/// The result of a route computation.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RouteResult {
pub legs: Vec<RouteLeg>,
/// Total elapsed time in weeks from departure to final arrival
pub total_time_weeks: u32,
/// The week index when the package departs the origin
pub departure_week: u32,
}

View File

@@ -0,0 +1,44 @@
use serde::{Deserialize, Serialize};
/// How a station is placed in the solar system.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum StationPlacement {
/// Station in heliocentric orbit
SolarOrbit {
a: f64, // Semi-major axis (AU)
e: f64, // Eccentricity
i: f64, // Inclination (degrees)
omega: f64, // Longitude of ascending node (degrees)
w: f64, // Argument of perihelion (degrees)
m0: f64, // Mean anomaly at epoch (degrees)
},
/// Station in orbit around a planet
PlanetaryOrbit {
parent_body_id: usize,
altitude_km: f64,
inclination: f64,
},
/// Station at a Lagrange point
LagrangePoint {
primary_body_id: usize, // e.g., Sun
secondary_body_id: usize, // e.g., Earth
point: LagrangePointId,
},
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum LagrangePointId {
L1,
L2,
L3,
L4,
L5,
}
/// A mass driver relay station.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Station {
pub id: usize,
pub name: String,
pub placement: StationPlacement,
}