casperlamboo 2015-08-04 09:54:02 +02:00 committed by Simon Voordouw
parent b73f38e2f3
commit b119c3d673
2 changed files with 26 additions and 0 deletions

View File

@ -5,6 +5,30 @@ export default class {
this.parts = [];
}
removeSelfIntersect () {
for (var i = 0; i < this.parts.length; i ++) {
var part1 = this.parts[i].intersect;
if (!part1.closed) {
continue;
}
for (var j = i + 1; j < this.parts.length; j ++) {
var part2 = this.parts[j].intersect;
if (!part2.closed) {
continue;
}
if (part2.intersect(part1).length > 0) {
this.parts[i].intersect = part1.union(part2);
this.parts.splice(j, 1);
}
}
}
}
optimizePaths (start) {
if (this.brim !== undefined && this.brim.length > 0) {
this.brim = this.brim.optimizePath(start);

View File

@ -353,6 +353,8 @@ export default class {
}
}
slice.removeSelfIntersect();
slices.push(slice);
}