test: tighten barrel regression guard to a hard near-exact bound

This commit is contained in:
sjat 2026-06-11 09:21:04 +02:00
parent 2c2bbb17b9
commit fcfa3a0d80

View file

@ -45,7 +45,8 @@ describe('polywarp', () => {
const test: Vec2[] = [[488, 244], [1464, 732], [1952, 488], [976, 976]]; const test: Vec2[] = [[488, 244], [1464, 732], [1952, 488], [976, 976]];
const polyMax = Math.max(...test.map((m) => dist(applyPolyWarp(w, m), trueMap(m)))); const polyMax = Math.max(...test.map((m) => dist(applyPolyWarp(w, m), trueMap(m))));
const homoMax = Math.max(...test.map((m) => dist(applyHomography(H, m), trueMap(m)))); const homoMax = Math.max(...test.map((m) => dist(applyHomography(H, m), trueMap(m))));
expect(polyMax).toBeLessThan(homoMax * 0.05); expect(homoMax).toBeGreaterThan(1e-3); // homography genuinely fails on barrel data
expect(polyMax).toBeLessThan(1e-6); // degree-3 fit of cubic data is near-exact everywhere
}); });
it('inverse round-trips machine points within a small tolerance', () => { it('inverse round-trips machine points within a small tolerance', () => {