mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-31 18:22:08 +02:00
refactor
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
|
use <../../__comm__/_pt2_hash.scad>;
|
||||||
use <../../util/dedup.scad>;
|
|
||||||
use <../../lines_intersection.scad>;
|
use <../../lines_intersection.scad>;
|
||||||
use <_convex_ct_clk_order.scad>;
|
use <_convex_ct_clk_order.scad>;
|
||||||
|
use <../../util/set/hashset.scad>;
|
||||||
|
use <../../util/set/hashset_elems.scad>;
|
||||||
|
|
||||||
function _in_convex_r(i, j, preC, convex_pts, pt, leng, convex_pts, pt) =
|
function _in_convex_r(i, j, preC, convex_pts, pt, leng, convex_pts, pt) =
|
||||||
j == leng || (
|
j == leng || (
|
||||||
@@ -18,12 +19,18 @@ function _in_convex(convex_pts, pt) =
|
|||||||
|
|
||||||
|
|
||||||
function _intersection_ps(shape, line_pts, epsilon) =
|
function _intersection_ps(shape, line_pts, epsilon) =
|
||||||
let(pts = [each shape, shape[0]])
|
let(
|
||||||
dedup([
|
pts = [each shape, shape[0]],
|
||||||
for(i = [0:len(shape) - 1])
|
npts = [
|
||||||
let(p = lines_intersection(line_pts, [pts[i], pts[i + 1]], epsilon = epsilon))
|
for(i = [0:len(shape) - 1])
|
||||||
if(p != []) p
|
let(p = lines_intersection(line_pts, [pts[i], pts[i + 1]], epsilon = epsilon))
|
||||||
]);
|
if(p != []) p
|
||||||
|
],
|
||||||
|
leng = len(npts)
|
||||||
|
)
|
||||||
|
leng < 2 ? npts :
|
||||||
|
leng == 2 ? (npts[0] != npts[1] ? npts : [npts[0]]) :
|
||||||
|
hashset_elems(hashset(npts, hash = function(p) _pt2_hash(p)));
|
||||||
|
|
||||||
function _convex_intersection(shape1, shape2, epsilon = 0.0001) =
|
function _convex_intersection(shape1, shape2, epsilon = 0.0001) =
|
||||||
(shape1 == [] || shape2 == []) ? [] :
|
(shape1 == [] || shape2 == []) ? [] :
|
||||||
|
Reference in New Issue
Block a user