TraceCleanupSolver: merge close same-net trace segments (#34)#440
Open
ryantanton1122-lang wants to merge 3 commits into
Open
TraceCleanupSolver: merge close same-net trace segments (#34)#440ryantanton1122-lang wants to merge 3 commits into
ryantanton1122-lang wants to merge 3 commits into
Conversation
Adds a new TraceCleanupSolver pipeline step `merging_close_same_net_traces` that runs after `untangling_traces` and before `minimizing_turns`. The step collapses parallel axis-aligned segments belonging to the same `dcConnNetId` whose perpendicular offset is smaller than `paddingBuffer` and that overlap on the parallel axis. Both segments are snapped to the midpoint coordinate, then each touched path is passed through `simplifyPath` to remove duplicate corners produced by the snap. Endpoint segments (the first and last in each tracePath) are deliberately skipped — those touch chip pins and moving them would disconnect the trace. Unit tests cover: - Horizontal segments same net, within threshold → snap - Vertical segments same net, within threshold → snap - Different-net traces → no snap - Segments beyond threshold → no snap - Pin-touching endpoint segments → no snap - Single trace per net → unchanged Resolves tscircuit#34.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The default threshold of `paddingBuffer` was the same as the upstream TraceOverlapShiftSolver shift amount, which meant this step was collapsing intentional channel spacings on shared-net traces. Halved to `paddingBuffer * 0.5` so only sub-channel-width offsets are collapsed. Also fixed a bug in the horizontal-snap test where the .find() predicate matched the first horizontal segment (the pin lead at y=0) instead of the snapped middle segment.
The 4-point path stubs had the horizontal merge candidate touching the pin endpoint (path[length-1]), which the implementation correctly skips. Updated both H and V tests, plus the negative-case tests, to use 6-point paths where path[2]->path[3] is a true interior segment.
Author
|
Status update after the test-data fix push (sha
The example29 failure is purely a snapshot-regeneration item — it'll resolve with If the maintainer prefers a more conservative threshold than Ready for review. |
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
merging_close_same_net_tracesstep to theTraceCleanupSolverpipeline that snaps parallel same-net trace segments onto a shared coordinate.After
SchematicTraceLinesSolver+TraceOverlapShiftSolver, two traces belonging to the same electrical net can end up running parallel at a small offset — visually this reads as two near-overlapping wires instead of a single trunk. Since the traces share a net, snapping them together preserves connectivity while removing the visual duplication.Algorithm
dcConnNetId.(EPS, threshold]and that overlap on the parallel axis, snap both to the midpoint.simplifyPath()to collapse duplicate corners.The default threshold is
paddingBuffer— the channel-spacing constant the upstreamTraceOverlapShiftSolveralready uses, so any offset that's smaller is exactly the cosmetic gap we want to collapse. Endpoint segments (the first and last in each tracePath) are never moved because they touch chip pins.Tests
tests/solvers/TraceCleanupSolver/mergeCloseSameNetTraces.test.tscovers:The full
TraceCleanupSolver.test.tssnapshot will likely need an-urefresh on first run since the cleanup output now includes the new step's effects — that's expected and verifiable in the diff.Closes
Closes #34.