Skip to content

feat: add SameNetTraceLineMergeSolver to merge collinear same-net traces#133

Open
HarshadaGawas05 wants to merge 1 commit intotscircuit:mainfrom
HarshadaGawas05:fix/merge-same-net-trace-lines-34
Open

feat: add SameNetTraceLineMergeSolver to merge collinear same-net traces#133
HarshadaGawas05 wants to merge 1 commit intotscircuit:mainfrom
HarshadaGawas05:fix/merge-same-net-trace-lines-34

Conversation

@HarshadaGawas05
Copy link

Fixes #34 — Merge same-net trace lines on same X or Y axis

/claim #34

Problem

Trace segments on the same net that landed at nearly the same Y (horizontal)
or same X (vertical) coordinate after overlap shifting were rendered as
separate parallel lines instead of one clean line.

Solution

Added SameNetTraceLineMergeSolver — a new post-processing step that runs
immediately after TraceOverlapShiftSolver. It groups segments by net,
buckets them by axis coordinate within a 0.01 tolerance, and
greedy-merges overlapping intervals into single segments.

Before

Before

After

After

Full view

overview

Files changed

  • lib/solvers/SameNetTraceLineMergeSolver/SameNetTraceLineMergeSolver.ts — new solver
  • lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts — wired in after TraceOverlapShiftSolver
  • site/issue-34-repro.page.tsx — before/after visual reproduction page
  • site/issue-34-input.ts — shared circuit input for repro + tests
  • tests/functions/merge-same-net-trace-lines.test.ts — 7 unit tests (exact coordinate assertions)
  • tests/examples/example-issue34.test.ts — integration snapshot test

Checklist

  • bun test — 57 pass, 5 skip, 0 fail
  • npx tsc --noEmit — zero errors
  • npx biome check — zero errors
  • Only SchematicTracePipelineSolver.ts modified among existing solvers
  • No new dependencies added
  • All pre-existing snapshot tests updated and passing

Fixes tscircuit#34
/claim tscircuit#34

- New SameNetTraceLineMergeSolver post-processing step after TraceOverlapShiftSolver
- Groups segments by net, buckets by axis coordinate within 0.01 tolerance
- Greedy interval merge collapses overlapping collinear segments to one
- Wired into SchematicTracePipelineSolver; all downstream solvers read mergedTraceMap
- Visual repro page: site/issue-34-repro.page.tsx (before/after side by side)
- 7 unit tests with exact coordinate assertions
- 1 integration snapshot test
- All 57 existing tests pass, zero TS errors, zero lint errors
@vercel
Copy link

vercel bot commented Mar 22, 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 Mar 22, 2026 9:21am

Request Review

@HarshadaGawas05
Copy link
Author

@seveibar this is ready for review — all checks passing, includes before/after visual repro, 7 unit tests, and 1 integration snapshot test. Happy to make any changes requested.

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.

Merge same-net trace lines that are close together (make at the same Y or same X)

1 participant