Skip to content

fix: remove zero-length segments in simplifyPath#366

Open
BuckyQ wants to merge 1 commit into
tscircuit:mainfrom
BuckyQ:fix/issue-78-dedup-zero-length-segments
Open

fix: remove zero-length segments in simplifyPath#366
BuckyQ wants to merge 1 commit into
tscircuit:mainfrom
BuckyQ:fix/issue-78-dedup-zero-length-segments

Conversation

@BuckyQ
Copy link
Copy Markdown

@BuckyQ BuckyQ commented May 19, 2026

Fixes #78

/claim #78

Root Cause

simplifyPath collapsed collinear midpoints but did not remove duplicate consecutive points (zero-length segments). Adjacent path points with identical coordinates produce a zero-length stub that renders as an extra trace line in the schematic.

Fix

Added dedupConsecutive to strip identical adjacent points before each collinear-collapse pass. simplifyPath now runs collapseCollinear(dedupConsecutive(path)) twice, with a final dedupConsecutive pass.

Tests

8 new unit tests: duplicate in middle, at start, at end, multiple consecutive duplicates, collinear collapse (H and V), zero-length stub at direction change.

Full suite: 65 pass, 4 skip, 0 fail. Format + type check pass.

…ines

Duplicate consecutive points in a trace path create zero-length segments
that appear as extra trace lines in the post-processing step (issue tscircuit#78).

The previous simplifyPath only collapsed collinear midpoints but did not
handle the case where p1 === p2 (identical coordinates). Adding a
dedupConsecutive pass before each collinear-collapse pass ensures all
zero-length stubs are removed before rendering.

/claim tscircuit#78
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 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 May 19, 2026 4:57pm

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