clarify that simple paths can have repeats

This commit is contained in:
Adrian Mariano 2021-09-28 21:22:05 -04:00
parent 7c3990f2ed
commit ea9d133408

View file

@ -485,6 +485,8 @@ function resample_path(path, N, spacing, closed=false) =
// bool = is_path_simple(path, [closed], [eps]); // bool = is_path_simple(path, [closed], [eps]);
// Description: // Description:
// Returns true if the path is simple, meaning that it has no self-intersections. // Returns true if the path is simple, meaning that it has no self-intersections.
// Repeated points are not considered self-intersections: a path with such points can
// still be simple.
// If closed is set to true then treat the path as a polygon. // If closed is set to true then treat the path as a polygon.
// Arguments: // Arguments:
// path = path to check // path = path to check
@ -497,7 +499,7 @@ function is_path_simple(path, closed=false, eps=EPSILON) =
normv1 = norm(v1), normv1 = norm(v1),
normv2 = norm(v2) normv2 = norm(v2)
) )
if (/*approx(normv1,0) || approx(normv2,0) ||*/ approx(v1*v2/normv1/normv2,-1)) 1] == [] if (approx(v1*v2/normv1/normv2,-1)) 1] == []
&& &&
_path_self_intersections(path,closed=closed,eps=eps) == []; _path_self_intersections(path,closed=closed,eps=eps) == [];