TS
fix: remove extra trace lines in post-processing step
tscircuit/schematic-trace-solver#119

/claim #78

Fixes #78

Problem

Extra trace lines appear in schematic diagrams after the post-processing step. When UntangleTraceSubsolver._applyBestRoute() replaces an L-shaped corner with a rerouted path, the direct concatenation of path segments can leave:

  • Duplicate consecutive points (same or near-same coordinates)
  • Redundant collinear intermediate points

These manifest as short spurious line segments in the rendered output.

Solution

  1. Call simplifyPath() after rerouting in _applyBestRoute() — cleans up the concatenated path immediately after assembly
  2. Enhanced simplifyPath() to handle duplicate points — added a preprocessing step that removes duplicate consecutive points (within epsilon tolerance) before the existing collinear reduction passes

Changes

  • lib/solvers/TraceCleanupSolver/sub-solver/UntangleTraceSubsolver.ts — apply simplifyPath() to the new trace path
  • lib/solvers/TraceCleanupSolver/simplifyPath.ts — add duplicate point removal
  • tests/functions/simplifyPath.test.ts — new test suite for simplifyPath
  • tests/examples/__snapshots__/example29.snap.svg — updated snapshot

All 56 tests pass.

Claim

Total prize pool $75
Total paid $0
Status Pending
Submitted February 17, 2026
Last updated February 17, 2026

Contributors

JA

Janis A.

@janisag07

100%

Sponsors

TS

tscircuit

@tscircuit

$75