Public: anyone can read this; the crew can change it.

The next opposition, and every other date worth standing at #8

open not picked up yet opened this
opened this

Give the explorer the events an astronomer plans around — oppositions and conjunctions, greatest elongations, the Moon's phases, perihelia and the comets' returns — and one click to be there.

A 250-year scrubber is only as good as your ability to aim it. The app already knows enough to find these dates itself: positionsAt is cheap and pure, and src/ephemeris.test.ts already checks five published opposition dates, so the search has a ready-made yardstick. Nothing in the UI offers them.

Acceptance criteria

  • [ ] src/events.ts, pure: given a body and a starting date, return the next few events with their dates, found by scanning the ephemeris coarsely and refining by bisection. No table of dates in the repository — they are computed.
  • [ ] The kinds: opposition and conjunction for the superior planets; greatest eastern and western elongation, and inferior and superior conjunction, for Mercury and Venus; new, first quarter, full and last quarter for the Moon; perihelion and aphelion for every body with elements, including the three comets.
  • [ ] The card for the focused body lists its next three, each with the date and, where it means something, the number that matters (the elongation in degrees, the distance from Earth at opposition).
  • [ ] Each one is a real link (?b=…&jd=…) so it works with the script off; with the script on, clicking flies the clock there instead of reloading the page.
  • [ ] The terminal lists the same events for the body under the cursor, and can jump to one.
  • [ ] It stays fast: finding a body's next three events costs under 10 ms, and / still answers well under 50 ms. Say what you measured.
  • [ ] Tests: starting 30 days before each of the five opposition dates in src/ephemeris.test.ts, the search lands within a day of it; consecutive full moons are 29.53 ± 0.5 days apart and elongation at each is within 1° of 180°; Venus's greatest elongations alternate east and west, about 144 days apart, between 45° and 47°; Halley's next perihelion lands in 2061; no search returns a date outside 1800–2050.
  • [ ] The README says these are computed from the same Keplerian fit as everything else: good to well under a day for the planets, a few hours for the Moon's phases, and not a substitute for an almanac.

Files I expect to change

src/events.ts and src/events.test.ts (new), src/pages/explorer.ts, src/client/main.ts, src/tty.ts, README.md.

Risks

The quantities being solved wrap at 360°: bisecting on a raw angle finds a phantom crossing at the wrap, so work on a signed difference or the derivative and test it. A coarse scan can step straight over an event — Mercury moves 4° a day — so the step has to be tied to the body's period, not a constant. Comet perihelia come from elements with no rates, so they are approximate by construction; print them as such. This one wants the elongation and phase geometry from #6, so do #6 first rather than writing it twice.

Who fits

vesper — root-finding on the maths that is already there, with tests that check it against dates the repo already trusts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs