node-red-contrib-tak-registration 0.13.1 → 0.14.1
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/node_modules/@turf/along/README.md +3 -5
- package/node_modules/@turf/along/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/along/dist/cjs/index.d.cts +3 -3
- package/node_modules/@turf/along/dist/esm/index.d.ts +3 -3
- package/node_modules/@turf/along/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/along/package.json +13 -13
- package/node_modules/@turf/angle/dist/cjs/index.cjs +10 -7
- package/node_modules/@turf/angle/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/angle/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/angle/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/angle/dist/esm/index.js +10 -7
- package/node_modules/@turf/angle/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/angle/package.json +15 -15
- package/node_modules/@turf/area/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/area/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/area/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/area/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/area/dist/esm/index.js +1 -2
- package/node_modules/@turf/area/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/area/package.json +10 -10
- package/node_modules/@turf/bbox/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bbox/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bbox/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bbox/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bbox/package.json +10 -10
- package/node_modules/@turf/bbox-clip/dist/cjs/index.cjs +9 -18
- package/node_modules/@turf/bbox-clip/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bbox-clip/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bbox-clip/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bbox-clip/dist/esm/index.js +9 -18
- package/node_modules/@turf/bbox-clip/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bbox-clip/package.json +11 -11
- package/node_modules/@turf/bbox-polygon/README.md +6 -6
- package/node_modules/@turf/bbox-polygon/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bbox-polygon/dist/cjs/index.d.cts +2 -2
- package/node_modules/@turf/bbox-polygon/dist/esm/index.d.ts +2 -2
- package/node_modules/@turf/bbox-polygon/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bbox-polygon/package.json +9 -9
- package/node_modules/@turf/bearing/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bearing/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bearing/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bearing/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bearing/package.json +11 -11
- package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bezier-spline/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bezier-spline/package.json +10 -10
- package/node_modules/@turf/boolean-clockwise/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-clockwise/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-clockwise/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-clockwise/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-clockwise/package.json +10 -10
- package/node_modules/@turf/boolean-concave/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-concave/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-concave/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-concave/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-concave/package.json +10 -10
- package/node_modules/@turf/boolean-contains/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-contains/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-contains/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-contains/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-contains/package.json +13 -13
- package/node_modules/@turf/boolean-crosses/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-crosses/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-crosses/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-crosses/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-crosses/package.json +13 -13
- package/node_modules/@turf/boolean-disjoint/README.md +1 -1
- package/node_modules/@turf/boolean-disjoint/dist/cjs/index.cjs +3 -3
- package/node_modules/@turf/boolean-disjoint/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-disjoint/dist/cjs/index.d.cts +3 -3
- package/node_modules/@turf/boolean-disjoint/dist/esm/index.d.ts +3 -3
- package/node_modules/@turf/boolean-disjoint/dist/esm/index.js +3 -3
- package/node_modules/@turf/boolean-disjoint/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-disjoint/package.json +13 -13
- package/node_modules/@turf/boolean-equal/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/boolean-equal/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-equal/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-equal/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-equal/dist/esm/index.js +1 -2
- package/node_modules/@turf/boolean-equal/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-equal/package.json +11 -11
- package/node_modules/@turf/boolean-intersects/dist/cjs/index.cjs +3 -3
- package/node_modules/@turf/boolean-intersects/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-intersects/dist/cjs/index.d.cts +3 -3
- package/node_modules/@turf/boolean-intersects/dist/esm/index.d.ts +3 -3
- package/node_modules/@turf/boolean-intersects/dist/esm/index.js +3 -3
- package/node_modules/@turf/boolean-intersects/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-intersects/package.json +11 -11
- package/node_modules/@turf/boolean-overlap/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/boolean-overlap/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-overlap/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-overlap/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-overlap/dist/esm/index.js +3 -6
- package/node_modules/@turf/boolean-overlap/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-overlap/package.json +13 -13
- package/node_modules/@turf/boolean-parallel/dist/cjs/index.cjs +7 -14
- package/node_modules/@turf/boolean-parallel/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-parallel/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-parallel/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-parallel/dist/esm/index.js +7 -14
- package/node_modules/@turf/boolean-parallel/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-parallel/package.json +12 -12
- package/node_modules/@turf/boolean-point-in-polygon/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/boolean-point-in-polygon/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-point-in-polygon/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js +2 -4
- package/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-point-in-polygon/package.json +10 -10
- package/node_modules/@turf/boolean-point-on-line/dist/cjs/index.cjs +10 -0
- package/node_modules/@turf/boolean-point-on-line/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-point-on-line/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-point-on-line/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-point-on-line/dist/esm/index.js +10 -0
- package/node_modules/@turf/boolean-point-on-line/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-point-on-line/package.json +10 -10
- package/node_modules/@turf/boolean-touches/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/boolean-touches/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-touches/dist/cjs/index.d.cts +2 -1
- package/node_modules/@turf/boolean-touches/dist/esm/index.d.ts +2 -1
- package/node_modules/@turf/boolean-touches/dist/esm/index.js +2 -4
- package/node_modules/@turf/boolean-touches/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-touches/package.json +12 -12
- package/node_modules/@turf/boolean-valid/dist/cjs/index.cjs +14 -28
- package/node_modules/@turf/boolean-valid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-valid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-valid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-valid/dist/esm/index.js +14 -28
- package/node_modules/@turf/boolean-valid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-valid/package.json +17 -17
- package/node_modules/@turf/boolean-within/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/boolean-within/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/boolean-within/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/boolean-within/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/boolean-within/dist/esm/index.js +4 -8
- package/node_modules/@turf/boolean-within/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/boolean-within/package.json +13 -13
- package/node_modules/@turf/buffer/dist/cjs/index.cjs +12 -24
- package/node_modules/@turf/buffer/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/buffer/dist/esm/index.js +12 -24
- package/node_modules/@turf/buffer/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/buffer/package.json +12 -12
- package/node_modules/@turf/center/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/center/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/center/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/center/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/center/package.json +12 -12
- package/node_modules/@turf/center-mean/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/center-mean/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/center-mean/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/center-mean/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/center-mean/package.json +13 -13
- package/node_modules/@turf/center-median/dist/cjs/index.cjs +5 -10
- package/node_modules/@turf/center-median/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/center-median/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/center-median/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/center-median/dist/esm/index.js +5 -10
- package/node_modules/@turf/center-median/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/center-median/package.json +17 -17
- package/node_modules/@turf/center-of-mass/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/center-of-mass/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/center-of-mass/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/center-of-mass/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/center-of-mass/dist/esm/index.js +2 -4
- package/node_modules/@turf/center-of-mass/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/center-of-mass/package.json +13 -13
- package/node_modules/@turf/centroid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/centroid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/centroid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/centroid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/centroid/package.json +10 -10
- package/node_modules/@turf/circle/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/circle/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/circle/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/circle/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/circle/package.json +11 -11
- package/node_modules/@turf/clean-coords/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/clean-coords/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/clean-coords/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/clean-coords/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/clean-coords/dist/esm/index.js +4 -8
- package/node_modules/@turf/clean-coords/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/clean-coords/package.json +11 -11
- package/node_modules/@turf/clone/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/clone/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/clone/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/clone/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/clone/package.json +10 -10
- package/node_modules/@turf/clusters/README.md +8 -2
- package/node_modules/@turf/clusters/dist/cjs/index.cjs +9 -18
- package/node_modules/@turf/clusters/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/clusters/dist/cjs/index.d.cts +9 -8
- package/node_modules/@turf/clusters/dist/esm/index.d.ts +9 -8
- package/node_modules/@turf/clusters/dist/esm/index.js +9 -18
- package/node_modules/@turf/clusters/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/clusters/package.json +10 -10
- package/node_modules/@turf/clusters-dbscan/README.md +38 -15
- package/node_modules/@turf/clusters-dbscan/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/clusters-dbscan/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/clusters-dbscan/dist/cjs/index.d.cts +16 -3
- package/node_modules/@turf/clusters-dbscan/dist/esm/index.d.ts +16 -3
- package/node_modules/@turf/clusters-dbscan/dist/esm/index.js +2 -4
- package/node_modules/@turf/clusters-dbscan/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/clusters-dbscan/package.json +14 -14
- package/node_modules/@turf/clusters-kmeans/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/clusters-kmeans/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/clusters-kmeans/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/clusters-kmeans/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/clusters-kmeans/dist/esm/index.js +2 -4
- package/node_modules/@turf/clusters-kmeans/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/clusters-kmeans/package.json +15 -15
- package/node_modules/@turf/collect/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/collect/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/collect/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/collect/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/collect/package.json +11 -11
- package/node_modules/@turf/combine/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/combine/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/combine/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/combine/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/combine/package.json +10 -10
- package/node_modules/@turf/concave/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/concave/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/concave/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/concave/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/concave/package.json +14 -14
- package/node_modules/@turf/convex/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/convex/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/convex/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/convex/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/convex/package.json +10 -10
- package/node_modules/@turf/destination/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/destination/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/destination/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/destination/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/destination/package.json +11 -11
- package/node_modules/@turf/difference/dist/cjs/index.cjs +8 -10
- package/node_modules/@turf/difference/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/difference/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/difference/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/difference/dist/esm/index.js +7 -9
- package/node_modules/@turf/difference/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/difference/package.json +11 -11
- package/node_modules/@turf/dissolve/README.md +11 -12
- package/node_modules/@turf/dissolve/dist/cjs/index.cjs +5 -6
- package/node_modules/@turf/dissolve/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/dissolve/dist/cjs/index.d.cts +3 -3
- package/node_modules/@turf/dissolve/dist/esm/index.d.ts +3 -3
- package/node_modules/@turf/dissolve/dist/esm/index.js +4 -5
- package/node_modules/@turf/dissolve/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/dissolve/package.json +13 -13
- package/node_modules/@turf/distance/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/distance/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/distance/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/distance/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/distance/package.json +10 -10
- package/node_modules/@turf/distance-weight/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/distance-weight/dist/cjs/index.d.cts +3 -1
- package/node_modules/@turf/distance-weight/dist/esm/index.d.ts +3 -1
- package/node_modules/@turf/distance-weight/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/distance-weight/package.json +12 -12
- package/node_modules/@turf/ellipse/dist/cjs/index.cjs +8 -16
- package/node_modules/@turf/ellipse/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/ellipse/dist/esm/index.js +8 -16
- package/node_modules/@turf/ellipse/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/ellipse/package.json +16 -16
- package/node_modules/@turf/envelope/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/envelope/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/envelope/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/envelope/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/envelope/package.json +11 -11
- package/node_modules/@turf/explode/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/explode/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/explode/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/explode/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/explode/package.json +10 -10
- package/node_modules/@turf/flatten/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/flatten/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/flatten/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/flatten/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/flatten/dist/esm/index.js +1 -2
- package/node_modules/@turf/flatten/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/flatten/package.json +10 -10
- package/node_modules/@turf/flip/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/flip/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/flip/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/flip/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/flip/dist/esm/index.js +3 -6
- package/node_modules/@turf/flip/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/flip/package.json +11 -11
- package/node_modules/@turf/geojson-rbush/dist/cjs/index.cjs +9 -18
- package/node_modules/@turf/geojson-rbush/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/geojson-rbush/dist/esm/index.js +9 -18
- package/node_modules/@turf/geojson-rbush/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/geojson-rbush/package.json +11 -11
- package/node_modules/@turf/great-circle/README.md +2 -1
- package/node_modules/@turf/great-circle/dist/cjs/index.cjs +7 -2
- package/node_modules/@turf/great-circle/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/great-circle/dist/esm/index.js +7 -2
- package/node_modules/@turf/great-circle/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/great-circle/package.json +9 -9
- package/node_modules/@turf/helpers/README.md +199 -154
- package/node_modules/@turf/helpers/dist/cjs/index.cjs +10 -7
- package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/helpers/dist/cjs/index.d.cts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.d.ts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.js +10 -7
- package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/helpers/package.json +8 -8
- package/node_modules/@turf/hex-grid/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/hex-grid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/hex-grid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/hex-grid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/hex-grid/dist/esm/index.js +2 -4
- package/node_modules/@turf/hex-grid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/hex-grid/package.json +14 -14
- package/node_modules/@turf/interpolate/README.md +5 -2
- package/node_modules/@turf/interpolate/dist/cjs/index.cjs +10 -15
- package/node_modules/@turf/interpolate/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/interpolate/dist/cjs/index.d.cts +3 -1
- package/node_modules/@turf/interpolate/dist/esm/index.d.ts +3 -1
- package/node_modules/@turf/interpolate/dist/esm/index.js +11 -16
- package/node_modules/@turf/interpolate/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/interpolate/package.json +18 -18
- package/node_modules/@turf/intersect/dist/cjs/index.cjs +7 -11
- package/node_modules/@turf/intersect/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/intersect/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/intersect/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/intersect/dist/esm/index.js +6 -10
- package/node_modules/@turf/intersect/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/intersect/package.json +11 -11
- package/node_modules/@turf/invariant/README.md +4 -0
- package/node_modules/@turf/invariant/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/invariant/dist/cjs/index.d.cts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.d.ts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/invariant/package.json +9 -9
- package/node_modules/@turf/isobands/dist/cjs/index.cjs +10 -20
- package/node_modules/@turf/isobands/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/isobands/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/isobands/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/isobands/dist/esm/index.js +10 -20
- package/node_modules/@turf/isobands/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/isobands/package.json +20 -20
- package/node_modules/@turf/isolines/dist/cjs/index.cjs +10 -20
- package/node_modules/@turf/isolines/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/isolines/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/isolines/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/isolines/dist/esm/index.js +10 -20
- package/node_modules/@turf/isolines/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/isolines/package.json +17 -17
- package/node_modules/@turf/kinks/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/kinks/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/kinks/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/kinks/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/kinks/package.json +10 -10
- package/node_modules/@turf/length/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/length/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/length/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/length/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/length/package.json +11 -11
- package/node_modules/@turf/line-arc/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-arc/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/line-arc/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/line-arc/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-arc/package.json +12 -12
- package/node_modules/@turf/line-chunk/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/line-chunk/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-chunk/dist/esm/index.js +3 -6
- package/node_modules/@turf/line-chunk/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-chunk/package.json +11 -11
- package/node_modules/@turf/line-intersect/README.md +1 -1
- package/node_modules/@turf/line-intersect/dist/cjs/index.cjs +3 -5
- package/node_modules/@turf/line-intersect/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-intersect/dist/cjs/index.d.cts +2 -2
- package/node_modules/@turf/line-intersect/dist/esm/index.d.ts +2 -2
- package/node_modules/@turf/line-intersect/dist/esm/index.js +3 -5
- package/node_modules/@turf/line-intersect/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-intersect/package.json +10 -10
- package/node_modules/@turf/line-offset/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/line-offset/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-offset/dist/esm/index.js +3 -6
- package/node_modules/@turf/line-offset/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-offset/package.json +10 -10
- package/node_modules/@turf/line-overlap/dist/cjs/index.cjs +10 -20
- package/node_modules/@turf/line-overlap/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-overlap/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/line-overlap/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/line-overlap/dist/esm/index.js +10 -20
- package/node_modules/@turf/line-overlap/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-overlap/package.json +15 -15
- package/node_modules/@turf/line-segment/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-segment/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/line-segment/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/line-segment/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-segment/package.json +11 -11
- package/node_modules/@turf/line-slice/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-slice/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-slice/package.json +10 -10
- package/node_modules/@turf/line-slice-along/dist/cjs/index.cjs +5 -10
- package/node_modules/@turf/line-slice-along/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-slice-along/dist/esm/index.js +5 -10
- package/node_modules/@turf/line-slice-along/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-slice-along/package.json +12 -12
- package/node_modules/@turf/line-split/dist/cjs/index.cjs +7 -14
- package/node_modules/@turf/line-split/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-split/dist/esm/index.js +7 -14
- package/node_modules/@turf/line-split/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-split/package.json +16 -16
- package/node_modules/@turf/line-to-polygon/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/line-to-polygon/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/line-to-polygon/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/line-to-polygon/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/line-to-polygon/dist/esm/index.js +4 -8
- package/node_modules/@turf/line-to-polygon/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/line-to-polygon/package.json +12 -12
- package/node_modules/@turf/mask/dist/cjs/index.cjs +7 -7
- package/node_modules/@turf/mask/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/mask/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/mask/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/mask/dist/esm/index.js +6 -6
- package/node_modules/@turf/mask/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/mask/package.json +11 -11
- package/node_modules/@turf/meta/README.md +145 -93
- package/node_modules/@turf/meta/dist/cjs/index.cjs +22 -44
- package/node_modules/@turf/meta/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/meta/dist/esm/index.js +22 -44
- package/node_modules/@turf/meta/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/meta/package.json +7 -7
- package/node_modules/@turf/midpoint/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/midpoint/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/midpoint/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/midpoint/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/midpoint/package.json +12 -12
- package/node_modules/@turf/moran-index/README.md +25 -47
- package/node_modules/@turf/moran-index/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/moran-index/dist/cjs/index.d.cts +16 -8
- package/node_modules/@turf/moran-index/dist/esm/index.d.ts +16 -8
- package/node_modules/@turf/moran-index/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/moran-index/package.json +11 -11
- package/node_modules/@turf/nearest-neighbor-analysis/README.md +50 -21
- package/node_modules/@turf/nearest-neighbor-analysis/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/nearest-neighbor-analysis/dist/cjs/index.d.cts +25 -6
- package/node_modules/@turf/nearest-neighbor-analysis/dist/esm/index.d.ts +25 -6
- package/node_modules/@turf/nearest-neighbor-analysis/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/nearest-neighbor-analysis/package.json +17 -17
- package/node_modules/@turf/nearest-point/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/nearest-point/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/nearest-point/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/nearest-point/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/nearest-point/dist/esm/index.js +2 -4
- package/node_modules/@turf/nearest-point/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/nearest-point/package.json +12 -12
- package/node_modules/@turf/nearest-point-on-line/README.md +9 -9
- package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.cjs +97 -53
- package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.d.cts +2 -2
- package/node_modules/@turf/nearest-point-on-line/dist/esm/index.d.ts +2 -2
- package/node_modules/@turf/nearest-point-on-line/dist/esm/index.js +99 -55
- package/node_modules/@turf/nearest-point-on-line/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/nearest-point-on-line/package.json +15 -18
- package/node_modules/@turf/nearest-point-to-line/README.md +1 -9
- package/node_modules/@turf/nearest-point-to-line/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/nearest-point-to-line/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/nearest-point-to-line/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/nearest-point-to-line/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/nearest-point-to-line/package.json +14 -14
- package/node_modules/@turf/planepoint/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/planepoint/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/planepoint/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/planepoint/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/planepoint/package.json +10 -10
- package/node_modules/@turf/point-grid/dist/cjs/index.cjs +2 -4
- package/node_modules/@turf/point-grid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/point-grid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/point-grid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/point-grid/dist/esm/index.js +2 -4
- package/node_modules/@turf/point-grid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/point-grid/package.json +14 -14
- package/node_modules/@turf/point-on-feature/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/point-on-feature/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/point-on-feature/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/point-on-feature/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/point-on-feature/package.json +15 -15
- package/node_modules/@turf/point-to-line-distance/README.md +10 -10
- package/node_modules/@turf/point-to-line-distance/dist/cjs/index.cjs +21 -19
- package/node_modules/@turf/point-to-line-distance/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/point-to-line-distance/dist/cjs/index.d.cts +3 -3
- package/node_modules/@turf/point-to-line-distance/dist/esm/index.d.ts +3 -3
- package/node_modules/@turf/point-to-line-distance/dist/esm/index.js +22 -20
- package/node_modules/@turf/point-to-line-distance/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/point-to-line-distance/package.json +18 -17
- package/node_modules/@turf/point-to-polygon-distance/LICENSE +20 -0
- package/node_modules/@turf/point-to-polygon-distance/README.md +61 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/cjs/index.cjs +49 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/cjs/index.cjs.map +1 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/cjs/index.d.cts +23 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/esm/index.d.ts +23 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/esm/index.js +49 -0
- package/node_modules/@turf/point-to-polygon-distance/dist/esm/index.js.map +1 -0
- package/node_modules/@turf/point-to-polygon-distance/package.json +80 -0
- package/node_modules/@turf/points-within-polygon/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/points-within-polygon/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/points-within-polygon/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/points-within-polygon/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/points-within-polygon/package.json +11 -11
- package/node_modules/@turf/polygon-smooth/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/polygon-smooth/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/polygon-smooth/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/polygon-smooth/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/polygon-smooth/dist/esm/index.js +1 -2
- package/node_modules/@turf/polygon-smooth/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/polygon-smooth/package.json +10 -10
- package/node_modules/@turf/polygon-tangents/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/polygon-tangents/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/polygon-tangents/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/polygon-tangents/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/polygon-tangents/dist/esm/index.js +1 -2
- package/node_modules/@turf/polygon-tangents/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/polygon-tangents/package.json +14 -14
- package/node_modules/@turf/polygon-to-line/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/polygon-to-line/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/polygon-to-line/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/polygon-to-line/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/polygon-to-line/package.json +10 -10
- package/node_modules/@turf/polygonize/dist/cjs/index.cjs +20 -40
- package/node_modules/@turf/polygonize/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/polygonize/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/polygonize/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/polygonize/dist/esm/index.js +20 -40
- package/node_modules/@turf/polygonize/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/polygonize/package.json +13 -13
- package/node_modules/@turf/projection/README.md +2 -2
- package/node_modules/@turf/projection/dist/cjs/index.cjs +6 -12
- package/node_modules/@turf/projection/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/projection/dist/cjs/index.d.cts +2 -2
- package/node_modules/@turf/projection/dist/esm/index.d.ts +2 -2
- package/node_modules/@turf/projection/dist/esm/index.js +6 -12
- package/node_modules/@turf/projection/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/projection/package.json +12 -12
- package/node_modules/@turf/quadrat-analysis/README.md +10 -10
- package/node_modules/@turf/quadrat-analysis/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/quadrat-analysis/dist/cjs/index.d.cts +4 -4
- package/node_modules/@turf/quadrat-analysis/dist/esm/index.d.ts +4 -4
- package/node_modules/@turf/quadrat-analysis/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/quadrat-analysis/package.json +18 -18
- package/node_modules/@turf/random/README.md +27 -29
- package/node_modules/@turf/random/dist/cjs/index.cjs +1 -3
- package/node_modules/@turf/random/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/random/dist/cjs/index.d.cts +11 -11
- package/node_modules/@turf/random/dist/esm/index.d.ts +11 -11
- package/node_modules/@turf/random/dist/esm/index.js +1 -3
- package/node_modules/@turf/random/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/random/package.json +9 -9
- package/node_modules/@turf/rectangle-grid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/rectangle-grid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/rectangle-grid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/rectangle-grid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/rectangle-grid/package.json +13 -13
- package/node_modules/@turf/rewind/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/rewind/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/rewind/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/rewind/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/rewind/dist/esm/index.js +3 -6
- package/node_modules/@turf/rewind/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/rewind/package.json +13 -13
- package/node_modules/@turf/rhumb-bearing/README.md +1 -1
- package/node_modules/@turf/rhumb-bearing/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/rhumb-bearing/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/rhumb-bearing/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/rhumb-bearing/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/rhumb-bearing/package.json +11 -11
- package/node_modules/@turf/rhumb-destination/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/rhumb-destination/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/rhumb-destination/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/rhumb-destination/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/rhumb-destination/dist/esm/index.js +1 -2
- package/node_modules/@turf/rhumb-destination/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/rhumb-destination/package.json +11 -11
- package/node_modules/@turf/rhumb-distance/README.md +1 -1
- package/node_modules/@turf/rhumb-distance/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/rhumb-distance/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/rhumb-distance/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/rhumb-distance/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/rhumb-distance/package.json +11 -11
- package/node_modules/@turf/sample/README.md +2 -1
- package/node_modules/@turf/sample/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/sample/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/sample/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/sample/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/sample/dist/esm/index.js +3 -6
- package/node_modules/@turf/sample/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/sample/package.json +9 -9
- package/node_modules/@turf/sector/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/sector/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/sector/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/sector/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/sector/dist/esm/index.js +4 -8
- package/node_modules/@turf/sector/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/sector/package.json +14 -14
- package/node_modules/@turf/shortest-path/README.md +13 -19
- package/node_modules/@turf/shortest-path/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/shortest-path/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/shortest-path/dist/cjs/index.d.cts +5 -5
- package/node_modules/@turf/shortest-path/dist/esm/index.d.ts +5 -5
- package/node_modules/@turf/shortest-path/dist/esm/index.js +3 -6
- package/node_modules/@turf/shortest-path/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/shortest-path/package.json +18 -18
- package/node_modules/@turf/simplify/dist/cjs/index.cjs +8 -16
- package/node_modules/@turf/simplify/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/simplify/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/simplify/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/simplify/dist/esm/index.js +8 -16
- package/node_modules/@turf/simplify/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/simplify/package.json +13 -13
- package/node_modules/@turf/square/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/square/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/square/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/square/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/square/package.json +10 -10
- package/node_modules/@turf/square-grid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/square-grid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/square-grid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/square-grid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/square-grid/package.json +12 -12
- package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.js +3 -6
- package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/standard-deviational-ellipse/package.json +16 -16
- package/node_modules/@turf/tag/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/tag/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/tag/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/tag/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/tag/dist/esm/index.js +1 -2
- package/node_modules/@turf/tag/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/tag/package.json +12 -12
- package/node_modules/@turf/tesselate/dist/cjs/index.cjs +1 -2
- package/node_modules/@turf/tesselate/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/tesselate/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/tesselate/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/tesselate/dist/esm/index.js +1 -2
- package/node_modules/@turf/tesselate/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/tesselate/package.json +9 -9
- package/node_modules/@turf/tin/dist/cjs/index.cjs +13 -14
- package/node_modules/@turf/tin/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/tin/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/tin/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/tin/dist/esm/index.js +13 -14
- package/node_modules/@turf/tin/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/tin/package.json +9 -9
- package/node_modules/@turf/transform-rotate/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/transform-rotate/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/transform-rotate/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/transform-rotate/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/transform-rotate/dist/esm/index.js +4 -8
- package/node_modules/@turf/transform-rotate/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/transform-rotate/package.json +17 -17
- package/node_modules/@turf/transform-scale/dist/cjs/index.cjs +18 -12
- package/node_modules/@turf/transform-scale/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/transform-scale/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/transform-scale/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/transform-scale/dist/esm/index.js +18 -12
- package/node_modules/@turf/transform-scale/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/transform-scale/package.json +21 -21
- package/node_modules/@turf/transform-translate/dist/cjs/index.cjs +4 -8
- package/node_modules/@turf/transform-translate/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/transform-translate/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/transform-translate/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/transform-translate/dist/esm/index.js +4 -8
- package/node_modules/@turf/transform-translate/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/transform-translate/package.json +14 -14
- package/node_modules/@turf/triangle-grid/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/triangle-grid/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/triangle-grid/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/triangle-grid/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/triangle-grid/package.json +13 -13
- package/node_modules/@turf/truncate/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/truncate/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/truncate/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/truncate/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/truncate/dist/esm/index.js +3 -6
- package/node_modules/@turf/truncate/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/truncate/package.json +10 -10
- package/node_modules/@turf/turf/dist/cjs/index.cjs +3 -1
- package/node_modules/@turf/turf/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/turf/dist/cjs/index.d.cts +1 -0
- package/node_modules/@turf/turf/dist/esm/index.d.ts +1 -0
- package/node_modules/@turf/turf/dist/esm/index.js +2 -0
- package/node_modules/@turf/turf/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/turf/package.json +126 -125
- package/node_modules/@turf/turf/turf.min.js +3 -26
- package/node_modules/@turf/union/README.md +44 -24
- package/node_modules/@turf/union/dist/cjs/index.cjs +9 -12
- package/node_modules/@turf/union/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/union/dist/cjs/index.d.cts +40 -21
- package/node_modules/@turf/union/dist/esm/index.d.ts +40 -21
- package/node_modules/@turf/union/dist/esm/index.js +8 -11
- package/node_modules/@turf/union/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/union/package.json +11 -11
- package/node_modules/@turf/unkink-polygon/dist/cjs/index.cjs +14 -28
- package/node_modules/@turf/unkink-polygon/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/unkink-polygon/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/unkink-polygon/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/unkink-polygon/dist/esm/index.js +14 -28
- package/node_modules/@turf/unkink-polygon/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/unkink-polygon/package.json +13 -13
- package/node_modules/@turf/voronoi/dist/cjs/index.cjs +3 -6
- package/node_modules/@turf/voronoi/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/voronoi/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/voronoi/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/voronoi/dist/esm/index.js +3 -6
- package/node_modules/@turf/voronoi/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/voronoi/package.json +11 -11
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/events.d.ts +1 -1
- package/node_modules/@types/node/globals.d.ts +8 -6
- package/node_modules/@types/node/module.d.ts +10 -3
- package/node_modules/@types/node/net.d.ts +3 -0
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +35 -2
- package/node_modules/@types/node/sqlite.d.ts +30 -9
- package/node_modules/bignumber.js/CHANGELOG.md +295 -0
- package/node_modules/bignumber.js/LICENCE.md +26 -0
- package/node_modules/bignumber.js/README.md +286 -0
- package/node_modules/bignumber.js/bignumber.d.ts +1831 -0
- package/node_modules/bignumber.js/bignumber.js +2922 -0
- package/node_modules/bignumber.js/bignumber.mjs +2907 -0
- package/node_modules/bignumber.js/doc/API.html +2249 -0
- package/node_modules/bignumber.js/package.json +50 -0
- package/node_modules/long/index.d.ts +1 -456
- package/node_modules/long/package.json +1 -1
- package/node_modules/long/umd/index.d.ts +456 -1
- package/node_modules/polyclip-ts/LICENSE +21 -0
- package/node_modules/{polygon-clipping → polyclip-ts}/README.md +35 -36
- package/node_modules/polyclip-ts/dist/cjs/index.cjs +1179 -0
- package/node_modules/polyclip-ts/dist/cjs/index.cjs.map +1 -0
- package/node_modules/polyclip-ts/dist/cjs/index.d.cts +12 -0
- package/node_modules/polyclip-ts/dist/esm/index.d.ts +12 -0
- package/node_modules/polyclip-ts/dist/esm/index.js +1138 -0
- package/node_modules/polyclip-ts/dist/esm/index.js.map +1 -0
- package/node_modules/polyclip-ts/dist/polyclip-ts.umd.js +4811 -0
- package/node_modules/polyclip-ts/dist/polyclip-ts.umd.min.js +2 -0
- package/node_modules/polyclip-ts/package.json +72 -0
- package/node_modules/splaytree-ts/LICENSE +29 -0
- package/node_modules/splaytree-ts/README.md +296 -0
- package/node_modules/splaytree-ts/dist/cjs/index.cjs +714 -0
- package/node_modules/splaytree-ts/dist/cjs/index.cjs.map +1 -0
- package/node_modules/splaytree-ts/dist/cjs/index.d.cts +105 -0
- package/node_modules/splaytree-ts/dist/esm/index.d.ts +105 -0
- package/node_modules/splaytree-ts/dist/esm/index.js +688 -0
- package/node_modules/splaytree-ts/dist/esm/index.js.map +1 -0
- package/node_modules/splaytree-ts/dist/splaytree-ts.umd.js +736 -0
- package/node_modules/splaytree-ts/dist/splaytree-ts.umd.min.js +2 -0
- package/node_modules/splaytree-ts/package.json +59 -0
- package/node_modules/uuid/README.md +29 -16
- package/node_modules/uuid/dist/cjs/md5.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/native.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/rng.js +1 -1
- package/node_modules/uuid/dist/cjs/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/stringify.js +2 -1
- package/node_modules/uuid/dist/cjs/v1.js +10 -1
- package/node_modules/uuid/dist/cjs/v1ToV6.js +1 -1
- package/node_modules/uuid/dist/cjs/v35.js +3 -3
- package/node_modules/uuid/dist/cjs/v4.js +7 -1
- package/node_modules/uuid/dist/cjs/v6ToV1.js +1 -1
- package/node_modules/uuid/dist/cjs/v7.js +10 -1
- package/node_modules/uuid/dist/cjs-browser/rng.js +1 -1
- package/node_modules/uuid/dist/cjs-browser/stringify.js +2 -1
- package/node_modules/uuid/dist/cjs-browser/v1.js +10 -1
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +1 -1
- package/node_modules/uuid/dist/cjs-browser/v35.js +3 -3
- package/node_modules/uuid/dist/cjs-browser/v4.js +7 -1
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +1 -1
- package/node_modules/uuid/dist/cjs-browser/v7.js +10 -1
- package/node_modules/uuid/dist/esm/md5.d.ts +2 -0
- package/node_modules/uuid/dist/esm/native.d.ts +1 -0
- package/node_modules/uuid/dist/esm/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v1.js +8 -0
- package/node_modules/uuid/dist/esm/v4.js +7 -1
- package/node_modules/uuid/dist/esm/v7.js +8 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +8 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +7 -1
- package/node_modules/uuid/dist/esm-browser/v7.js +8 -0
- package/node_modules/uuid/package.json +26 -28
- package/package.json +4 -4
- package/tak-registration.js +3 -1
- package/node_modules/polygon-clipping/LICENSE.md +0 -11
- package/node_modules/polygon-clipping/dist/polygon-clipping.cjs.js +0 -1803
- package/node_modules/polygon-clipping/dist/polygon-clipping.d.ts +0 -14
- package/node_modules/polygon-clipping/dist/polygon-clipping.esm.js +0 -1532
- package/node_modules/polygon-clipping/dist/polygon-clipping.umd.js +0 -2496
- package/node_modules/polygon-clipping/dist/polygon-clipping.umd.min.js +0 -24
- package/node_modules/polygon-clipping/dist/polygon-clipping.umd.min.js.map +0 -1
- package/node_modules/polygon-clipping/node_modules/robust-predicates/LICENSE +0 -24
- package/node_modules/polygon-clipping/node_modules/robust-predicates/README.md +0 -82
- package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/incircle.js +0 -765
- package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/insphere.js +0 -766
- package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/orient2d.js +0 -184
- package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/orient3d.js +0 -462
- package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/util.js +0 -138
- package/node_modules/polygon-clipping/node_modules/robust-predicates/index.d.ts +0 -49
- package/node_modules/polygon-clipping/node_modules/robust-predicates/index.js +0 -5
- package/node_modules/polygon-clipping/node_modules/robust-predicates/package.json +0 -75
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/incircle.js +0 -908
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/incircle.min.js +0 -1
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/insphere.js +0 -914
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/insphere.min.js +0 -1
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient2d.js +0 -280
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient2d.min.js +0 -1
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient3d.js +0 -601
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient3d.min.js +0 -1
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/predicates.js +0 -2328
- package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/predicates.min.js +0 -1
- package/node_modules/polygon-clipping/package.json +0 -79
- package/node_modules/splaytree/Readme.md +0 -222
- package/node_modules/splaytree/dist/splay.esm.js +0 -686
- package/node_modules/splaytree/dist/splay.esm.js.map +0 -1
- package/node_modules/splaytree/dist/splay.js +0 -694
- package/node_modules/splaytree/dist/splay.js.map +0 -1
- package/node_modules/splaytree/package.json +0 -91
- package/node_modules/splaytree/src/index.ts +0 -679
- package/node_modules/splaytree/src/node.ts +0 -15
- package/node_modules/splaytree/src/types.ts +0 -2
- package/node_modules/splaytree/typings/index.d.ts +0 -82
- package/node_modules/splaytree/typings/node.d.ts +0 -8
- package/node_modules/splaytree/typings/types.d.ts +0 -2
- package/node_modules/uuid/CHANGELOG.md +0 -335
- package/node_modules/uuid/CONTRIBUTING.md +0 -18
- package/node_modules/uuid/dist/cjs/test/parse.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/parse.test.js +0 -50
- package/node_modules/uuid/dist/cjs/test/rng.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/rng.test.js +0 -14
- package/node_modules/uuid/dist/cjs/test/stringify.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/stringify.test.js +0 -23
- package/node_modules/uuid/dist/cjs/test/test_constants.d.ts +0 -33
- package/node_modules/uuid/dist/cjs/test/test_constants.js +0 -91
- package/node_modules/uuid/dist/cjs/test/v1.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/v1.test.js +0 -127
- package/node_modules/uuid/dist/cjs/test/v35.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/v35.test.js +0 -143
- package/node_modules/uuid/dist/cjs/test/v4.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/v4.test.js +0 -60
- package/node_modules/uuid/dist/cjs/test/v6.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/v6.test.js +0 -56
- package/node_modules/uuid/dist/cjs/test/v7.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/v7.test.js +0 -194
- package/node_modules/uuid/dist/cjs/test/validate.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/validate.test.js +0 -13
- package/node_modules/uuid/dist/cjs/test/version.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs/test/version.test.js +0 -20
- package/node_modules/uuid/dist/cjs-browser/test/parse.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/parse.test.js +0 -50
- package/node_modules/uuid/dist/cjs-browser/test/rng.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/rng.test.js +0 -14
- package/node_modules/uuid/dist/cjs-browser/test/stringify.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/stringify.test.js +0 -23
- package/node_modules/uuid/dist/cjs-browser/test/test_constants.d.ts +0 -33
- package/node_modules/uuid/dist/cjs-browser/test/test_constants.js +0 -91
- package/node_modules/uuid/dist/cjs-browser/test/v1.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/v1.test.js +0 -127
- package/node_modules/uuid/dist/cjs-browser/test/v35.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/v35.test.js +0 -143
- package/node_modules/uuid/dist/cjs-browser/test/v4.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/v4.test.js +0 -60
- package/node_modules/uuid/dist/cjs-browser/test/v6.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/v6.test.js +0 -56
- package/node_modules/uuid/dist/cjs-browser/test/v7.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/v7.test.js +0 -194
- package/node_modules/uuid/dist/cjs-browser/test/validate.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/validate.test.js +0 -13
- package/node_modules/uuid/dist/cjs-browser/test/version.test.d.ts +0 -1
- package/node_modules/uuid/dist/cjs-browser/test/version.test.js +0 -20
- package/node_modules/uuid/dist/esm/test/parse.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/parse.test.js +0 -48
- package/node_modules/uuid/dist/esm/test/rng.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/rng.test.js +0 -12
- package/node_modules/uuid/dist/esm/test/stringify.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/stringify.test.js +0 -21
- package/node_modules/uuid/dist/esm/test/test_constants.d.ts +0 -33
- package/node_modules/uuid/dist/esm/test/test_constants.js +0 -88
- package/node_modules/uuid/dist/esm/test/v1.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/v1.test.js +0 -125
- package/node_modules/uuid/dist/esm/test/v35.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/v35.test.js +0 -141
- package/node_modules/uuid/dist/esm/test/v4.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/v4.test.js +0 -58
- package/node_modules/uuid/dist/esm/test/v6.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/v6.test.js +0 -54
- package/node_modules/uuid/dist/esm/test/v7.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/v7.test.js +0 -192
- package/node_modules/uuid/dist/esm/test/validate.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/validate.test.js +0 -11
- package/node_modules/uuid/dist/esm/test/version.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm/test/version.test.js +0 -18
- package/node_modules/uuid/dist/esm-browser/test/parse.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/parse.test.js +0 -48
- package/node_modules/uuid/dist/esm-browser/test/rng.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/rng.test.js +0 -12
- package/node_modules/uuid/dist/esm-browser/test/stringify.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/stringify.test.js +0 -21
- package/node_modules/uuid/dist/esm-browser/test/test_constants.d.ts +0 -33
- package/node_modules/uuid/dist/esm-browser/test/test_constants.js +0 -88
- package/node_modules/uuid/dist/esm-browser/test/v1.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/v1.test.js +0 -125
- package/node_modules/uuid/dist/esm-browser/test/v35.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/v35.test.js +0 -141
- package/node_modules/uuid/dist/esm-browser/test/v4.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/v4.test.js +0 -58
- package/node_modules/uuid/dist/esm-browser/test/v6.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/v6.test.js +0 -54
- package/node_modules/uuid/dist/esm-browser/test/v7.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/v7.test.js +0 -192
- package/node_modules/uuid/dist/esm-browser/test/validate.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/validate.test.js +0 -11
- package/node_modules/uuid/dist/esm-browser/test/version.test.d.ts +0 -1
- package/node_modules/uuid/dist/esm-browser/test/version.test.js +0 -18
|
@@ -1,2496 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.polygonClipping = factory());
|
|
5
|
-
})(this, (function () { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* splaytree v3.1.2
|
|
9
|
-
* Fast Splay tree for Node and browser
|
|
10
|
-
*
|
|
11
|
-
* @author Alexander Milevski <info@w8r.name>
|
|
12
|
-
* @license MIT
|
|
13
|
-
* @preserve
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/*! *****************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
19
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
20
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
|
|
22
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
23
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
24
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
25
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
26
|
-
|
|
27
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
28
|
-
and limitations under the License.
|
|
29
|
-
***************************************************************************** */
|
|
30
|
-
|
|
31
|
-
function __generator(thisArg, body) {
|
|
32
|
-
var _ = {
|
|
33
|
-
label: 0,
|
|
34
|
-
sent: function () {
|
|
35
|
-
if (t[0] & 1) throw t[1];
|
|
36
|
-
return t[1];
|
|
37
|
-
},
|
|
38
|
-
trys: [],
|
|
39
|
-
ops: []
|
|
40
|
-
},
|
|
41
|
-
f,
|
|
42
|
-
y,
|
|
43
|
-
t,
|
|
44
|
-
g;
|
|
45
|
-
return g = {
|
|
46
|
-
next: verb(0),
|
|
47
|
-
"throw": verb(1),
|
|
48
|
-
"return": verb(2)
|
|
49
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
50
|
-
return this;
|
|
51
|
-
}), g;
|
|
52
|
-
function verb(n) {
|
|
53
|
-
return function (v) {
|
|
54
|
-
return step([n, v]);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function step(op) {
|
|
58
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
59
|
-
while (_) try {
|
|
60
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
61
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
62
|
-
switch (op[0]) {
|
|
63
|
-
case 0:
|
|
64
|
-
case 1:
|
|
65
|
-
t = op;
|
|
66
|
-
break;
|
|
67
|
-
case 4:
|
|
68
|
-
_.label++;
|
|
69
|
-
return {
|
|
70
|
-
value: op[1],
|
|
71
|
-
done: false
|
|
72
|
-
};
|
|
73
|
-
case 5:
|
|
74
|
-
_.label++;
|
|
75
|
-
y = op[1];
|
|
76
|
-
op = [0];
|
|
77
|
-
continue;
|
|
78
|
-
case 7:
|
|
79
|
-
op = _.ops.pop();
|
|
80
|
-
_.trys.pop();
|
|
81
|
-
continue;
|
|
82
|
-
default:
|
|
83
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
84
|
-
_ = 0;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
88
|
-
_.label = op[1];
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
92
|
-
_.label = t[1];
|
|
93
|
-
t = op;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
if (t && _.label < t[2]) {
|
|
97
|
-
_.label = t[2];
|
|
98
|
-
_.ops.push(op);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
if (t[2]) _.ops.pop();
|
|
102
|
-
_.trys.pop();
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
op = body.call(thisArg, _);
|
|
106
|
-
} catch (e) {
|
|
107
|
-
op = [6, e];
|
|
108
|
-
y = 0;
|
|
109
|
-
} finally {
|
|
110
|
-
f = t = 0;
|
|
111
|
-
}
|
|
112
|
-
if (op[0] & 5) throw op[1];
|
|
113
|
-
return {
|
|
114
|
-
value: op[0] ? op[1] : void 0,
|
|
115
|
-
done: true
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
var Node = /** @class */function () {
|
|
120
|
-
function Node(key, data) {
|
|
121
|
-
this.next = null;
|
|
122
|
-
this.key = key;
|
|
123
|
-
this.data = data;
|
|
124
|
-
this.left = null;
|
|
125
|
-
this.right = null;
|
|
126
|
-
}
|
|
127
|
-
return Node;
|
|
128
|
-
}();
|
|
129
|
-
|
|
130
|
-
/* follows "An implementation of top-down splaying"
|
|
131
|
-
* by D. Sleator <sleator@cs.cmu.edu> March 1992
|
|
132
|
-
*/
|
|
133
|
-
function DEFAULT_COMPARE(a, b) {
|
|
134
|
-
return a > b ? 1 : a < b ? -1 : 0;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Simple top down splay, not requiring i to be in the tree t.
|
|
138
|
-
*/
|
|
139
|
-
function splay(i, t, comparator) {
|
|
140
|
-
var N = new Node(null, null);
|
|
141
|
-
var l = N;
|
|
142
|
-
var r = N;
|
|
143
|
-
while (true) {
|
|
144
|
-
var cmp = comparator(i, t.key);
|
|
145
|
-
//if (i < t.key) {
|
|
146
|
-
if (cmp < 0) {
|
|
147
|
-
if (t.left === null) break;
|
|
148
|
-
//if (i < t.left.key) {
|
|
149
|
-
if (comparator(i, t.left.key) < 0) {
|
|
150
|
-
var y = t.left; /* rotate right */
|
|
151
|
-
t.left = y.right;
|
|
152
|
-
y.right = t;
|
|
153
|
-
t = y;
|
|
154
|
-
if (t.left === null) break;
|
|
155
|
-
}
|
|
156
|
-
r.left = t; /* link right */
|
|
157
|
-
r = t;
|
|
158
|
-
t = t.left;
|
|
159
|
-
//} else if (i > t.key) {
|
|
160
|
-
} else if (cmp > 0) {
|
|
161
|
-
if (t.right === null) break;
|
|
162
|
-
//if (i > t.right.key) {
|
|
163
|
-
if (comparator(i, t.right.key) > 0) {
|
|
164
|
-
var y = t.right; /* rotate left */
|
|
165
|
-
t.right = y.left;
|
|
166
|
-
y.left = t;
|
|
167
|
-
t = y;
|
|
168
|
-
if (t.right === null) break;
|
|
169
|
-
}
|
|
170
|
-
l.right = t; /* link left */
|
|
171
|
-
l = t;
|
|
172
|
-
t = t.right;
|
|
173
|
-
} else break;
|
|
174
|
-
}
|
|
175
|
-
/* assemble */
|
|
176
|
-
l.right = t.left;
|
|
177
|
-
r.left = t.right;
|
|
178
|
-
t.left = N.right;
|
|
179
|
-
t.right = N.left;
|
|
180
|
-
return t;
|
|
181
|
-
}
|
|
182
|
-
function insert(i, data, t, comparator) {
|
|
183
|
-
var node = new Node(i, data);
|
|
184
|
-
if (t === null) {
|
|
185
|
-
node.left = node.right = null;
|
|
186
|
-
return node;
|
|
187
|
-
}
|
|
188
|
-
t = splay(i, t, comparator);
|
|
189
|
-
var cmp = comparator(i, t.key);
|
|
190
|
-
if (cmp < 0) {
|
|
191
|
-
node.left = t.left;
|
|
192
|
-
node.right = t;
|
|
193
|
-
t.left = null;
|
|
194
|
-
} else if (cmp >= 0) {
|
|
195
|
-
node.right = t.right;
|
|
196
|
-
node.left = t;
|
|
197
|
-
t.right = null;
|
|
198
|
-
}
|
|
199
|
-
return node;
|
|
200
|
-
}
|
|
201
|
-
function split(key, v, comparator) {
|
|
202
|
-
var left = null;
|
|
203
|
-
var right = null;
|
|
204
|
-
if (v) {
|
|
205
|
-
v = splay(key, v, comparator);
|
|
206
|
-
var cmp = comparator(v.key, key);
|
|
207
|
-
if (cmp === 0) {
|
|
208
|
-
left = v.left;
|
|
209
|
-
right = v.right;
|
|
210
|
-
} else if (cmp < 0) {
|
|
211
|
-
right = v.right;
|
|
212
|
-
v.right = null;
|
|
213
|
-
left = v;
|
|
214
|
-
} else {
|
|
215
|
-
left = v.left;
|
|
216
|
-
v.left = null;
|
|
217
|
-
right = v;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
left: left,
|
|
222
|
-
right: right
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function merge(left, right, comparator) {
|
|
226
|
-
if (right === null) return left;
|
|
227
|
-
if (left === null) return right;
|
|
228
|
-
right = splay(left.key, right, comparator);
|
|
229
|
-
right.left = left;
|
|
230
|
-
return right;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Prints level of the tree
|
|
234
|
-
*/
|
|
235
|
-
function printRow(root, prefix, isTail, out, printNode) {
|
|
236
|
-
if (root) {
|
|
237
|
-
out("" + prefix + (isTail ? '└── ' : '├── ') + printNode(root) + "\n");
|
|
238
|
-
var indent = prefix + (isTail ? ' ' : '│ ');
|
|
239
|
-
if (root.left) printRow(root.left, indent, false, out, printNode);
|
|
240
|
-
if (root.right) printRow(root.right, indent, true, out, printNode);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
var Tree = /** @class */function () {
|
|
244
|
-
function Tree(comparator) {
|
|
245
|
-
if (comparator === void 0) {
|
|
246
|
-
comparator = DEFAULT_COMPARE;
|
|
247
|
-
}
|
|
248
|
-
this._root = null;
|
|
249
|
-
this._size = 0;
|
|
250
|
-
this._comparator = comparator;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Inserts a key, allows duplicates
|
|
254
|
-
*/
|
|
255
|
-
Tree.prototype.insert = function (key, data) {
|
|
256
|
-
this._size++;
|
|
257
|
-
return this._root = insert(key, data, this._root, this._comparator);
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Adds a key, if it is not present in the tree
|
|
261
|
-
*/
|
|
262
|
-
Tree.prototype.add = function (key, data) {
|
|
263
|
-
var node = new Node(key, data);
|
|
264
|
-
if (this._root === null) {
|
|
265
|
-
node.left = node.right = null;
|
|
266
|
-
this._size++;
|
|
267
|
-
this._root = node;
|
|
268
|
-
}
|
|
269
|
-
var comparator = this._comparator;
|
|
270
|
-
var t = splay(key, this._root, comparator);
|
|
271
|
-
var cmp = comparator(key, t.key);
|
|
272
|
-
if (cmp === 0) this._root = t;else {
|
|
273
|
-
if (cmp < 0) {
|
|
274
|
-
node.left = t.left;
|
|
275
|
-
node.right = t;
|
|
276
|
-
t.left = null;
|
|
277
|
-
} else if (cmp > 0) {
|
|
278
|
-
node.right = t.right;
|
|
279
|
-
node.left = t;
|
|
280
|
-
t.right = null;
|
|
281
|
-
}
|
|
282
|
-
this._size++;
|
|
283
|
-
this._root = node;
|
|
284
|
-
}
|
|
285
|
-
return this._root;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* @param {Key} key
|
|
289
|
-
* @return {Node|null}
|
|
290
|
-
*/
|
|
291
|
-
Tree.prototype.remove = function (key) {
|
|
292
|
-
this._root = this._remove(key, this._root, this._comparator);
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Deletes i from the tree if it's there
|
|
296
|
-
*/
|
|
297
|
-
Tree.prototype._remove = function (i, t, comparator) {
|
|
298
|
-
var x;
|
|
299
|
-
if (t === null) return null;
|
|
300
|
-
t = splay(i, t, comparator);
|
|
301
|
-
var cmp = comparator(i, t.key);
|
|
302
|
-
if (cmp === 0) {
|
|
303
|
-
/* found it */
|
|
304
|
-
if (t.left === null) {
|
|
305
|
-
x = t.right;
|
|
306
|
-
} else {
|
|
307
|
-
x = splay(i, t.left, comparator);
|
|
308
|
-
x.right = t.right;
|
|
309
|
-
}
|
|
310
|
-
this._size--;
|
|
311
|
-
return x;
|
|
312
|
-
}
|
|
313
|
-
return t; /* It wasn't there */
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Removes and returns the node with smallest key
|
|
317
|
-
*/
|
|
318
|
-
Tree.prototype.pop = function () {
|
|
319
|
-
var node = this._root;
|
|
320
|
-
if (node) {
|
|
321
|
-
while (node.left) node = node.left;
|
|
322
|
-
this._root = splay(node.key, this._root, this._comparator);
|
|
323
|
-
this._root = this._remove(node.key, this._root, this._comparator);
|
|
324
|
-
return {
|
|
325
|
-
key: node.key,
|
|
326
|
-
data: node.data
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
return null;
|
|
330
|
-
};
|
|
331
|
-
/**
|
|
332
|
-
* Find without splaying
|
|
333
|
-
*/
|
|
334
|
-
Tree.prototype.findStatic = function (key) {
|
|
335
|
-
var current = this._root;
|
|
336
|
-
var compare = this._comparator;
|
|
337
|
-
while (current) {
|
|
338
|
-
var cmp = compare(key, current.key);
|
|
339
|
-
if (cmp === 0) return current;else if (cmp < 0) current = current.left;else current = current.right;
|
|
340
|
-
}
|
|
341
|
-
return null;
|
|
342
|
-
};
|
|
343
|
-
Tree.prototype.find = function (key) {
|
|
344
|
-
if (this._root) {
|
|
345
|
-
this._root = splay(key, this._root, this._comparator);
|
|
346
|
-
if (this._comparator(key, this._root.key) !== 0) return null;
|
|
347
|
-
}
|
|
348
|
-
return this._root;
|
|
349
|
-
};
|
|
350
|
-
Tree.prototype.contains = function (key) {
|
|
351
|
-
var current = this._root;
|
|
352
|
-
var compare = this._comparator;
|
|
353
|
-
while (current) {
|
|
354
|
-
var cmp = compare(key, current.key);
|
|
355
|
-
if (cmp === 0) return true;else if (cmp < 0) current = current.left;else current = current.right;
|
|
356
|
-
}
|
|
357
|
-
return false;
|
|
358
|
-
};
|
|
359
|
-
Tree.prototype.forEach = function (visitor, ctx) {
|
|
360
|
-
var current = this._root;
|
|
361
|
-
var Q = []; /* Initialize stack s */
|
|
362
|
-
var done = false;
|
|
363
|
-
while (!done) {
|
|
364
|
-
if (current !== null) {
|
|
365
|
-
Q.push(current);
|
|
366
|
-
current = current.left;
|
|
367
|
-
} else {
|
|
368
|
-
if (Q.length !== 0) {
|
|
369
|
-
current = Q.pop();
|
|
370
|
-
visitor.call(ctx, current);
|
|
371
|
-
current = current.right;
|
|
372
|
-
} else done = true;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return this;
|
|
376
|
-
};
|
|
377
|
-
/**
|
|
378
|
-
* Walk key range from `low` to `high`. Stops if `fn` returns a value.
|
|
379
|
-
*/
|
|
380
|
-
Tree.prototype.range = function (low, high, fn, ctx) {
|
|
381
|
-
var Q = [];
|
|
382
|
-
var compare = this._comparator;
|
|
383
|
-
var node = this._root;
|
|
384
|
-
var cmp;
|
|
385
|
-
while (Q.length !== 0 || node) {
|
|
386
|
-
if (node) {
|
|
387
|
-
Q.push(node);
|
|
388
|
-
node = node.left;
|
|
389
|
-
} else {
|
|
390
|
-
node = Q.pop();
|
|
391
|
-
cmp = compare(node.key, high);
|
|
392
|
-
if (cmp > 0) {
|
|
393
|
-
break;
|
|
394
|
-
} else if (compare(node.key, low) >= 0) {
|
|
395
|
-
if (fn.call(ctx, node)) return this; // stop if smth is returned
|
|
396
|
-
}
|
|
397
|
-
node = node.right;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return this;
|
|
401
|
-
};
|
|
402
|
-
/**
|
|
403
|
-
* Returns array of keys
|
|
404
|
-
*/
|
|
405
|
-
Tree.prototype.keys = function () {
|
|
406
|
-
var keys = [];
|
|
407
|
-
this.forEach(function (_a) {
|
|
408
|
-
var key = _a.key;
|
|
409
|
-
return keys.push(key);
|
|
410
|
-
});
|
|
411
|
-
return keys;
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* Returns array of all the data in the nodes
|
|
415
|
-
*/
|
|
416
|
-
Tree.prototype.values = function () {
|
|
417
|
-
var values = [];
|
|
418
|
-
this.forEach(function (_a) {
|
|
419
|
-
var data = _a.data;
|
|
420
|
-
return values.push(data);
|
|
421
|
-
});
|
|
422
|
-
return values;
|
|
423
|
-
};
|
|
424
|
-
Tree.prototype.min = function () {
|
|
425
|
-
if (this._root) return this.minNode(this._root).key;
|
|
426
|
-
return null;
|
|
427
|
-
};
|
|
428
|
-
Tree.prototype.max = function () {
|
|
429
|
-
if (this._root) return this.maxNode(this._root).key;
|
|
430
|
-
return null;
|
|
431
|
-
};
|
|
432
|
-
Tree.prototype.minNode = function (t) {
|
|
433
|
-
if (t === void 0) {
|
|
434
|
-
t = this._root;
|
|
435
|
-
}
|
|
436
|
-
if (t) while (t.left) t = t.left;
|
|
437
|
-
return t;
|
|
438
|
-
};
|
|
439
|
-
Tree.prototype.maxNode = function (t) {
|
|
440
|
-
if (t === void 0) {
|
|
441
|
-
t = this._root;
|
|
442
|
-
}
|
|
443
|
-
if (t) while (t.right) t = t.right;
|
|
444
|
-
return t;
|
|
445
|
-
};
|
|
446
|
-
/**
|
|
447
|
-
* Returns node at given index
|
|
448
|
-
*/
|
|
449
|
-
Tree.prototype.at = function (index) {
|
|
450
|
-
var current = this._root;
|
|
451
|
-
var done = false;
|
|
452
|
-
var i = 0;
|
|
453
|
-
var Q = [];
|
|
454
|
-
while (!done) {
|
|
455
|
-
if (current) {
|
|
456
|
-
Q.push(current);
|
|
457
|
-
current = current.left;
|
|
458
|
-
} else {
|
|
459
|
-
if (Q.length > 0) {
|
|
460
|
-
current = Q.pop();
|
|
461
|
-
if (i === index) return current;
|
|
462
|
-
i++;
|
|
463
|
-
current = current.right;
|
|
464
|
-
} else done = true;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return null;
|
|
468
|
-
};
|
|
469
|
-
Tree.prototype.next = function (d) {
|
|
470
|
-
var root = this._root;
|
|
471
|
-
var successor = null;
|
|
472
|
-
if (d.right) {
|
|
473
|
-
successor = d.right;
|
|
474
|
-
while (successor.left) successor = successor.left;
|
|
475
|
-
return successor;
|
|
476
|
-
}
|
|
477
|
-
var comparator = this._comparator;
|
|
478
|
-
while (root) {
|
|
479
|
-
var cmp = comparator(d.key, root.key);
|
|
480
|
-
if (cmp === 0) break;else if (cmp < 0) {
|
|
481
|
-
successor = root;
|
|
482
|
-
root = root.left;
|
|
483
|
-
} else root = root.right;
|
|
484
|
-
}
|
|
485
|
-
return successor;
|
|
486
|
-
};
|
|
487
|
-
Tree.prototype.prev = function (d) {
|
|
488
|
-
var root = this._root;
|
|
489
|
-
var predecessor = null;
|
|
490
|
-
if (d.left !== null) {
|
|
491
|
-
predecessor = d.left;
|
|
492
|
-
while (predecessor.right) predecessor = predecessor.right;
|
|
493
|
-
return predecessor;
|
|
494
|
-
}
|
|
495
|
-
var comparator = this._comparator;
|
|
496
|
-
while (root) {
|
|
497
|
-
var cmp = comparator(d.key, root.key);
|
|
498
|
-
if (cmp === 0) break;else if (cmp < 0) root = root.left;else {
|
|
499
|
-
predecessor = root;
|
|
500
|
-
root = root.right;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return predecessor;
|
|
504
|
-
};
|
|
505
|
-
Tree.prototype.clear = function () {
|
|
506
|
-
this._root = null;
|
|
507
|
-
this._size = 0;
|
|
508
|
-
return this;
|
|
509
|
-
};
|
|
510
|
-
Tree.prototype.toList = function () {
|
|
511
|
-
return toList(this._root);
|
|
512
|
-
};
|
|
513
|
-
/**
|
|
514
|
-
* Bulk-load items. Both array have to be same size
|
|
515
|
-
*/
|
|
516
|
-
Tree.prototype.load = function (keys, values, presort) {
|
|
517
|
-
if (values === void 0) {
|
|
518
|
-
values = [];
|
|
519
|
-
}
|
|
520
|
-
if (presort === void 0) {
|
|
521
|
-
presort = false;
|
|
522
|
-
}
|
|
523
|
-
var size = keys.length;
|
|
524
|
-
var comparator = this._comparator;
|
|
525
|
-
// sort if needed
|
|
526
|
-
if (presort) sort(keys, values, 0, size - 1, comparator);
|
|
527
|
-
if (this._root === null) {
|
|
528
|
-
// empty tree
|
|
529
|
-
this._root = loadRecursive(keys, values, 0, size);
|
|
530
|
-
this._size = size;
|
|
531
|
-
} else {
|
|
532
|
-
// that re-builds the whole tree from two in-order traversals
|
|
533
|
-
var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);
|
|
534
|
-
size = this._size + size;
|
|
535
|
-
this._root = sortedListToBST({
|
|
536
|
-
head: mergedList
|
|
537
|
-
}, 0, size);
|
|
538
|
-
}
|
|
539
|
-
return this;
|
|
540
|
-
};
|
|
541
|
-
Tree.prototype.isEmpty = function () {
|
|
542
|
-
return this._root === null;
|
|
543
|
-
};
|
|
544
|
-
Object.defineProperty(Tree.prototype, "size", {
|
|
545
|
-
get: function () {
|
|
546
|
-
return this._size;
|
|
547
|
-
},
|
|
548
|
-
enumerable: true,
|
|
549
|
-
configurable: true
|
|
550
|
-
});
|
|
551
|
-
Object.defineProperty(Tree.prototype, "root", {
|
|
552
|
-
get: function () {
|
|
553
|
-
return this._root;
|
|
554
|
-
},
|
|
555
|
-
enumerable: true,
|
|
556
|
-
configurable: true
|
|
557
|
-
});
|
|
558
|
-
Tree.prototype.toString = function (printNode) {
|
|
559
|
-
if (printNode === void 0) {
|
|
560
|
-
printNode = function (n) {
|
|
561
|
-
return String(n.key);
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
var out = [];
|
|
565
|
-
printRow(this._root, '', true, function (v) {
|
|
566
|
-
return out.push(v);
|
|
567
|
-
}, printNode);
|
|
568
|
-
return out.join('');
|
|
569
|
-
};
|
|
570
|
-
Tree.prototype.update = function (key, newKey, newData) {
|
|
571
|
-
var comparator = this._comparator;
|
|
572
|
-
var _a = split(key, this._root, comparator),
|
|
573
|
-
left = _a.left,
|
|
574
|
-
right = _a.right;
|
|
575
|
-
if (comparator(key, newKey) < 0) {
|
|
576
|
-
right = insert(newKey, newData, right, comparator);
|
|
577
|
-
} else {
|
|
578
|
-
left = insert(newKey, newData, left, comparator);
|
|
579
|
-
}
|
|
580
|
-
this._root = merge(left, right, comparator);
|
|
581
|
-
};
|
|
582
|
-
Tree.prototype.split = function (key) {
|
|
583
|
-
return split(key, this._root, this._comparator);
|
|
584
|
-
};
|
|
585
|
-
Tree.prototype[Symbol.iterator] = function () {
|
|
586
|
-
var current, Q, done;
|
|
587
|
-
return __generator(this, function (_a) {
|
|
588
|
-
switch (_a.label) {
|
|
589
|
-
case 0:
|
|
590
|
-
current = this._root;
|
|
591
|
-
Q = [];
|
|
592
|
-
done = false;
|
|
593
|
-
_a.label = 1;
|
|
594
|
-
case 1:
|
|
595
|
-
if (!!done) return [3 /*break*/, 6];
|
|
596
|
-
if (!(current !== null)) return [3 /*break*/, 2];
|
|
597
|
-
Q.push(current);
|
|
598
|
-
current = current.left;
|
|
599
|
-
return [3 /*break*/, 5];
|
|
600
|
-
case 2:
|
|
601
|
-
if (!(Q.length !== 0)) return [3 /*break*/, 4];
|
|
602
|
-
current = Q.pop();
|
|
603
|
-
return [4 /*yield*/, current];
|
|
604
|
-
case 3:
|
|
605
|
-
_a.sent();
|
|
606
|
-
current = current.right;
|
|
607
|
-
return [3 /*break*/, 5];
|
|
608
|
-
case 4:
|
|
609
|
-
done = true;
|
|
610
|
-
_a.label = 5;
|
|
611
|
-
case 5:
|
|
612
|
-
return [3 /*break*/, 1];
|
|
613
|
-
case 6:
|
|
614
|
-
return [2 /*return*/];
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
};
|
|
618
|
-
return Tree;
|
|
619
|
-
}();
|
|
620
|
-
function loadRecursive(keys, values, start, end) {
|
|
621
|
-
var size = end - start;
|
|
622
|
-
if (size > 0) {
|
|
623
|
-
var middle = start + Math.floor(size / 2);
|
|
624
|
-
var key = keys[middle];
|
|
625
|
-
var data = values[middle];
|
|
626
|
-
var node = new Node(key, data);
|
|
627
|
-
node.left = loadRecursive(keys, values, start, middle);
|
|
628
|
-
node.right = loadRecursive(keys, values, middle + 1, end);
|
|
629
|
-
return node;
|
|
630
|
-
}
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
function createList(keys, values) {
|
|
634
|
-
var head = new Node(null, null);
|
|
635
|
-
var p = head;
|
|
636
|
-
for (var i = 0; i < keys.length; i++) {
|
|
637
|
-
p = p.next = new Node(keys[i], values[i]);
|
|
638
|
-
}
|
|
639
|
-
p.next = null;
|
|
640
|
-
return head.next;
|
|
641
|
-
}
|
|
642
|
-
function toList(root) {
|
|
643
|
-
var current = root;
|
|
644
|
-
var Q = [];
|
|
645
|
-
var done = false;
|
|
646
|
-
var head = new Node(null, null);
|
|
647
|
-
var p = head;
|
|
648
|
-
while (!done) {
|
|
649
|
-
if (current) {
|
|
650
|
-
Q.push(current);
|
|
651
|
-
current = current.left;
|
|
652
|
-
} else {
|
|
653
|
-
if (Q.length > 0) {
|
|
654
|
-
current = p = p.next = Q.pop();
|
|
655
|
-
current = current.right;
|
|
656
|
-
} else done = true;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
p.next = null; // that'll work even if the tree was empty
|
|
660
|
-
return head.next;
|
|
661
|
-
}
|
|
662
|
-
function sortedListToBST(list, start, end) {
|
|
663
|
-
var size = end - start;
|
|
664
|
-
if (size > 0) {
|
|
665
|
-
var middle = start + Math.floor(size / 2);
|
|
666
|
-
var left = sortedListToBST(list, start, middle);
|
|
667
|
-
var root = list.head;
|
|
668
|
-
root.left = left;
|
|
669
|
-
list.head = list.head.next;
|
|
670
|
-
root.right = sortedListToBST(list, middle + 1, end);
|
|
671
|
-
return root;
|
|
672
|
-
}
|
|
673
|
-
return null;
|
|
674
|
-
}
|
|
675
|
-
function mergeLists(l1, l2, compare) {
|
|
676
|
-
var head = new Node(null, null); // dummy
|
|
677
|
-
var p = head;
|
|
678
|
-
var p1 = l1;
|
|
679
|
-
var p2 = l2;
|
|
680
|
-
while (p1 !== null && p2 !== null) {
|
|
681
|
-
if (compare(p1.key, p2.key) < 0) {
|
|
682
|
-
p.next = p1;
|
|
683
|
-
p1 = p1.next;
|
|
684
|
-
} else {
|
|
685
|
-
p.next = p2;
|
|
686
|
-
p2 = p2.next;
|
|
687
|
-
}
|
|
688
|
-
p = p.next;
|
|
689
|
-
}
|
|
690
|
-
if (p1 !== null) {
|
|
691
|
-
p.next = p1;
|
|
692
|
-
} else if (p2 !== null) {
|
|
693
|
-
p.next = p2;
|
|
694
|
-
}
|
|
695
|
-
return head.next;
|
|
696
|
-
}
|
|
697
|
-
function sort(keys, values, left, right, compare) {
|
|
698
|
-
if (left >= right) return;
|
|
699
|
-
var pivot = keys[left + right >> 1];
|
|
700
|
-
var i = left - 1;
|
|
701
|
-
var j = right + 1;
|
|
702
|
-
while (true) {
|
|
703
|
-
do i++; while (compare(keys[i], pivot) < 0);
|
|
704
|
-
do j--; while (compare(keys[j], pivot) > 0);
|
|
705
|
-
if (i >= j) break;
|
|
706
|
-
var tmp = keys[i];
|
|
707
|
-
keys[i] = keys[j];
|
|
708
|
-
keys[j] = tmp;
|
|
709
|
-
tmp = values[i];
|
|
710
|
-
values[i] = values[j];
|
|
711
|
-
values[j] = tmp;
|
|
712
|
-
}
|
|
713
|
-
sort(keys, values, left, j, compare);
|
|
714
|
-
sort(keys, values, j + 1, right, compare);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* A bounding box has the format:
|
|
719
|
-
*
|
|
720
|
-
* { ll: { x: xmin, y: ymin }, ur: { x: xmax, y: ymax } }
|
|
721
|
-
*
|
|
722
|
-
*/
|
|
723
|
-
|
|
724
|
-
const isInBbox = (bbox, point) => {
|
|
725
|
-
return bbox.ll.x <= point.x && point.x <= bbox.ur.x && bbox.ll.y <= point.y && point.y <= bbox.ur.y;
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
/* Returns either null, or a bbox (aka an ordered pair of points)
|
|
729
|
-
* If there is only one point of overlap, a bbox with identical points
|
|
730
|
-
* will be returned */
|
|
731
|
-
const getBboxOverlap = (b1, b2) => {
|
|
732
|
-
// check if the bboxes overlap at all
|
|
733
|
-
if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
|
|
734
|
-
|
|
735
|
-
// find the middle two X values
|
|
736
|
-
const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
|
|
737
|
-
const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
|
|
738
|
-
|
|
739
|
-
// find the middle two Y values
|
|
740
|
-
const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
|
|
741
|
-
const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
|
|
742
|
-
|
|
743
|
-
// put those middle values together to get the overlap
|
|
744
|
-
return {
|
|
745
|
-
ll: {
|
|
746
|
-
x: lowerX,
|
|
747
|
-
y: lowerY
|
|
748
|
-
},
|
|
749
|
-
ur: {
|
|
750
|
-
x: upperX,
|
|
751
|
-
y: upperY
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
};
|
|
755
|
-
|
|
756
|
-
/* Javascript doesn't do integer math. Everything is
|
|
757
|
-
* floating point with percision Number.EPSILON.
|
|
758
|
-
*
|
|
759
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON
|
|
760
|
-
*/
|
|
761
|
-
|
|
762
|
-
let epsilon$1 = Number.EPSILON;
|
|
763
|
-
|
|
764
|
-
// IE Polyfill
|
|
765
|
-
if (epsilon$1 === undefined) epsilon$1 = Math.pow(2, -52);
|
|
766
|
-
const EPSILON_SQ = epsilon$1 * epsilon$1;
|
|
767
|
-
|
|
768
|
-
/* FLP comparator */
|
|
769
|
-
const cmp = (a, b) => {
|
|
770
|
-
// check if they're both 0
|
|
771
|
-
if (-epsilon$1 < a && a < epsilon$1) {
|
|
772
|
-
if (-epsilon$1 < b && b < epsilon$1) {
|
|
773
|
-
return 0;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// check if they're flp equal
|
|
778
|
-
const ab = a - b;
|
|
779
|
-
if (ab * ab < EPSILON_SQ * a * b) {
|
|
780
|
-
return 0;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
// normal comparison
|
|
784
|
-
return a < b ? -1 : 1;
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* This class rounds incoming values sufficiently so that
|
|
789
|
-
* floating points problems are, for the most part, avoided.
|
|
790
|
-
*
|
|
791
|
-
* Incoming points are have their x & y values tested against
|
|
792
|
-
* all previously seen x & y values. If either is 'too close'
|
|
793
|
-
* to a previously seen value, it's value is 'snapped' to the
|
|
794
|
-
* previously seen value.
|
|
795
|
-
*
|
|
796
|
-
* All points should be rounded by this class before being
|
|
797
|
-
* stored in any data structures in the rest of this algorithm.
|
|
798
|
-
*/
|
|
799
|
-
|
|
800
|
-
class PtRounder {
|
|
801
|
-
constructor() {
|
|
802
|
-
this.reset();
|
|
803
|
-
}
|
|
804
|
-
reset() {
|
|
805
|
-
this.xRounder = new CoordRounder();
|
|
806
|
-
this.yRounder = new CoordRounder();
|
|
807
|
-
}
|
|
808
|
-
round(x, y) {
|
|
809
|
-
return {
|
|
810
|
-
x: this.xRounder.round(x),
|
|
811
|
-
y: this.yRounder.round(y)
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
class CoordRounder {
|
|
816
|
-
constructor() {
|
|
817
|
-
this.tree = new Tree();
|
|
818
|
-
// preseed with 0 so we don't end up with values < Number.EPSILON
|
|
819
|
-
this.round(0);
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// Note: this can rounds input values backwards or forwards.
|
|
823
|
-
// You might ask, why not restrict this to just rounding
|
|
824
|
-
// forwards? Wouldn't that allow left endpoints to always
|
|
825
|
-
// remain left endpoints during splitting (never change to
|
|
826
|
-
// right). No - it wouldn't, because we snap intersections
|
|
827
|
-
// to endpoints (to establish independence from the segment
|
|
828
|
-
// angle for t-intersections).
|
|
829
|
-
round(coord) {
|
|
830
|
-
const node = this.tree.add(coord);
|
|
831
|
-
const prevNode = this.tree.prev(node);
|
|
832
|
-
if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
|
|
833
|
-
this.tree.remove(coord);
|
|
834
|
-
return prevNode.key;
|
|
835
|
-
}
|
|
836
|
-
const nextNode = this.tree.next(node);
|
|
837
|
-
if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
|
|
838
|
-
this.tree.remove(coord);
|
|
839
|
-
return nextNode.key;
|
|
840
|
-
}
|
|
841
|
-
return coord;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// singleton available by import
|
|
846
|
-
const rounder = new PtRounder();
|
|
847
|
-
|
|
848
|
-
const epsilon = 1.1102230246251565e-16;
|
|
849
|
-
const splitter = 134217729;
|
|
850
|
-
const resulterrbound = (3 + 8 * epsilon) * epsilon;
|
|
851
|
-
|
|
852
|
-
// fast_expansion_sum_zeroelim routine from oritinal code
|
|
853
|
-
function sum(elen, e, flen, f, h) {
|
|
854
|
-
let Q, Qnew, hh, bvirt;
|
|
855
|
-
let enow = e[0];
|
|
856
|
-
let fnow = f[0];
|
|
857
|
-
let eindex = 0;
|
|
858
|
-
let findex = 0;
|
|
859
|
-
if (fnow > enow === fnow > -enow) {
|
|
860
|
-
Q = enow;
|
|
861
|
-
enow = e[++eindex];
|
|
862
|
-
} else {
|
|
863
|
-
Q = fnow;
|
|
864
|
-
fnow = f[++findex];
|
|
865
|
-
}
|
|
866
|
-
let hindex = 0;
|
|
867
|
-
if (eindex < elen && findex < flen) {
|
|
868
|
-
if (fnow > enow === fnow > -enow) {
|
|
869
|
-
Qnew = enow + Q;
|
|
870
|
-
hh = Q - (Qnew - enow);
|
|
871
|
-
enow = e[++eindex];
|
|
872
|
-
} else {
|
|
873
|
-
Qnew = fnow + Q;
|
|
874
|
-
hh = Q - (Qnew - fnow);
|
|
875
|
-
fnow = f[++findex];
|
|
876
|
-
}
|
|
877
|
-
Q = Qnew;
|
|
878
|
-
if (hh !== 0) {
|
|
879
|
-
h[hindex++] = hh;
|
|
880
|
-
}
|
|
881
|
-
while (eindex < elen && findex < flen) {
|
|
882
|
-
if (fnow > enow === fnow > -enow) {
|
|
883
|
-
Qnew = Q + enow;
|
|
884
|
-
bvirt = Qnew - Q;
|
|
885
|
-
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
|
886
|
-
enow = e[++eindex];
|
|
887
|
-
} else {
|
|
888
|
-
Qnew = Q + fnow;
|
|
889
|
-
bvirt = Qnew - Q;
|
|
890
|
-
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
|
891
|
-
fnow = f[++findex];
|
|
892
|
-
}
|
|
893
|
-
Q = Qnew;
|
|
894
|
-
if (hh !== 0) {
|
|
895
|
-
h[hindex++] = hh;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
while (eindex < elen) {
|
|
900
|
-
Qnew = Q + enow;
|
|
901
|
-
bvirt = Qnew - Q;
|
|
902
|
-
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
|
903
|
-
enow = e[++eindex];
|
|
904
|
-
Q = Qnew;
|
|
905
|
-
if (hh !== 0) {
|
|
906
|
-
h[hindex++] = hh;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
while (findex < flen) {
|
|
910
|
-
Qnew = Q + fnow;
|
|
911
|
-
bvirt = Qnew - Q;
|
|
912
|
-
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
|
913
|
-
fnow = f[++findex];
|
|
914
|
-
Q = Qnew;
|
|
915
|
-
if (hh !== 0) {
|
|
916
|
-
h[hindex++] = hh;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
if (Q !== 0 || hindex === 0) {
|
|
920
|
-
h[hindex++] = Q;
|
|
921
|
-
}
|
|
922
|
-
return hindex;
|
|
923
|
-
}
|
|
924
|
-
function estimate(elen, e) {
|
|
925
|
-
let Q = e[0];
|
|
926
|
-
for (let i = 1; i < elen; i++) Q += e[i];
|
|
927
|
-
return Q;
|
|
928
|
-
}
|
|
929
|
-
function vec(n) {
|
|
930
|
-
return new Float64Array(n);
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
const ccwerrboundA = (3 + 16 * epsilon) * epsilon;
|
|
934
|
-
const ccwerrboundB = (2 + 12 * epsilon) * epsilon;
|
|
935
|
-
const ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
|
|
936
|
-
const B = vec(4);
|
|
937
|
-
const C1 = vec(8);
|
|
938
|
-
const C2 = vec(12);
|
|
939
|
-
const D = vec(16);
|
|
940
|
-
const u = vec(4);
|
|
941
|
-
function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
|
|
942
|
-
let acxtail, acytail, bcxtail, bcytail;
|
|
943
|
-
let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;
|
|
944
|
-
const acx = ax - cx;
|
|
945
|
-
const bcx = bx - cx;
|
|
946
|
-
const acy = ay - cy;
|
|
947
|
-
const bcy = by - cy;
|
|
948
|
-
s1 = acx * bcy;
|
|
949
|
-
c = splitter * acx;
|
|
950
|
-
ahi = c - (c - acx);
|
|
951
|
-
alo = acx - ahi;
|
|
952
|
-
c = splitter * bcy;
|
|
953
|
-
bhi = c - (c - bcy);
|
|
954
|
-
blo = bcy - bhi;
|
|
955
|
-
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
956
|
-
t1 = acy * bcx;
|
|
957
|
-
c = splitter * acy;
|
|
958
|
-
ahi = c - (c - acy);
|
|
959
|
-
alo = acy - ahi;
|
|
960
|
-
c = splitter * bcx;
|
|
961
|
-
bhi = c - (c - bcx);
|
|
962
|
-
blo = bcx - bhi;
|
|
963
|
-
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
964
|
-
_i = s0 - t0;
|
|
965
|
-
bvirt = s0 - _i;
|
|
966
|
-
B[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
967
|
-
_j = s1 + _i;
|
|
968
|
-
bvirt = _j - s1;
|
|
969
|
-
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
970
|
-
_i = _0 - t1;
|
|
971
|
-
bvirt = _0 - _i;
|
|
972
|
-
B[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
973
|
-
u3 = _j + _i;
|
|
974
|
-
bvirt = u3 - _j;
|
|
975
|
-
B[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
|
976
|
-
B[3] = u3;
|
|
977
|
-
let det = estimate(4, B);
|
|
978
|
-
let errbound = ccwerrboundB * detsum;
|
|
979
|
-
if (det >= errbound || -det >= errbound) {
|
|
980
|
-
return det;
|
|
981
|
-
}
|
|
982
|
-
bvirt = ax - acx;
|
|
983
|
-
acxtail = ax - (acx + bvirt) + (bvirt - cx);
|
|
984
|
-
bvirt = bx - bcx;
|
|
985
|
-
bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
|
|
986
|
-
bvirt = ay - acy;
|
|
987
|
-
acytail = ay - (acy + bvirt) + (bvirt - cy);
|
|
988
|
-
bvirt = by - bcy;
|
|
989
|
-
bcytail = by - (bcy + bvirt) + (bvirt - cy);
|
|
990
|
-
if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
|
|
991
|
-
return det;
|
|
992
|
-
}
|
|
993
|
-
errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
|
|
994
|
-
det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
|
|
995
|
-
if (det >= errbound || -det >= errbound) return det;
|
|
996
|
-
s1 = acxtail * bcy;
|
|
997
|
-
c = splitter * acxtail;
|
|
998
|
-
ahi = c - (c - acxtail);
|
|
999
|
-
alo = acxtail - ahi;
|
|
1000
|
-
c = splitter * bcy;
|
|
1001
|
-
bhi = c - (c - bcy);
|
|
1002
|
-
blo = bcy - bhi;
|
|
1003
|
-
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1004
|
-
t1 = acytail * bcx;
|
|
1005
|
-
c = splitter * acytail;
|
|
1006
|
-
ahi = c - (c - acytail);
|
|
1007
|
-
alo = acytail - ahi;
|
|
1008
|
-
c = splitter * bcx;
|
|
1009
|
-
bhi = c - (c - bcx);
|
|
1010
|
-
blo = bcx - bhi;
|
|
1011
|
-
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1012
|
-
_i = s0 - t0;
|
|
1013
|
-
bvirt = s0 - _i;
|
|
1014
|
-
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
1015
|
-
_j = s1 + _i;
|
|
1016
|
-
bvirt = _j - s1;
|
|
1017
|
-
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
1018
|
-
_i = _0 - t1;
|
|
1019
|
-
bvirt = _0 - _i;
|
|
1020
|
-
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
1021
|
-
u3 = _j + _i;
|
|
1022
|
-
bvirt = u3 - _j;
|
|
1023
|
-
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
|
1024
|
-
u[3] = u3;
|
|
1025
|
-
const C1len = sum(4, B, 4, u, C1);
|
|
1026
|
-
s1 = acx * bcytail;
|
|
1027
|
-
c = splitter * acx;
|
|
1028
|
-
ahi = c - (c - acx);
|
|
1029
|
-
alo = acx - ahi;
|
|
1030
|
-
c = splitter * bcytail;
|
|
1031
|
-
bhi = c - (c - bcytail);
|
|
1032
|
-
blo = bcytail - bhi;
|
|
1033
|
-
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1034
|
-
t1 = acy * bcxtail;
|
|
1035
|
-
c = splitter * acy;
|
|
1036
|
-
ahi = c - (c - acy);
|
|
1037
|
-
alo = acy - ahi;
|
|
1038
|
-
c = splitter * bcxtail;
|
|
1039
|
-
bhi = c - (c - bcxtail);
|
|
1040
|
-
blo = bcxtail - bhi;
|
|
1041
|
-
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1042
|
-
_i = s0 - t0;
|
|
1043
|
-
bvirt = s0 - _i;
|
|
1044
|
-
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
1045
|
-
_j = s1 + _i;
|
|
1046
|
-
bvirt = _j - s1;
|
|
1047
|
-
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
1048
|
-
_i = _0 - t1;
|
|
1049
|
-
bvirt = _0 - _i;
|
|
1050
|
-
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
1051
|
-
u3 = _j + _i;
|
|
1052
|
-
bvirt = u3 - _j;
|
|
1053
|
-
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
|
1054
|
-
u[3] = u3;
|
|
1055
|
-
const C2len = sum(C1len, C1, 4, u, C2);
|
|
1056
|
-
s1 = acxtail * bcytail;
|
|
1057
|
-
c = splitter * acxtail;
|
|
1058
|
-
ahi = c - (c - acxtail);
|
|
1059
|
-
alo = acxtail - ahi;
|
|
1060
|
-
c = splitter * bcytail;
|
|
1061
|
-
bhi = c - (c - bcytail);
|
|
1062
|
-
blo = bcytail - bhi;
|
|
1063
|
-
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1064
|
-
t1 = acytail * bcxtail;
|
|
1065
|
-
c = splitter * acytail;
|
|
1066
|
-
ahi = c - (c - acytail);
|
|
1067
|
-
alo = acytail - ahi;
|
|
1068
|
-
c = splitter * bcxtail;
|
|
1069
|
-
bhi = c - (c - bcxtail);
|
|
1070
|
-
blo = bcxtail - bhi;
|
|
1071
|
-
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
|
1072
|
-
_i = s0 - t0;
|
|
1073
|
-
bvirt = s0 - _i;
|
|
1074
|
-
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
|
1075
|
-
_j = s1 + _i;
|
|
1076
|
-
bvirt = _j - s1;
|
|
1077
|
-
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
|
1078
|
-
_i = _0 - t1;
|
|
1079
|
-
bvirt = _0 - _i;
|
|
1080
|
-
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
|
1081
|
-
u3 = _j + _i;
|
|
1082
|
-
bvirt = u3 - _j;
|
|
1083
|
-
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
|
1084
|
-
u[3] = u3;
|
|
1085
|
-
const Dlen = sum(C2len, C2, 4, u, D);
|
|
1086
|
-
return D[Dlen - 1];
|
|
1087
|
-
}
|
|
1088
|
-
function orient2d(ax, ay, bx, by, cx, cy) {
|
|
1089
|
-
const detleft = (ay - cy) * (bx - cx);
|
|
1090
|
-
const detright = (ax - cx) * (by - cy);
|
|
1091
|
-
const det = detleft - detright;
|
|
1092
|
-
const detsum = Math.abs(detleft + detright);
|
|
1093
|
-
if (Math.abs(det) >= ccwerrboundA * detsum) return det;
|
|
1094
|
-
return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
/* Cross Product of two vectors with first point at origin */
|
|
1098
|
-
const crossProduct = (a, b) => a.x * b.y - a.y * b.x;
|
|
1099
|
-
|
|
1100
|
-
/* Dot Product of two vectors with first point at origin */
|
|
1101
|
-
const dotProduct = (a, b) => a.x * b.x + a.y * b.y;
|
|
1102
|
-
|
|
1103
|
-
/* Comparator for two vectors with same starting point */
|
|
1104
|
-
const compareVectorAngles = (basePt, endPt1, endPt2) => {
|
|
1105
|
-
const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
|
|
1106
|
-
if (res > 0) return -1;
|
|
1107
|
-
if (res < 0) return 1;
|
|
1108
|
-
return 0;
|
|
1109
|
-
};
|
|
1110
|
-
const length = v => Math.sqrt(dotProduct(v, v));
|
|
1111
|
-
|
|
1112
|
-
/* Get the sine of the angle from pShared -> pAngle to pShaed -> pBase */
|
|
1113
|
-
const sineOfAngle = (pShared, pBase, pAngle) => {
|
|
1114
|
-
const vBase = {
|
|
1115
|
-
x: pBase.x - pShared.x,
|
|
1116
|
-
y: pBase.y - pShared.y
|
|
1117
|
-
};
|
|
1118
|
-
const vAngle = {
|
|
1119
|
-
x: pAngle.x - pShared.x,
|
|
1120
|
-
y: pAngle.y - pShared.y
|
|
1121
|
-
};
|
|
1122
|
-
return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
/* Get the cosine of the angle from pShared -> pAngle to pShaed -> pBase */
|
|
1126
|
-
const cosineOfAngle = (pShared, pBase, pAngle) => {
|
|
1127
|
-
const vBase = {
|
|
1128
|
-
x: pBase.x - pShared.x,
|
|
1129
|
-
y: pBase.y - pShared.y
|
|
1130
|
-
};
|
|
1131
|
-
const vAngle = {
|
|
1132
|
-
x: pAngle.x - pShared.x,
|
|
1133
|
-
y: pAngle.y - pShared.y
|
|
1134
|
-
};
|
|
1135
|
-
return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
/* Get the x coordinate where the given line (defined by a point and vector)
|
|
1139
|
-
* crosses the horizontal line with the given y coordiante.
|
|
1140
|
-
* In the case of parrallel lines (including overlapping ones) returns null. */
|
|
1141
|
-
const horizontalIntersection = (pt, v, y) => {
|
|
1142
|
-
if (v.y === 0) return null;
|
|
1143
|
-
return {
|
|
1144
|
-
x: pt.x + v.x / v.y * (y - pt.y),
|
|
1145
|
-
y: y
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
|
-
/* Get the y coordinate where the given line (defined by a point and vector)
|
|
1150
|
-
* crosses the vertical line with the given x coordiante.
|
|
1151
|
-
* In the case of parrallel lines (including overlapping ones) returns null. */
|
|
1152
|
-
const verticalIntersection = (pt, v, x) => {
|
|
1153
|
-
if (v.x === 0) return null;
|
|
1154
|
-
return {
|
|
1155
|
-
x: x,
|
|
1156
|
-
y: pt.y + v.y / v.x * (x - pt.x)
|
|
1157
|
-
};
|
|
1158
|
-
};
|
|
1159
|
-
|
|
1160
|
-
/* Get the intersection of two lines, each defined by a base point and a vector.
|
|
1161
|
-
* In the case of parrallel lines (including overlapping ones) returns null. */
|
|
1162
|
-
const intersection$1 = (pt1, v1, pt2, v2) => {
|
|
1163
|
-
// take some shortcuts for vertical and horizontal lines
|
|
1164
|
-
// this also ensures we don't calculate an intersection and then discover
|
|
1165
|
-
// it's actually outside the bounding box of the line
|
|
1166
|
-
if (v1.x === 0) return verticalIntersection(pt2, v2, pt1.x);
|
|
1167
|
-
if (v2.x === 0) return verticalIntersection(pt1, v1, pt2.x);
|
|
1168
|
-
if (v1.y === 0) return horizontalIntersection(pt2, v2, pt1.y);
|
|
1169
|
-
if (v2.y === 0) return horizontalIntersection(pt1, v1, pt2.y);
|
|
1170
|
-
|
|
1171
|
-
// General case for non-overlapping segments.
|
|
1172
|
-
// This algorithm is based on Schneider and Eberly.
|
|
1173
|
-
// http://www.cimec.org.ar/~ncalvo/Schneider_Eberly.pdf - pg 244
|
|
1174
|
-
|
|
1175
|
-
const kross = crossProduct(v1, v2);
|
|
1176
|
-
if (kross == 0) return null;
|
|
1177
|
-
const ve = {
|
|
1178
|
-
x: pt2.x - pt1.x,
|
|
1179
|
-
y: pt2.y - pt1.y
|
|
1180
|
-
};
|
|
1181
|
-
const d1 = crossProduct(ve, v1) / kross;
|
|
1182
|
-
const d2 = crossProduct(ve, v2) / kross;
|
|
1183
|
-
|
|
1184
|
-
// take the average of the two calculations to minimize rounding error
|
|
1185
|
-
const x1 = pt1.x + d2 * v1.x,
|
|
1186
|
-
x2 = pt2.x + d1 * v2.x;
|
|
1187
|
-
const y1 = pt1.y + d2 * v1.y,
|
|
1188
|
-
y2 = pt2.y + d1 * v2.y;
|
|
1189
|
-
const x = (x1 + x2) / 2;
|
|
1190
|
-
const y = (y1 + y2) / 2;
|
|
1191
|
-
return {
|
|
1192
|
-
x: x,
|
|
1193
|
-
y: y
|
|
1194
|
-
};
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
class SweepEvent {
|
|
1198
|
-
// for ordering sweep events in the sweep event queue
|
|
1199
|
-
static compare(a, b) {
|
|
1200
|
-
// favor event with a point that the sweep line hits first
|
|
1201
|
-
const ptCmp = SweepEvent.comparePoints(a.point, b.point);
|
|
1202
|
-
if (ptCmp !== 0) return ptCmp;
|
|
1203
|
-
|
|
1204
|
-
// the points are the same, so link them if needed
|
|
1205
|
-
if (a.point !== b.point) a.link(b);
|
|
1206
|
-
|
|
1207
|
-
// favor right events over left
|
|
1208
|
-
if (a.isLeft !== b.isLeft) return a.isLeft ? 1 : -1;
|
|
1209
|
-
|
|
1210
|
-
// we have two matching left or right endpoints
|
|
1211
|
-
// ordering of this case is the same as for their segments
|
|
1212
|
-
return Segment.compare(a.segment, b.segment);
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
// for ordering points in sweep line order
|
|
1216
|
-
static comparePoints(aPt, bPt) {
|
|
1217
|
-
if (aPt.x < bPt.x) return -1;
|
|
1218
|
-
if (aPt.x > bPt.x) return 1;
|
|
1219
|
-
if (aPt.y < bPt.y) return -1;
|
|
1220
|
-
if (aPt.y > bPt.y) return 1;
|
|
1221
|
-
return 0;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
// Warning: 'point' input will be modified and re-used (for performance)
|
|
1225
|
-
constructor(point, isLeft) {
|
|
1226
|
-
if (point.events === undefined) point.events = [this];else point.events.push(this);
|
|
1227
|
-
this.point = point;
|
|
1228
|
-
this.isLeft = isLeft;
|
|
1229
|
-
// this.segment, this.otherSE set by factory
|
|
1230
|
-
}
|
|
1231
|
-
link(other) {
|
|
1232
|
-
if (other.point === this.point) {
|
|
1233
|
-
throw new Error("Tried to link already linked events");
|
|
1234
|
-
}
|
|
1235
|
-
const otherEvents = other.point.events;
|
|
1236
|
-
for (let i = 0, iMax = otherEvents.length; i < iMax; i++) {
|
|
1237
|
-
const evt = otherEvents[i];
|
|
1238
|
-
this.point.events.push(evt);
|
|
1239
|
-
evt.point = this.point;
|
|
1240
|
-
}
|
|
1241
|
-
this.checkForConsuming();
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
/* Do a pass over our linked events and check to see if any pair
|
|
1245
|
-
* of segments match, and should be consumed. */
|
|
1246
|
-
checkForConsuming() {
|
|
1247
|
-
// FIXME: The loops in this method run O(n^2) => no good.
|
|
1248
|
-
// Maintain little ordered sweep event trees?
|
|
1249
|
-
// Can we maintaining an ordering that avoids the need
|
|
1250
|
-
// for the re-sorting with getLeftmostComparator in geom-out?
|
|
1251
|
-
|
|
1252
|
-
// Compare each pair of events to see if other events also match
|
|
1253
|
-
const numEvents = this.point.events.length;
|
|
1254
|
-
for (let i = 0; i < numEvents; i++) {
|
|
1255
|
-
const evt1 = this.point.events[i];
|
|
1256
|
-
if (evt1.segment.consumedBy !== undefined) continue;
|
|
1257
|
-
for (let j = i + 1; j < numEvents; j++) {
|
|
1258
|
-
const evt2 = this.point.events[j];
|
|
1259
|
-
if (evt2.consumedBy !== undefined) continue;
|
|
1260
|
-
if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
|
|
1261
|
-
evt1.segment.consume(evt2.segment);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
getAvailableLinkedEvents() {
|
|
1266
|
-
// point.events is always of length 2 or greater
|
|
1267
|
-
const events = [];
|
|
1268
|
-
for (let i = 0, iMax = this.point.events.length; i < iMax; i++) {
|
|
1269
|
-
const evt = this.point.events[i];
|
|
1270
|
-
if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
|
|
1271
|
-
events.push(evt);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
return events;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* Returns a comparator function for sorting linked events that will
|
|
1279
|
-
* favor the event that will give us the smallest left-side angle.
|
|
1280
|
-
* All ring construction starts as low as possible heading to the right,
|
|
1281
|
-
* so by always turning left as sharp as possible we'll get polygons
|
|
1282
|
-
* without uncessary loops & holes.
|
|
1283
|
-
*
|
|
1284
|
-
* The comparator function has a compute cache such that it avoids
|
|
1285
|
-
* re-computing already-computed values.
|
|
1286
|
-
*/
|
|
1287
|
-
getLeftmostComparator(baseEvent) {
|
|
1288
|
-
const cache = new Map();
|
|
1289
|
-
const fillCache = linkedEvent => {
|
|
1290
|
-
const nextEvent = linkedEvent.otherSE;
|
|
1291
|
-
cache.set(linkedEvent, {
|
|
1292
|
-
sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
|
|
1293
|
-
cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
|
|
1294
|
-
});
|
|
1295
|
-
};
|
|
1296
|
-
return (a, b) => {
|
|
1297
|
-
if (!cache.has(a)) fillCache(a);
|
|
1298
|
-
if (!cache.has(b)) fillCache(b);
|
|
1299
|
-
const {
|
|
1300
|
-
sine: asine,
|
|
1301
|
-
cosine: acosine
|
|
1302
|
-
} = cache.get(a);
|
|
1303
|
-
const {
|
|
1304
|
-
sine: bsine,
|
|
1305
|
-
cosine: bcosine
|
|
1306
|
-
} = cache.get(b);
|
|
1307
|
-
|
|
1308
|
-
// both on or above x-axis
|
|
1309
|
-
if (asine >= 0 && bsine >= 0) {
|
|
1310
|
-
if (acosine < bcosine) return 1;
|
|
1311
|
-
if (acosine > bcosine) return -1;
|
|
1312
|
-
return 0;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
// both below x-axis
|
|
1316
|
-
if (asine < 0 && bsine < 0) {
|
|
1317
|
-
if (acosine < bcosine) return -1;
|
|
1318
|
-
if (acosine > bcosine) return 1;
|
|
1319
|
-
return 0;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
// one above x-axis, one below
|
|
1323
|
-
if (bsine < asine) return -1;
|
|
1324
|
-
if (bsine > asine) return 1;
|
|
1325
|
-
return 0;
|
|
1326
|
-
};
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
// Give segments unique ID's to get consistent sorting of
|
|
1331
|
-
// segments and sweep events when all else is identical
|
|
1332
|
-
let segmentId = 0;
|
|
1333
|
-
class Segment {
|
|
1334
|
-
/* This compare() function is for ordering segments in the sweep
|
|
1335
|
-
* line tree, and does so according to the following criteria:
|
|
1336
|
-
*
|
|
1337
|
-
* Consider the vertical line that lies an infinestimal step to the
|
|
1338
|
-
* right of the right-more of the two left endpoints of the input
|
|
1339
|
-
* segments. Imagine slowly moving a point up from negative infinity
|
|
1340
|
-
* in the increasing y direction. Which of the two segments will that
|
|
1341
|
-
* point intersect first? That segment comes 'before' the other one.
|
|
1342
|
-
*
|
|
1343
|
-
* If neither segment would be intersected by such a line, (if one
|
|
1344
|
-
* or more of the segments are vertical) then the line to be considered
|
|
1345
|
-
* is directly on the right-more of the two left inputs.
|
|
1346
|
-
*/
|
|
1347
|
-
static compare(a, b) {
|
|
1348
|
-
const alx = a.leftSE.point.x;
|
|
1349
|
-
const blx = b.leftSE.point.x;
|
|
1350
|
-
const arx = a.rightSE.point.x;
|
|
1351
|
-
const brx = b.rightSE.point.x;
|
|
1352
|
-
|
|
1353
|
-
// check if they're even in the same vertical plane
|
|
1354
|
-
if (brx < alx) return 1;
|
|
1355
|
-
if (arx < blx) return -1;
|
|
1356
|
-
const aly = a.leftSE.point.y;
|
|
1357
|
-
const bly = b.leftSE.point.y;
|
|
1358
|
-
const ary = a.rightSE.point.y;
|
|
1359
|
-
const bry = b.rightSE.point.y;
|
|
1360
|
-
|
|
1361
|
-
// is left endpoint of segment B the right-more?
|
|
1362
|
-
if (alx < blx) {
|
|
1363
|
-
// are the two segments in the same horizontal plane?
|
|
1364
|
-
if (bly < aly && bly < ary) return 1;
|
|
1365
|
-
if (bly > aly && bly > ary) return -1;
|
|
1366
|
-
|
|
1367
|
-
// is the B left endpoint colinear to segment A?
|
|
1368
|
-
const aCmpBLeft = a.comparePoint(b.leftSE.point);
|
|
1369
|
-
if (aCmpBLeft < 0) return 1;
|
|
1370
|
-
if (aCmpBLeft > 0) return -1;
|
|
1371
|
-
|
|
1372
|
-
// is the A right endpoint colinear to segment B ?
|
|
1373
|
-
const bCmpARight = b.comparePoint(a.rightSE.point);
|
|
1374
|
-
if (bCmpARight !== 0) return bCmpARight;
|
|
1375
|
-
|
|
1376
|
-
// colinear segments, consider the one with left-more
|
|
1377
|
-
// left endpoint to be first (arbitrary?)
|
|
1378
|
-
return -1;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
// is left endpoint of segment A the right-more?
|
|
1382
|
-
if (alx > blx) {
|
|
1383
|
-
if (aly < bly && aly < bry) return -1;
|
|
1384
|
-
if (aly > bly && aly > bry) return 1;
|
|
1385
|
-
|
|
1386
|
-
// is the A left endpoint colinear to segment B?
|
|
1387
|
-
const bCmpALeft = b.comparePoint(a.leftSE.point);
|
|
1388
|
-
if (bCmpALeft !== 0) return bCmpALeft;
|
|
1389
|
-
|
|
1390
|
-
// is the B right endpoint colinear to segment A?
|
|
1391
|
-
const aCmpBRight = a.comparePoint(b.rightSE.point);
|
|
1392
|
-
if (aCmpBRight < 0) return 1;
|
|
1393
|
-
if (aCmpBRight > 0) return -1;
|
|
1394
|
-
|
|
1395
|
-
// colinear segments, consider the one with left-more
|
|
1396
|
-
// left endpoint to be first (arbitrary?)
|
|
1397
|
-
return 1;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
// if we get here, the two left endpoints are in the same
|
|
1401
|
-
// vertical plane, ie alx === blx
|
|
1402
|
-
|
|
1403
|
-
// consider the lower left-endpoint to come first
|
|
1404
|
-
if (aly < bly) return -1;
|
|
1405
|
-
if (aly > bly) return 1;
|
|
1406
|
-
|
|
1407
|
-
// left endpoints are identical
|
|
1408
|
-
// check for colinearity by using the left-more right endpoint
|
|
1409
|
-
|
|
1410
|
-
// is the A right endpoint more left-more?
|
|
1411
|
-
if (arx < brx) {
|
|
1412
|
-
const bCmpARight = b.comparePoint(a.rightSE.point);
|
|
1413
|
-
if (bCmpARight !== 0) return bCmpARight;
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
// is the B right endpoint more left-more?
|
|
1417
|
-
if (arx > brx) {
|
|
1418
|
-
const aCmpBRight = a.comparePoint(b.rightSE.point);
|
|
1419
|
-
if (aCmpBRight < 0) return 1;
|
|
1420
|
-
if (aCmpBRight > 0) return -1;
|
|
1421
|
-
}
|
|
1422
|
-
if (arx !== brx) {
|
|
1423
|
-
// are these two [almost] vertical segments with opposite orientation?
|
|
1424
|
-
// if so, the one with the lower right endpoint comes first
|
|
1425
|
-
const ay = ary - aly;
|
|
1426
|
-
const ax = arx - alx;
|
|
1427
|
-
const by = bry - bly;
|
|
1428
|
-
const bx = brx - blx;
|
|
1429
|
-
if (ay > ax && by < bx) return 1;
|
|
1430
|
-
if (ay < ax && by > bx) return -1;
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
// we have colinear segments with matching orientation
|
|
1434
|
-
// consider the one with more left-more right endpoint to be first
|
|
1435
|
-
if (arx > brx) return 1;
|
|
1436
|
-
if (arx < brx) return -1;
|
|
1437
|
-
|
|
1438
|
-
// if we get here, two two right endpoints are in the same
|
|
1439
|
-
// vertical plane, ie arx === brx
|
|
1440
|
-
|
|
1441
|
-
// consider the lower right-endpoint to come first
|
|
1442
|
-
if (ary < bry) return -1;
|
|
1443
|
-
if (ary > bry) return 1;
|
|
1444
|
-
|
|
1445
|
-
// right endpoints identical as well, so the segments are idential
|
|
1446
|
-
// fall back on creation order as consistent tie-breaker
|
|
1447
|
-
if (a.id < b.id) return -1;
|
|
1448
|
-
if (a.id > b.id) return 1;
|
|
1449
|
-
|
|
1450
|
-
// identical segment, ie a === b
|
|
1451
|
-
return 0;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
/* Warning: a reference to ringWindings input will be stored,
|
|
1455
|
-
* and possibly will be later modified */
|
|
1456
|
-
constructor(leftSE, rightSE, rings, windings) {
|
|
1457
|
-
this.id = ++segmentId;
|
|
1458
|
-
this.leftSE = leftSE;
|
|
1459
|
-
leftSE.segment = this;
|
|
1460
|
-
leftSE.otherSE = rightSE;
|
|
1461
|
-
this.rightSE = rightSE;
|
|
1462
|
-
rightSE.segment = this;
|
|
1463
|
-
rightSE.otherSE = leftSE;
|
|
1464
|
-
this.rings = rings;
|
|
1465
|
-
this.windings = windings;
|
|
1466
|
-
// left unset for performance, set later in algorithm
|
|
1467
|
-
// this.ringOut, this.consumedBy, this.prev
|
|
1468
|
-
}
|
|
1469
|
-
static fromRing(pt1, pt2, ring) {
|
|
1470
|
-
let leftPt, rightPt, winding;
|
|
1471
|
-
|
|
1472
|
-
// ordering the two points according to sweep line ordering
|
|
1473
|
-
const cmpPts = SweepEvent.comparePoints(pt1, pt2);
|
|
1474
|
-
if (cmpPts < 0) {
|
|
1475
|
-
leftPt = pt1;
|
|
1476
|
-
rightPt = pt2;
|
|
1477
|
-
winding = 1;
|
|
1478
|
-
} else if (cmpPts > 0) {
|
|
1479
|
-
leftPt = pt2;
|
|
1480
|
-
rightPt = pt1;
|
|
1481
|
-
winding = -1;
|
|
1482
|
-
} else throw new Error(`Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`);
|
|
1483
|
-
const leftSE = new SweepEvent(leftPt, true);
|
|
1484
|
-
const rightSE = new SweepEvent(rightPt, false);
|
|
1485
|
-
return new Segment(leftSE, rightSE, [ring], [winding]);
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
1489
|
-
replaceRightSE(newRightSE) {
|
|
1490
|
-
this.rightSE = newRightSE;
|
|
1491
|
-
this.rightSE.segment = this;
|
|
1492
|
-
this.rightSE.otherSE = this.leftSE;
|
|
1493
|
-
this.leftSE.otherSE = this.rightSE;
|
|
1494
|
-
}
|
|
1495
|
-
bbox() {
|
|
1496
|
-
const y1 = this.leftSE.point.y;
|
|
1497
|
-
const y2 = this.rightSE.point.y;
|
|
1498
|
-
return {
|
|
1499
|
-
ll: {
|
|
1500
|
-
x: this.leftSE.point.x,
|
|
1501
|
-
y: y1 < y2 ? y1 : y2
|
|
1502
|
-
},
|
|
1503
|
-
ur: {
|
|
1504
|
-
x: this.rightSE.point.x,
|
|
1505
|
-
y: y1 > y2 ? y1 : y2
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
/* A vector from the left point to the right */
|
|
1511
|
-
vector() {
|
|
1512
|
-
return {
|
|
1513
|
-
x: this.rightSE.point.x - this.leftSE.point.x,
|
|
1514
|
-
y: this.rightSE.point.y - this.leftSE.point.y
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
isAnEndpoint(pt) {
|
|
1518
|
-
return pt.x === this.leftSE.point.x && pt.y === this.leftSE.point.y || pt.x === this.rightSE.point.x && pt.y === this.rightSE.point.y;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
/* Compare this segment with a point.
|
|
1522
|
-
*
|
|
1523
|
-
* A point P is considered to be colinear to a segment if there
|
|
1524
|
-
* exists a distance D such that if we travel along the segment
|
|
1525
|
-
* from one * endpoint towards the other a distance D, we find
|
|
1526
|
-
* ourselves at point P.
|
|
1527
|
-
*
|
|
1528
|
-
* Return value indicates:
|
|
1529
|
-
*
|
|
1530
|
-
* 1: point lies above the segment (to the left of vertical)
|
|
1531
|
-
* 0: point is colinear to segment
|
|
1532
|
-
* -1: point lies below the segment (to the right of vertical)
|
|
1533
|
-
*/
|
|
1534
|
-
comparePoint(point) {
|
|
1535
|
-
if (this.isAnEndpoint(point)) return 0;
|
|
1536
|
-
const lPt = this.leftSE.point;
|
|
1537
|
-
const rPt = this.rightSE.point;
|
|
1538
|
-
const v = this.vector();
|
|
1539
|
-
|
|
1540
|
-
// Exactly vertical segments.
|
|
1541
|
-
if (lPt.x === rPt.x) {
|
|
1542
|
-
if (point.x === lPt.x) return 0;
|
|
1543
|
-
return point.x < lPt.x ? 1 : -1;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
// Nearly vertical segments with an intersection.
|
|
1547
|
-
// Check to see where a point on the line with matching Y coordinate is.
|
|
1548
|
-
const yDist = (point.y - lPt.y) / v.y;
|
|
1549
|
-
const xFromYDist = lPt.x + yDist * v.x;
|
|
1550
|
-
if (point.x === xFromYDist) return 0;
|
|
1551
|
-
|
|
1552
|
-
// General case.
|
|
1553
|
-
// Check to see where a point on the line with matching X coordinate is.
|
|
1554
|
-
const xDist = (point.x - lPt.x) / v.x;
|
|
1555
|
-
const yFromXDist = lPt.y + xDist * v.y;
|
|
1556
|
-
if (point.y === yFromXDist) return 0;
|
|
1557
|
-
return point.y < yFromXDist ? -1 : 1;
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
/**
|
|
1561
|
-
* Given another segment, returns the first non-trivial intersection
|
|
1562
|
-
* between the two segments (in terms of sweep line ordering), if it exists.
|
|
1563
|
-
*
|
|
1564
|
-
* A 'non-trivial' intersection is one that will cause one or both of the
|
|
1565
|
-
* segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
|
|
1566
|
-
*
|
|
1567
|
-
* * endpoint of segA with endpoint of segB --> trivial
|
|
1568
|
-
* * endpoint of segA with point along segB --> non-trivial
|
|
1569
|
-
* * endpoint of segB with point along segA --> non-trivial
|
|
1570
|
-
* * point along segA with point along segB --> non-trivial
|
|
1571
|
-
*
|
|
1572
|
-
* If no non-trivial intersection exists, return null
|
|
1573
|
-
* Else, return null.
|
|
1574
|
-
*/
|
|
1575
|
-
getIntersection(other) {
|
|
1576
|
-
// If bboxes don't overlap, there can't be any intersections
|
|
1577
|
-
const tBbox = this.bbox();
|
|
1578
|
-
const oBbox = other.bbox();
|
|
1579
|
-
const bboxOverlap = getBboxOverlap(tBbox, oBbox);
|
|
1580
|
-
if (bboxOverlap === null) return null;
|
|
1581
|
-
|
|
1582
|
-
// We first check to see if the endpoints can be considered intersections.
|
|
1583
|
-
// This will 'snap' intersections to endpoints if possible, and will
|
|
1584
|
-
// handle cases of colinearity.
|
|
1585
|
-
|
|
1586
|
-
const tlp = this.leftSE.point;
|
|
1587
|
-
const trp = this.rightSE.point;
|
|
1588
|
-
const olp = other.leftSE.point;
|
|
1589
|
-
const orp = other.rightSE.point;
|
|
1590
|
-
|
|
1591
|
-
// does each endpoint touch the other segment?
|
|
1592
|
-
// note that we restrict the 'touching' definition to only allow segments
|
|
1593
|
-
// to touch endpoints that lie forward from where we are in the sweep line pass
|
|
1594
|
-
const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
|
|
1595
|
-
const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
|
|
1596
|
-
const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
|
|
1597
|
-
const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
|
|
1598
|
-
|
|
1599
|
-
// do left endpoints match?
|
|
1600
|
-
if (touchesThisLSE && touchesOtherLSE) {
|
|
1601
|
-
// these two cases are for colinear segments with matching left
|
|
1602
|
-
// endpoints, and one segment being longer than the other
|
|
1603
|
-
if (touchesThisRSE && !touchesOtherRSE) return trp;
|
|
1604
|
-
if (!touchesThisRSE && touchesOtherRSE) return orp;
|
|
1605
|
-
// either the two segments match exactly (two trival intersections)
|
|
1606
|
-
// or just on their left endpoint (one trivial intersection
|
|
1607
|
-
return null;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
// does this left endpoint matches (other doesn't)
|
|
1611
|
-
if (touchesThisLSE) {
|
|
1612
|
-
// check for segments that just intersect on opposing endpoints
|
|
1613
|
-
if (touchesOtherRSE) {
|
|
1614
|
-
if (tlp.x === orp.x && tlp.y === orp.y) return null;
|
|
1615
|
-
}
|
|
1616
|
-
// t-intersection on left endpoint
|
|
1617
|
-
return tlp;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
// does other left endpoint matches (this doesn't)
|
|
1621
|
-
if (touchesOtherLSE) {
|
|
1622
|
-
// check for segments that just intersect on opposing endpoints
|
|
1623
|
-
if (touchesThisRSE) {
|
|
1624
|
-
if (trp.x === olp.x && trp.y === olp.y) return null;
|
|
1625
|
-
}
|
|
1626
|
-
// t-intersection on left endpoint
|
|
1627
|
-
return olp;
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
// trivial intersection on right endpoints
|
|
1631
|
-
if (touchesThisRSE && touchesOtherRSE) return null;
|
|
1632
|
-
|
|
1633
|
-
// t-intersections on just one right endpoint
|
|
1634
|
-
if (touchesThisRSE) return trp;
|
|
1635
|
-
if (touchesOtherRSE) return orp;
|
|
1636
|
-
|
|
1637
|
-
// None of our endpoints intersect. Look for a general intersection between
|
|
1638
|
-
// infinite lines laid over the segments
|
|
1639
|
-
const pt = intersection$1(tlp, this.vector(), olp, other.vector());
|
|
1640
|
-
|
|
1641
|
-
// are the segments parrallel? Note that if they were colinear with overlap,
|
|
1642
|
-
// they would have an endpoint intersection and that case was already handled above
|
|
1643
|
-
if (pt === null) return null;
|
|
1644
|
-
|
|
1645
|
-
// is the intersection found between the lines not on the segments?
|
|
1646
|
-
if (!isInBbox(bboxOverlap, pt)) return null;
|
|
1647
|
-
|
|
1648
|
-
// round the the computed point if needed
|
|
1649
|
-
return rounder.round(pt.x, pt.y);
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
/**
|
|
1653
|
-
* Split the given segment into multiple segments on the given points.
|
|
1654
|
-
* * Each existing segment will retain its leftSE and a new rightSE will be
|
|
1655
|
-
* generated for it.
|
|
1656
|
-
* * A new segment will be generated which will adopt the original segment's
|
|
1657
|
-
* rightSE, and a new leftSE will be generated for it.
|
|
1658
|
-
* * If there are more than two points given to split on, new segments
|
|
1659
|
-
* in the middle will be generated with new leftSE and rightSE's.
|
|
1660
|
-
* * An array of the newly generated SweepEvents will be returned.
|
|
1661
|
-
*
|
|
1662
|
-
* Warning: input array of points is modified
|
|
1663
|
-
*/
|
|
1664
|
-
split(point) {
|
|
1665
|
-
const newEvents = [];
|
|
1666
|
-
const alreadyLinked = point.events !== undefined;
|
|
1667
|
-
const newLeftSE = new SweepEvent(point, true);
|
|
1668
|
-
const newRightSE = new SweepEvent(point, false);
|
|
1669
|
-
const oldRightSE = this.rightSE;
|
|
1670
|
-
this.replaceRightSE(newRightSE);
|
|
1671
|
-
newEvents.push(newRightSE);
|
|
1672
|
-
newEvents.push(newLeftSE);
|
|
1673
|
-
const newSeg = new Segment(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
|
|
1674
|
-
|
|
1675
|
-
// when splitting a nearly vertical downward-facing segment,
|
|
1676
|
-
// sometimes one of the resulting new segments is vertical, in which
|
|
1677
|
-
// case its left and right events may need to be swapped
|
|
1678
|
-
if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
|
|
1679
|
-
newSeg.swapEvents();
|
|
1680
|
-
}
|
|
1681
|
-
if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
|
|
1682
|
-
this.swapEvents();
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
// in the point we just used to create new sweep events with was already
|
|
1686
|
-
// linked to other events, we need to check if either of the affected
|
|
1687
|
-
// segments should be consumed
|
|
1688
|
-
if (alreadyLinked) {
|
|
1689
|
-
newLeftSE.checkForConsuming();
|
|
1690
|
-
newRightSE.checkForConsuming();
|
|
1691
|
-
}
|
|
1692
|
-
return newEvents;
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
/* Swap which event is left and right */
|
|
1696
|
-
swapEvents() {
|
|
1697
|
-
const tmpEvt = this.rightSE;
|
|
1698
|
-
this.rightSE = this.leftSE;
|
|
1699
|
-
this.leftSE = tmpEvt;
|
|
1700
|
-
this.leftSE.isLeft = true;
|
|
1701
|
-
this.rightSE.isLeft = false;
|
|
1702
|
-
for (let i = 0, iMax = this.windings.length; i < iMax; i++) {
|
|
1703
|
-
this.windings[i] *= -1;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
/* Consume another segment. We take their rings under our wing
|
|
1708
|
-
* and mark them as consumed. Use for perfectly overlapping segments */
|
|
1709
|
-
consume(other) {
|
|
1710
|
-
let consumer = this;
|
|
1711
|
-
let consumee = other;
|
|
1712
|
-
while (consumer.consumedBy) consumer = consumer.consumedBy;
|
|
1713
|
-
while (consumee.consumedBy) consumee = consumee.consumedBy;
|
|
1714
|
-
const cmp = Segment.compare(consumer, consumee);
|
|
1715
|
-
if (cmp === 0) return; // already consumed
|
|
1716
|
-
// the winner of the consumption is the earlier segment
|
|
1717
|
-
// according to sweep line ordering
|
|
1718
|
-
if (cmp > 0) {
|
|
1719
|
-
const tmp = consumer;
|
|
1720
|
-
consumer = consumee;
|
|
1721
|
-
consumee = tmp;
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
// make sure a segment doesn't consume it's prev
|
|
1725
|
-
if (consumer.prev === consumee) {
|
|
1726
|
-
const tmp = consumer;
|
|
1727
|
-
consumer = consumee;
|
|
1728
|
-
consumee = tmp;
|
|
1729
|
-
}
|
|
1730
|
-
for (let i = 0, iMax = consumee.rings.length; i < iMax; i++) {
|
|
1731
|
-
const ring = consumee.rings[i];
|
|
1732
|
-
const winding = consumee.windings[i];
|
|
1733
|
-
const index = consumer.rings.indexOf(ring);
|
|
1734
|
-
if (index === -1) {
|
|
1735
|
-
consumer.rings.push(ring);
|
|
1736
|
-
consumer.windings.push(winding);
|
|
1737
|
-
} else consumer.windings[index] += winding;
|
|
1738
|
-
}
|
|
1739
|
-
consumee.rings = null;
|
|
1740
|
-
consumee.windings = null;
|
|
1741
|
-
consumee.consumedBy = consumer;
|
|
1742
|
-
|
|
1743
|
-
// mark sweep events consumed as to maintain ordering in sweep event queue
|
|
1744
|
-
consumee.leftSE.consumedBy = consumer.leftSE;
|
|
1745
|
-
consumee.rightSE.consumedBy = consumer.rightSE;
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
/* The first segment previous segment chain that is in the result */
|
|
1749
|
-
prevInResult() {
|
|
1750
|
-
if (this._prevInResult !== undefined) return this._prevInResult;
|
|
1751
|
-
if (!this.prev) this._prevInResult = null;else if (this.prev.isInResult()) this._prevInResult = this.prev;else this._prevInResult = this.prev.prevInResult();
|
|
1752
|
-
return this._prevInResult;
|
|
1753
|
-
}
|
|
1754
|
-
beforeState() {
|
|
1755
|
-
if (this._beforeState !== undefined) return this._beforeState;
|
|
1756
|
-
if (!this.prev) this._beforeState = {
|
|
1757
|
-
rings: [],
|
|
1758
|
-
windings: [],
|
|
1759
|
-
multiPolys: []
|
|
1760
|
-
};else {
|
|
1761
|
-
const seg = this.prev.consumedBy || this.prev;
|
|
1762
|
-
this._beforeState = seg.afterState();
|
|
1763
|
-
}
|
|
1764
|
-
return this._beforeState;
|
|
1765
|
-
}
|
|
1766
|
-
afterState() {
|
|
1767
|
-
if (this._afterState !== undefined) return this._afterState;
|
|
1768
|
-
const beforeState = this.beforeState();
|
|
1769
|
-
this._afterState = {
|
|
1770
|
-
rings: beforeState.rings.slice(0),
|
|
1771
|
-
windings: beforeState.windings.slice(0),
|
|
1772
|
-
multiPolys: []
|
|
1773
|
-
};
|
|
1774
|
-
const ringsAfter = this._afterState.rings;
|
|
1775
|
-
const windingsAfter = this._afterState.windings;
|
|
1776
|
-
const mpsAfter = this._afterState.multiPolys;
|
|
1777
|
-
|
|
1778
|
-
// calculate ringsAfter, windingsAfter
|
|
1779
|
-
for (let i = 0, iMax = this.rings.length; i < iMax; i++) {
|
|
1780
|
-
const ring = this.rings[i];
|
|
1781
|
-
const winding = this.windings[i];
|
|
1782
|
-
const index = ringsAfter.indexOf(ring);
|
|
1783
|
-
if (index === -1) {
|
|
1784
|
-
ringsAfter.push(ring);
|
|
1785
|
-
windingsAfter.push(winding);
|
|
1786
|
-
} else windingsAfter[index] += winding;
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
// calcualte polysAfter
|
|
1790
|
-
const polysAfter = [];
|
|
1791
|
-
const polysExclude = [];
|
|
1792
|
-
for (let i = 0, iMax = ringsAfter.length; i < iMax; i++) {
|
|
1793
|
-
if (windingsAfter[i] === 0) continue; // non-zero rule
|
|
1794
|
-
const ring = ringsAfter[i];
|
|
1795
|
-
const poly = ring.poly;
|
|
1796
|
-
if (polysExclude.indexOf(poly) !== -1) continue;
|
|
1797
|
-
if (ring.isExterior) polysAfter.push(poly);else {
|
|
1798
|
-
if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
|
|
1799
|
-
const index = polysAfter.indexOf(ring.poly);
|
|
1800
|
-
if (index !== -1) polysAfter.splice(index, 1);
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
// calculate multiPolysAfter
|
|
1805
|
-
for (let i = 0, iMax = polysAfter.length; i < iMax; i++) {
|
|
1806
|
-
const mp = polysAfter[i].multiPoly;
|
|
1807
|
-
if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
|
|
1808
|
-
}
|
|
1809
|
-
return this._afterState;
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
/* Is this segment part of the final result? */
|
|
1813
|
-
isInResult() {
|
|
1814
|
-
// if we've been consumed, we're not in the result
|
|
1815
|
-
if (this.consumedBy) return false;
|
|
1816
|
-
if (this._isInResult !== undefined) return this._isInResult;
|
|
1817
|
-
const mpsBefore = this.beforeState().multiPolys;
|
|
1818
|
-
const mpsAfter = this.afterState().multiPolys;
|
|
1819
|
-
switch (operation.type) {
|
|
1820
|
-
case "union":
|
|
1821
|
-
{
|
|
1822
|
-
// UNION - included iff:
|
|
1823
|
-
// * On one side of us there is 0 poly interiors AND
|
|
1824
|
-
// * On the other side there is 1 or more.
|
|
1825
|
-
const noBefores = mpsBefore.length === 0;
|
|
1826
|
-
const noAfters = mpsAfter.length === 0;
|
|
1827
|
-
this._isInResult = noBefores !== noAfters;
|
|
1828
|
-
break;
|
|
1829
|
-
}
|
|
1830
|
-
case "intersection":
|
|
1831
|
-
{
|
|
1832
|
-
// INTERSECTION - included iff:
|
|
1833
|
-
// * on one side of us all multipolys are rep. with poly interiors AND
|
|
1834
|
-
// * on the other side of us, not all multipolys are repsented
|
|
1835
|
-
// with poly interiors
|
|
1836
|
-
let least;
|
|
1837
|
-
let most;
|
|
1838
|
-
if (mpsBefore.length < mpsAfter.length) {
|
|
1839
|
-
least = mpsBefore.length;
|
|
1840
|
-
most = mpsAfter.length;
|
|
1841
|
-
} else {
|
|
1842
|
-
least = mpsAfter.length;
|
|
1843
|
-
most = mpsBefore.length;
|
|
1844
|
-
}
|
|
1845
|
-
this._isInResult = most === operation.numMultiPolys && least < most;
|
|
1846
|
-
break;
|
|
1847
|
-
}
|
|
1848
|
-
case "xor":
|
|
1849
|
-
{
|
|
1850
|
-
// XOR - included iff:
|
|
1851
|
-
// * the difference between the number of multipolys represented
|
|
1852
|
-
// with poly interiors on our two sides is an odd number
|
|
1853
|
-
const diff = Math.abs(mpsBefore.length - mpsAfter.length);
|
|
1854
|
-
this._isInResult = diff % 2 === 1;
|
|
1855
|
-
break;
|
|
1856
|
-
}
|
|
1857
|
-
case "difference":
|
|
1858
|
-
{
|
|
1859
|
-
// DIFFERENCE included iff:
|
|
1860
|
-
// * on exactly one side, we have just the subject
|
|
1861
|
-
const isJustSubject = mps => mps.length === 1 && mps[0].isSubject;
|
|
1862
|
-
this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
|
|
1863
|
-
break;
|
|
1864
|
-
}
|
|
1865
|
-
default:
|
|
1866
|
-
throw new Error(`Unrecognized operation type found ${operation.type}`);
|
|
1867
|
-
}
|
|
1868
|
-
return this._isInResult;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
class RingIn {
|
|
1873
|
-
constructor(geomRing, poly, isExterior) {
|
|
1874
|
-
if (!Array.isArray(geomRing) || geomRing.length === 0) {
|
|
1875
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1876
|
-
}
|
|
1877
|
-
this.poly = poly;
|
|
1878
|
-
this.isExterior = isExterior;
|
|
1879
|
-
this.segments = [];
|
|
1880
|
-
if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
|
|
1881
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1882
|
-
}
|
|
1883
|
-
const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
|
|
1884
|
-
this.bbox = {
|
|
1885
|
-
ll: {
|
|
1886
|
-
x: firstPoint.x,
|
|
1887
|
-
y: firstPoint.y
|
|
1888
|
-
},
|
|
1889
|
-
ur: {
|
|
1890
|
-
x: firstPoint.x,
|
|
1891
|
-
y: firstPoint.y
|
|
1892
|
-
}
|
|
1893
|
-
};
|
|
1894
|
-
let prevPoint = firstPoint;
|
|
1895
|
-
for (let i = 1, iMax = geomRing.length; i < iMax; i++) {
|
|
1896
|
-
if (typeof geomRing[i][0] !== "number" || typeof geomRing[i][1] !== "number") {
|
|
1897
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1898
|
-
}
|
|
1899
|
-
let point = rounder.round(geomRing[i][0], geomRing[i][1]);
|
|
1900
|
-
// skip repeated points
|
|
1901
|
-
if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
|
|
1902
|
-
this.segments.push(Segment.fromRing(prevPoint, point, this));
|
|
1903
|
-
if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
|
|
1904
|
-
if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
|
|
1905
|
-
if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
|
|
1906
|
-
if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
|
|
1907
|
-
prevPoint = point;
|
|
1908
|
-
}
|
|
1909
|
-
// add segment from last to first if last is not the same as first
|
|
1910
|
-
if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
|
|
1911
|
-
this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
getSweepEvents() {
|
|
1915
|
-
const sweepEvents = [];
|
|
1916
|
-
for (let i = 0, iMax = this.segments.length; i < iMax; i++) {
|
|
1917
|
-
const segment = this.segments[i];
|
|
1918
|
-
sweepEvents.push(segment.leftSE);
|
|
1919
|
-
sweepEvents.push(segment.rightSE);
|
|
1920
|
-
}
|
|
1921
|
-
return sweepEvents;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
class PolyIn {
|
|
1925
|
-
constructor(geomPoly, multiPoly) {
|
|
1926
|
-
if (!Array.isArray(geomPoly)) {
|
|
1927
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1928
|
-
}
|
|
1929
|
-
this.exteriorRing = new RingIn(geomPoly[0], this, true);
|
|
1930
|
-
// copy by value
|
|
1931
|
-
this.bbox = {
|
|
1932
|
-
ll: {
|
|
1933
|
-
x: this.exteriorRing.bbox.ll.x,
|
|
1934
|
-
y: this.exteriorRing.bbox.ll.y
|
|
1935
|
-
},
|
|
1936
|
-
ur: {
|
|
1937
|
-
x: this.exteriorRing.bbox.ur.x,
|
|
1938
|
-
y: this.exteriorRing.bbox.ur.y
|
|
1939
|
-
}
|
|
1940
|
-
};
|
|
1941
|
-
this.interiorRings = [];
|
|
1942
|
-
for (let i = 1, iMax = geomPoly.length; i < iMax; i++) {
|
|
1943
|
-
const ring = new RingIn(geomPoly[i], this, false);
|
|
1944
|
-
if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
|
|
1945
|
-
if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
|
|
1946
|
-
if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
|
|
1947
|
-
if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
|
|
1948
|
-
this.interiorRings.push(ring);
|
|
1949
|
-
}
|
|
1950
|
-
this.multiPoly = multiPoly;
|
|
1951
|
-
}
|
|
1952
|
-
getSweepEvents() {
|
|
1953
|
-
const sweepEvents = this.exteriorRing.getSweepEvents();
|
|
1954
|
-
for (let i = 0, iMax = this.interiorRings.length; i < iMax; i++) {
|
|
1955
|
-
const ringSweepEvents = this.interiorRings[i].getSweepEvents();
|
|
1956
|
-
for (let j = 0, jMax = ringSweepEvents.length; j < jMax; j++) {
|
|
1957
|
-
sweepEvents.push(ringSweepEvents[j]);
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
return sweepEvents;
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
class MultiPolyIn {
|
|
1964
|
-
constructor(geom, isSubject) {
|
|
1965
|
-
if (!Array.isArray(geom)) {
|
|
1966
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1967
|
-
}
|
|
1968
|
-
try {
|
|
1969
|
-
// if the input looks like a polygon, convert it to a multipolygon
|
|
1970
|
-
if (typeof geom[0][0][0] === "number") geom = [geom];
|
|
1971
|
-
} catch (ex) {
|
|
1972
|
-
// The input is either malformed or has empty arrays.
|
|
1973
|
-
// In either case, it will be handled later on.
|
|
1974
|
-
}
|
|
1975
|
-
this.polys = [];
|
|
1976
|
-
this.bbox = {
|
|
1977
|
-
ll: {
|
|
1978
|
-
x: Number.POSITIVE_INFINITY,
|
|
1979
|
-
y: Number.POSITIVE_INFINITY
|
|
1980
|
-
},
|
|
1981
|
-
ur: {
|
|
1982
|
-
x: Number.NEGATIVE_INFINITY,
|
|
1983
|
-
y: Number.NEGATIVE_INFINITY
|
|
1984
|
-
}
|
|
1985
|
-
};
|
|
1986
|
-
for (let i = 0, iMax = geom.length; i < iMax; i++) {
|
|
1987
|
-
const poly = new PolyIn(geom[i], this);
|
|
1988
|
-
if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
|
|
1989
|
-
if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
|
|
1990
|
-
if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
|
|
1991
|
-
if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
|
|
1992
|
-
this.polys.push(poly);
|
|
1993
|
-
}
|
|
1994
|
-
this.isSubject = isSubject;
|
|
1995
|
-
}
|
|
1996
|
-
getSweepEvents() {
|
|
1997
|
-
const sweepEvents = [];
|
|
1998
|
-
for (let i = 0, iMax = this.polys.length; i < iMax; i++) {
|
|
1999
|
-
const polySweepEvents = this.polys[i].getSweepEvents();
|
|
2000
|
-
for (let j = 0, jMax = polySweepEvents.length; j < jMax; j++) {
|
|
2001
|
-
sweepEvents.push(polySweepEvents[j]);
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
return sweepEvents;
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
class RingOut {
|
|
2009
|
-
/* Given the segments from the sweep line pass, compute & return a series
|
|
2010
|
-
* of closed rings from all the segments marked to be part of the result */
|
|
2011
|
-
static factory(allSegments) {
|
|
2012
|
-
const ringsOut = [];
|
|
2013
|
-
for (let i = 0, iMax = allSegments.length; i < iMax; i++) {
|
|
2014
|
-
const segment = allSegments[i];
|
|
2015
|
-
if (!segment.isInResult() || segment.ringOut) continue;
|
|
2016
|
-
let prevEvent = null;
|
|
2017
|
-
let event = segment.leftSE;
|
|
2018
|
-
let nextEvent = segment.rightSE;
|
|
2019
|
-
const events = [event];
|
|
2020
|
-
const startingPoint = event.point;
|
|
2021
|
-
const intersectionLEs = [];
|
|
2022
|
-
|
|
2023
|
-
/* Walk the chain of linked events to form a closed ring */
|
|
2024
|
-
while (true) {
|
|
2025
|
-
prevEvent = event;
|
|
2026
|
-
event = nextEvent;
|
|
2027
|
-
events.push(event);
|
|
2028
|
-
|
|
2029
|
-
/* Is the ring complete? */
|
|
2030
|
-
if (event.point === startingPoint) break;
|
|
2031
|
-
while (true) {
|
|
2032
|
-
const availableLEs = event.getAvailableLinkedEvents();
|
|
2033
|
-
|
|
2034
|
-
/* Did we hit a dead end? This shouldn't happen.
|
|
2035
|
-
* Indicates some earlier part of the algorithm malfunctioned. */
|
|
2036
|
-
if (availableLEs.length === 0) {
|
|
2037
|
-
const firstPt = events[0].point;
|
|
2038
|
-
const lastPt = events[events.length - 1].point;
|
|
2039
|
-
throw new Error(`Unable to complete output ring starting at [${firstPt.x},` + ` ${firstPt.y}]. Last matching segment found ends at` + ` [${lastPt.x}, ${lastPt.y}].`);
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
/* Only one way to go, so cotinue on the path */
|
|
2043
|
-
if (availableLEs.length === 1) {
|
|
2044
|
-
nextEvent = availableLEs[0].otherSE;
|
|
2045
|
-
break;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
/* We must have an intersection. Check for a completed loop */
|
|
2049
|
-
let indexLE = null;
|
|
2050
|
-
for (let j = 0, jMax = intersectionLEs.length; j < jMax; j++) {
|
|
2051
|
-
if (intersectionLEs[j].point === event.point) {
|
|
2052
|
-
indexLE = j;
|
|
2053
|
-
break;
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
/* Found a completed loop. Cut that off and make a ring */
|
|
2057
|
-
if (indexLE !== null) {
|
|
2058
|
-
const intersectionLE = intersectionLEs.splice(indexLE)[0];
|
|
2059
|
-
const ringEvents = events.splice(intersectionLE.index);
|
|
2060
|
-
ringEvents.unshift(ringEvents[0].otherSE);
|
|
2061
|
-
ringsOut.push(new RingOut(ringEvents.reverse()));
|
|
2062
|
-
continue;
|
|
2063
|
-
}
|
|
2064
|
-
/* register the intersection */
|
|
2065
|
-
intersectionLEs.push({
|
|
2066
|
-
index: events.length,
|
|
2067
|
-
point: event.point
|
|
2068
|
-
});
|
|
2069
|
-
/* Choose the left-most option to continue the walk */
|
|
2070
|
-
const comparator = event.getLeftmostComparator(prevEvent);
|
|
2071
|
-
nextEvent = availableLEs.sort(comparator)[0].otherSE;
|
|
2072
|
-
break;
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
ringsOut.push(new RingOut(events));
|
|
2076
|
-
}
|
|
2077
|
-
return ringsOut;
|
|
2078
|
-
}
|
|
2079
|
-
constructor(events) {
|
|
2080
|
-
this.events = events;
|
|
2081
|
-
for (let i = 0, iMax = events.length; i < iMax; i++) {
|
|
2082
|
-
events[i].segment.ringOut = this;
|
|
2083
|
-
}
|
|
2084
|
-
this.poly = null;
|
|
2085
|
-
}
|
|
2086
|
-
getGeom() {
|
|
2087
|
-
// Remove superfluous points (ie extra points along a straight line),
|
|
2088
|
-
let prevPt = this.events[0].point;
|
|
2089
|
-
const points = [prevPt];
|
|
2090
|
-
for (let i = 1, iMax = this.events.length - 1; i < iMax; i++) {
|
|
2091
|
-
const pt = this.events[i].point;
|
|
2092
|
-
const nextPt = this.events[i + 1].point;
|
|
2093
|
-
if (compareVectorAngles(pt, prevPt, nextPt) === 0) continue;
|
|
2094
|
-
points.push(pt);
|
|
2095
|
-
prevPt = pt;
|
|
2096
|
-
}
|
|
2097
|
-
|
|
2098
|
-
// ring was all (within rounding error of angle calc) colinear points
|
|
2099
|
-
if (points.length === 1) return null;
|
|
2100
|
-
|
|
2101
|
-
// check if the starting point is necessary
|
|
2102
|
-
const pt = points[0];
|
|
2103
|
-
const nextPt = points[1];
|
|
2104
|
-
if (compareVectorAngles(pt, prevPt, nextPt) === 0) points.shift();
|
|
2105
|
-
points.push(points[0]);
|
|
2106
|
-
const step = this.isExteriorRing() ? 1 : -1;
|
|
2107
|
-
const iStart = this.isExteriorRing() ? 0 : points.length - 1;
|
|
2108
|
-
const iEnd = this.isExteriorRing() ? points.length : -1;
|
|
2109
|
-
const orderedPoints = [];
|
|
2110
|
-
for (let i = iStart; i != iEnd; i += step) orderedPoints.push([points[i].x, points[i].y]);
|
|
2111
|
-
return orderedPoints;
|
|
2112
|
-
}
|
|
2113
|
-
isExteriorRing() {
|
|
2114
|
-
if (this._isExteriorRing === undefined) {
|
|
2115
|
-
const enclosing = this.enclosingRing();
|
|
2116
|
-
this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
|
|
2117
|
-
}
|
|
2118
|
-
return this._isExteriorRing;
|
|
2119
|
-
}
|
|
2120
|
-
enclosingRing() {
|
|
2121
|
-
if (this._enclosingRing === undefined) {
|
|
2122
|
-
this._enclosingRing = this._calcEnclosingRing();
|
|
2123
|
-
}
|
|
2124
|
-
return this._enclosingRing;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
/* Returns the ring that encloses this one, if any */
|
|
2128
|
-
_calcEnclosingRing() {
|
|
2129
|
-
// start with the ealier sweep line event so that the prevSeg
|
|
2130
|
-
// chain doesn't lead us inside of a loop of ours
|
|
2131
|
-
let leftMostEvt = this.events[0];
|
|
2132
|
-
for (let i = 1, iMax = this.events.length; i < iMax; i++) {
|
|
2133
|
-
const evt = this.events[i];
|
|
2134
|
-
if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
|
|
2135
|
-
}
|
|
2136
|
-
let prevSeg = leftMostEvt.segment.prevInResult();
|
|
2137
|
-
let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
|
|
2138
|
-
while (true) {
|
|
2139
|
-
// no segment found, thus no ring can enclose us
|
|
2140
|
-
if (!prevSeg) return null;
|
|
2141
|
-
|
|
2142
|
-
// no segments below prev segment found, thus the ring of the prev
|
|
2143
|
-
// segment must loop back around and enclose us
|
|
2144
|
-
if (!prevPrevSeg) return prevSeg.ringOut;
|
|
2145
|
-
|
|
2146
|
-
// if the two segments are of different rings, the ring of the prev
|
|
2147
|
-
// segment must either loop around us or the ring of the prev prev
|
|
2148
|
-
// seg, which would make us and the ring of the prev peers
|
|
2149
|
-
if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
|
|
2150
|
-
if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
|
|
2151
|
-
return prevSeg.ringOut;
|
|
2152
|
-
} else return prevSeg.ringOut.enclosingRing();
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
// two segments are from the same ring, so this was a penisula
|
|
2156
|
-
// of that ring. iterate downward, keep searching
|
|
2157
|
-
prevSeg = prevPrevSeg.prevInResult();
|
|
2158
|
-
prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
class PolyOut {
|
|
2163
|
-
constructor(exteriorRing) {
|
|
2164
|
-
this.exteriorRing = exteriorRing;
|
|
2165
|
-
exteriorRing.poly = this;
|
|
2166
|
-
this.interiorRings = [];
|
|
2167
|
-
}
|
|
2168
|
-
addInterior(ring) {
|
|
2169
|
-
this.interiorRings.push(ring);
|
|
2170
|
-
ring.poly = this;
|
|
2171
|
-
}
|
|
2172
|
-
getGeom() {
|
|
2173
|
-
const geom = [this.exteriorRing.getGeom()];
|
|
2174
|
-
// exterior ring was all (within rounding error of angle calc) colinear points
|
|
2175
|
-
if (geom[0] === null) return null;
|
|
2176
|
-
for (let i = 0, iMax = this.interiorRings.length; i < iMax; i++) {
|
|
2177
|
-
const ringGeom = this.interiorRings[i].getGeom();
|
|
2178
|
-
// interior ring was all (within rounding error of angle calc) colinear points
|
|
2179
|
-
if (ringGeom === null) continue;
|
|
2180
|
-
geom.push(ringGeom);
|
|
2181
|
-
}
|
|
2182
|
-
return geom;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
class MultiPolyOut {
|
|
2186
|
-
constructor(rings) {
|
|
2187
|
-
this.rings = rings;
|
|
2188
|
-
this.polys = this._composePolys(rings);
|
|
2189
|
-
}
|
|
2190
|
-
getGeom() {
|
|
2191
|
-
const geom = [];
|
|
2192
|
-
for (let i = 0, iMax = this.polys.length; i < iMax; i++) {
|
|
2193
|
-
const polyGeom = this.polys[i].getGeom();
|
|
2194
|
-
// exterior ring was all (within rounding error of angle calc) colinear points
|
|
2195
|
-
if (polyGeom === null) continue;
|
|
2196
|
-
geom.push(polyGeom);
|
|
2197
|
-
}
|
|
2198
|
-
return geom;
|
|
2199
|
-
}
|
|
2200
|
-
_composePolys(rings) {
|
|
2201
|
-
const polys = [];
|
|
2202
|
-
for (let i = 0, iMax = rings.length; i < iMax; i++) {
|
|
2203
|
-
const ring = rings[i];
|
|
2204
|
-
if (ring.poly) continue;
|
|
2205
|
-
if (ring.isExteriorRing()) polys.push(new PolyOut(ring));else {
|
|
2206
|
-
const enclosingRing = ring.enclosingRing();
|
|
2207
|
-
if (!enclosingRing.poly) polys.push(new PolyOut(enclosingRing));
|
|
2208
|
-
enclosingRing.poly.addInterior(ring);
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
return polys;
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
/**
|
|
2216
|
-
* NOTE: We must be careful not to change any segments while
|
|
2217
|
-
* they are in the SplayTree. AFAIK, there's no way to tell
|
|
2218
|
-
* the tree to rebalance itself - thus before splitting
|
|
2219
|
-
* a segment that's in the tree, we remove it from the tree,
|
|
2220
|
-
* do the split, then re-insert it. (Even though splitting a
|
|
2221
|
-
* segment *shouldn't* change its correct position in the
|
|
2222
|
-
* sweep line tree, the reality is because of rounding errors,
|
|
2223
|
-
* it sometimes does.)
|
|
2224
|
-
*/
|
|
2225
|
-
|
|
2226
|
-
class SweepLine {
|
|
2227
|
-
constructor(queue) {
|
|
2228
|
-
let comparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Segment.compare;
|
|
2229
|
-
this.queue = queue;
|
|
2230
|
-
this.tree = new Tree(comparator);
|
|
2231
|
-
this.segments = [];
|
|
2232
|
-
}
|
|
2233
|
-
process(event) {
|
|
2234
|
-
const segment = event.segment;
|
|
2235
|
-
const newEvents = [];
|
|
2236
|
-
|
|
2237
|
-
// if we've already been consumed by another segment,
|
|
2238
|
-
// clean up our body parts and get out
|
|
2239
|
-
if (event.consumedBy) {
|
|
2240
|
-
if (event.isLeft) this.queue.remove(event.otherSE);else this.tree.remove(segment);
|
|
2241
|
-
return newEvents;
|
|
2242
|
-
}
|
|
2243
|
-
const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
|
|
2244
|
-
if (!node) throw new Error(`Unable to find segment #${segment.id} ` + `[${segment.leftSE.point.x}, ${segment.leftSE.point.y}] -> ` + `[${segment.rightSE.point.x}, ${segment.rightSE.point.y}] ` + "in SweepLine tree.");
|
|
2245
|
-
let prevNode = node;
|
|
2246
|
-
let nextNode = node;
|
|
2247
|
-
let prevSeg = undefined;
|
|
2248
|
-
let nextSeg = undefined;
|
|
2249
|
-
|
|
2250
|
-
// skip consumed segments still in tree
|
|
2251
|
-
while (prevSeg === undefined) {
|
|
2252
|
-
prevNode = this.tree.prev(prevNode);
|
|
2253
|
-
if (prevNode === null) prevSeg = null;else if (prevNode.key.consumedBy === undefined) prevSeg = prevNode.key;
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
// skip consumed segments still in tree
|
|
2257
|
-
while (nextSeg === undefined) {
|
|
2258
|
-
nextNode = this.tree.next(nextNode);
|
|
2259
|
-
if (nextNode === null) nextSeg = null;else if (nextNode.key.consumedBy === undefined) nextSeg = nextNode.key;
|
|
2260
|
-
}
|
|
2261
|
-
if (event.isLeft) {
|
|
2262
|
-
// Check for intersections against the previous segment in the sweep line
|
|
2263
|
-
let prevMySplitter = null;
|
|
2264
|
-
if (prevSeg) {
|
|
2265
|
-
const prevInter = prevSeg.getIntersection(segment);
|
|
2266
|
-
if (prevInter !== null) {
|
|
2267
|
-
if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
|
|
2268
|
-
if (!prevSeg.isAnEndpoint(prevInter)) {
|
|
2269
|
-
const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
|
|
2270
|
-
for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {
|
|
2271
|
-
newEvents.push(newEventsFromSplit[i]);
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
// Check for intersections against the next segment in the sweep line
|
|
2278
|
-
let nextMySplitter = null;
|
|
2279
|
-
if (nextSeg) {
|
|
2280
|
-
const nextInter = nextSeg.getIntersection(segment);
|
|
2281
|
-
if (nextInter !== null) {
|
|
2282
|
-
if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
|
|
2283
|
-
if (!nextSeg.isAnEndpoint(nextInter)) {
|
|
2284
|
-
const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
|
|
2285
|
-
for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {
|
|
2286
|
-
newEvents.push(newEventsFromSplit[i]);
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
// For simplicity, even if we find more than one intersection we only
|
|
2293
|
-
// spilt on the 'earliest' (sweep-line style) of the intersections.
|
|
2294
|
-
// The other intersection will be handled in a future process().
|
|
2295
|
-
if (prevMySplitter !== null || nextMySplitter !== null) {
|
|
2296
|
-
let mySplitter = null;
|
|
2297
|
-
if (prevMySplitter === null) mySplitter = nextMySplitter;else if (nextMySplitter === null) mySplitter = prevMySplitter;else {
|
|
2298
|
-
const cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
|
|
2299
|
-
mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
// Rounding errors can cause changes in ordering,
|
|
2303
|
-
// so remove afected segments and right sweep events before splitting
|
|
2304
|
-
this.queue.remove(segment.rightSE);
|
|
2305
|
-
newEvents.push(segment.rightSE);
|
|
2306
|
-
const newEventsFromSplit = segment.split(mySplitter);
|
|
2307
|
-
for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {
|
|
2308
|
-
newEvents.push(newEventsFromSplit[i]);
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
if (newEvents.length > 0) {
|
|
2312
|
-
// We found some intersections, so re-do the current event to
|
|
2313
|
-
// make sure sweep line ordering is totally consistent for later
|
|
2314
|
-
// use with the segment 'prev' pointers
|
|
2315
|
-
this.tree.remove(segment);
|
|
2316
|
-
newEvents.push(event);
|
|
2317
|
-
} else {
|
|
2318
|
-
// done with left event
|
|
2319
|
-
this.segments.push(segment);
|
|
2320
|
-
segment.prev = prevSeg;
|
|
2321
|
-
}
|
|
2322
|
-
} else {
|
|
2323
|
-
// event.isRight
|
|
2324
|
-
|
|
2325
|
-
// since we're about to be removed from the sweep line, check for
|
|
2326
|
-
// intersections between our previous and next segments
|
|
2327
|
-
if (prevSeg && nextSeg) {
|
|
2328
|
-
const inter = prevSeg.getIntersection(nextSeg);
|
|
2329
|
-
if (inter !== null) {
|
|
2330
|
-
if (!prevSeg.isAnEndpoint(inter)) {
|
|
2331
|
-
const newEventsFromSplit = this._splitSafely(prevSeg, inter);
|
|
2332
|
-
for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {
|
|
2333
|
-
newEvents.push(newEventsFromSplit[i]);
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
if (!nextSeg.isAnEndpoint(inter)) {
|
|
2337
|
-
const newEventsFromSplit = this._splitSafely(nextSeg, inter);
|
|
2338
|
-
for (let i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {
|
|
2339
|
-
newEvents.push(newEventsFromSplit[i]);
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
this.tree.remove(segment);
|
|
2345
|
-
}
|
|
2346
|
-
return newEvents;
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
/* Safely split a segment that is currently in the datastructures
|
|
2350
|
-
* IE - a segment other than the one that is currently being processed. */
|
|
2351
|
-
_splitSafely(seg, pt) {
|
|
2352
|
-
// Rounding errors can cause changes in ordering,
|
|
2353
|
-
// so remove afected segments and right sweep events before splitting
|
|
2354
|
-
// removeNode() doesn't work, so have re-find the seg
|
|
2355
|
-
// https://github.com/w8r/splay-tree/pull/5
|
|
2356
|
-
this.tree.remove(seg);
|
|
2357
|
-
const rightSE = seg.rightSE;
|
|
2358
|
-
this.queue.remove(rightSE);
|
|
2359
|
-
const newEvents = seg.split(pt);
|
|
2360
|
-
newEvents.push(rightSE);
|
|
2361
|
-
// splitting can trigger consumption
|
|
2362
|
-
if (seg.consumedBy === undefined) this.tree.add(seg);
|
|
2363
|
-
return newEvents;
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
// Limits on iterative processes to prevent infinite loops - usually caused by floating-point math round-off errors.
|
|
2368
|
-
const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1000000;
|
|
2369
|
-
const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1000000;
|
|
2370
|
-
class Operation {
|
|
2371
|
-
run(type, geom, moreGeoms) {
|
|
2372
|
-
operation.type = type;
|
|
2373
|
-
rounder.reset();
|
|
2374
|
-
|
|
2375
|
-
/* Convert inputs to MultiPoly objects */
|
|
2376
|
-
const multipolys = [new MultiPolyIn(geom, true)];
|
|
2377
|
-
for (let i = 0, iMax = moreGeoms.length; i < iMax; i++) {
|
|
2378
|
-
multipolys.push(new MultiPolyIn(moreGeoms[i], false));
|
|
2379
|
-
}
|
|
2380
|
-
operation.numMultiPolys = multipolys.length;
|
|
2381
|
-
|
|
2382
|
-
/* BBox optimization for difference operation
|
|
2383
|
-
* If the bbox of a multipolygon that's part of the clipping doesn't
|
|
2384
|
-
* intersect the bbox of the subject at all, we can just drop that
|
|
2385
|
-
* multiploygon. */
|
|
2386
|
-
if (operation.type === "difference") {
|
|
2387
|
-
// in place removal
|
|
2388
|
-
const subject = multipolys[0];
|
|
2389
|
-
let i = 1;
|
|
2390
|
-
while (i < multipolys.length) {
|
|
2391
|
-
if (getBboxOverlap(multipolys[i].bbox, subject.bbox) !== null) i++;else multipolys.splice(i, 1);
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
/* BBox optimization for intersection operation
|
|
2396
|
-
* If we can find any pair of multipolygons whose bbox does not overlap,
|
|
2397
|
-
* then the result will be empty. */
|
|
2398
|
-
if (operation.type === "intersection") {
|
|
2399
|
-
// TODO: this is O(n^2) in number of polygons. By sorting the bboxes,
|
|
2400
|
-
// it could be optimized to O(n * ln(n))
|
|
2401
|
-
for (let i = 0, iMax = multipolys.length; i < iMax; i++) {
|
|
2402
|
-
const mpA = multipolys[i];
|
|
2403
|
-
for (let j = i + 1, jMax = multipolys.length; j < jMax; j++) {
|
|
2404
|
-
if (getBboxOverlap(mpA.bbox, multipolys[j].bbox) === null) return [];
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
/* Put segment endpoints in a priority queue */
|
|
2410
|
-
const queue = new Tree(SweepEvent.compare);
|
|
2411
|
-
for (let i = 0, iMax = multipolys.length; i < iMax; i++) {
|
|
2412
|
-
const sweepEvents = multipolys[i].getSweepEvents();
|
|
2413
|
-
for (let j = 0, jMax = sweepEvents.length; j < jMax; j++) {
|
|
2414
|
-
queue.insert(sweepEvents[j]);
|
|
2415
|
-
if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
|
|
2416
|
-
// prevents an infinite loop, an otherwise common manifestation of bugs
|
|
2417
|
-
throw new Error("Infinite loop when putting segment endpoints in a priority queue " + "(queue size too big).");
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
/* Pass the sweep line over those endpoints */
|
|
2423
|
-
const sweepLine = new SweepLine(queue);
|
|
2424
|
-
let prevQueueSize = queue.size;
|
|
2425
|
-
let node = queue.pop();
|
|
2426
|
-
while (node) {
|
|
2427
|
-
const evt = node.key;
|
|
2428
|
-
if (queue.size === prevQueueSize) {
|
|
2429
|
-
// prevents an infinite loop, an otherwise common manifestation of bugs
|
|
2430
|
-
const seg = evt.segment;
|
|
2431
|
-
throw new Error(`Unable to pop() ${evt.isLeft ? "left" : "right"} SweepEvent ` + `[${evt.point.x}, ${evt.point.y}] from segment #${seg.id} ` + `[${seg.leftSE.point.x}, ${seg.leftSE.point.y}] -> ` + `[${seg.rightSE.point.x}, ${seg.rightSE.point.y}] from queue.`);
|
|
2432
|
-
}
|
|
2433
|
-
if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
|
|
2434
|
-
// prevents an infinite loop, an otherwise common manifestation of bugs
|
|
2435
|
-
throw new Error("Infinite loop when passing sweep line over endpoints " + "(queue size too big).");
|
|
2436
|
-
}
|
|
2437
|
-
if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
|
|
2438
|
-
// prevents an infinite loop, an otherwise common manifestation of bugs
|
|
2439
|
-
throw new Error("Infinite loop when passing sweep line over endpoints " + "(too many sweep line segments).");
|
|
2440
|
-
}
|
|
2441
|
-
const newEvents = sweepLine.process(evt);
|
|
2442
|
-
for (let i = 0, iMax = newEvents.length; i < iMax; i++) {
|
|
2443
|
-
const evt = newEvents[i];
|
|
2444
|
-
if (evt.consumedBy === undefined) queue.insert(evt);
|
|
2445
|
-
}
|
|
2446
|
-
prevQueueSize = queue.size;
|
|
2447
|
-
node = queue.pop();
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
|
-
// free some memory we don't need anymore
|
|
2451
|
-
rounder.reset();
|
|
2452
|
-
|
|
2453
|
-
/* Collect and compile segments we're keeping into a multipolygon */
|
|
2454
|
-
const ringsOut = RingOut.factory(sweepLine.segments);
|
|
2455
|
-
const result = new MultiPolyOut(ringsOut);
|
|
2456
|
-
return result.getGeom();
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
// singleton available by import
|
|
2461
|
-
const operation = new Operation();
|
|
2462
|
-
|
|
2463
|
-
const union = function (geom) {
|
|
2464
|
-
for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2465
|
-
moreGeoms[_key - 1] = arguments[_key];
|
|
2466
|
-
}
|
|
2467
|
-
return operation.run("union", geom, moreGeoms);
|
|
2468
|
-
};
|
|
2469
|
-
const intersection = function (geom) {
|
|
2470
|
-
for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2471
|
-
moreGeoms[_key2 - 1] = arguments[_key2];
|
|
2472
|
-
}
|
|
2473
|
-
return operation.run("intersection", geom, moreGeoms);
|
|
2474
|
-
};
|
|
2475
|
-
const xor = function (geom) {
|
|
2476
|
-
for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
2477
|
-
moreGeoms[_key3 - 1] = arguments[_key3];
|
|
2478
|
-
}
|
|
2479
|
-
return operation.run("xor", geom, moreGeoms);
|
|
2480
|
-
};
|
|
2481
|
-
const difference = function (subjectGeom) {
|
|
2482
|
-
for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
2483
|
-
clippingGeoms[_key4 - 1] = arguments[_key4];
|
|
2484
|
-
}
|
|
2485
|
-
return operation.run("difference", subjectGeom, clippingGeoms);
|
|
2486
|
-
};
|
|
2487
|
-
var index = {
|
|
2488
|
-
union: union,
|
|
2489
|
-
intersection: intersection,
|
|
2490
|
-
xor: xor,
|
|
2491
|
-
difference: difference
|
|
2492
|
-
};
|
|
2493
|
-
|
|
2494
|
-
return index;
|
|
2495
|
-
|
|
2496
|
-
}));
|