mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
fixed closed lines detected as open lines
fixed https://github.com/Doodle3D/Doodle3D-Slicer/issues/10
This commit is contained in:
parent
c61ee24944
commit
032f896bb4
@ -208,7 +208,8 @@ export default class {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstPoint = index;
|
var firstPoints = [index];
|
||||||
|
var isFirstPoint = true;
|
||||||
var closed = false;
|
var closed = false;
|
||||||
|
|
||||||
var shape = [];
|
var shape = [];
|
||||||
@ -226,7 +227,7 @@ export default class {
|
|||||||
for (var j = 0; j < connects.length; j ++) {
|
for (var j = 0; j < connects.length; j ++) {
|
||||||
var index = connects[j];
|
var index = connects[j];
|
||||||
|
|
||||||
if (index === firstPoint && shape.length > 2) {
|
if (firstPoints.indexOf(index) !== -1 && shape.length > 2) {
|
||||||
closed = true;
|
closed = true;
|
||||||
index = -1;
|
index = -1;
|
||||||
break;
|
break;
|
||||||
@ -241,6 +242,10 @@ export default class {
|
|||||||
|
|
||||||
// can't calculate normal if distance is smaller as 0.0001
|
// can't calculate normal if distance is smaller as 0.0001
|
||||||
if ((faceNormal.x === 0 && faceNormal.y === 0) || a.distanceTo(b) < 0.0001) {
|
if ((faceNormal.x === 0 && faceNormal.y === 0) || a.distanceTo(b) < 0.0001) {
|
||||||
|
if (isFirstPoint) {
|
||||||
|
firstPoints.push(index);
|
||||||
|
}
|
||||||
|
|
||||||
delete intersectionPoints[index];
|
delete intersectionPoints[index];
|
||||||
|
|
||||||
connects = connects.concat(lines[index].connects);
|
connects = connects.concat(lines[index].connects);
|
||||||
@ -266,6 +271,7 @@ export default class {
|
|||||||
index = -1;
|
index = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isFirstPoint = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
@ -704,7 +710,6 @@ export default class {
|
|||||||
this.progress.generatedGCode = true;
|
this.progress.generatedGCode = true;
|
||||||
this._updateProgress(settings);
|
this._updateProgress(settings);
|
||||||
|
|
||||||
|
|
||||||
return gcode.getGCode();
|
return gcode.getGCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user