mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
0782b073e2
commit
a2503476de
19 files changed
+561
-548
No files matched your search
+30
-1
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import test from 'node:test';
|
||||
import { fromDegrees } from './ellipsoid.js';
|
||||
import { sphereFromPoints } from './sphere.js';
|
||||
import { sphereFromPoints, sphereUnion } from './sphere.js';
|
||||
|
||||
test('a sphere from points is the default renderer’s, to the bit', () => {
|
||||
let seed = 7;
|
||||
@@ -28,3 +28,32 @@ test('a sphere from points is the default renderer’s, to the bit', () => {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('the union of two spheres is the default renderer’s, to the bit', () => {
|
||||
const sphere = (x, y, z, radius) => ({ center: { x, y, z }, radius });
|
||||
const cases = [
|
||||
// Apart, overlapping, one inside the other either way, concentric.
|
||||
[sphere(0, 0, 0, 6378137), sphere(4.2e7, 1e6, -3e5, 2.1e7)],
|
||||
[sphere(1, 2, 3, 10), sphere(5, -4, 2, 8)],
|
||||
[sphere(0, 0, 0, 6378137), sphere(1e5, 0, 0, 7000)],
|
||||
[sphere(1e5, 0, 0, 7000), sphere(0, 0, 0, 6378137)],
|
||||
[sphere(3, 3, 3, 5), sphere(3, 3, 3, 5)],
|
||||
];
|
||||
for (const [left, right] of cases) {
|
||||
const ours = sphereUnion(left, right);
|
||||
const theirs = Cesium.BoundingSphere.union(
|
||||
new Cesium.BoundingSphere(
|
||||
new Cesium.Cartesian3(left.center.x, left.center.y, left.center.z),
|
||||
left.radius,
|
||||
),
|
||||
new Cesium.BoundingSphere(
|
||||
new Cesium.Cartesian3(right.center.x, right.center.y, right.center.z),
|
||||
right.radius,
|
||||
),
|
||||
);
|
||||
assert.deepEqual(
|
||||
[ours.center.x, ours.center.y, ours.center.z, ours.radius],
|
||||
[theirs.center.x, theirs.center.y, theirs.center.z, theirs.radius],
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user