mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
feat(satellites): current ISS model with moving parts and a command panel
The ISS model is now NASA/JSC IGOAL's current-configuration station (Nauka, Prichal, Bishop, roll-out arrays), reduced from 96 MB to 3 MB with its joints kept as nodes. NASA's file is a mirror image of the station and marks 15 materials as blended; both are corrected. Its parts move by computation, never telemetry: arrays and radiators by the Sun (feathered in the Earth's shadow), the Ku-band dishes toward the TDRS nominal slots, and the robotic arms as an illustrative sway. Selecting the ISS shows a collapsed command panel: zoom to the station, Automatic (default, with a lit/shadow status line) and Manual controls for the Sun's position, arrays, radiators, dishes and Canadarm2. Also: docked objects are found by comparing both orbits at one instant, the tracked card keeps clear of the model, the model file loads only near its range, and both ISS panels follow a language change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9aeabbacfb
commit
a75993a66b
35 files changed
+2636
-119
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
ISS_COMMAND_ZOOM_RANGE_M,
|
||||
issCommandFastOrbit,
|
||||
issCommandShouldShow,
|
||||
issCommandZoomStep,
|
||||
} from './issCommand.js';
|
||||
import { ISS_NORAD } from './policy.js';
|
||||
|
||||
test('the panel shows only while the ISS is selected, layer on, Cockpit off', () => {
|
||||
const base = { enabled: true, trackedNorad: ISS_NORAD, cockpitHeld: false };
|
||||
assert.equal(issCommandShouldShow(base), true);
|
||||
assert.equal(issCommandShouldShow({ ...base, enabled: false }), false);
|
||||
assert.equal(issCommandShouldShow({ ...base, trackedNorad: 20580 }), false);
|
||||
assert.equal(issCommandShouldShow({ ...base, trackedNorad: null }), false);
|
||||
assert.equal(issCommandShouldShow({ ...base, cockpitHeld: true }), false);
|
||||
});
|
||||
|
||||
test('the zoom eases in to its range and stops there, never past it', () => {
|
||||
let distance = 726_000;
|
||||
let steps = 0;
|
||||
for (; steps < 400; steps++) {
|
||||
const step = issCommandZoomStep(distance);
|
||||
if (!step) break;
|
||||
assert.ok(step > 0 && step < distance - ISS_COMMAND_ZOOM_RANGE_M);
|
||||
distance -= step;
|
||||
}
|
||||
assert.ok(steps < 120); // under two seconds at 60 frames a second
|
||||
assert.ok(distance >= ISS_COMMAND_ZOOM_RANGE_M);
|
||||
assert.ok(distance <= ISS_COMMAND_ZOOM_RANGE_M * 1.02 + 1e-6);
|
||||
// Already closer: nothing to do, and it never pushes the camera back out.
|
||||
assert.equal(issCommandZoomStep(180), 0);
|
||||
});
|
||||
|
||||
test('the fast orbit turns the Sun once per lap, part of it in shadow', () => {
|
||||
const start = issCommandFastOrbit(0);
|
||||
assert.ok(Math.abs(Math.hypot(...start.sun) - 1) < 1e-9);
|
||||
assert.equal(start.sunlit, true);
|
||||
assert.equal(issCommandFastOrbit(20_000).sunlit, false); // half a lap: below
|
||||
const lap = issCommandFastOrbit(40_000);
|
||||
lap.sun.forEach((v, i) => assert.ok(Math.abs(v - start.sun[i]) < 1e-9));
|
||||
});
|
||||
|
||||
test('the zoom is offered only from far away', async () => {
|
||||
const { ISS_COMMAND_FAR_M, issCommandOffersZoom } =
|
||||
await import('./issCommand.js');
|
||||
assert.equal(issCommandOffersZoom(726_000), true);
|
||||
assert.equal(issCommandOffersZoom(ISS_COMMAND_FAR_M + 1), true);
|
||||
// Where the zoom itself stops, and anywhere closer, it is gone.
|
||||
assert.equal(issCommandOffersZoom(ISS_COMMAND_ZOOM_RANGE_M * 1.02), false);
|
||||
assert.equal(issCommandOffersZoom(150), false);
|
||||
});
|
||||
|
||||
test('the status line says lit or in shadow, and nothing before the model is placed', async () => {
|
||||
const { issCommandStatusText } = await import('./issCommand.js');
|
||||
assert.equal(issCommandStatusText(null), '');
|
||||
assert.notEqual(issCommandStatusText(true), issCommandStatusText(false));
|
||||
assert.ok(issCommandStatusText(true).length > 0);
|
||||
assert.ok(issCommandStatusText(false).length > 0);
|
||||
});
|
||||
Reference in new issue
Block a user