feat: Merge same-net trace lines that are close together#129
Open
youcef3300 wants to merge 1 commit intotscircuit:mainfrom
Open
feat: Merge same-net trace lines that are close together#129youcef3300 wants to merge 1 commit intotscircuit:mainfrom
youcef3300 wants to merge 1 commit intotscircuit:mainfrom
Conversation
…t traces Adds a new pipeline phase that identifies same-net trace segments running parallel and close together, then snaps them to the same coordinate. This reduces visual clutter from near-duplicate parallel lines. Algorithm: - Groups traces by globalConnNetId - Collects horizontal/vertical segments per net group - Uses union-find to cluster segments from different traces that are within threshold (0.06) and have genuine range overlap - Snaps clustered segments to length-weighted average coordinate Includes 5 unit tests and 1 visual example (example31). All existing 29 example tests continue to pass unchanged. Closes tscircuit#34
|
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.
Summary
Adds a new
SameNetTraceLineMergeSolverpipeline phase that merges same-net trace segments running parallel and close together onto the same coordinate (Y for horizontal, X for vertical).lib/solvers/SameNetTraceLineMergeSolver/SameNetTraceLineMergeSolver.tsTraceOverlapShiftSolver, beforeNetLabelPlacementSolverglobalConnNetId, uses union-find to cluster segments from different traces within 0.06 threshold with genuine range overlap, snaps to length-weighted averageBefore/After
The solver activates when two traces on the same electrical net have parallel segments at slightly different coordinates (e.g., Y=1.0 and Y=1.04). It snaps them to a shared coordinate, reducing visual clutter from near-duplicate parallel lines.
Example:
site/examples/example31-same-net-merge.page.tsx— 3 chips connected on 2 nets demonstrating the merge behavior.Tests
example31) with SVG snapshotTest plan
bun test— all tests passbunx tsc --noEmit— no new type errorsCloses #34