diff --git a/src/geo/polygon.js b/src/geo/polygon.js index fe4efe03..9de197e6 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -645,6 +645,13 @@ } }; + /** + * @returns {boolean} true if both polygons wind the same way + */ + PRO.sameWindings = function(poly) { + return this.isClockwise() === poly.isClockwise(); + }; + /** * reverse direction of polygon points. * @returns {Polygon} self diff --git a/src/kiri/print.js b/src/kiri/print.js index 27ea1e84..88cab303 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -1056,6 +1056,10 @@ // console.log({skip_open_above:above}); continue; } + // do not allow inner and outer polys to mix + if (!above.sameWindings(pool)) { + continue; + } // if pool fits into smallest above pool, add it and break if (polygonFitsIn(pool, above, 0.1)) { above.poolsDown.push(pool);