feat(solver): add SameNetMergeSegmentSolver to collapse redundant same-net parallel segments#441
Open
sucloudflare wants to merge 1 commit into
Open
Conversation
…e-net parallel segments Closes tscircuit#34 Closes tscircuit#29 When two traces share the same net and have parallel axis-aligned segments within MERGE_THRESHOLD (0.25 schematic units) of each other with overlapping extents, they appear as near-duplicate stacked lines on the schematic. This adds SameNetMergeSegmentSolver which: - Scans all trace segment pairs for horizontal (same Y) or vertical (same X) candidates on the same net - Snaps both segments to the midpoint coordinate and extends to the union of their extents (fixed-point iteration until no more merges possible) - Runs in the pipeline after TraceCleanupSolver, before NetLabelPlacementSolver Tests: 5 unit tests covering horizontal merge, vertical merge, different-net no-merge, far-apart no-merge, and extent union.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34
Closes #29
Problem
When two traces belong to the same net, the schematic router sometimes places parallel segments very close together (within ~0.2 schematic units) on the same axis. These appear as two nearly-identical stacked lines—visual clutter that makes the schematic harder to read.
Solution
New
SameNetMergeSegmentSolverthat runs in the pipeline afterTraceCleanupSolver:MERGE_THRESHOLD(0.25 su) and whose extents overlap — collapses both to the midpoint coordinate and extends to the union of both extentsPipeline change
TraceCleanupSolver→SameNetMergeSegmentSolver→NetLabelPlacementSolver→Example28Solver→ ...Downstream solvers pick up merged traces via:
Tests added
5 unit tests in
tests/solvers/SameNetMergeSegmentSolver/SameNetMergeSegmentSolver.test.ts: