clipper2-ts 1.5.4-3.9a869ba → 1.5.4-5.9a869ba
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/README.md +4 -4
- package/dist/Clipper.d.ts +3 -3
- package/dist/Clipper.d.ts.map +1 -1
- package/dist/Clipper.js +74 -77
- package/dist/Clipper.js.map +1 -1
- package/dist/Core.js +24 -27
- package/dist/Core.js.map +1 -1
- package/dist/Engine.d.ts +1 -1
- package/dist/Engine.d.ts.map +1 -1
- package/dist/Engine.js +206 -210
- package/dist/Engine.js.map +1 -1
- package/dist/Minkowski.d.ts +1 -1
- package/dist/Minkowski.d.ts.map +1 -1
- package/dist/Minkowski.js +15 -18
- package/dist/Minkowski.js.map +1 -1
- package/dist/Offset.d.ts +2 -2
- package/dist/Offset.d.ts.map +1 -1
- package/dist/Offset.js +63 -62
- package/dist/Offset.js.map +1 -1
- package/dist/RectClip.d.ts +1 -1
- package/dist/RectClip.d.ts.map +1 -1
- package/dist/RectClip.js +47 -49
- package/dist/RectClip.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -56
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/Clipper.ts +5 -5
- package/src/Engine.ts +2 -2
- package/src/Minkowski.ts +2 -2
- package/src/Offset.ts +2 -2
- package/src/RectClip.ts +1 -1
- package/src/index.ts +7 -7
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# clipper2-ts
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/clipper2-ts)
|
|
4
|
+
[](https://github.com/countertype/clipper2-ts/blob/main/LICENSE)
|
|
5
5
|
|
|
6
6
|
TypeScript port of Angus Johnson's [Clipper2](https://github.com/AngusJohnson/Clipper2) library for polygon clipping and offsetting
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install
|
|
11
|
+
npm install clipper2-ts
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
import { Clipper, FillRule, JoinType, EndType } from '
|
|
17
|
+
import { Clipper, FillRule, JoinType, EndType } from 'clipper2-ts';
|
|
18
18
|
|
|
19
19
|
// Define polygons as arrays of points
|
|
20
20
|
const subject = [[
|
package/dist/Clipper.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* the inherent complexities of the other modules. *
|
|
9
9
|
* License : https://www.boost.org/LICENSE_1_0.txt *
|
|
10
10
|
*******************************************************************************/
|
|
11
|
-
import { Point64, PointD, Path64, PathD, Paths64, PathsD, Rect64, RectD, ClipType, FillRule, PointInPolygonResult } from './Core';
|
|
12
|
-
import { PolyTree64, PolyTreeD, PolyPathD } from './Engine';
|
|
13
|
-
import { JoinType, EndType } from './Offset';
|
|
11
|
+
import { Point64, PointD, Path64, PathD, Paths64, PathsD, Rect64, RectD, ClipType, FillRule, PointInPolygonResult } from './Core.js';
|
|
12
|
+
import { PolyTree64, PolyTreeD, PolyPathD } from './Engine.js';
|
|
13
|
+
import { JoinType, EndType } from './Offset.js';
|
|
14
14
|
export declare namespace Clipper {
|
|
15
15
|
const invalidRect64: Rect64;
|
|
16
16
|
const invalidRectD: RectD;
|
package/dist/Clipper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipper.d.ts","sourceRoot":"","sources":["../src/Clipper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;gFASgF;AAEhF,OAAO,EACL,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAC9D,QAAQ,EAAY,QAAQ,EAAE,oBAAoB,EAGnD,MAAM,
|
|
1
|
+
{"version":3,"file":"Clipper.d.ts","sourceRoot":"","sources":["../src/Clipper.ts"],"names":[],"mappings":"AAAA;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************************************************************************
|
|
3
2
|
* Author : Angus Johnson *
|
|
4
3
|
* Date : 5 March 2025 *
|
|
@@ -9,73 +8,71 @@
|
|
|
9
8
|
* the inherent complexities of the other modules. *
|
|
10
9
|
* License : https://www.boost.org/LICENSE_1_0.txt *
|
|
11
10
|
*******************************************************************************/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Minkowski_1 = require("./Minkowski");
|
|
19
|
-
var Clipper;
|
|
11
|
+
import { ClipType, PathType, InternalClipper, Point64Utils, PointDUtils, Rect64Utils, RectDUtils, InvalidRect64, InvalidRectD } from './Core.js';
|
|
12
|
+
import { Clipper64, ClipperD } from './Engine.js';
|
|
13
|
+
import { ClipperOffset } from './Offset.js';
|
|
14
|
+
import { RectClip64, RectClipLines64 } from './RectClip.js';
|
|
15
|
+
import { Minkowski } from './Minkowski.js';
|
|
16
|
+
export var Clipper;
|
|
20
17
|
(function (Clipper) {
|
|
21
18
|
// Constants
|
|
22
|
-
Clipper.invalidRect64 =
|
|
23
|
-
Clipper.invalidRectD =
|
|
19
|
+
Clipper.invalidRect64 = InvalidRect64;
|
|
20
|
+
Clipper.invalidRectD = InvalidRectD;
|
|
24
21
|
// Boolean operations
|
|
25
22
|
function intersect(subject, clip, fillRule) {
|
|
26
|
-
return booleanOp(
|
|
23
|
+
return booleanOp(ClipType.Intersection, subject, clip, fillRule);
|
|
27
24
|
}
|
|
28
25
|
Clipper.intersect = intersect;
|
|
29
26
|
function intersectD(subject, clip, fillRule, precision = 2) {
|
|
30
|
-
return booleanOpD(
|
|
27
|
+
return booleanOpD(ClipType.Intersection, subject, clip, fillRule, precision);
|
|
31
28
|
}
|
|
32
29
|
Clipper.intersectD = intersectD;
|
|
33
30
|
function union(subject, clipOrFillRule, fillRule) {
|
|
34
31
|
if (typeof clipOrFillRule === 'number') {
|
|
35
32
|
// First overload: union(subject, fillRule)
|
|
36
|
-
return booleanOp(
|
|
33
|
+
return booleanOp(ClipType.Union, subject, null, clipOrFillRule);
|
|
37
34
|
}
|
|
38
35
|
else {
|
|
39
36
|
// Second overload: union(subject, clip, fillRule)
|
|
40
|
-
return booleanOp(
|
|
37
|
+
return booleanOp(ClipType.Union, subject, clipOrFillRule, fillRule);
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
Clipper.union = union;
|
|
44
41
|
function unionD(subject, clipOrFillRule, fillRuleOrPrecision, precision) {
|
|
45
42
|
if (typeof clipOrFillRule === 'number') {
|
|
46
43
|
// First overload: unionD(subject, fillRule)
|
|
47
|
-
return booleanOpD(
|
|
44
|
+
return booleanOpD(ClipType.Union, subject, null, clipOrFillRule);
|
|
48
45
|
}
|
|
49
46
|
else {
|
|
50
47
|
// Second overload: unionD(subject, clip, fillRule, precision)
|
|
51
|
-
return booleanOpD(
|
|
48
|
+
return booleanOpD(ClipType.Union, subject, clipOrFillRule, fillRuleOrPrecision, precision || 2);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
Clipper.unionD = unionD;
|
|
55
52
|
function difference(subject, clip, fillRule) {
|
|
56
|
-
return booleanOp(
|
|
53
|
+
return booleanOp(ClipType.Difference, subject, clip, fillRule);
|
|
57
54
|
}
|
|
58
55
|
Clipper.difference = difference;
|
|
59
56
|
function differenceD(subject, clip, fillRule, precision = 2) {
|
|
60
|
-
return booleanOpD(
|
|
57
|
+
return booleanOpD(ClipType.Difference, subject, clip, fillRule, precision);
|
|
61
58
|
}
|
|
62
59
|
Clipper.differenceD = differenceD;
|
|
63
60
|
function xor(subject, clip, fillRule) {
|
|
64
|
-
return booleanOp(
|
|
61
|
+
return booleanOp(ClipType.Xor, subject, clip, fillRule);
|
|
65
62
|
}
|
|
66
63
|
Clipper.xor = xor;
|
|
67
64
|
function xorD(subject, clip, fillRule, precision = 2) {
|
|
68
|
-
return booleanOpD(
|
|
65
|
+
return booleanOpD(ClipType.Xor, subject, clip, fillRule, precision);
|
|
69
66
|
}
|
|
70
67
|
Clipper.xorD = xorD;
|
|
71
68
|
function booleanOp(clipType, subject, clip, fillRule) {
|
|
72
69
|
const solution = [];
|
|
73
70
|
if (subject === null)
|
|
74
71
|
return solution;
|
|
75
|
-
const c = new
|
|
76
|
-
c.addPaths(subject,
|
|
72
|
+
const c = new Clipper64();
|
|
73
|
+
c.addPaths(subject, PathType.Subject);
|
|
77
74
|
if (clip !== null) {
|
|
78
|
-
c.addPaths(clip,
|
|
75
|
+
c.addPaths(clip, PathType.Clip);
|
|
79
76
|
}
|
|
80
77
|
c.execute(clipType, fillRule, solution);
|
|
81
78
|
return solution;
|
|
@@ -84,17 +81,17 @@ var Clipper;
|
|
|
84
81
|
function booleanOpWithPolyTree(clipType, subject, clip, polytree, fillRule) {
|
|
85
82
|
if (subject === null)
|
|
86
83
|
return;
|
|
87
|
-
const c = new
|
|
88
|
-
c.addPaths(subject,
|
|
84
|
+
const c = new Clipper64();
|
|
85
|
+
c.addPaths(subject, PathType.Subject);
|
|
89
86
|
if (clip !== null) {
|
|
90
|
-
c.addPaths(clip,
|
|
87
|
+
c.addPaths(clip, PathType.Clip);
|
|
91
88
|
}
|
|
92
89
|
c.execute(clipType, fillRule, polytree);
|
|
93
90
|
}
|
|
94
91
|
Clipper.booleanOpWithPolyTree = booleanOpWithPolyTree;
|
|
95
92
|
function booleanOpD(clipType, subject, clip, fillRule, precision = 2) {
|
|
96
93
|
const solution = [];
|
|
97
|
-
const c = new
|
|
94
|
+
const c = new ClipperD(precision);
|
|
98
95
|
c.addSubjectPaths(subject);
|
|
99
96
|
if (clip !== null) {
|
|
100
97
|
c.addClipPaths(clip);
|
|
@@ -106,7 +103,7 @@ var Clipper;
|
|
|
106
103
|
function booleanOpDWithPolyTree(clipType, subject, clip, polytree, fillRule, precision = 2) {
|
|
107
104
|
if (subject === null)
|
|
108
105
|
return;
|
|
109
|
-
const c = new
|
|
106
|
+
const c = new ClipperD(precision);
|
|
110
107
|
c.addSubjectPaths(subject);
|
|
111
108
|
if (clip !== null) {
|
|
112
109
|
c.addClipPaths(clip);
|
|
@@ -115,7 +112,7 @@ var Clipper;
|
|
|
115
112
|
}
|
|
116
113
|
Clipper.booleanOpDWithPolyTree = booleanOpDWithPolyTree;
|
|
117
114
|
function inflatePaths(paths, delta, joinType, endType, miterLimit = 2.0, arcTolerance = 0.0) {
|
|
118
|
-
const co = new
|
|
115
|
+
const co = new ClipperOffset(miterLimit, arcTolerance);
|
|
119
116
|
co.addPaths(paths, joinType, endType);
|
|
120
117
|
const solution = [];
|
|
121
118
|
co.execute(delta, solution);
|
|
@@ -123,10 +120,10 @@ var Clipper;
|
|
|
123
120
|
}
|
|
124
121
|
Clipper.inflatePaths = inflatePaths;
|
|
125
122
|
function inflatePathsD(paths, delta, joinType, endType, miterLimit = 2.0, precision = 2, arcTolerance = 0.0) {
|
|
126
|
-
|
|
123
|
+
InternalClipper.checkPrecision(precision);
|
|
127
124
|
const scale = Math.pow(10, precision);
|
|
128
125
|
const tmp = scalePaths64(paths, scale);
|
|
129
|
-
const co = new
|
|
126
|
+
const co = new ClipperOffset(miterLimit, scale * arcTolerance);
|
|
130
127
|
co.addPaths(tmp, joinType, endType);
|
|
131
128
|
const solution = [];
|
|
132
129
|
co.execute(delta * scale, solution); // reuse solution to receive (scaled) solution
|
|
@@ -137,14 +134,14 @@ var Clipper;
|
|
|
137
134
|
if ('left' in rect && typeof rect.left === 'number' && Number.isInteger(rect.left)) {
|
|
138
135
|
// Rect64 case
|
|
139
136
|
const rect64 = rect;
|
|
140
|
-
if (
|
|
137
|
+
if (Rect64Utils.isEmpty(rect64))
|
|
141
138
|
return [];
|
|
142
139
|
if (Array.isArray(pathsOrPath[0])) {
|
|
143
140
|
// Paths64
|
|
144
141
|
const paths = pathsOrPath;
|
|
145
142
|
if (paths.length === 0)
|
|
146
143
|
return [];
|
|
147
|
-
const rc = new
|
|
144
|
+
const rc = new RectClip64(rect64);
|
|
148
145
|
return rc.execute(paths);
|
|
149
146
|
}
|
|
150
147
|
else {
|
|
@@ -160,8 +157,8 @@ var Clipper;
|
|
|
160
157
|
// RectD case
|
|
161
158
|
const rectD = rect;
|
|
162
159
|
const prec = precision || 2;
|
|
163
|
-
|
|
164
|
-
if (
|
|
160
|
+
InternalClipper.checkPrecision(prec);
|
|
161
|
+
if (RectDUtils.isEmpty(rectD))
|
|
165
162
|
return [];
|
|
166
163
|
const scale = Math.pow(10, prec);
|
|
167
164
|
const r = scaleRect(rectD, scale);
|
|
@@ -171,7 +168,7 @@ var Clipper;
|
|
|
171
168
|
if (paths.length === 0)
|
|
172
169
|
return [];
|
|
173
170
|
const tmpPath = scalePaths64(paths, scale);
|
|
174
|
-
const rc = new
|
|
171
|
+
const rc = new RectClip64(r);
|
|
175
172
|
const result = rc.execute(tmpPath);
|
|
176
173
|
return scalePathsD(result, 1 / scale);
|
|
177
174
|
}
|
|
@@ -190,14 +187,14 @@ var Clipper;
|
|
|
190
187
|
if ('left' in rect && typeof rect.left === 'number' && Number.isInteger(rect.left)) {
|
|
191
188
|
// Rect64 case
|
|
192
189
|
const rect64 = rect;
|
|
193
|
-
if (
|
|
190
|
+
if (Rect64Utils.isEmpty(rect64))
|
|
194
191
|
return [];
|
|
195
192
|
if (Array.isArray(pathsOrPath[0])) {
|
|
196
193
|
// Paths64
|
|
197
194
|
const paths = pathsOrPath;
|
|
198
195
|
if (paths.length === 0)
|
|
199
196
|
return [];
|
|
200
|
-
const rc = new
|
|
197
|
+
const rc = new RectClipLines64(rect64);
|
|
201
198
|
return rc.execute(paths);
|
|
202
199
|
}
|
|
203
200
|
else {
|
|
@@ -213,8 +210,8 @@ var Clipper;
|
|
|
213
210
|
// RectD case
|
|
214
211
|
const rectD = rect;
|
|
215
212
|
const prec = precision || 2;
|
|
216
|
-
|
|
217
|
-
if (
|
|
213
|
+
InternalClipper.checkPrecision(prec);
|
|
214
|
+
if (RectDUtils.isEmpty(rectD))
|
|
218
215
|
return [];
|
|
219
216
|
const scale = Math.pow(10, prec);
|
|
220
217
|
const r = scaleRect(rectD, scale);
|
|
@@ -224,7 +221,7 @@ var Clipper;
|
|
|
224
221
|
if (paths.length === 0)
|
|
225
222
|
return [];
|
|
226
223
|
const tmpPath = scalePaths64(paths, scale);
|
|
227
|
-
const rc = new
|
|
224
|
+
const rc = new RectClipLines64(r);
|
|
228
225
|
const result = rc.execute(tmpPath);
|
|
229
226
|
return scalePathsD(result, 1 / scale);
|
|
230
227
|
}
|
|
@@ -240,19 +237,19 @@ var Clipper;
|
|
|
240
237
|
}
|
|
241
238
|
Clipper.rectClipLines = rectClipLines;
|
|
242
239
|
function minkowskiSum(pattern, path, isClosed) {
|
|
243
|
-
return
|
|
240
|
+
return Minkowski.sum(pattern, path, isClosed);
|
|
244
241
|
}
|
|
245
242
|
Clipper.minkowskiSum = minkowskiSum;
|
|
246
243
|
function minkowskiSumD(pattern, path, isClosed) {
|
|
247
|
-
return
|
|
244
|
+
return Minkowski.sumD(pattern, path, isClosed);
|
|
248
245
|
}
|
|
249
246
|
Clipper.minkowskiSumD = minkowskiSumD;
|
|
250
247
|
function minkowskiDiff(pattern, path, isClosed) {
|
|
251
|
-
return
|
|
248
|
+
return Minkowski.diff(pattern, path, isClosed);
|
|
252
249
|
}
|
|
253
250
|
Clipper.minkowskiDiff = minkowskiDiff;
|
|
254
251
|
function minkowskiDiffD(pattern, path, isClosed) {
|
|
255
|
-
return
|
|
252
|
+
return Minkowski.diffD(pattern, path, isClosed);
|
|
256
253
|
}
|
|
257
254
|
Clipper.minkowskiDiffD = minkowskiDiffD;
|
|
258
255
|
function area(path) {
|
|
@@ -309,7 +306,7 @@ var Clipper;
|
|
|
309
306
|
function path64ToString(path) {
|
|
310
307
|
let result = "";
|
|
311
308
|
for (const pt of path) {
|
|
312
|
-
result +=
|
|
309
|
+
result += Point64Utils.toString(pt);
|
|
313
310
|
}
|
|
314
311
|
return result + '\n';
|
|
315
312
|
}
|
|
@@ -325,7 +322,7 @@ var Clipper;
|
|
|
325
322
|
function pathDToString(path, precision = 2) {
|
|
326
323
|
let result = "";
|
|
327
324
|
for (const pt of path) {
|
|
328
|
-
result +=
|
|
325
|
+
result += PointDUtils.toString(pt, precision);
|
|
329
326
|
}
|
|
330
327
|
return result + '\n';
|
|
331
328
|
}
|
|
@@ -370,7 +367,7 @@ var Clipper;
|
|
|
370
367
|
}
|
|
371
368
|
Clipper.scaleRect = scaleRect;
|
|
372
369
|
function scalePath(path, scale) {
|
|
373
|
-
if (
|
|
370
|
+
if (InternalClipper.isAlmostZero(scale - 1))
|
|
374
371
|
return path;
|
|
375
372
|
const result = [];
|
|
376
373
|
for (const pt of path) {
|
|
@@ -383,7 +380,7 @@ var Clipper;
|
|
|
383
380
|
}
|
|
384
381
|
Clipper.scalePath = scalePath;
|
|
385
382
|
function scalePaths(paths, scale) {
|
|
386
|
-
if (
|
|
383
|
+
if (InternalClipper.isAlmostZero(scale - 1))
|
|
387
384
|
return paths;
|
|
388
385
|
const result = [];
|
|
389
386
|
for (const path of paths) {
|
|
@@ -393,17 +390,17 @@ var Clipper;
|
|
|
393
390
|
}
|
|
394
391
|
Clipper.scalePaths = scalePaths;
|
|
395
392
|
function scalePathD(path, scale) {
|
|
396
|
-
if (
|
|
393
|
+
if (InternalClipper.isAlmostZero(scale - 1))
|
|
397
394
|
return path;
|
|
398
395
|
const result = [];
|
|
399
396
|
for (const pt of path) {
|
|
400
|
-
result.push(
|
|
397
|
+
result.push(PointDUtils.scale(pt, scale));
|
|
401
398
|
}
|
|
402
399
|
return result;
|
|
403
400
|
}
|
|
404
401
|
Clipper.scalePathD = scalePathD;
|
|
405
402
|
function scalePathsD(paths, scale) {
|
|
406
|
-
if (
|
|
403
|
+
if (InternalClipper.isAlmostZero(scale - 1))
|
|
407
404
|
return paths;
|
|
408
405
|
const result = [];
|
|
409
406
|
for (const path of paths) {
|
|
@@ -455,7 +452,7 @@ var Clipper;
|
|
|
455
452
|
function path64FromD(path) {
|
|
456
453
|
const result = [];
|
|
457
454
|
for (const pt of path) {
|
|
458
|
-
result.push(
|
|
455
|
+
result.push(Point64Utils.fromPointD(pt));
|
|
459
456
|
}
|
|
460
457
|
return result;
|
|
461
458
|
}
|
|
@@ -479,7 +476,7 @@ var Clipper;
|
|
|
479
476
|
function pathD(path) {
|
|
480
477
|
const result = [];
|
|
481
478
|
for (const pt of path) {
|
|
482
|
-
result.push(
|
|
479
|
+
result.push(PointDUtils.fromPoint64(pt));
|
|
483
480
|
}
|
|
484
481
|
return result;
|
|
485
482
|
}
|
|
@@ -541,11 +538,11 @@ var Clipper;
|
|
|
541
538
|
}
|
|
542
539
|
Clipper.reversePathsD = reversePathsD;
|
|
543
540
|
function getBounds(path) {
|
|
544
|
-
return
|
|
541
|
+
return InternalClipper.getBounds(path);
|
|
545
542
|
}
|
|
546
543
|
Clipper.getBounds = getBounds;
|
|
547
544
|
function getBoundsPaths(paths) {
|
|
548
|
-
const result =
|
|
545
|
+
const result = Rect64Utils.createInvalid();
|
|
549
546
|
for (const path of paths) {
|
|
550
547
|
for (const pt of path) {
|
|
551
548
|
if (pt.x < result.left)
|
|
@@ -562,7 +559,7 @@ var Clipper;
|
|
|
562
559
|
}
|
|
563
560
|
Clipper.getBoundsPaths = getBoundsPaths;
|
|
564
561
|
function getBoundsD(path) {
|
|
565
|
-
const result =
|
|
562
|
+
const result = RectDUtils.createInvalid();
|
|
566
563
|
for (const pt of path) {
|
|
567
564
|
if (pt.x < result.left)
|
|
568
565
|
result.left = pt.x;
|
|
@@ -573,12 +570,12 @@ var Clipper;
|
|
|
573
570
|
if (pt.y > result.bottom)
|
|
574
571
|
result.bottom = pt.y;
|
|
575
572
|
}
|
|
576
|
-
return Math.abs(result.left - Number.MAX_VALUE) <
|
|
573
|
+
return Math.abs(result.left - Number.MAX_VALUE) < InternalClipper.floatingPointTolerance ?
|
|
577
574
|
{ left: 0, top: 0, right: 0, bottom: 0 } : result;
|
|
578
575
|
}
|
|
579
576
|
Clipper.getBoundsD = getBoundsD;
|
|
580
577
|
function getBoundsPathsD(paths) {
|
|
581
|
-
const result =
|
|
578
|
+
const result = RectDUtils.createInvalid();
|
|
582
579
|
for (const path of paths) {
|
|
583
580
|
for (const pt of path) {
|
|
584
581
|
if (pt.x < result.left)
|
|
@@ -591,7 +588,7 @@ var Clipper;
|
|
|
591
588
|
result.bottom = pt.y;
|
|
592
589
|
}
|
|
593
590
|
}
|
|
594
|
-
return Math.abs(result.left - Number.MAX_VALUE) <
|
|
591
|
+
return Math.abs(result.left - Number.MAX_VALUE) < InternalClipper.floatingPointTolerance ?
|
|
595
592
|
{ left: 0, top: 0, right: 0, bottom: 0 } : result;
|
|
596
593
|
}
|
|
597
594
|
Clipper.getBoundsPathsD = getBoundsPathsD;
|
|
@@ -674,12 +671,12 @@ var Clipper;
|
|
|
674
671
|
let lastPt = path[0];
|
|
675
672
|
result.push(lastPt);
|
|
676
673
|
for (let i = 1; i < cnt; i++) {
|
|
677
|
-
if (!
|
|
674
|
+
if (!Point64Utils.equals(lastPt, path[i])) {
|
|
678
675
|
lastPt = path[i];
|
|
679
676
|
result.push(lastPt);
|
|
680
677
|
}
|
|
681
678
|
}
|
|
682
|
-
if (isClosedPath &&
|
|
679
|
+
if (isClosedPath && Point64Utils.equals(lastPt, result[0])) {
|
|
683
680
|
result.pop();
|
|
684
681
|
}
|
|
685
682
|
return result;
|
|
@@ -742,7 +739,7 @@ var Clipper;
|
|
|
742
739
|
while (true) {
|
|
743
740
|
let idx = 0;
|
|
744
741
|
let maxD = 0;
|
|
745
|
-
while (end > begin &&
|
|
742
|
+
while (end > begin && Point64Utils.equals(path[begin], path[end]))
|
|
746
743
|
flags[end--] = false;
|
|
747
744
|
for (let i = begin + 1; i < end; ++i) {
|
|
748
745
|
// PerpendicDistFromLineSqrd - avoids expensive Sqrt()
|
|
@@ -792,7 +789,7 @@ var Clipper;
|
|
|
792
789
|
while (true) {
|
|
793
790
|
let idx = 0;
|
|
794
791
|
let maxD = 0;
|
|
795
|
-
while (end > begin &&
|
|
792
|
+
while (end > begin && PointDUtils.equals(path[begin], path[end]))
|
|
796
793
|
flags[end--] = false;
|
|
797
794
|
for (let i = begin + 1; i < end; ++i) {
|
|
798
795
|
// PerpendicDistFromLineSqrd - avoids expensive Sqrt()
|
|
@@ -1023,13 +1020,13 @@ var Clipper;
|
|
|
1023
1020
|
let len = path.length;
|
|
1024
1021
|
let i = 0;
|
|
1025
1022
|
if (!isOpen) {
|
|
1026
|
-
while (i < len - 1 &&
|
|
1023
|
+
while (i < len - 1 && InternalClipper.isCollinear(path[len - 1], path[i], path[i + 1]))
|
|
1027
1024
|
i++;
|
|
1028
|
-
while (i < len - 1 &&
|
|
1025
|
+
while (i < len - 1 && InternalClipper.isCollinear(path[len - 2], path[len - 1], path[i]))
|
|
1029
1026
|
len--;
|
|
1030
1027
|
}
|
|
1031
1028
|
if (len - i < 3) {
|
|
1032
|
-
if (!isOpen || len < 2 ||
|
|
1029
|
+
if (!isOpen || len < 2 || Point64Utils.equals(path[0], path[1])) {
|
|
1033
1030
|
return [];
|
|
1034
1031
|
}
|
|
1035
1032
|
return path;
|
|
@@ -1038,7 +1035,7 @@ var Clipper;
|
|
|
1038
1035
|
let last = path[i];
|
|
1039
1036
|
result.push(last);
|
|
1040
1037
|
for (i++; i < len - 1; i++) {
|
|
1041
|
-
if (
|
|
1038
|
+
if (InternalClipper.isCollinear(last, path[i], path[i + 1]))
|
|
1042
1039
|
continue;
|
|
1043
1040
|
last = path[i];
|
|
1044
1041
|
result.push(last);
|
|
@@ -1046,11 +1043,11 @@ var Clipper;
|
|
|
1046
1043
|
if (isOpen) {
|
|
1047
1044
|
result.push(path[len - 1]);
|
|
1048
1045
|
}
|
|
1049
|
-
else if (!
|
|
1046
|
+
else if (!InternalClipper.isCollinear(last, path[len - 1], result[0])) {
|
|
1050
1047
|
result.push(path[len - 1]);
|
|
1051
1048
|
}
|
|
1052
1049
|
else {
|
|
1053
|
-
while (result.length > 2 &&
|
|
1050
|
+
while (result.length > 2 && InternalClipper.isCollinear(result[result.length - 1], result[result.length - 2], result[0])) {
|
|
1054
1051
|
result.pop();
|
|
1055
1052
|
}
|
|
1056
1053
|
if (result.length < 3) {
|
|
@@ -1061,7 +1058,7 @@ var Clipper;
|
|
|
1061
1058
|
}
|
|
1062
1059
|
Clipper.trimCollinear = trimCollinear;
|
|
1063
1060
|
function trimCollinearD(path, precision, isOpen = false) {
|
|
1064
|
-
|
|
1061
|
+
InternalClipper.checkPrecision(precision);
|
|
1065
1062
|
const scale = Math.pow(10, precision);
|
|
1066
1063
|
let p = scalePath64(path, scale);
|
|
1067
1064
|
p = trimCollinear(p, isOpen);
|
|
@@ -1069,15 +1066,15 @@ var Clipper;
|
|
|
1069
1066
|
}
|
|
1070
1067
|
Clipper.trimCollinearD = trimCollinearD;
|
|
1071
1068
|
function pointInPolygon(pt, polygon) {
|
|
1072
|
-
return
|
|
1069
|
+
return InternalClipper.pointInPolygon(pt, polygon);
|
|
1073
1070
|
}
|
|
1074
1071
|
Clipper.pointInPolygon = pointInPolygon;
|
|
1075
1072
|
function pointInPolygonD(pt, polygon, precision = 2) {
|
|
1076
|
-
|
|
1073
|
+
InternalClipper.checkPrecision(precision);
|
|
1077
1074
|
const scale = Math.pow(10, precision);
|
|
1078
|
-
const p =
|
|
1075
|
+
const p = Point64Utils.fromPointD(PointDUtils.scale(pt, scale));
|
|
1079
1076
|
const pathScaled = scalePath64(polygon, scale);
|
|
1080
|
-
return
|
|
1077
|
+
return InternalClipper.pointInPolygon(p, pathScaled);
|
|
1081
1078
|
}
|
|
1082
1079
|
Clipper.pointInPolygonD = pointInPolygonD;
|
|
1083
1080
|
function ellipse(center, radiusX, radiusY = 0, steps = 0) {
|
|
@@ -1130,5 +1127,5 @@ var Clipper;
|
|
|
1130
1127
|
return result;
|
|
1131
1128
|
}
|
|
1132
1129
|
Clipper.ellipseD = ellipseD;
|
|
1133
|
-
})(Clipper || (
|
|
1130
|
+
})(Clipper || (Clipper = {}));
|
|
1134
1131
|
//# sourceMappingURL=Clipper.js.map
|