From 3bc92876b42dfe0fb80c2485199efdb85624364a Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 3 Jul 2023 23:00:00 +0200 Subject: Fix arc bounding box calculation for full circles --- gerbonara/utils.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gerbonara/utils.py') diff --git a/gerbonara/utils.py b/gerbonara/utils.py index 2bda581..e2587fa 100644 --- a/gerbonara/utils.py +++ b/gerbonara/utils.py @@ -354,6 +354,10 @@ def arc_bounds(x1, y1, x2, y2, cx, cy, clockwise): # Calculate radius r = math.sqrt(x1**2 + y1**2) + # Special case: Gerber defines an arc with p1 == p2 as a full circle. + if math.isclose(x1, x2) and math.isclose(y1, y2): + return (cx-r, cy-r), (cx+r, cy+r) + # Calculate in which half-planes (north/south, west/east) P1 and P2 lie. # Note that we assume the y axis points upwards, as in Gerber and maths. # SVG has its y axis pointing downwards. -- cgit