From 25ececdc78897b22431efdf3ab92fd7ed01d844e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 22 Apr 2026 15:55:16 -0500 Subject: [PATCH] Place perigee label at correct phase, fix caption wording --- static/js/moonbounce.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/static/js/moonbounce.js b/static/js/moonbounce.js index f44799b..706295e 100644 --- a/static/js/moonbounce.js +++ b/static/js/moonbounce.js @@ -302,7 +302,7 @@ { key: 'dist', label: 'Distance', init: '384,000 km' }, { key: 'extra', label: 'Extra loss vs mean', init: '0.0 dB' }, ], - caption: 'Moon distance over one synodic month. The bump in the middle is perigee, the dip at the ends is apogee. The number on the right is how much extra round-trip path loss that costs you compared to the mean distance. Perigee is the good night.', + caption: 'Moon distance over one synodic month. The dips at the ends are perigee, the hump in the middle is apogee. The number on the right is how much extra round-trip path loss that costs you compared to the mean distance. Perigee is the good night.', }); if (!s) return; @@ -358,15 +358,12 @@ } ctx.stroke(); - // Perigee/apogee annotations. dOf = mean - amp*cos(2πφ), so min (perigee) is at φ=0 and φ=1, - // max (apogee) is at φ=0.5. - const periX = xOf(0.25), periY = yOf(dOf(0.25)); + // dOf = mean - amp*cos(2πφ): perigee (min d) at φ=0 and 1, apogee (max d) at φ=0.5. + const periX = xOf(0), periY = yOf(dOf(0)); const apoX = xOf(0.5), apoY = yOf(dOf(0.5)); - // Use phase 0 for perigee marker dot (bottom-left), but put label inside panel at phase 0.25 to keep it readable. - const periMarkX = xOf(0), periMarkY = yOf(dOf(0)); ctx.fillStyle = C.green; - ctx.beginPath(); ctx.arc(periMarkX, periMarkY, 4, 0, Math.PI * 2); ctx.fill(); - pill(ctx, 'perigee (closest)', periX, periY + 16, C.green, 'center'); + ctx.beginPath(); ctx.arc(periX, periY, 4, 0, Math.PI * 2); ctx.fill(); + pill(ctx, 'perigee (closest)', periX + 10, periY, C.green, 'left'); ctx.fillStyle = C.orange; ctx.beginPath(); ctx.arc(apoX, apoY, 4, 0, Math.PI * 2); ctx.fill(); pill(ctx, 'apogee (farthest)', apoX, apoY - 14, C.orange, 'center');