1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-27 16:30:29 +02:00
This commit is contained in:
Justin Lin
2022-05-03 17:24:28 +08:00
parent 5e289d6442
commit 7792030765

View File

@@ -5,18 +5,19 @@ use <../../util/set/hashset_elems.scad>;
include <../../__comm__/_pt2_hash.scad>; include <../../__comm__/_pt2_hash.scad>;
function _in_convex_r(i, j, preC, convex_pts, pt, leng, convex_pts, pt) = function _in_convex_r(s, convex_pts, pt, leng, i = 0) =
j == leng || ( i + 1 == leng ||
let(c = cross(convex_pts[i] - pt, convex_pts[j] - pt)) s * cross(convex_pts[i] - pt, convex_pts[i + 1] - pt) > 0 &&
c * preC > 0 && _in_convex_r(j, j + 1, c, convex_pts, pt, leng, convex_pts, pt) _in_convex_r(s, convex_pts, pt, leng, i + 1);
);
function _in_convex(convex_pts, pt) = function _in_convex(convex_pts, pt) =
let( let(leng = len(convex_pts))
leng = len(convex_pts), _in_convex_r(
c = cross(convex_pts[leng - 1] - pt, convex_pts[0] - pt) cross(convex_pts[leng - 1] - pt, convex_pts[0] - pt),
) convex_pts,
_in_convex_r(0, 1, c, convex_pts, pt, leng, convex_pts, pt); pt,
leng
);
function _intersection_ps(closed_shape, line_pts, epsilon) = function _intersection_ps(closed_shape, line_pts, epsilon) =
let( let(