Expand description
A hierarchy of reference frames, and the sphere-of-influence crossings that move a body between them.
The physics plan, whose rules are in docs/notes/simulation.md: “bodies
parent to dominant gravity source (galaxy
→ star → planet → moon → vehicle). Simulation runs in the local frame; the
frame itself moves on-rails. Frame transitions (sphere-of-influence
crossing) are explicit events.”
§Why a hierarchy at all
Gravity is an n-body problem and nothing here pretends otherwise; what a hierarchy buys is that one body dominates at any given place, so the motion is a two-body problem plus small perturbations. That is the patched conic approximation, and it is why a spacecraft’s trajectory can be propagated analytically for a thousand orbits instead of integrated: inside a sphere of influence there is one attractor, and at its boundary the body is handed to the next frame out or in.
§Why the positions are WorldPos
A frame conversion is an addition, and at these distances an addition in
plain f64 is where a seam comes from: at Jupiter’s orbit an f64 metre
coordinate has about 128 m between representable values, so a body would
visibly snap as it crossed. WorldPos carries the large part as an
integer sector index and the small part as an offset below 2^20 m, where
the spacing is a fraction of a nanometre — so the crossing is exact and
Frames::convert round-trips bit for bit. That is what
06-orbit.md’s “no visible seam or jitter” asks for, and
a_crossing_far_from_the_origin_keeps_millimetres is what measures it: a
millimetre held 10^15 m from the root, which a plain f64 metre coordinate
cannot represent at all.
§What drove it
docs/plan/sample/06-orbit.md milestone 3 — the moon transfer, which is an
SOI transition and a sector crossing at once.
Structs§
- FrameId
- A frame’s handle in a
Frameshierarchy. - Frames
- A tree of reference frames: a root, and bodies parented to whatever dominates them.
- State
- A position and velocity, read in some frame.
Functions§
- sphere_
of_ influence - The radius of a body’s sphere of influence, in metres.