extend approach. need to switch to segment comparison w/ angles

This commit is contained in:
Stewart Allen 2025-09-24 20:34:11 -04:00
commit 78d4d606a4
2 changed files with 83 additions and 26 deletions

View file

@ -2326,7 +2326,7 @@ export class Polygon {
// split long straight lines into segments no longer than max
// and return a new polygon
segment(max = 1, mark) {
segment(max = 1, mark, wrap) {
const newp = [];
const points = this.points;
const length = points.length;
@ -2358,6 +2358,9 @@ export class Polygon {
}
}
if (newp.length > length) {
if (wrap) {
newp.push(newp[0]);
}
return newPolygon().addPoints(newp.map(p => p.clone(['segment']))).setOpenValue(this.open);
}
return this;