From 03bca85e3414b65e0fa9e33c781992e8528f12ba Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 21 Sep 2019 08:22:22 +0800 Subject: [PATCH] refactor --- src/bezier_surface.scad | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/bezier_surface.scad b/src/bezier_surface.scad index 4e6d8e78..0efccdf2 100644 --- a/src/bezier_surface.scad +++ b/src/bezier_surface.scad @@ -9,13 +9,18 @@ **/ function bezier_surface(t_step, ctrl_pts) = - let(pts = [ - for(i = 0; i < len(ctrl_pts); i = i + 1) + let( + leng_ctrl_pts = len(ctrl_pts), + pts = [ + for(i = 0; i < leng_ctrl_pts; i = i + 1) bezier_curve(t_step, ctrl_pts[i]) - ]) - [for(x = 0; x < len(pts[0]); x = x + 1) + ], + leng_pts0 = len(pts[0]), + leng_pts = len(pts) + ) + [for(x = 0; x < leng_pts0; x = x + 1) bezier_curve( t_step, - [for(y = [0:len(pts) - 1]) pts[y][x]] + [for(y = 0; y < leng_pts; y = y + 1) pts[y][x]] ) ]; \ No newline at end of file