1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 19:54:29 +02:00

refactor: del pts

This commit is contained in:
Justin Lin
2022-04-14 10:19:22 +08:00
parent 2400ad550b
commit f2e81bf3c3
2 changed files with 5 additions and 5 deletions

View File

@@ -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);
convex == [] ? [] : convex_ct_clk_order(convex);

View File

@@ -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)
)
);