Skip to content

feat: detect close same-net trace endpoints for merging (#378)#405

Open
onchito-walks wants to merge 2 commits into
tscircuit:mainfrom
onchito-walks:feat/find-close-same-net-traces
Open

feat: detect close same-net trace endpoints for merging (#378)#405
onchito-walks wants to merge 2 commits into
tscircuit:mainfrom
onchito-walks:feat/find-close-same-net-traces

Conversation

@onchito-walks
Copy link
Copy Markdown

@onchito-walks onchito-walks commented May 21, 2026

Summary

Detection + merge pipeline for close same-net trace endpoints. Two-phase approach:

Phase 1: Detection

Groups same-net traces whose endpoints are within 0.5 grid units of each other. Conservative — no path mutations, just grouping.

Phase 2: Merge

For each detected group, finds the closest endpoint pair and constructs a continuous path with an L-shaped connector. Handles horizontal, vertical, and touching endpoints.

Changes

  • New sub-solver: detect close same-net traces
  • New sub-solver: merge close same-net traces
  • 7 focused tests: horizontal merge, vertical merge, touching endpoints, distance gate, reverse orientation, multi-group, single-trace safety

Verification

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 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 22, 2026 1:34am

Request Review

…ion (tscircuit#378)

- Add findCloseSameNetTraceGroups sub-solver that groups same-net traces
  by endpoint proximity (default threshold: 0.5mm)
- Wire into TraceCleanupSolver init and output
- Add focused test coverage for same-net grouping
- All 62 tests pass, typecheck clean, build clean, format clean

Addresses tscircuit#378
@onchito-walks
Copy link
Copy Markdown
Author

This adds the detection phase for close same-net trace endpoints. It runs conservatively — only groups traces, never mutates paths — so downstream phases can decide whether to merge them. I kept the detection threshold at 0.5 units based on the existing trace grid spacing, but happy to adjust if you have a different convention in mind.

The implementation is structured as a self-contained sub-solver with its own test suite (1 test, 4 assertions, passing). Ready for review whenever you get a chance.

Builds on the detection phase to actually merge close same-net trace
segments. mergeTwoSameNetTraces finds the closest endpoint pair between
two same-net traces and constructs a continuous path through an L-shaped
connector. mergeCloseSameNetTraceGroups processes all detected groups.

7 tests covering: horizontal merge, vertical merge, touching endpoints,
distance gate, reverse orientation, multi-group processing, single-trace
safety.
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.

1 participant