Skip to content

fix(post-processing): remove zero-length segments left by diagonal fix#456

Open
theherrovn-sys wants to merge 1 commit into
tscircuit:mainfrom
theherrovn-sys:fix/remove-zero-length-segments-post-processing-78
Open

fix(post-processing): remove zero-length segments left by diagonal fix#456
theherrovn-sys wants to merge 1 commit into
tscircuit:mainfrom
theherrovn-sys:fix/remove-zero-length-segments-post-processing-78

Conversation

@theherrovn-sys
Copy link
Copy Markdown

Closes #78

/claim #78

Root cause: when TraceOverlapShiftSolver.findAndFixNextDiagonalSegment
fixes a near-zero diagonal segment it inserts an elbowPoint via splice().
If the chosen elbow coincides with the adjacent endpoint (p1 or p2), a
zero-length segment is produced. simplifyPath did not remove duplicate
consecutive points, so the spurious segment survived into final output.

Fix 1 - simplifyPath.ts: add isSamePoint() guard that drops zero-length
(duplicate) points in both simplification passes.

Fix 2 - TraceOverlapShiftSolver.ts: before splice(), detect when the
elbow equals p1 or p2 and snap the existing endpoint instead of
inserting a duplicate.

Closes tscircuit#78

Root cause: when TraceOverlapShiftSolver.findAndFixNextDiagonalSegment
fixes a near-zero diagonal segment it inserts an elbowPoint via splice().
If the chosen elbow coincides with the adjacent endpoint (p1 or p2), a
zero-length segment is produced. simplifyPath did not remove duplicate
consecutive points, so the spurious segment survived into final output.

Fix 1 - simplifyPath.ts: add isSamePoint() guard that drops zero-length
(duplicate) points in both simplification passes.

Fix 2 - TraceOverlapShiftSolver.ts: before splice(), detect when the
elbow equals p1 or p2 and snap the existing endpoint instead of
inserting a duplicate.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 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 May 31, 2026 12:25pm

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.

Fix extra trace lines in post-processing step

1 participant