diff --git a/src/geo/polygon.js b/src/geo/polygon.js index a1e168c1..6a008275 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -230,10 +230,33 @@ return Math.abs(diff); } + PRO.debur = function(dist) { + if (this.len < 2) { + return null; + } + const pa = this.points, + pln = pa.length, + open = this.open, + newp = newPolygon(), + min = dist || BASE.config.precision_merge; + let lo; + newp.push(lo = pa[0]); + for (let i=1; i= min) { + newp.push(lo = pa[i]); + } + } + newp.open = open; + newp.parent = this.parent; + if (newp.length < 2) { + return null; + } + return newp; + }; + PRO.miter = function(debug) { if (this.length < 3) return this; - // todo - to eliminate path sharps in renders const slo = [], pa = this.points, pln = pa.length, open = this.open; let last; for (let i=1; i { const contour = []; - poly = poly.clean().miter(); + poly = poly.debur(); + if (!poly) return; + poly = poly.miter(); + // cleaning converts open to closed which is problematic + // poly = poly.clean().miter(); // if (poly.debug) { // const save = this.current; // this.setLayer('debug.acute', 0xff0000).addPoly(poly, {thin:true});