Skip to content

fix: implement coordinate snapping and path simplification to ensure …#280

Open
MaelProgramming wants to merge 1 commit into
tscircuit:mainfrom
MaelProgramming:fix-coordinate-snapping
Open

fix: implement coordinate snapping and path simplification to ensure …#280
MaelProgramming wants to merge 1 commit into
tscircuit:mainfrom
MaelProgramming:fix-coordinate-snapping

Conversation

@MaelProgramming
Copy link
Copy Markdown

This PR addresses issue #34 regarding misaligned or "jittery" traces in the schematic.

Key Changes:

Fuzzy Snapping: Implemented a snapToGrid function with a 0.01 tolerance to force points onto integer coordinates when the offset is negligible.

Path Simplification: Integrated simplifyPath into the solver pipeline to remove redundant points on straight segments.

Direct Injection: The fix is applied in SchematicTraceLinesSolver right when the path is validated, ensuring all rendered traces are perfectly orthogonal.

Visual Validation
The fix has been validated using React Cosmos with the SchematicTraceLinesSolver02 fixture. As shown in the attached video, the traces are now perfectly straight and the pixel offsets from #34 are gone.

Checklist
[x] TypeScript Build OK (pnpm run build).

[x] Biome Formatting OK (pnpm run format).

[x] Visually verified via Cosmos fixtures.

/claim #34

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 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 5, 2026 6:11pm

Request Review

@MaelProgramming
Copy link
Copy Markdown
Author

@seveibar
Copy link
Copy Markdown
Contributor

seveibar commented May 5, 2026

@MaelProgramming based on your video seems broken no? Also why are there no tests or snapshots?

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