From d5d809c70d842a8324179419e877e1e838ed130f Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 31 Mar 2022 07:44:05 +0800 Subject: [PATCH] refactor: built-in search --- src/sweep.scad | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sweep.scad b/src/sweep.scad index 4a13e12e..7a4f6098 100644 --- a/src/sweep.scad +++ b/src/sweep.scad @@ -9,7 +9,6 @@ **/ use ; -use ; use ; module sweep(sections, triangles = "SOLID") { @@ -41,9 +40,9 @@ module sweep(sections, triangles = "SOLID") { ); function the_same_after_twisting(f_sect, l_sect, leng_pts_sect) = - let(found_at_i = find_index(f_sect, function(p) p == l_sect[0])) - found_at_i <= 0 ? false : - l_sect == concat(slice(f_sect, found_at_i), slice(f_sect, 0, found_at_i)); + let(found = search([l_sect[0]], f_sect)[0]) + found == [] || found == 0 ? false : + l_sect == concat(slice(f_sect, found), slice(f_sect, 0, found)); function to_v_pts(sects) = [for(sect = sects) each sect];