Fix swapped perigee/apogee labels in distance scene

This commit is contained in:
Graham McIntire 2026-04-22 15:54:14 -05:00
parent 2bc10fc605
commit 188d7ee080
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -358,15 +358,18 @@
}
ctx.stroke();
// Perigee/apogee annotations
const periX = xOf(0.5), periY = yOf(dOf(0.5));
const apoX = xOf(0.0), apoY = yOf(dOf(0.0));
// 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));
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(periX, periY, 4, 0, Math.PI * 2); ctx.fill();
pill(ctx, 'perigee (closest)', periX, periY - 14, C.green, 'center');
ctx.beginPath(); ctx.arc(periMarkX, periMarkY, 4, 0, Math.PI * 2); ctx.fill();
pill(ctx, 'perigee (closest)', periX, periY + 16, C.green, 'center');
ctx.fillStyle = C.orange;
ctx.beginPath(); ctx.arc(apoX, apoY, 4, 0, Math.PI * 2); ctx.fill();
pill(ctx, 'apogee (farthest)', apoX + 8, apoY + 14, C.orange, 'left');
pill(ctx, 'apogee (farthest)', apoX, apoY - 14, C.orange, 'center');
// Animated cursor
const t = (performance.now() - start) / 1000;