Skip to content

fix: remove duplicate consecutive points causing extra trace lines in post-processing#189

Open
LuSrodri wants to merge 2 commits intotscircuit:mainfrom
LuSrodri:fix/extra-trace-lines-post-processing-78
Open

fix: remove duplicate consecutive points causing extra trace lines in post-processing#189
LuSrodri wants to merge 2 commits intotscircuit:mainfrom
LuSrodri:fix/extra-trace-lines-post-processing-78

Conversation

@LuSrodri
Copy link
Copy Markdown

Problem\n\nExtra zero-length trace segments appear in the schematic output when _applyBestRoute() splices a rerouted segment into an existing trace path. The splice produces duplicate consecutive coordinates at the junction (the last point of the left slice equals the first point of bestRoute), which renders as a tiny extra line artifact.\n\nsimplifyPath() also lacked protection: if duplicate consecutive points reached the collinear-merge pass, the direction test would see a zero-length segment and behave incorrectly.\n\n## Fix\n\nAdded removeDuplicateConsecutivePoints() to simplifyPath.ts (also exported for direct use):\n- simplifyPath now calls it as a pre-pass before the collinear-merge loops, so zero-length segments are stripped regardless of origin.\n- UntangleTraceSubsolver._applyBestRoute wraps the spliced path with removeDuplicateConsecutivePoints at the splice site, fixing the root cause.\n\n## Files\n\n| File | Change |\n|------|--------|\n| lib/solvers/TraceCleanupSolver/simplifyPath.ts | Added exported removeDuplicateConsecutivePoints; call it at start of simplifyPath |\n| lib/solvers/TraceCleanupSolver/sub-solver/UntangleTraceSubsolver.ts | Import and apply removeDuplicateConsecutivePoints in _applyBestRoute |\n| tests/functions/simplifyPath.test.ts | New unit tests for removeDuplicateConsecutivePoints and updated simplifyPath behaviour |\n\n/claim #78

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
schematic-trace-solver Ready Ready Preview, Comment Apr 15, 2026 1:26am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant