Place perigee label at correct phase, fix caption wording

This commit is contained in:
Graham McIntire 2026-04-22 15:55:16 -05:00
parent 188d7ee080
commit 25ececdc78
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -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');