mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Pin how a horizon-culled draw set's lift stands in for the aircraft layers'
The aircraft layers lift a contact for the horizon test only when its fix is below 10 m; a horizon-culled set on the Cesium draw port lifts every row drawn below 12 m, and the contract has no per-row lift to say otherwise. The 10 m threshold is now named beside the cull height (iconSet's ICON_CULL_LIFT_BELOW_M, which the aircraft icon layer reads), with what the two rules share and where they part: they agree on every row the aircraft rule lifts and every row drawn at 12 m or more, and the port judges the rest higher (a contact between 10 and 12 m, or one drawn below its fix), so it never hides what the aircraft rule shows. No renderer change: a 10 m threshold in the port would change the ships and fires it already draws.
This commit is contained in:
1 parent
2cc226c1f9
commit
ef61be2b3b
3 files changed
+56
-4
No files matched your search
@@ -7,6 +7,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
createIconSet,
|
createIconSet,
|
||||||
ICON_CULL_LIFT,
|
ICON_CULL_LIFT,
|
||||||
|
ICON_CULL_LIFT_BELOW_M,
|
||||||
ICON_RECEDES,
|
ICON_RECEDES,
|
||||||
ICON_ROTATES,
|
ICON_ROTATES,
|
||||||
} from './iconSet.js';
|
} from './iconSet.js';
|
||||||
@@ -42,9 +43,6 @@ const COCKPIT_SCALE_BY_DISTANCE = new Cesium.NearFarScalar(
|
|||||||
8000000,
|
8000000,
|
||||||
0.65,
|
0.65,
|
||||||
);
|
);
|
||||||
/** Contacts drawn below this height (m) are judged for the horizon a little
|
|
||||||
* above the ellipsoid (ICON_CULL_LIFT). */
|
|
||||||
const CULL_LIFT_BELOW_M = 10;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An aircraft layer's contacts as one icon set: each row's motion segment
|
* An aircraft layer's contacts as one icon set: each row's motion segment
|
||||||
@@ -333,7 +331,7 @@ export function createAircraftIcons({
|
|||||||
row,
|
row,
|
||||||
ICON_CULL_LIFT,
|
ICON_CULL_LIFT,
|
||||||
Number.isFinite(info?.renderAltitudeM) &&
|
Number.isFinite(info?.renderAltitudeM) &&
|
||||||
info.renderAltitudeM < CULL_LIFT_BELOW_M,
|
info.renderAltitudeM < ICON_CULL_LIFT_BELOW_M,
|
||||||
);
|
);
|
||||||
set.setAlpha(row, state.records.missingPolls.get(icao24) ? 0.45 : 1);
|
set.setAlpha(row, state.records.missingPolls.get(icao24) ? 0.45 : 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,22 @@ export const ICON_RECEDES = 4;
|
|||||||
export const ICON_CULL_LIFT = 8;
|
export const ICON_CULL_LIFT = 8;
|
||||||
/** The ellipsoid height a CULL_LIFT row is raised to for the horizon test. */
|
/** The ellipsoid height a CULL_LIFT row is raised to for the horizon test. */
|
||||||
export const ICON_CULL_HEIGHT_M = HORIZON_LIFT_M;
|
export const ICON_CULL_HEIGHT_M = HORIZON_LIFT_M;
|
||||||
|
/**
|
||||||
|
* Contacts whose fix is below this height (m) get CULL_LIFT in the aircraft
|
||||||
|
* layers' icon sets; theirs are the only rows flagged by height.
|
||||||
|
*
|
||||||
|
* Through the draw port a `horizonCull` set flags every row, so every row
|
||||||
|
* drawn below ICON_CULL_HEIGHT_M is lifted. The two agree on every row this
|
||||||
|
* rule flags (lifted either way) and every row drawn at or above
|
||||||
|
* ICON_CULL_HEIGHT_M (no lift either way). They differ only on rows this
|
||||||
|
* rule leaves unflagged (fix at or above 10 m) while drawn below 12 m: a
|
||||||
|
* contact between 10 and 12 m (judged up to 2 m higher), or one whose drawn
|
||||||
|
* position sits lower than its fix (a climb-out from a lower earlier fix, a
|
||||||
|
* dead-reckoned ground drift). The port judges those higher, so it never
|
||||||
|
* hides what this rule shows, and shows near-ground contacts at the limb that
|
||||||
|
* this rule culled, which is what the lift is for.
|
||||||
|
*/
|
||||||
|
export const ICON_CULL_LIFT_BELOW_M = 10;
|
||||||
|
|
||||||
/** Move the epoch once render times are this many seconds from it. */
|
/** Move the epoch once render times are this many seconds from it. */
|
||||||
const REBASE_AFTER_SEC = 1800;
|
const REBASE_AFTER_SEC = 1800;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
ICON_CULL_LIFT,
|
ICON_CULL_LIFT,
|
||||||
ICON_ROTATES,
|
ICON_ROTATES,
|
||||||
ICON_SHOWN,
|
ICON_SHOWN,
|
||||||
|
ICON_CULL_LIFT_BELOW_M,
|
||||||
} from './iconSet.js';
|
} from './iconSet.js';
|
||||||
import {
|
import {
|
||||||
writeArcSegment,
|
writeArcSegment,
|
||||||
@@ -334,3 +335,40 @@ test('removing a row moves its switch, proxy and depth-test columns too', () =>
|
|||||||
assert.equal(set.pickProxyHeight(moved), 33);
|
assert.equal(set.pickProxyHeight(moved), 33);
|
||||||
assert.equal(set.depthTestDistance(moved), 0);
|
assert.equal(set.depthTestDistance(moved), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a horizon-culled draw set lifts what the aircraft layers lift, and lifts the rest no lower', () => {
|
||||||
|
const set = createIconSet();
|
||||||
|
const row = set.add('a');
|
||||||
|
set.setFlag(row, ICON_CULL_LIFT, true);
|
||||||
|
const heightOf = (p) => Cesium.Cartographic.fromCartesian(p).height;
|
||||||
|
// The aircraft layers' rule, by fix height h for a row drawn at d.
|
||||||
|
const aircraft = (h, d) =>
|
||||||
|
h < ICON_CULL_LIFT_BELOW_M ? Math.max(d, ICON_CULL_HEIGHT_M) : d;
|
||||||
|
for (const [h, d] of [
|
||||||
|
[-31, -31],
|
||||||
|
[5, 5],
|
||||||
|
[9.99, 9.99],
|
||||||
|
[12, 12],
|
||||||
|
[400, 400],
|
||||||
|
[9, 15],
|
||||||
|
[20, 20],
|
||||||
|
]) {
|
||||||
|
const at = Cesium.Cartesian3.fromDegrees(-97.04, 32.9, d);
|
||||||
|
const judged = heightOf(set.cullPoint(row, at));
|
||||||
|
assert.ok(
|
||||||
|
Math.abs(judged - aircraft(h, d)) < 1e-3,
|
||||||
|
`${h}/${d} m: ${judged}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Unflagged by the aircraft rule, drawn below 12 m: judged higher, never lower.
|
||||||
|
for (const [h, d] of [
|
||||||
|
[10, 10],
|
||||||
|
[11, 11],
|
||||||
|
[20, 5],
|
||||||
|
]) {
|
||||||
|
const at = Cesium.Cartesian3.fromDegrees(4.1, 51.95, d);
|
||||||
|
const judged = heightOf(set.cullPoint(row, at));
|
||||||
|
assert.ok(Math.abs(judged - ICON_CULL_HEIGHT_M) < 1e-3, `${h}/${d} m`);
|
||||||
|
assert.ok(judged > aircraft(h, d), 'judged higher');
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in new issue
Block a user