Skip to content

fix: Correct computation for bounding box of gerber files.#342

Merged
spe-ciellt merged 1 commit intogerbv:developfrom
eyal0:fix_gerber_bbox
Mar 3, 2026
Merged

fix: Correct computation for bounding box of gerber files.#342
spe-ciellt merged 1 commit intogerbv:developfrom
eyal0:fix_gerber_bbox

Conversation

@eyal0
Copy link
Copy Markdown
Collaborator

@eyal0 eyal0 commented Mar 3, 2026

For the bounding box of an arc, we must consider the starting point, the end point, and every point that is at an x-axis or y-axis extent. Those occur at the angles that are multiples of 90 degrees. The for loop should iterate over those rather than every 90 degrees start from the start of the arc.

Similar code is in drill.c.

This fixes #336.

@eyal0 eyal0 force-pushed the fix_gerber_bbox branch from 4859ca1 to f028a39 Compare March 3, 2026 04:28
Copy link
Copy Markdown
Contributor

@rampageservices rampageservices left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This matches the corrected version already in drill.c:502 (from #298), and fixes the exact bug we described in #336.

For reference, #335 point 2 also documented this discrepancy between the two implementations — this PR resolves it.

For the bounding box of an arc, we must consider the starting point,
the end point, and every point that is at an x-axis or y-axis extent.
Those occur at the angles that are multiples of 90 degrees.  The `for`
loop should iterate over those rather than every 90 degrees start from
the start of the arc.

Similar code is in `drill.c`.

This fixes gerbv#336.
@eyal0 eyal0 force-pushed the fix_gerber_bbox branch from f028a39 to 5d90fe3 Compare March 3, 2026 04:40
@spe-ciellt spe-ciellt added the fix Solution for a potential problem or omission. label Mar 3, 2026
@spe-ciellt spe-ciellt self-assigned this Mar 3, 2026
@spe-ciellt spe-ciellt merged commit 00dc874 into gerbv:develop Mar 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Solution for a potential problem or omission.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect gerber bounds computed by gerbv

3 participants