@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:18Z
3
+ - **Last updated**: 2024-05-08T18:24:32Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
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
- res[res.length - 1].push(b);
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
- res[res.length - 1].push(first[1]);
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
@@ -9,8 +9,7 @@ const liangBarsky2 = (a, b, min, max, ca = [], cb = []) => {
9
9
  max[0],
10
10
  max[1]
11
11
  );
12
- if (!res)
13
- return;
12
+ if (!res) return;
14
13
  ca[0] = res[0];
15
14
  ca[1] = res[1];
16
15
  cb[0] = res[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom-clip-line",
3
- "version": "2.3.87",
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.1",
40
- "@thi.ng/geom-isec": "^3.0.8",
41
- "@thi.ng/vectors": "^7.10.29"
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.0",
45
- "esbuild": "^0.20.2",
46
- "typedoc": "^0.25.12",
47
- "typescript": "^5.4.3"
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": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
90
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
91
91
  }