summaryrefslogtreecommitdiff
path: root/gerbonara
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-07-03 23:00:00 +0200
committerjaseg <git@jaseg.de>2023-07-03 23:00:00 +0200
commit3bc92876b42dfe0fb80c2485199efdb85624364a (patch)
treeb4f4924ba7248bdd37cd78024ac8ebb421e9a193 /gerbonara
parent34fae0a7c2cf894117eee0b25e32726a492d25a8 (diff)
downloadgerbonara-3bc92876b42dfe0fb80c2485199efdb85624364a.tar.gz
gerbonara-3bc92876b42dfe0fb80c2485199efdb85624364a.tar.bz2
gerbonara-3bc92876b42dfe0fb80c2485199efdb85624364a.zip
Fix arc bounding box calculation for full circles
Diffstat (limited to 'gerbonara')
-rw-r--r--gerbonara/utils.py4
1 files changed, 4 insertions, 0 deletions
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.