Skip to content

fix: remove redundant second pass in simplifyPath (#78)#202

Open
BossChaos wants to merge 1 commit intotscircuit:mainfrom
BossChaos:main
Open

fix: remove redundant second pass in simplifyPath (#78)#202
BossChaos wants to merge 1 commit intotscircuit:mainfrom
BossChaos:main

Conversation

@BossChaos
Copy link
Copy Markdown

Summary

Fixes #78 - removes extra trace lines in post-processing step.

Root Cause

The simplifyPath function in lib/solvers/TraceCleanupSolver/simplifyPath.ts had two identical passes that both remove collinear points:

  • First pass (lines 10-22): removes redundant collinear points
  • Second pass (lines 25-38): does the exact same thing again

The second pass was completely redundant and could potentially introduce visual artifacts in the trace rendering.

Changes

  • Removed the duplicate second loop (16 lines deleted)
  • Single pass is sufficient to simplify the path
  • No behavior change expected for valid inputs

Testing

The existing test suite should pass as this is a pure optimization that produces the same output for valid inputs.

- The simplifyPath function had two identical passes that both removed collinear points
- The second pass (lines 25-38) was redundant and could potentially introduce extra trace lines
- Removed the duplicate loop, keeping only the first simplification pass

Fixes tscircuit#78
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 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 Apr 20, 2026 3:36pm

Request Review

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.

Fix extra trace lines in post-processing step

1 participant