From f2e81bf3c3d7bbb2dd25a722f06fa5cb523b6737 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 14 Apr 2022 10:19:22 +0800 Subject: [PATCH] refactor: del pts --- src/experimental/convex_intersection.scad | 6 +++--- src/voronoi/_impl/_convex_intersection.scad | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/experimental/convex_intersection.scad b/src/experimental/convex_intersection.scad index a228f9ee..c0acc0cc 100644 --- a/src/experimental/convex_intersection.scad +++ b/src/experimental/convex_intersection.scad @@ -7,11 +7,11 @@ function convex_intersection(shape1, shape2, epsilon = 0.0001) = (shape1 == [] || shape2 == []) ? [] : let( leng = len(shape1), - pts = [each shape1, shape1[0]], convex = concat( [for(p = shape1) if(in_shape(shape2, p, include_edge = true)) p], [for(p = shape2) if(in_shape(shape1, p, include_edge = true)) p], - [for(i = [0:leng - 1]) each _intersection_ps(shape2, [pts[i], pts[i + 1]], epsilon)] + [for(i = [0:leng - 1]) each _intersection_ps(shape2, [shape1[i], shape1[i + 1]], epsilon)], + _intersection_ps(shape2, [shape1[len(shape1) - 1], shape1[0]], epsilon) ) ) - convex == [] ? [] : convex_ct_clk_order(convex); \ No newline at end of file + convex == [] ? [] : convex_ct_clk_order(convex); diff --git a/src/voronoi/_impl/_convex_intersection.scad b/src/voronoi/_impl/_convex_intersection.scad index 57ed6ad8..f9c1cab6 100644 --- a/src/voronoi/_impl/_convex_intersection.scad +++ b/src/voronoi/_impl/_convex_intersection.scad @@ -34,11 +34,11 @@ function _intersection_ps(shape, line_pts, epsilon) = function _convex_intersection(shape1, shape2, epsilon = 0.0001) = (shape1 == [] || shape2 == []) ? [] : - let(pts = [each shape1, shape1[0]]) _convex_ct_clk_order( concat( [for(p = shape1) if(_in_convex(shape2, p)) p], [for(p = shape2) if(_in_convex(shape1, p)) p], - [for(i = [0:len(shape1) - 1]) each _intersection_ps(shape2, [pts[i], pts[i + 1]], epsilon)] + [for(i = [0:len(shape1) - 2]) each _intersection_ps(shape2, [shape1[i], shape1[i + 1]], epsilon)], + _intersection_ps(shape2, [shape1[len(shape1) - 1], shape1[0]], epsilon) ) ); \ No newline at end of file