Compute launch paths, cameras and colours without Cesium

The launches layer's path building, replay camera maths, policy constants,
state, marker colours and mission panel no longer import Cesium. Paths and
camera poses are plain ECEF points computed by the geo helpers with the
default renderer's own formulas in the same order, so trajectories, orbits
and camera framing land where they did. Geodesic interpolation moves from
the stub renderer into geo/geodesic (geodesicLine, solved once per
geodesic), and geo/sphere gains the renderer's sphere union.

Marker colours are renderer colours, with the panel's CSS from the same
palette. The rendering part, still Cesium for its entities, converts the
plain points where the entities take them, culls with the shared horizon
test, loads the unbound camera factory, and hands the panel the live
payload position directly instead of through the entity.

Camera, model, panel, paths, policy, policyHelpers and state leave the
allow-list.
This commit is contained in:
Sameh Khamis committed 2026-11-06 22:57:55 -08:00
1 parent 0782b073e2
commit a2503476de
19 files changed
+561 -548

No files matched your search

+37 -1
View File
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import test from 'node:test';
import { surfaceDistance } from './geodesic.js';
import { geodesicAt, surfaceDistance } from './geodesic.js';
test('surface distance matches the default renderer’s geodesic', () => {
let seed = 11;
@@ -45,3 +45,39 @@ test('the same point is no distance away, and nearly antipodal points still answ
);
assert.ok(Number.isFinite(far) && far > 1.9e7);
});
test('a point along the geodesic is the default renderer’s', () => {
let seed = 23;
const random = () => (seed = (seed * 16807) % 2147483647) / 2147483647;
const d = Math.PI / 180;
for (let i = 0; i < 200; i++) {
const start = new Cesium.Cartographic(
(random() * 360 - 180) * d,
(random() * 170 - 85) * d,
);
const reach = i % 2 ? 3 : 90;
const end = new Cesium.Cartographic(
start.longitude + (random() * 2 - 1) * reach * d,
Math.max(
-89,
Math.min(89, start.latitude / d + (random() * 2 - 1) * reach),
) * d,
);
const geodesic = new Cesium.EllipsoidGeodesic(start, end);
for (const fraction of [0, 0.25, 0.5, 0.9, 1]) {
const theirs = geodesic.interpolateUsingFraction(fraction);
const ours = geodesicAt(
start.longitude,
start.latitude,
end.longitude,
end.latitude,
fraction,
);
assert.ok(
Math.abs(ours.lon - theirs.longitude) <= 1e-12 &&
Math.abs(ours.lat - theirs.latitude) <= 1e-12,
`${i} @ ${fraction}: ${ours.lon},${ours.lat} vs ${theirs.longitude},${theirs.latitude}`,
);
}
}
});