Skip to content

feat: Merge same-net trace lines that are close together (#34)#347

Open
ma-moon wants to merge 2 commits into
tscircuit:mainfrom
ma-moon:feat/merge-same-net-traces
Open

feat: Merge same-net trace lines that are close together (#34)#347
ma-moon wants to merge 2 commits into
tscircuit:mainfrom
ma-moon:feat/merge-same-net-traces

Conversation

@ma-moon
Copy link
Copy Markdown

@ma-moon ma-moon commented May 15, 2026

Summary

Adds MergeSameNetTracesSolver to the trace pipeline. When two trace lines belong to the same net and have parallel segments within 0.3 units of each other, they are merged to the same coordinate (midpoint), reducing visual clutter.

Changes

  • New: lib/solvers/MergeSameNetTracesSolver/MergeSameNetTracesSolver.ts — Solver that detects close parallel segments on same-net traces and merges them
  • Modified: lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts — Added the new solver to the pipeline after TraceCleanup

Implementation

  • Uses globalConnMap.areConnected() to identify traces in the same net
  • Finds parallel (horizontal or vertical) segments within 0.3 grid units
  • Merges to the midpoint coordinate
  • Handles both horizontal (Y merge) and vertical (X merge) segments

Closes #34

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 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 15, 2026 7:05am

Request Review

@ma-moon
Copy link
Copy Markdown
Author

ma-moon commented May 15, 2026

Hi @seveibar, this PR adds the MergeSameNetTracesSolver for #29. It detects parallel segments on same-net traces within 0.3 units and merges them to the midpoint. Happy to make any adjustments needed!

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