mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
fixed https://github.com/Doodle3D/Doodle3D-Slicer/issues/12
This commit is contained in:
parent
b73f38e2f3
commit
b119c3d673
24
src/slice.js
24
src/slice.js
@ -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);
|
||||
|
@ -353,6 +353,8 @@ export default class {
|
||||
}
|
||||
}
|
||||
|
||||
slice.removeSelfIntersect();
|
||||
|
||||
slices.push(slice);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user