Skip to content

Conversation

@lamb356
Copy link

@lamb356 lamb356 commented Dec 12, 2025

/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

@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
schematic-trace-solver Ready Ready Preview Comment Dec 12, 2025 7:11am

@0hmX
Copy link
Contributor

0hmX commented Dec 12, 2025

image

regression, please point to an example or a location that it is fixing? I can not see any fix here; add an example if we do not have one

@lamb356
Copy link
Author

lamb356 commented Dec 12, 2025

This fixes issue #100. The simplifyPath() function now removes duplicate consecutive points after untangling routes. Here's the visual diff showing the fix:
example29 diff

@0hmX
Copy link
Contributor

0hmX commented Dec 13, 2025

nop, it's regressing. You could recreate the example from the issue and add it as a test case, and then try to solve it.

@lamb356
Copy link
Author

lamb356 commented Dec 13, 2025

Hi @techmannih, I tried to find issue #100 but:

schematic-trace-solver/issues/100 returns 404
tscircuit/core/issues/100 is about chip pins (unrelated)

Could you link me to the specific issue with the example you'd like me to add as a test case?
In the meantime, the example29 test I added does demonstrate the fix - the visual diff shows extra trace lines being removed after untangling. Happy to add any additional test cases you need once I can see the original issue.

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.

2 participants