TS
Fix extra trace lines in post-processing step
tscircuit/schematic-trace-solver#100

/claim #78

Problem

Extra trace lines were appearing in schematic diagrams after the post-processing step.

Root Cause

In UntangleTraceSubsolver._applyBestRoute(), when replacing an L-shaped corner with a new route, the function was directly concatenating path segments without simplifying them. This could leave redundant collinear points or duplicate consecutive points.

Solution

  1. Call simplifyPath immediately after rerouting - Added call to simplifyPath() in _applyBestRoute()
  2. Enhanced simplifyPath to handle duplicate points - Added preprocessing step to remove duplicate consecutive points
  3. Added comprehensive tests - 8 new tests for simplifyPath

Files Changed

  • lib/solvers/TraceCleanupSolver/sub-solver/UntangleTraceSubsolver.ts
  • lib/solvers/TraceCleanupSolver/simplifyPath.ts
  • tests/functions/simplifyPath.test.ts (new)
  • tests/examples/__snapshots__/example29.snap.svg (updated)

Test Results

All 57 tests pass ✓ example29 diff

Claim

Total prize pool $75
Total paid $0
Status Pending
Submitted December 12, 2025
Last updated December 12, 2025

Contributors

LA

lamb356

@lamb356

100%

Sponsors

TS

tscircuit

@tscircuit

$75