Skip to content

feat: voyage modules — Spacecraft, Brachistochrone, MissionPlanner (proposal / no obligation)#92

Draft
tymrtn wants to merge 3 commits intotyppo:masterfrom
tymrtn:voyage-modules
Draft

feat: voyage modules — Spacecraft, Brachistochrone, MissionPlanner (proposal / no obligation)#92
tymrtn wants to merge 3 commits intotyppo:masterfrom
tymrtn:voyage-modules

Conversation

@tymrtn
Copy link
Copy Markdown

@tymrtn tymrtn commented May 7, 2026

Hi Ian — opening this as a draft for your consideration. Zero pressure to merge; the work lives happily as a fork at tymrtn/spacekit and we'll keep it there if the scope is too far from where you want Spacekit to go.

What this adds

Three new modules layered on top of Spacekit's existing visualization primitives, aimed at users who want to render active missions (vehicles, trajectories) alongside the passive solar-system bodies Spacekit already supports beautifully:

  1. Brachistochrone.ts — single-leg trajectory solver for high-thrust, high-Δv propulsion. Iterative lead-angle rendezvous against a target Ephem, plus a velocity-matching addendum for the endpoint Δv. Returns flight time, Δv components, peak velocity, and a sampled trajectory suitable for rendering as a Line. Pure function, no Three.js dependency. 27 tests cover Earth→Mars, Earth→Jupiter, Earth→Pluto at multiple acceleration levels, plus iteration-budget edge cases.

  2. Spacecraft.ts — drive spec (exhaustVelocityMs, maxAccelG, label), mass partitioning (dry/propellant tonnes), and Tsiolkovsky helpers (propellantForDeltaV, deltaVForWetMass, spacecraftStateAfterDeltaV). Includes a DRIVE_PB11_REFERENCE preset (v_e ≈ 0.034c, 0.43g) for the demo I'm using, but the API is drive-agnostic — anyone could plug in chemical, nuclear-thermal, ion, or antimatter constants. 23 tests.

  3. MissionPlanner.ts — multi-leg orchestrator (e.g. Earth → Saturn → Neptune) that chains brachistochrone legs, accumulates Δv, back-allocates per-leg propellant via the rocket equation, and exposes findActiveLeg(missionT) for timeline/scrubber UI. 22 tests.

All three sit alongside SpaceObject, Orbit, etc. in src/, with tests in test/ matching your existing convention. Total: 162/162 tests passing (90 upstream + 72 new). Bundle builds clean to ~739 KB minified.

Ran pnpm test and pnpm run build against your master + my changes. No regressions in upstream behavior; new code is additive.

Why this might fit (and why it might not)

  • Why fit: Spacekit already handles the hard part (Keplerian propagation, orbit rendering, ephemeris). Adding a spacecraft and a trajectory solver makes Spacekit a complete "design and watch a mission" engine, not just "render the solar system." Users who want active vehicles currently have to roll their own on top.
  • Why might not: This expands Spacekit's scope from "passive visualization" to "active simulation," which is a real philosophical shift. If you'd rather keep Spacekit focused on bodies + orbits, totally reasonable — closing this PR with no hard feelings.

Live demo

Built a concept-paper companion that uses these modules end-to-end: https://u1f99e.com/labs/pb11-directed-exhaust/voyage-sim — pick a destination, watch the brachistochrone trajectory, zoom into the spacecraft. The site uses the bundle from this branch. Companion to a research paper on proton-boron fusion propulsion — credit to your library is in the disclaimer.

Notes on style

  • Followed existing TypeScript conventions (no class accessors at the default ES3 target; explicit method calls; Orbit(ephem, {}) two-arg pattern).
  • Test-only helper exports use module-specific names (__brachistochroneTest, __spacecraftTest) to avoid collision under export *.
  • Internal physics constants are co-located with the modules that use them; happy to refactor into Units.ts if you'd prefer.

Either way, thanks for Spacekit — it's a beautiful library and made this companion piece feasible.

— Tyler / Lobster Labs

tymrtn and others added 3 commits May 6, 2026 20:12
Implements a brachistochrone (constant-acceleration flip-and-burn)
trajectory solver with iterative lead-angle rendezvous and a
velocity-matching addendum for endpoint Δv.

For high-thrust, high-Δv propulsion concepts — fusion drives, beam-
target ignition systems — the brachistochrone is the natural mission
profile. This module solves the single-leg case and returns flight
time, Δv components, peak velocity, arrival JD, and a sampled
trajectory suitable for rendering.

Tested against three reference cases (Earth→Mars, Earth→Jupiter,
Earth→Pluto) at 0.43 g; results align with the parametric estimates
in Martin (2026), arxiv submission pending. 27 new unit tests.

Refs: docs/superpowers/specs and Martin (2026) "Phase Space Reframing
for Directed Fusion Exhaust" Section 4.3.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nting

Spacecraft is a plain physics class — drive (v_e, max accel), dry/wet
mass — with helpers for the rocket-equation Δv → propellant conversion
and a stateAfterDeltaV snapshot useful for live-mission telemetry.

Includes DRIVE_PB11_REFERENCE preset with v_e = 0.034c and a_max =
0.43g per Martin (2026) reference architecture. Validates against
paper Section 4.3 propellant fraction (28-31% for Δv ≈ 0.012c on a
1000-tonne dry mass). 23 new unit tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a multi-leg mission planner that sequences brachistochrone legs
for grand-tour voyages (e.g. Earth → Saturn → Neptune). Tracks
cumulative Δv, propellant burn per leg via the rocket equation, and
mission feasibility against the paper's 60% propellant-fraction
threshold. findActiveLeg() supports timeline-scrubbing UI.

Also normalizes the new modules for Spacekit's tsconfig (no class
accessors at default ES3 target; Orbit constructor needs explicit
options arg; getPositionAtTime needs explicit second arg).

Renames test-internal helpers to module-specific names to avoid
collision when re-exported via index.ts.

22 new MissionPlanner tests; 162/162 total tests passing; bundle
builds clean to 739 KB minified ESM/CJS/IIFE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for thunderous-lolly-07875e failed.

Name Link
🔨 Latest commit 9ca4541
🔍 Latest deploy log https://app.netlify.com/projects/thunderous-lolly-07875e/deploys/69fcb81df6524e000838abb8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant