another pool nesting fix requiring matching windings
This commit is contained in:
parent
88c52242b1
commit
273eed2bb9
2 changed files with 11 additions and 0 deletions
|
|
@ -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.
|
* reverse direction of polygon points.
|
||||||
* @returns {Polygon} self
|
* @returns {Polygon} self
|
||||||
|
|
|
||||||
|
|
@ -1056,6 +1056,10 @@
|
||||||
// console.log({skip_open_above:above});
|
// console.log({skip_open_above:above});
|
||||||
continue;
|
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 pool fits into smallest above pool, add it and break
|
||||||
if (polygonFitsIn(pool, above, 0.1)) {
|
if (polygonFitsIn(pool, above, 0.1)) {
|
||||||
above.poolsDown.push(pool);
|
above.poolsDown.push(pool);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue