summaryrefslogtreecommitdiff
path: root/gerber/primitives.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2017-11-16 09:56:03 -0500
committerGitHub <noreply@github.com>2017-11-16 09:56:03 -0500
commit4bd2f6c7dac7c80fd6e530ed992e35aced2eaa71 (patch)
treeeebcd8a137a975e4ac44cd6c1b0c563406ec6cf9 /gerber/primitives.py
parente12a04fc16fd3c43a1353658a528ac8325ef42bb (diff)
parentc2ed707b52e35d047daf5b6346e071d695861895 (diff)
downloadgerbonara-4bd2f6c7dac7c80fd6e530ed992e35aced2eaa71.tar.gz
gerbonara-4bd2f6c7dac7c80fd6e530ed992e35aced2eaa71.tar.bz2
gerbonara-4bd2f6c7dac7c80fd6e530ed992e35aced2eaa71.zip
Merge pull request #79 from curtacircuitos/fix-slot-position
Fix slot position
Diffstat (limited to 'gerber/primitives.py')
-rw-r--r--gerber/primitives.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py
index a031199..b24b6c3 100644
--- a/gerber/primitives.py
+++ b/gerber/primitives.py
@@ -1669,9 +1669,12 @@ class Slot(Primitive):
@property
def bounding_box(self):
if self._bounding_box is None:
- ll = tuple([c - self.diameter / 2. for c in self.position])
- ur = tuple([c + self.diameter / 2. for c in self.position])
- self._bounding_box = ((ll[0], ur[0]), (ll[1], ur[1]))
+ radius = self.diameter / 2.
+ min_x = min(self.start[0], self.end[0]) - radius
+ max_x = max(self.start[0], self.end[0]) + radius
+ min_y = min(self.start[1], self.end[1]) - radius
+ max_y = max(self.start[1], self.end[1]) + radius
+ self._bounding_box = ((min_x, max_x), (min_y, max_y))
return self._bounding_box
def offset(self, x_offset=0, y_offset=0):