test: sample corridor floors beyond cell-boundary hysteresis

This commit is contained in:
Sameh Khamis committed 2026-09-13 03:56:23 -07:00
1 parent 1f76f81484
commit 6bd755109f
1 file changed
+21 -2
+21 -2
View File
@@ -3203,10 +3203,25 @@ async function main() {
await fl.update(v); await fl.update(v);
await window.__dfSettle(600); await window.__dfSettle(600);
} }
const bb1 = window.__dfFindBB('aaa097'); // The floor owner intentionally retains the previous cell near an
const d1 = bb1 ? window.__dfCarto(bb1.position) : null; // edge. Sample inside a cell, beyond that hysteresis band, so the raw
// coordinate's floor is unambiguously the floor the sprite must use.
// Wait for geometry, not a passing height; a missing clamp still fails.
const interiorLimit = 0.0005 - gf.CELL_HYSTERESIS_DEG - 0.00002;
const sampleDeadline = Date.now() + 8000;
let d1 = null;
let sampleInterior = false;
do {
await window.__dfSettle(250);
const bb1 = window.__dfFindBB('aaa097');
d1 = bb1 ? window.__dfCarto(bb1.position) : null;
sampleInterior = !!d1
&& Math.abs(d1.lat - cell(d1.lat)) < interiorLimit
&& Math.abs(d1.lon - cell(d1.lon)) < interiorLimit;
} while (!sampleInterior && Date.now() < sampleDeadline);
return { return {
startCold, startCold,
sampleInterior,
displayCell, displayCell,
fixCell, fixCell,
sameCellAsFix: displayCell.lat === fixCell.lat && displayCell.lon === fixCell.lon, sameCellAsFix: displayCell.lat === fixCell.lat && displayCell.lon === fixCell.lon,
@@ -3249,6 +3264,10 @@ async function main() {
dfCorridor.controlFloor == null, dfCorridor.controlFloor == null,
`control cell floor = ${dfCorridor.controlFloor}`); `control cell floor = ${dfCorridor.controlFloor}`);
record('display-floor/corridor: the height sample clears cell-boundary hysteresis',
dfCorridor.sampleInterior === true,
'the sampled coordinate lies inside one unambiguous floor cell');
record('display-floor/corridor: the sprite rides the corridor-warmed floor', record('display-floor/corridor: the sprite rides the corridor-warmed floor',
Number.isFinite(dfCorridor.spriteH) && Number.isFinite(dfCorridor.spriteFloor) Number.isFinite(dfCorridor.spriteH) && Number.isFinite(dfCorridor.spriteFloor)
&& dfCorridor.spriteH >= dfCorridor.spriteFloor + DISPLAY_FLOOR_LIFT_M - 0.5, && dfCorridor.spriteH >= dfCorridor.spriteFloor + DISPLAY_FLOOR_LIFT_M - 0.5,