Remove micro-detours from simplified routes, add debug script and regression test#652
Remove micro-detours from simplified routes, add debug script and regression test#652
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏃 Benchmark This PRRun benchmarks by commenting on this PR: Examples:
Any PR whose title contains |
| if (Math.min(distAB, distBC) >= MICRO_DETOUR_MIN_TINY_EDGE) continue | ||
| if (Math.max(distAB, distBC) <= MICRO_DETOUR_MIN_LARGE_EDGE) continue |
There was a problem hiding this comment.
Logic gap in micro-detour detection. When distAB = 0.005 (tiny) and distBC = 0.025 (medium), the conditions:
- Line 43:
Math.min(0.005, 0.025) = 0.005 < 0.01✓ (passes) - Line 44:
Math.max(0.005, 0.025) = 0.025 <= 0.03✓ (skips removal)
This creates a gap where triangles with one very small edge (< 0.01) and one medium edge (between 0.01 and 0.03) are NOT removed, potentially leaving micro-detours in the output.
// Consider adjusting line 44 to:
if (Math.max(distAB, distBC) < MICRO_DETOUR_MIN_LARGE_EDGE) continue
// Or removing this check entirely if all micro-detours should be caughtThis may cause the regression test to pass while still allowing some micro-triangular detours through, as the test only checks chord < 0.08 without the edge size constraints.
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
Motivation
convertHdRouteToSimplifiedRouteto reduce spurious kinks in output.Description
sanitizeLayerPointsand small geometry helpers (distance) along with constants to detect and remove near-duplicate points and micro-detours based on chord length, edge sizes, and perpendicular distance.sanitizeLayerPointsintoconvertHdRouteToSimplifiedRoutefor both layer transitions and the final layer emission so wires are emitted from cleaned point lists.scripts/debug-dataset01-circuit011-solver3.tsto reproduce and inspect candidate tiny-triangle detours across solver stages.tests/bugs/dataset01-circuit011-solver3-no-micro-triangle.test.tsand a convenience script entrydebug:dataset01:circuit011:solver3inpackage.json.Testing
tests/bugs/dataset01-circuit011-solver3-no-micro-triangle.test.tsviabun testand it passed.bun testto ensure no regressions and the suite passed.Codex Task