summaryrefslogtreecommitdiff
path: root/gerbonara/layers.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-04 20:06:16 +0200
committerjaseg <git@jaseg.de>2023-04-10 23:57:15 +0200
commit44ca8349ebfef90b363ea765af44f5d6261778fe (patch)
treecf084aab6c8106ddd28279373bec2f4b235aa3cc /gerbonara/layers.py
parentce8d0451787f3aaa3b0a83e24f0bce7f2a55c62a (diff)
downloadgerbonara-44ca8349ebfef90b363ea765af44f5d6261778fe.tar.gz
gerbonara-44ca8349ebfef90b363ea765af44f5d6261778fe.tar.bz2
gerbonara-44ca8349ebfef90b363ea765af44f5d6261778fe.zip
cad: Fix outline reconstruction and add text feature
Diffstat (limited to 'gerbonara/layers.py')
-rw-r--r--gerbonara/layers.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/gerbonara/layers.py b/gerbonara/layers.py
index 6c61756..22a845f 100644
--- a/gerbonara/layers.py
+++ b/gerbonara/layers.py
@@ -1055,7 +1055,7 @@ class LayerStack:
joins = {}
for cur in lines:
- for i, (x, y) in enumerate([(cur.x1, cur.y1), (cur.x2, cur.y2)]):
+ for (i, x, y) in [(0, cur.x1, cur.y1), (1, cur.x2, cur.y2)]:
x_left = bisect.bisect_left (by_x, x, key=lambda elem: elem[0] + tol)
x_right = bisect.bisect_right(by_x, x, key=lambda elem: elem[0] - tol)
selected = { elem for elem_x, elem in by_x[x_left:x_right] if elem != cur }
@@ -1080,11 +1080,9 @@ class LayerStack:
joins[(cur, i)] = (nearest, j)
joins[(nearest, j)] = (cur, i)
- def flip_if(obj, i):
- if i:
- c = copy.copy(obj)
- c.flip()
- return c
+ def flip_if(obj, cond):
+ if cond:
+ return obj.flip()
else:
return obj