mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(flights): a tracked flight's trail splits at gaps, follows the drawn aircraft, and a lost aircraft coasts then reads SIGNAL LOST
The trail no longer joins a day of history into one line. It lifts the pen across a gap of more than 48 minutes, an implied speed over 1,500 kt, or a report without altitude (a parked aircraft within 0.1 nm for under 3 h stays joined), and every history point is kept as its own segment. History never gets an invented altitude. The live end is the path the aircraft was drawn along, thinned to its shape, so it no longer cuts corners through turns; a late report trims what was drawn after it. Old segments are frozen in chunks, so a 2,000-point trail costs about 0.1 ms a frame. A tracked aircraft that misses an update shows STALE and is dimmed. It keeps flying on its last speed and heading for five minutes (at most 1,500 kt), then stops, dimmed, labelled SIGNAL LOST with the time since its last report, and is kept for ten minutes after that report so the camera keeps its target. Aircraft on or near known ground hold at their last report instead of coasting. Military flights follow the same rules.
This commit is contained in:
1 parent
66a8ff06cb
commit
8fec5a76bf
49 files changed
+6486
-363
No files matched your search
@@ -4,6 +4,7 @@ import { CLASS_SCALE_2D } from '../../data/aircraftClass.js';
|
||||
import {
|
||||
turnRateFromFixHistory,
|
||||
liftRepeatedGroundFix,
|
||||
staleHoldsForFix,
|
||||
synthesizeForwardKinematicsFix,
|
||||
} from '../../data/motionModel.js';
|
||||
import { aircraftIcon } from '../../data/aircraftIcons.js';
|
||||
@@ -29,6 +30,7 @@ export function createMilitarySnapshotRenderer({
|
||||
return function applySnapshot(snapshot, viewer) {
|
||||
const currentIcaos = new Set();
|
||||
const receiptNowMs = snapshot.observedAtMs;
|
||||
records.beginSnapshot(snapshot.observedAtMs);
|
||||
// Field-test fix (RS46): coarse floor cells to warm for the below-ground
|
||||
// clamp — collected during the loop (low airborne contacts only),
|
||||
// batch-resolved once after it. Never a fetch inside the loop.
|
||||
@@ -83,6 +85,9 @@ export function createMilitarySnapshotRenderer({
|
||||
position: position.clone(),
|
||||
velocity: meta.speedMps,
|
||||
track: meta.track,
|
||||
// Drawn at an invented height: a trail seeded from history keeps no
|
||||
// position for it.
|
||||
inventedHeight: meta.renderAltitudeInvented === true,
|
||||
});
|
||||
if (history.length > POSITION_HISTORY_LIMIT) {
|
||||
history.shift();
|
||||
@@ -95,26 +100,36 @@ export function createMilitarySnapshotRenderer({
|
||||
// (owner): ground traffic appends too — taxi history stays live
|
||||
// after touchdown; _appendTrailFix floors grounded positions at
|
||||
// the surface so the ground leg drapes instead of diving.
|
||||
if (isTracked) tracking._appendTrailFix(position.clone());
|
||||
if (isTracked)
|
||||
tracking._appendTrailFix(position.clone(), fixEpochMs, {
|
||||
nullAltitude: meta.renderAltitudeInvented === true,
|
||||
});
|
||||
} else {
|
||||
const modelOwnsGroundVisual = rendering._modelOwnsVisual(icao24);
|
||||
if (!modelOwnsGroundVisual) {
|
||||
liftRepeatedGroundFix(newest, position, meta.onGround);
|
||||
}
|
||||
// A forward synthetic fix follows the stale rules (none while the
|
||||
// contact holds at its report, a coast capped from the real report,
|
||||
// never below the ground) and is a motion aid, never a trail report.
|
||||
const kinematicsChanged =
|
||||
newest.velocity !== meta.speedMps || newest.track !== meta.track;
|
||||
if (kinematicsChanged) {
|
||||
const holds = staleHoldsForFix(newest, {
|
||||
onGround: meta.onGround,
|
||||
cachedGroundFloor,
|
||||
});
|
||||
if (kinematicsChanged && !holds) {
|
||||
const synthetic = synthesizeForwardKinematicsFix(newest, {
|
||||
epochMs: Date.now(),
|
||||
velocity: meta.speedMps,
|
||||
track: meta.track,
|
||||
turnRateDps: meta.turnRateDps,
|
||||
cachedGroundFloor,
|
||||
});
|
||||
if (synthetic) {
|
||||
history.push(synthetic);
|
||||
if (history.length > POSITION_HISTORY_LIMIT) history.shift();
|
||||
meta.turnRateDps = turnRateFromFixHistory(history);
|
||||
if (isTracked) tracking._appendTrailFix(synthetic.position.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -261,6 +276,7 @@ export function createMilitarySnapshotRenderer({
|
||||
complete: snapshot.complete,
|
||||
retainIds: snapshot.retainIds,
|
||||
likelyLanded: queries._likelyLanded(icao24),
|
||||
tracked: icao24 === flightState._trackedIcao,
|
||||
});
|
||||
if (absence === 'retain') continue;
|
||||
if (absence === 'stale') {
|
||||
|
||||
Reference in new issue
Block a user