From 38a854063eff9aabcb68a84dd2afcee82de14e8f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 24 Nov 2026 21:32:09 +0100 Subject: [PATCH] ridge: offsetRange on a desktop viewport with keep under 0.75 is pinned Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/scene/ridge/view.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/features/scene/ridge/view.test.ts b/src/app/features/scene/ridge/view.test.ts index 395ea727..ae3c7f3c 100644 --- a/src/app/features/scene/ridge/view.test.ts +++ b/src/app/features/scene/ridge/view.test.ts @@ -216,6 +216,20 @@ describe('offsetRange', () => { expect(ehi).toBe(180); }); + it('on a desktop viewport, where the width binds the scale and keep is well under 1, the backward offset stops where the nearest card shrunk by R / (R + r) lifts its foot to the bottom edge', () => { + // 1920 x 1080 with the ground rows the manifest guarantees: scale 1.65 (the width term), so keep = 0.15 x 1080 / (1.65 x 150) = 0.65, far under the 0.75 a clamped keep would stop at. The bake's r_max is made large enough that the foot, not r_max, binds. + const wide = parseManifest(wireManifest({ view: { ...(wireManifest().view as object), horizon_row: 450 }, camera: { r_max_m: 600, r_max_forward_m: 700 } }), '/d/'); + const win = windowFor(wide.view, 1920, 1080); + const keep = (0.15 * 1080) / (win.plane.scale * 150); + expect(keep).toBeGreaterThan(0.6); + expect(keep).toBeLessThan(0.7); + const [lo, hi] = offsetRange(wide, win, 'both'); + expect(lo).toBeCloseTo(-1000 * (1 / keep - 1), 6); // about -538 m + expect(-lo).toBeLessThan(600); + expect(hi).toBe(700); + expect(offsetRange(wide, win, 'offset')).toEqual([lo, -lo]); + }); + it('reads the ground rows from the runtime constants: 150 of 600, so the plane reaches the bottom of every viewport at rest', () => { expect(groundRowsNeeded(600)).toBeCloseTo(150, 9); const exact = withView({ horizon_row: 600 - groundRowsNeeded(600) });