fixes #238 pocket contour open polys segmented improperly
This commit is contained in:
parent
ca83824f00
commit
260c0c6641
1 changed files with 3 additions and 2 deletions
|
|
@ -1849,7 +1849,8 @@ class Polygon {
|
||||||
const newp = [];
|
const newp = [];
|
||||||
const points = this.points;
|
const points = this.points;
|
||||||
const length = points.length;
|
const length = points.length;
|
||||||
for (let i=0, p=points, l1=length, l2=l1+1; i<l1; i++) {
|
const l0 = this.open ? length - 1 : length;
|
||||||
|
for (let i=0, p=points, l1=length, l2=l1+1; i<l0; i++) {
|
||||||
const p1 = p[i];
|
const p1 = p[i];
|
||||||
const p2 = p[(i + 1) % l1];
|
const p2 = p[(i + 1) % l1];
|
||||||
const dx = p2.x - p1.x;
|
const dx = p2.x - p1.x;
|
||||||
|
|
@ -1873,7 +1874,7 @@ class Polygon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newp.length > length) {
|
if (newp.length > length) {
|
||||||
return newPolygon().addPoints(newp.map(p => p.clone()));
|
return newPolygon().addPoints(newp.map(p => p.clone())).setOpenValue(this.open);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue