From 5c4e18031623207b31855ff58be6b4c907962474 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 5 Feb 2022 13:28:56 +0100 Subject: Strip down outline highlight example --- examples/highlight_outline.py | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'examples') diff --git a/examples/highlight_outline.py b/examples/highlight_outline.py index f2e7f3e..9d89ce2 100644 --- a/examples/highlight_outline.py +++ b/examples/highlight_outline.py @@ -20,24 +20,6 @@ def highlight_outline(input_dir, output_dir): elif isinstance(obj, Arc): outline += obj.converted('mm').approximate(0.1, 'mm') - # FIXME test code - #print('') - #print('') - #outline = [] - #for i in range(16): - # for j in range(16): - # cx, cy = i*3, j*3 - # w = i/8 - # angle = j*2*math.pi/16 - # x1, y1 = cx-w/2, cy - # x2, y2 = cx+w/2, cy - # - # x1, y1 = rotate_point(x1, y1, angle, cx, cy) - # x2, y2 = rotate_point(x2, y2, angle, cx, cy) - # - # outline.append(Line(x1, y1, x2, y2, aperture=CircleAperture(1.0, unit=MM), unit=MM)) - # print(f'') - marker_angle = math.pi/3 marker_spacing = 2 marker_width = 0.1 @@ -57,10 +39,7 @@ def highlight_outline(input_dir, output_dir): if r == 0: continue - cr = math.hypot(cx, cy) - #w = line.aperture.equivalent_width('mm') w = 10 - tl_x, tl_y = line.x1 + math.sin(angle)*w/2, line.y1 - math.cos(angle)*w/2 tr_x, tr_y = line.x2 + math.sin(angle)*w/2, line.y2 - math.cos(angle)*w/2 br_x, br_y = line.x2 - math.sin(angle)*w/2, line.y2 + math.cos(angle)*w/2 @@ -68,8 +47,6 @@ def highlight_outline(input_dir, output_dir): tr = math.dist((tl_x, tl_y), (br_x, br_y))/2 - #print(f'') - n = math.ceil(tr/marker_spacing) for i in range(-n, n+1): px, py = cx + i*marker_dx, cy + i*marker_dy @@ -79,10 +56,8 @@ def highlight_outline(input_dir, output_dir): lx1, ly1 = rotate_point(lx1, ly1, angle, cx, cy) lx2, ly2 = rotate_point(lx2, ly2, angle, cx, cy) - #print(f'') def clip_line_point(x1, y1, x2, y2, xabs, yabs): - #print(x1, y1, x2, y2, end=' -> ', file=sys.stderr) if x2 != x1: a = (y2 - y1) / (x2 - x1) x2 = min(xabs, max(-xabs, x2)) @@ -99,7 +74,6 @@ def highlight_outline(input_dir, output_dir): elif abs(y1) > yabs: return None - #print(x1, y1, x2, y2, file=sys.stderr) return x1, y1, x2, y2 if not (foo := clip_line_point(lx1-cx, ly1-cy, lx2-cx, ly2-cy, r, w/2)): @@ -117,16 +91,7 @@ def highlight_outline(input_dir, output_dir): stack['top silk'].objects.append(Line(lx1, ly1, lx2, ly2, unit=MM, aperture=ap, polarity_dark=True)) - #print(f'') - - #delta_a = marker_angle - angle - #ex, ey = px, py - #print(f'') - #print(delta_a, file=sys.stderr) - # delta_a + math.pi/2 - stack.save_to_directory(output_dir) - #print('') if __name__ == '__main__': import argparse @@ -135,3 +100,4 @@ if __name__ == '__main__': parser.add_argument('output') args = parser.parse_args() highlight_outline(args.input, args.output) + -- cgit