Skip to content

feat: add SameNetTraceMergeSolver pipeline phase#160

Open
satyamdas03 wants to merge 2 commits intotscircuit:mainfrom
satyamdas03:feat/same-net-trace-merge-solver
Open

feat: add SameNetTraceMergeSolver pipeline phase#160
satyamdas03 wants to merge 2 commits intotscircuit:mainfrom
satyamdas03:feat/same-net-trace-merge-solver

Conversation

@satyamdas03
Copy link
Copy Markdown

@satyamdas03 satyamdas03 commented Apr 4, 2026

Summary

Implements issues #34 and #29: same-net trace segments running parallel and close together on the same axis are now merged into a single line.

What this adds

lib/solvers/SameNetTraceMergeSolver/SameNetTraceMergeSolver.ts — new pipeline phase:

  • Groups traces by globalConnNetId
  • For each same-net pair, finds horizontal segments within GAP_THRESHOLD (0.19 units) of each other with overlapping X ranges → snaps both to the same Y
  • Same logic for vertical segments (overlapping Y ranges → snaps to same X)
  • Runs simplifyPath afterward to remove collinear/zero-length waypoints and keep all paths orthogonal

SchematicTracePipelineSolver — wired in after TraceCleanupSolver, before the final NetLabelPlacementSolver pass.

Tests (5 total, all passing)

  • Unit: merges close horizontal same-net segments ✅
  • Unit: merges close vertical same-net segments ✅
  • Unit: does NOT merge traces on different nets ✅
  • Unit: does NOT merge when gap > GAP_THRESHOLD ✅
  • Integration: full pipeline snapshot with sameNetTraceMergeSolver present ✅

54 pass, 0 fail — full suite

/claim #34
/claim #29

Implements a new post-cleanup pipeline step that merges same-net trace
segments running parallel and close together on the same axis:

- Horizontal segments on the same net within GAP_THRESHOLD (0.19 units)
  of each other with overlapping X ranges are snapped to the same Y.
- Vertical segments on the same net within GAP_THRESHOLD with overlapping
  Y ranges are snapped to the same X.

After merging, collinear/zero-length points are removed via simplifyPath
so the resulting paths stay clean and orthogonal.

The solver is wired into SchematicTracePipelineSolver after TraceCleanupSolver
and before the final NetLabelPlacementSolver pass.

Adds 5 tests (4 unit + 1 integration) — all 54 suite tests pass, 0 fail.

Closes tscircuit#34

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 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 4, 2026 10:56pm

Request Review

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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