fix(cockpit): no swath readout while the orbital view looks past the Earth's limb

This commit is contained in:
Sameh Khamis committed 2026-11-08 15:55:02 -08:00
1 parent 5c25bc54e6
commit 6ca53febad
3 files changed
+37 -4

No files matched your search

+14
View File
@@ -13,6 +13,7 @@ import {
nadirOrientation,
nextOrbitalZoom,
offNadirAngleDeg,
offNadirCentreMeetsEarth,
offNadirSwathScale,
offNadirOrientation,
orbitalBaseFovRad,
@@ -300,3 +301,16 @@ test("a tilted view's width grows faster across the frame than along it", () =>
}
assert.equal(offNadirSwathScale({ northDeg: Number.NaN }), 1);
});
test('a view tilted past the limb no longer meets the Earth', () => {
// GEO: the Earth spans about 8.7 degrees either side of nadir.
assert.equal(offNadirCentreMeetsEarth(35_786_000, { northDeg: 5 }), true);
assert.equal(offNadirCentreMeetsEarth(35_786_000, { northDeg: 15 }), false);
// LEO: a 30 degree tilt still lands on the ground.
assert.equal(
offNadirCentreMeetsEarth(420_000, { northDeg: 20, eastDeg: 20 }),
true,
);
assert.equal(offNadirCentreMeetsEarth(420_000, { eastDeg: 80 }), false);
assert.equal(offNadirCentreMeetsEarth(NaN, {}), false);
});