refactor(satellites): Cesium rendering behind a renderer interface

Move native points, synchronous orbit primitives, tracked entities, follow and picking into the Cesium renderer. Use appClock for satellite physical epochs and isolate the unchanged CelestialRing ephemeris. Synthetic core/dense and ISS/MEO/GEO snapshots match the baseline exactly; all gates pass. The pointer-ownership source assertion follows scene.pick into render/cesium.js; registry and import-boundary assertions now reflect the migrated satellite layer.
This commit is contained in:
German Khokhlov committed 2026-10-22 22:37:09 +04:00
1 parent 83fbe6949f
commit 000ef99464
27 files changed
+459 -196

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
// Deterministic TLE catalogs for phase 3 browser QA; no live feed requests.
import { W1_FROZEN_MS } from './w1Feeds.js';
const checksum = (line) => {
const body = line.padEnd(68).slice(0, 68);
let sum = 0;
for (const c of body) sum += /[0-9]/.test(c) ? Number(c) : c === '-' ? 1 : 0;
return body + (sum % 10);
};
const tle = (id, name, index, inclination, motion) => {
const number = String(id).padStart(5, '0');
const angle = (value) => (value % 360).toFixed(4).padStart(8);
return [
name,
checksum(
`1 ${number}U 26001A 26289.50000000 .00000000 00000-0 00000-0 0 999`,
),
checksum(
`2 ${number} ${angle(inclination)} ${angle(index * 137.508)} 0003000 ${angle(0)} ${angle(index * 47.3)} ${motion.toFixed(8).padStart(11)}00001`,
),
].join('\n');
};
const GROUPS = {
stations: [25544, 1, 51.64, 15.5, 'ISS (ZARYA)'],
visual: [30000, 720, 53, 15.2, 'QA VISUAL'],
'gps-ops': [40000, 32, 55, 2.0056, 'QA GPS'],
'glo-ops': [41000, 24, 64.8, 2.131, 'QA GLONASS'],
galileo: [42000, 30, 56, 1.7047, 'QA GALILEO'],
geo: [45000, 32, 0.1, 1.0027, 'QA GEO'],
starlink: [50000, 6000, 53, 15.2, 'QA STARLINK'],
};
export const SATELLITE_FIXTURE_EPOCH = W1_FROZEN_MS;
export const SATELLITE_FIXTURE_CORE_COUNT = 839;
export const SATELLITE_FIXTURE_DENSE_COUNT = 6839;
export function satelliteFixture(group) {
const spec = GROUPS[group];
if (!spec) throw new TypeError('Unknown fixture group');
const [first, count, inclination, motion, prefix] = spec;
return (
Array.from({ length: count }, (_, i) =>
tle(
first + i,
count === 1 ? prefix : `${prefix} ${i + 1}`,
i,
inclination,
motion,
),
).join('\n') + '\n'
);
}
+46
View File
@@ -0,0 +1,46 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { twoline2satrec, propagate } from 'satellite.js';
import {
satelliteFixture,
SATELLITE_FIXTURE_EPOCH,
} from './satelliteFixture.js';
test('satellite fixture has distinct, valid SGP4 catalogs including LEO, MEO and GEO', () => {
const ids = new Set();
const counts = {
stations: 1,
visual: 720,
'gps-ops': 32,
'glo-ops': 24,
galileo: 30,
geo: 32,
starlink: 6000,
};
for (const [group, count] of Object.entries(counts)) {
const lines = satelliteFixture(group).trim().split('\n');
assert.equal(lines.length, count * 3);
for (let i = 0; i < lines.length; i += 3) {
for (const line of [lines[i + 1], lines[i + 2]]) {
assert.equal(line.length, 69);
const sum = [...line.slice(0, 68)].reduce(
(n, c) => n + (/\d/.test(c) ? Number(c) : c === '-' ? 1 : 0),
0,
);
assert.equal(Number(line[68]), sum % 10);
}
const rec = twoline2satrec(lines[i + 1], lines[i + 2]);
assert.equal(rec.error, 0);
assert.ok(!ids.has(rec.satnum));
ids.add(rec.satnum);
const position = propagate(
rec,
new Date(SATELLITE_FIXTURE_EPOCH),
).position;
assert.ok(position && Number.isFinite(position.x));
const radius = Math.hypot(position.x, position.y, position.z);
if (group === 'geo') assert.ok(radius > 41000 && radius < 43000);
if (group === 'gps-ops') assert.ok(radius > 26000 && radius < 27000);
}
}
});