diff --git a/src/__private__/__edge_r.scad b/src/__private__/__edge_r.scad new file mode 100644 index 00000000..70a6888d --- /dev/null +++ b/src/__private__/__edge_r.scad @@ -0,0 +1,7 @@ +function __edge_r_begin(orig_r, a, a_step, m) = + let(leng = orig_r * cos(a_step / 2)) + leng / cos((m - 0.5) * a_step - a); + +function __edge_r_end(orig_r, a, a_step, n) = + let(leng = orig_r * cos(a_step / 2)) + leng / cos((n + 0.5) * a_step - a); \ No newline at end of file diff --git a/src/__private__/__shape_arc.scad b/src/__private__/__shape_arc.scad index 404e1ac7..35959f6a 100644 --- a/src/__private__/__shape_arc.scad +++ b/src/__private__/__shape_arc.scad @@ -1,11 +1,3 @@ -function __edge_r_begin(orig_r, a, a_step, m) = - let(leng = orig_r * cos(a_step / 2)) - leng / cos((m - 0.5) * a_step - a); - -function __edge_r_end(orig_r, a, a_step, n) = - let(leng = orig_r * cos(a_step / 2)) - leng / cos((n + 0.5) * a_step - a); - function __shape_arc(radius, angle, width, width_mode = "LINE_CROSS") = let( w_offset = width_mode == "LINE_CROSS" ? [width / 2, -width / 2] : ( diff --git a/src/arc.scad b/src/arc.scad index 5b9d6658..d888ef66 100644 --- a/src/arc.scad +++ b/src/arc.scad @@ -15,6 +15,7 @@ include <__private__/__frags.scad>; include <__private__/__is_vector.scad>; include <__private__/__ra_to_xy.scad>; +include <__private__/__edge_r.scad>; include <__private__/__shape_arc.scad>; module arc(radius, angle, width, width_mode = "LINE_CROSS") { diff --git a/src/arc_path.scad b/src/arc_path.scad index 1b4bf38e..4f5a2bc7 100644 --- a/src/arc_path.scad +++ b/src/arc_path.scad @@ -15,14 +15,7 @@ include <__private__/__frags.scad>; include <__private__/__is_vector.scad>; include <__private__/__ra_to_xy.scad>; - -function __edge_r_begin(orig_r, a, a_step, m) = - let(leng = orig_r * cos(a_step / 2)) - leng / cos((m - 0.5) * a_step - a); - -function __edge_r_end(orig_r, a, a_step, n) = - let(leng = orig_r * cos(a_step / 2)) - leng / cos((n + 0.5) * a_step - a); +include <__private__/__edge_r.scad>; function arc_path(radius, angle) = let( @@ -35,5 +28,6 @@ function arc_path(radius, angle) = m > n ? [] : [ for(i = [m:n]) __ra_to_xy(radius, a_step * i) - ]) + ], + angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(radius, angles[1], a_step, n), angles[1])]) ) points; \ No newline at end of file