From 000d84923dced9f2b4c1831b0e972d61191cb349 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Mon, 27 Sep 2021 21:36:24 -0400 Subject: [PATCH] add sanitize_region, appease docsgen --- regions.scad | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/regions.scad b/regions.scad index e05d5a5..327176e 100644 --- a/regions.scad +++ b/regions.scad @@ -78,6 +78,16 @@ function check_and_fix_path(path, valid_dim=undef, closed=false, name="path") = +// Function: sanitize_region() +// Usage: +// r_fixed = sanitize_region(r); +// Description: +// Takes a malformed input region that contains self-intersecting polygons or polygons +// that cross each other and converts it into a properly defined region without +// these defects. +function sanitize_region(r) = exclusive_or([for(poly=r) each polygon_parts(poly)]); + + // Module: region() // Usage: @@ -154,7 +164,7 @@ function do_segments_intersect(s1,s2) = ) approx_sign(a1)!=approx_sign(a2) && approx_sign(a3)!=approx_sign(a4); -// Note: parallel intersecting lines seem to have all the a's equal approx to zero +// note that parallel intersecting lines seem to have all the a's equal approx to zero // Function: polygons_equal()