1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 11:44:50 +02:00

refactor: built-in search

This commit is contained in:
Justin Lin
2022-03-31 07:44:05 +08:00
parent aa082712df
commit d5d809c70d

View File

@@ -9,7 +9,6 @@
**/
use <util/reverse.scad>;
use <util/find_index.scad>;
use <util/slice.scad>;
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];