clipper2-ts 2.0.1-13 → 2.0.1-15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Engine.d.ts.map +1 -1
- package/dist/Engine.js +13 -28
- package/dist/Engine.js.map +1 -1
- package/dist/Shewchuk.d.ts +3 -0
- package/dist/Shewchuk.d.ts.map +1 -0
- package/dist/Shewchuk.js +953 -0
- package/dist/Shewchuk.js.map +1 -0
- package/dist/Triangulation.d.ts +2 -5
- package/dist/Triangulation.d.ts.map +1 -1
- package/dist/Triangulation.js +85 -259
- package/dist/Triangulation.js.map +1 -1
- package/dist/cdt/SweepCDT.d.ts +7 -0
- package/dist/cdt/SweepCDT.d.ts.map +1 -0
- package/dist/cdt/SweepCDT.js +1272 -0
- package/dist/cdt/SweepCDT.js.map +1 -0
- package/dist/cdt/predicates.d.ts +3 -0
- package/dist/cdt/predicates.d.ts.map +1 -0
- package/dist/cdt/predicates.js +948 -0
- package/dist/cdt/predicates.js.map +1 -0
- package/dist/clipper2.min.mjs +6 -6
- package/dist/clipper2.min.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Engine.ts +4 -17
- package/src/Shewchuk.ts +690 -0
- package/src/Triangulation.ts +87 -272
- package/src/cdt/SweepCDT.ts +1220 -0
- package/src/cdt/predicates.ts +682 -0
package/package.json
CHANGED
package/src/Engine.ts
CHANGED
|
@@ -2938,7 +2938,6 @@ protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {
|
|
|
2938
2938
|
|
|
2939
2939
|
let startOp = outrec.pts!;
|
|
2940
2940
|
let op2: OutPt | null = startOp;
|
|
2941
|
-
let removedAny = false;
|
|
2942
2941
|
|
|
2943
2942
|
while (true) {
|
|
2944
2943
|
// NB if preserveCollinear == true, then only remove 180 deg. spikes
|
|
@@ -2952,7 +2951,6 @@ protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {
|
|
|
2952
2951
|
outrec.pts = op2.prev;
|
|
2953
2952
|
}
|
|
2954
2953
|
op2 = this.disposeOutPt(op2!);
|
|
2955
|
-
removedAny = true;
|
|
2956
2954
|
if (!this.isValidClosedPath(op2)) {
|
|
2957
2955
|
outrec.pts = null;
|
|
2958
2956
|
return;
|
|
@@ -2965,7 +2963,7 @@ protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {
|
|
|
2965
2963
|
if (op2 === startOp) break;
|
|
2966
2964
|
}
|
|
2967
2965
|
|
|
2968
|
-
|
|
2966
|
+
this.fixSelfIntersects(outrec);
|
|
2969
2967
|
}
|
|
2970
2968
|
|
|
2971
2969
|
private isValidClosedPath(op: OutPt | null): boolean {
|
|
@@ -2988,28 +2986,16 @@ protected buildTree(polytree: PolyPathBase, solutionOpen: Paths64): void {
|
|
|
2988
2986
|
|
|
2989
2987
|
while (true) {
|
|
2990
2988
|
if (op2.next && op2.next.next &&
|
|
2991
|
-
|
|
2992
|
-
this.boundingBoxesOverlap(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt) && // TEST: Bbox only
|
|
2989
|
+
this.boundingBoxesOverlap(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt) &&
|
|
2993
2990
|
InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next.pt, op2.next.next.pt)) {
|
|
2994
|
-
if (op2.next.next.next &&
|
|
2995
|
-
// optimization (not in C# reference): bbox check before segsIntersect
|
|
2996
|
-
this.boundingBoxesOverlap(op2.prev.pt, op2.pt, op2.next.next.pt, op2.next.next.next.pt) && // TEST: Bbox only
|
|
2997
|
-
InternalClipper.segsIntersect(op2.prev.pt, op2.pt, op2.next.next.pt, op2.next.next.next.pt)) {
|
|
2998
|
-
// adjacent intersections (ie a micro self-intersection)
|
|
2999
|
-
op2 = this.duplicateOp(op2, false);
|
|
3000
|
-
op2.pt = op2.next!.next!.next!.pt;
|
|
3001
|
-
op2 = op2.next!;
|
|
3002
|
-
} else {
|
|
3003
2991
|
if (op2 === outrec.pts || op2.next === outrec.pts) {
|
|
3004
2992
|
outrec.pts = outrec.pts!.prev;
|
|
3005
2993
|
}
|
|
3006
2994
|
this.doSplitOp(outrec, op2);
|
|
3007
2995
|
if (outrec.pts === null) return;
|
|
3008
2996
|
op2 = outrec.pts;
|
|
3009
|
-
// triangles can't self-intersect
|
|
3010
2997
|
if (op2.prev === op2.next!.next) break;
|
|
3011
2998
|
continue;
|
|
3012
|
-
}
|
|
3013
2999
|
}
|
|
3014
3000
|
|
|
3015
3001
|
op2 = op2.next!;
|
|
@@ -3340,7 +3326,8 @@ export class ClipperD extends ClipperBase {
|
|
|
3340
3326
|
}
|
|
3341
3327
|
|
|
3342
3328
|
public addPath(path: PathD, polytype: PathType, isOpen: boolean = false): void {
|
|
3343
|
-
|
|
3329
|
+
const tmp: PathsD = [path];
|
|
3330
|
+
this.addPaths(tmp, polytype, isOpen);
|
|
3344
3331
|
}
|
|
3345
3332
|
|
|
3346
3333
|
public addPaths(paths: PathsD, polytype: PathType, isOpen: boolean = false): void {
|