mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Contacts move back as smoothly as they move on
A snapshot timeline may declare spanMs: each record of a snapshot at a time then carries its own fixes from spanMs before the time to spanMs after it. Flights, military flights and vessels following the clock are placed on those fixes, so a seek or a move back within the fixes loaded is no jump: nothing is cleared and play does not wait. The step there is asked for once and stands in for every contact; those it has keep their place. Fixes are merged across snapshots at least 20 s apart, at most 240 a contact, and a contact is not drawn more than a minute before its first fix.
This commit is contained in:
1 parent
b8a320edce
commit
2b5fb51684
27 files changed
+1377
-182
No files matched your search
@@ -1,4 +1,8 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import {
|
||||
historyBracketIndex,
|
||||
historyUnseenAt,
|
||||
} from '../../data/timelineHistory.js';
|
||||
import { julianAt } from '../../time/julian.js';
|
||||
import {
|
||||
lerpAngleDeg,
|
||||
@@ -61,6 +65,7 @@ export function createMotion({
|
||||
*/
|
||||
|
||||
function _deadReckon(icao24, result) {
|
||||
flightState._drUnseen = false;
|
||||
const history = flightState._positionHistory.get(icao24);
|
||||
const info = flightState.records.data.get(icao24);
|
||||
if (!history || history.length === 0) {
|
||||
@@ -93,7 +98,15 @@ export function createMotion({
|
||||
);
|
||||
|
||||
// Bracketing pair: interpolate — no extrapolation error, no snap-back.
|
||||
for (let i = history.length - 1; i >= 1; i--) {
|
||||
// The pair around the render time (and the one before it, for a fix at
|
||||
// exactly that time), found by halving: a contact following the clock
|
||||
// keeps a long history.
|
||||
for (
|
||||
let i = historyBracketIndex(history, renderTime),
|
||||
stop = Math.max(1, i - 1);
|
||||
i >= stop;
|
||||
i--
|
||||
) {
|
||||
const a = history[i - 1];
|
||||
const b = history[i];
|
||||
if (
|
||||
@@ -147,6 +160,9 @@ export function createMotion({
|
||||
// the bracketing interpolation above with NO freeze and NO backward snap. (Holding
|
||||
// the oldest fix froze the icon until enough history accrued, then jumped.)
|
||||
const oldest = history[0];
|
||||
// Following the clock, a time well before its first fix is before it
|
||||
// was there: the fleet pass hides it.
|
||||
flightState._drUnseen = historyUnseenAt(history, renderTime);
|
||||
const lookbackSec = Cesium.JulianDate.secondsDifference(
|
||||
oldest.time,
|
||||
renderTime,
|
||||
|
||||
Reference in new issue
Block a user