From 1a92c27b284faec68dc6a075dfd859b7494b4329 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 17 May 2019 10:00:04 +0800 Subject: [PATCH] added edge_aligned_sections --- src/edge_aligned_sections.scad | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/edge_aligned_sections.scad diff --git a/src/edge_aligned_sections.scad b/src/edge_aligned_sections.scad new file mode 100644 index 00000000..db8f38ab --- /dev/null +++ b/src/edge_aligned_sections.scad @@ -0,0 +1,18 @@ +function edge_aligned_sections(shape_pts, edge_path) = + let( + start_point = edge_path[0], + base_leng = norm(start_point), + scaling_matrice = [ + for(p = edge_path) + let(s = norm([p[0], p[1], 0]) / base_leng) + m_scaling([s, s, 1]) + ] + ) + [ + for(i = [0:len(edge_path) - 1]) + [ + for(p = shape_pts) + let(scaled_p = scaling_matrice[i] * [p[0], p[1], edge_path[i][2], 1]) + [scaled_p[0], scaled_p[1], scaled_p[2]] + ] + ]; \ No newline at end of file