Skip to content

fix: remove extra trace lines from post-processing step#121

Open
makaiachildress-web wants to merge 1 commit intotscircuit:mainfrom
makaiachildress-web:fix-extra-trace-lines-issue78
Open

fix: remove extra trace lines from post-processing step#121
makaiachildress-web wants to merge 1 commit intotscircuit:mainfrom
makaiachildress-web:fix-extra-trace-lines-issue78

Conversation

@makaiachildress-web
Copy link

Summary

Fixes #78

When UntangleTraceSubsolver._applyBestRoute() reroutes L-shaped corners, it concatenates path segments:

const newTracePath = [
  ...originalTrace.tracePath.slice(0, p2Index),
  ...bestRoute,
  ...originalTrace.tracePath.slice(p2Index + 1),
]

This can produce duplicate consecutive points at the junctions (where the old path meets the rerouted segment), which render as zero-length extra trace line segments in the schematic output.

Fix

  1. UntangleTraceSubsolver: Added removeDuplicateConsecutivePoints() after path concatenation in _applyBestRoute() to strip duplicate junction points
  2. simplifyPath: Enhanced with duplicate consecutive point preprocessing before the existing collinear point removal

Key difference from prior PRs (#100, #119)

Those PRs applied the full simplifyPath (including collinear removal) in _applyBestRoute(), which changed the timing of path simplification relative to downstream minimizeTurns and balanceZShapes — causing the example29 snapshot to change. This was seen as a regression.

This PR applies only duplicate point removal in _applyBestRoute(), which is the minimal fix needed. Collinear simplification still happens at the correct time downstream. Zero existing snapshots change.

Tests

  • 9 new unit tests for simplifyPath covering duplicates, collinear points, and combined cases
  • New integration test (example_issue78): NE555 timer circuit with J1 connector and maxMspPairDistance=6, verifying all trace paths are clean (no duplicates, no collinear intermediate points)
  • All 59 existing tests pass, 0 snapshot regressions

/claim #78

🤖 Generated with Claude Code

AI Disclosure: This PR was developed using Claude Code (claude-opus-4-6). All code was reviewed and tested before submission.

Add duplicate consecutive point removal to UntangleTraceSubsolver._applyBestRoute()
and enhance simplifyPath with duplicate point preprocessing.

When _applyBestRoute() concatenates path segments after rerouting L-shaped corners,
the junction points can produce duplicate consecutive coordinates that render as
zero-length extra trace segments in the schematic output.

Changes:
- UntangleTraceSubsolver: remove duplicate consecutive points after path concatenation
- simplifyPath: add removeDuplicateConsecutivePoints preprocessing before collinear removal
- Add 9 unit tests for simplifyPath covering duplicates, collinear, and combined cases
- Add NE555+J1 connector integration test verifying clean trace paths

All 59 existing tests pass with zero snapshot regressions.

/claim tscircuit#78

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 17, 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 Feb 17, 2026 11:40pm

Request Review

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.

Fix extra trace lines in post-processing step

1 participant