diff options
author | Hamilton Kibbe <ham@hamiltonkib.be> | 2015-02-12 11:28:50 -0500 |
---|---|---|
committer | Hamilton Kibbe <ham@hamiltonkib.be> | 2015-02-12 11:28:50 -0500 |
commit | 8f69c1dfa281b6486c8fce16c1d58acef70c7ae7 (patch) | |
tree | 2dec25cbe731e5bf218dc508cdd082286f446edf /gerber/primitives.py | |
parent | 41f9475b132001d52064392057e376c6423c33dc (diff) | |
download | gerbonara-8f69c1dfa281b6486c8fce16c1d58acef70c7ae7.tar.gz gerbonara-8f69c1dfa281b6486c8fce16c1d58acef70c7ae7.tar.bz2 gerbonara-8f69c1dfa281b6486c8fce16c1d58acef70c7ae7.zip |
Update line primitive to take aperture parameter
This fixes the exception referenced in #12. Still need to add rendering
code for rectangle aperture lines and arcs.
Rectangle strokes will be drawn as polygons by the rendering backends.
Diffstat (limited to 'gerber/primitives.py')
-rw-r--r-- | gerber/primitives.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py index 2d666b8..a239cab 100644 --- a/gerber/primitives.py +++ b/gerber/primitives.py @@ -52,11 +52,11 @@ class Primitive(object): class Line(Primitive):
"""
"""
- def __init__(self, start, end, width, **kwargs):
+ def __init__(self, start, end, aperture, **kwargs):
super(Line, self).__init__(**kwargs)
self.start = start
self.end = end
- self.width = width
+ self.aperture = aperture
@property
def angle(self):
@@ -64,26 +64,26 @@ class Line(Primitive): angle = math.atan2(delta_y, delta_x)
return angle
- @property
- def bounding_box(self):
- width_2 = self.width / 2.
- min_x = min(self.start[0], self.end[0]) - width_2
- max_x = max(self.start[0], self.end[0]) + width_2
- min_y = min(self.start[1], self.end[1]) - width_2
- max_y = max(self.start[1], self.end[1]) + width_2
- return ((min_x, max_x), (min_y, max_y))
+ #@property
+ #def bounding_box(self):
+ # width_2 = self.width / 2.
+ # min_x = min(self.start[0], self.end[0]) - width_2
+ # max_x = max(self.start[0], self.end[0]) + width_2
+ # min_y = min(self.start[1], self.end[1]) - width_2
+ # max_y = max(self.start[1], self.end[1]) + width_2
+ # return ((min_x, max_x), (min_y, max_y))
class Arc(Primitive):
"""
"""
- def __init__(self, start, end, center, direction, width, **kwargs):
+ def __init__(self, start, end, center, direction, aperture, **kwargs):
super(Arc, self).__init__(**kwargs)
self.start = start
self.end = end
self.center = center
self.direction = direction
- self.width = width
+ self.aperture = aperture
@property
def radius(self):
|