summaryrefslogtreecommitdiff
path: root/gerber/primitives.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-03-05 10:04:58 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-03-05 10:04:58 +0800
commit7f47aea332ee1df45c87baa304d95ed03cc59865 (patch)
tree3205ab404766fd09d0ed0a47a0857be38568088a /gerber/primitives.py
parent7b88509c4acb4edbbe1a39762758bf28efecfc7f (diff)
downloadgerbonara-7f47aea332ee1df45c87baa304d95ed03cc59865.tar.gz
gerbonara-7f47aea332ee1df45c87baa304d95ed03cc59865.tar.bz2
gerbonara-7f47aea332ee1df45c87baa304d95ed03cc59865.zip
Write polygons to macros
Diffstat (limited to 'gerber/primitives.py')
-rw-r--r--gerber/primitives.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py
index 3c85f17..08aa634 100644
--- a/gerber/primitives.py
+++ b/gerber/primitives.py
@@ -736,6 +736,10 @@ class Polygon(Primitive):
@property
def flashed(self):
return True
+
+ @property
+ def diameter(self):
+ return self.radius * 2
@property
def bounding_box(self):
@@ -759,6 +763,20 @@ class Polygon(Primitive):
points.append(rotate_point((self.position[0] + self.radius, self.position[1]), offset + da * i, self.position))
return points
+
+ def equivalent(self, other, offset):
+ '''
+ Is this the outline the same as the other, ignoring the position offset?
+ '''
+
+ # Quick check if it even makes sense to compare them
+ if type(self) != type(other) or self.sides != other.sides or self.radius != other.radius:
+ return False
+
+ equiv_pos = tuple(map(add, other.position, offset))
+
+ return nearly_equal(self.position, equiv_pos)
+
class AMGroup(Primitive):
"""