1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-28 17:00:00 +02:00

add arc_great_circle

This commit is contained in:
Justin Lin
2022-07-21 17:17:52 +08:00
parent ed75179dfe
commit 709c92714e

View File

@@ -0,0 +1,12 @@
use <__comm__/__frags.scad>
use <ptf/ptf_rotate.scad>
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)];