mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
support 3d point
This commit is contained in:
parent
aabc373798
commit
f6a1050a01
@ -1,11 +1,16 @@
|
||||
include <__private__/__to3d.scad>;
|
||||
include <__private__/__in_line2d.scad>;
|
||||
|
||||
function _in_polyline_sub(line_pts, pt, epsilon, iend, i = 0) =
|
||||
function _in_polyline_sub(pts, pt, epsilon, iend, i = 0) =
|
||||
i == iend ? false : (
|
||||
__in_line2d([line_pts[i], line_pts[i + 1]], pt, epsilon) ? true :
|
||||
_in_polyline_sub(line_pts, pt, epsilon, iend, i + 1)
|
||||
__in_line2d([pts[i], pts[i + 1]], pt, epsilon) ? true :
|
||||
_in_polyline_sub(pts, pt, epsilon, iend, i + 1)
|
||||
);
|
||||
|
||||
function in_polyline(line_pts, pt, epsilon = 0.0001) =
|
||||
_in_polyline_sub(line_pts, pt, epsilon, len(line_pts) - 1);
|
||||
let(
|
||||
pts = len(line_pts[0]) == 2 ? [for(pt = line_pts) __to3d(pt)] : line_pts,
|
||||
pt3d = len(pt) == 2 ? __to3d(pt) : pt
|
||||
)
|
||||
_in_polyline_sub(pts, pt3d, epsilon, len(pts) - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user