mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-24 03:53:49 +01:00
fixed https://github.com/Doodle3D/Doodle3D-Slicer/issues/12
This commit is contained in:
parent
1ac87e6f0c
commit
d3af71bc22
24
src/slice.js
24
src/slice.js
@ -5,6 +5,30 @@ export default class {
|
|||||||
this.parts = [];
|
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) {
|
optimizePaths (start) {
|
||||||
if (this.brim !== undefined && this.brim.length > 0) {
|
if (this.brim !== undefined && this.brim.length > 0) {
|
||||||
this.brim = this.brim.optimizePath(start);
|
this.brim = this.brim.optimizePath(start);
|
||||||
|
@ -353,6 +353,8 @@ export default class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slice.removeSelfIntersect();
|
||||||
|
|
||||||
slices.push(slice);
|
slices.push(slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user