From 709c92714eb7b8fc0d9180223b40b49ad954fae0 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 21 Jul 2022 17:17:52 +0800 Subject: [PATCH] add arc_great_circle --- src/experimental/arc_great_circle.scad | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/experimental/arc_great_circle.scad diff --git a/src/experimental/arc_great_circle.scad b/src/experimental/arc_great_circle.scad new file mode 100644 index 00000000..1f3433dc --- /dev/null +++ b/src/experimental/arc_great_circle.scad @@ -0,0 +1,12 @@ +use <__comm__/__frags.scad> +use + +function arc_great_circle(p1, p2, center = [0, 0, 0]) = + let( + radius = norm(p1 - center), + normal_vt = cross(p2, p1), + a = acos(p2 * p1 / pow(radius, 2)), + steps = round(a / (360 / __frags(radius))), + a_step = a / steps + ) + [for(i = [0:steps]) ptf_rotate(p1, a_step * i, normal_vt)]; \ No newline at end of file