Skip to content

feat: merge same-net trace lines that are close together (Issue #34)#108

Open
giajoe24 wants to merge 3 commits intotscircuit:mainfrom
giajoe24:fix-issue-34-parallel-traces
Open

feat: merge same-net trace lines that are close together (Issue #34)#108
giajoe24 wants to merge 3 commits intotscircuit:mainfrom
giajoe24:fix-issue-34-parallel-traces

Conversation

@giajoe24
Copy link

@giajoe24 giajoe24 commented Jan 17, 2026

Fix: Merge Close Parallel Trace Lines (Issue #34)

Description

This PR addresses Issue #34 by enhancing the TraceCombineSolver to identify and merge trace segments that are parallel and remain in very close proximity (within a 0.05 threshold), even if they are not strictly collinear or touching end-to-end.

Previously, TraceCombineSolver only handled collinear segments that were touching or overlapping. This improvement handles cases where traces might be slightly offset (e.g. due to floating point differences or grid alignment), consolidating them into a single clean trace aligned to their average center.

Changes

  • Core Logic: Added tryCombineParallelTraces method to TraceCombineSolver.
    • Detects parallel traces (Horizontal/Vertical).
    • Checks for proximity (threshold: 0.05).
    • Merges them into a single trace aligned to the average coordinate of the two.
  • Integration: Updated combineTracesForNet logic to attempt parallel merging if end-to-end connection fails.
  • Tests: Added tests/reproduction_issue_34.test.ts to verify that close parallel traces are correctly merged into one.

Verification

Related Issue

Closes #34
/claim #34

@vercel
Copy link

vercel bot commented Jan 17, 2026

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

Project Deployment Review Updated (UTC)
schematic-trace-solver Ready Ready Preview, Comment Jan 18, 2026 3:28am

Request Review

Copy link

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to recreate an example of the problem, then show that you fixed the problem in a snapshot

@giajoe24
Copy link
Author

@rushabhcodes
I have created a reproduction case and verified the fix.

Here is the visual proof:

Before (TraceCombineSolver input):
Two close parallel traces on the same net.
issue_34_before

After (TraceCombineSolver output):
The traces are correctly merged into a single path.
issue_34_after

I also verified this with a reproduction test tests/reproduction_issue_34.test.ts which now passes.

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)

2 participants