From 86276490eb7c68d770a4b7280f90562eeef62833 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 13 Jun 2023 18:53:03 +0200 Subject: coil gen WIP --- coil_gen.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/coil_gen.py b/coil_gen.py index 4dd0847..df09be8 100644 --- a/coil_gen.py +++ b/coil_gen.py @@ -59,6 +59,17 @@ def generate(infile, outfile, polygon, start_angle, stop_radius, trace_width, cl segment_heights = [point_line_distance((cx, cy), (x1, y1), (x2, y2)) for (x1, y1), (x2, y2) in segments] + closest_points = [] + for h, ((x1, y1), (x2, y2)) in zip(segment_heights, segments): + dc1 = dist((x1, y1), (cx, cy)) + d12 = dist((x1, y1), (x2, y2)) + db = sqrt(dc1**2 - h**2) + xn = (x2 - x1) / d12 + yn = (y2 - y1) / d12 + xb = x1 + xn * db + yb = y1 + yn * db + closest_points.append((xb, yb)) + smallest_radius = min(segment_heights) #trace_radius = smallest_radius - stop_radius trace_radius = smallest_radius @@ -92,8 +103,11 @@ def generate(infile, outfile, polygon, start_angle, stop_radius, trace_width, cl f.write(f'>\n') f.write(f'\n') f.write(f'\n') - f.write(f'\n') + #f.write(f'\n') f.write(f'\n') + for x, y in closest_points: + f.write(f'\n') + f.write(f'') f.write('\n') if __name__ == '__main__': -- cgit