Skip to content

feat: add SameNetTraceAlignSolver to merge close same-net trace segments#326

Open
chenchong0215 wants to merge 2 commits into
tscircuit:mainfrom
chenchong0215:fix/align-same-net-traces-34
Open

feat: add SameNetTraceAlignSolver to merge close same-net trace segments#326
chenchong0215 wants to merge 2 commits into
tscircuit:mainfrom
chenchong0215:fix/align-same-net-traces-34

Conversation

@chenchong0215
Copy link
Copy Markdown

Closes #34


This PR implements SameNetTraceAlignSolver that aligns same-net trace segments which are close together.

Algorithm

  • Groups traces by globalConnNetId
  • Extracts horizontal and vertical segments per net
  • Single-linkage clustering by fixed coordinate (Y for horizontal, X for vertical)
  • Computes average coordinate per cluster and snaps all segments to that average

Effect

Reduces visual zig-zag in schematics by aligning nearby same-net trace segments.

Testing

  • 4 new tests added, all pass
  • Full test suite: 61 pass, 4 skip, 0 fail

Pipeline Integration

Added to SchematicTracePipelineSolver after traceCleanupSolver.

Issue: schematic-trace-solver tscircuit#34
Bounty: $75

Algorithm:
- Groups traces by globalConnNetId
- Extracts horizontal and vertical segments per net
- Single-linkage clustering by fixed coordinate (Y for horizontal, X for vertical)
- Computes average coordinate per cluster and snaps all segments to that average

The solver reduces visual zig-zag in schematics by aligning nearby
same-net trace segments that are close together to share the same
Y coordinate (for horizontal) or X coordinate (for vertical).

Pipeline position: after traceCleanupSolver
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 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 May 13, 2026 0:55am

Request Review

@chenchong0215
Copy link
Copy Markdown
Author

Hi @seveibar 👋 All CI checks are passing. Would appreciate a review when you get a chance. Thanks! (fixes #34)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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