Put orbits and stars in the same reference frame
The app's two sources disagree about which frame they are in, and nothing reconciled them. HYG star positions are equatorial J2000 — that is what raDecDistanceToXyz produces and what the galaxy view renders directly. Orbital elements come from JPL Horizons, whose default reference plane for element output is the ecliptic, and the ETL never overrides it. The two are tilted 23.4 degrees apart, so the orbits sat that far off the sky they are drawn against. Confirmed rather than assumed, from both ends: the Horizons request in lib/horizons.ts sets no REF_PLANE, and the resulting solar-system inclinations are 0 to 17 degrees with Earth exactly 0.00 — which is only true of the ecliptic, since Earth's orbit defines it. eclipticToEquatorial now rotates orbit positions into the scene frame, so a direction means the same thing in the galaxy view and the system view. The rotation is about the vernal-equinox axis, which both frames share. That exposed a presentation problem the old code had been hiding. The renderer mapped the propagator's z straight onto the scene's vertical, which silently redefined the frame but did make systems render flat. In a properly equatorial scene, orbital planes lie 23.4 degrees off the scene's own axes, so a system would be presented edge-on. Rather than rotate the world back into a comfortable pose — which would only put the orbits at odds with the sky again — the camera now settles relative to the orbital plane: a three-quarter view about 37 degrees off the ecliptic normal. The arrival still begins along the approach direction and swings round as it settles, so the transition stays continuous, and the framing is now the same every time rather than inherited from wherever the camera happened to be. Tests: 247 passing, up from 237. The frame tests are the discriminating kind — Earth's orbit must lie perpendicular to the ecliptic pole rather than to the scene's vertical, and must reach 23.4 degrees of declination a quarter orbit on, where it used to read zero. Verified in a browser against Sol and Gl 357. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaySiNst4HhDXBHnMy8p5G
This commit is contained in:
@@ -52,6 +52,11 @@ same place an in-scene click would.
|
||||
star field is instanced quads on a `SpriteNodeMaterial` instead, which behaves the same on
|
||||
both backends. Their size is angular rather than world-space — real stars are unresolvable
|
||||
point sources, so apparent size should follow brightness, not distance.
|
||||
- **One reference frame.** The two data sources disagree: HYG gives star positions in
|
||||
equatorial J2000, while JPL Horizons reports orbital elements against the ecliptic, tilted
|
||||
23.4° away. The scene is equatorial throughout and orbits are rotated into it, so a direction
|
||||
means the same thing in both views. Systems are still presented face-on — by placing the
|
||||
camera relative to the orbital plane rather than by rotating the world into a convenient pose.
|
||||
- **Two coordinate scales.** The galaxy view works in parsecs and the system view in AU —
|
||||
about eight orders of magnitude apart, which wrecks float precision if rendered in one unit
|
||||
space. The camera rig recentres the active star to the origin ("floating origin") and swaps
|
||||
|
||||
Reference in New Issue
Block a user