fix: detect overlapping polygon and pill courtyards - #186
Open
zkasuran wants to merge 1 commit into
Open
Conversation
checkCourtyardOverlap dropped pcb_courtyard_polygon and pcb_courtyard_pill from its filter, so components whose polygon or pill courtyards overlapped on the same layer passed with no error. Collect both types and turn a pill into a stadium polygon (two semicircle caps, sampled like the circle courtyard's 32-gon).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #185
What
checkCourtyardOverlaponly collectedpcb_courtyard_rect,pcb_courtyard_circleandpcb_courtyard_outline.pcb_courtyard_polygonandpcb_courtyard_pillwere dropped by the filter, so two components whose polygon or pill courtyards overlap on the same layer passed the check with no error.Why it matters
pcb_courtyard_polygonis emitted by real inputs.kicad-component-converterproduces it when importing footprints and@tscircuit/evalcarries it, so a KiCad footprint whose courtyard is a polygon was never checked for overlap.checkPcbComponentOverlapalready treatspcb_courtyard_polygonas a courtyard, so the two overlap checks disagreed on what a courtyard is.Change
pcb_courtyard_polygonandpcb_courtyard_pillto the courtyard filter and theCourtyardElementtype.getCourtyardPolygonreturns the polygon points directly forpcb_courtyard_polygonand approximates a pill as a stadium polygon (two semicircular caps sampled the same way the circle courtyard is turned into a 32-gon).Tests
New file
tests/lib/check-courtyard-overlap/courtyard-polygon-pill-overlap.test.ts:The three assertion tests fail before this change (0 errors) and pass after.
Verified locally before submitting
bun test: 145 pass, 0 failbunx tsc --noEmit: cleanbunx biome format .: cleanAI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: bun test (145 pass, 0 fail), bunx tsc --noEmit clean, biome format clean.