@thi.ng/geom-clip-line 2.3.87 → 2.3.89
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/CHANGELOG.md +1 -1
- package/clip-poly.js +5 -10
- package/liang-barsky.js +1 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
package/clip-poly.js
CHANGED
|
@@ -24,8 +24,7 @@ const clipLineSegmentPoly = (a, b, poly) => {
|
|
|
24
24
|
};
|
|
25
25
|
const clipPolylinePoly = (pts, poly) => {
|
|
26
26
|
let res = [];
|
|
27
|
-
if (pts.length < 2)
|
|
28
|
-
return res;
|
|
27
|
+
if (pts.length < 2) return res;
|
|
29
28
|
let isAInside = pointInPolygon2(pts[0], poly);
|
|
30
29
|
for (let i = 0, n = pts.length - 1; i < n; i++) {
|
|
31
30
|
const a = pts[i];
|
|
@@ -34,20 +33,16 @@ const clipPolylinePoly = (pts, poly) => {
|
|
|
34
33
|
const isecs = intersectLinePolylineAll(a, b, poly, true).isec;
|
|
35
34
|
if (!isecs) {
|
|
36
35
|
if (isAInside && isBInside) {
|
|
37
|
-
if (res.length)
|
|
38
|
-
|
|
39
|
-
else
|
|
40
|
-
res.push([a, b]);
|
|
36
|
+
if (res.length) res[res.length - 1].push(b);
|
|
37
|
+
else res.push([a, b]);
|
|
41
38
|
}
|
|
42
39
|
} else {
|
|
43
40
|
isAInside && isecs.unshift(a);
|
|
44
41
|
isBInside && isecs.push(b);
|
|
45
42
|
const [first, ...segments] = collectSegments(isecs);
|
|
46
43
|
if (isAInside) {
|
|
47
|
-
if (res.length)
|
|
48
|
-
|
|
49
|
-
else
|
|
50
|
-
res.push(first);
|
|
44
|
+
if (res.length) res[res.length - 1].push(first[1]);
|
|
45
|
+
else res.push(first);
|
|
51
46
|
} else {
|
|
52
47
|
res.push(first);
|
|
53
48
|
}
|
package/liang-barsky.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-clip-line",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.89",
|
|
4
4
|
"description": "2D line clipping (Liang-Barsky)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/geom-isec": "^3.0
|
|
41
|
-
"@thi.ng/vectors": "^7.10.
|
|
39
|
+
"@thi.ng/api": "^8.11.2",
|
|
40
|
+
"@thi.ng/geom-isec": "^3.1.0",
|
|
41
|
+
"@thi.ng/vectors": "^7.10.31"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@microsoft/api-extractor": "^7.43.
|
|
45
|
-
"esbuild": "^0.
|
|
46
|
-
"typedoc": "^0.25.
|
|
47
|
-
"typescript": "^5.4.
|
|
44
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
45
|
+
"esbuild": "^0.21.1",
|
|
46
|
+
"typedoc": "^0.25.13",
|
|
47
|
+
"typescript": "^5.4.5"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"2d",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
],
|
|
88
88
|
"year": 2013
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
91
91
|
}
|