@thi.ng/geom-clip-line 1.2.43 → 2.0.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/CHANGELOG.md +34 -80
- package/README.md +14 -5
- package/clip-poly.d.ts +1 -1
- package/clip-poly.js +4 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +35 -24
- package/lib/index.js +0 -88
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@2.0.0...@thi.ng/geom-clip-line@2.0.1) (2021-10-13)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
9
9
|
|
|
@@ -11,113 +11,67 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.45...@thi.ng/geom-clip-line@2.0.0) (2021-10-12)
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### Build System
|
|
18
18
|
|
|
19
|
-
*
|
|
19
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
### BREAKING CHANGES
|
|
22
23
|
|
|
24
|
+
* discontinue CommonJS & UMD versions
|
|
23
25
|
|
|
26
|
+
- only ESM modules will be published from now on
|
|
27
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
28
|
+
- i.e. launch NodeJS via:
|
|
29
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
30
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
31
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [1.2.40](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.39...@thi.ng/geom-clip-line@1.2.40) (2021-08-08)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## [1.2.39](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.38...@thi.ng/geom-clip-line@1.2.39) (2021-08-04)
|
|
42
|
-
|
|
43
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## [1.2.38](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.37...@thi.ng/geom-clip-line@1.2.38) (2021-08-04)
|
|
50
|
-
|
|
51
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## [1.2.37](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.36...@thi.ng/geom-clip-line@1.2.37) (2021-07-27)
|
|
58
|
-
|
|
59
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## [1.2.36](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.35...@thi.ng/geom-clip-line@1.2.36) (2021-07-01)
|
|
66
|
-
|
|
67
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## [1.2.35](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.34...@thi.ng/geom-clip-line@1.2.35) (2021-06-08)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @thi.ng/geom-clip-line
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.1.4...@thi.ng/geom-clip-line@1.2.0) (2020-07-17)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Features
|
|
85
|
-
|
|
86
|
-
* **geom-clip-line:** add clipLineSegmentPoly() ([bec7b93](https://github.com/thi-ng/umbrella/commit/bec7b93f13450a02ca62995992d1f488d2ff24be))
|
|
87
|
-
|
|
88
|
-
|
|
33
|
+
Also:
|
|
34
|
+
- normalize/restructure/reorg all package.json files
|
|
35
|
+
- cleanup all build scripts, remove obsolete
|
|
36
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
89
37
|
|
|
90
38
|
|
|
91
39
|
|
|
92
|
-
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.0.19...@thi.ng/geom-clip-line@1.1.0) (2020-06-20)
|
|
93
40
|
|
|
94
41
|
|
|
95
|
-
### Features
|
|
96
42
|
|
|
97
|
-
|
|
43
|
+
## [1.2.42](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.2.41...@thi.ng/geom-clip-line@1.2.42) (2021-08-17)
|
|
98
44
|
|
|
45
|
+
### Bug Fixes
|
|
99
46
|
|
|
47
|
+
- **geom-clip-line:** off-by-one error in clipLinePoly() ([7898810](https://github.com/thi-ng/umbrella/commit/7898810244a7a4e4cba43c7ec0bedc095e1f4be4))
|
|
100
48
|
|
|
49
|
+
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.1.4...@thi.ng/geom-clip-line@1.2.0) (2020-07-17)
|
|
101
50
|
|
|
51
|
+
### Features
|
|
102
52
|
|
|
103
|
-
|
|
53
|
+
- **geom-clip-line:** add clipLineSegmentPoly() ([bec7b93](https://github.com/thi-ng/umbrella/commit/bec7b93f13450a02ca62995992d1f488d2ff24be))
|
|
104
54
|
|
|
55
|
+
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip-line@1.0.19...@thi.ng/geom-clip-line@1.1.0) (2020-06-20)
|
|
105
56
|
|
|
106
|
-
###
|
|
57
|
+
### Features
|
|
107
58
|
|
|
108
|
-
|
|
59
|
+
- **geom-clip-line:** add clipLinePoly(), update deps ([e096efd](https://github.com/thi-ng/umbrella/commit/e096efdbe71549a781daa5b154c47e5e0eea33d1))
|
|
109
60
|
|
|
61
|
+
# 1.0.0 (2020-02-25)
|
|
110
62
|
|
|
111
|
-
###
|
|
63
|
+
### Bug Fixes
|
|
112
64
|
|
|
113
|
-
|
|
65
|
+
- **geom-clip-line:** fix internal clip edge classifier ([c0cc9af](https://github.com/thi-ng/umbrella/commit/c0cc9af93293b3e68e9d5724874039e16bd6835e))
|
|
114
66
|
|
|
67
|
+
### Documentation
|
|
115
68
|
|
|
116
|
-
|
|
69
|
+
- **geom-clip-line:** update readme ([f78374b](https://github.com/thi-ng/umbrella/commit/f78374bec7dfe6227faaf699ab51e9a129ade922))
|
|
117
70
|
|
|
118
|
-
|
|
71
|
+
### Features
|
|
119
72
|
|
|
73
|
+
- **geom-clip-line:** extract as own pkg (from [@thi](https://github.com/thi).ng/geom-clip) ([34e3262](https://github.com/thi-ng/umbrella/commit/34e3262f8784df44f4adb729110d37513fccdfb3))
|
|
120
74
|
|
|
121
|
-
###
|
|
75
|
+
### BREAKING CHANGES
|
|
122
76
|
|
|
123
|
-
|
|
77
|
+
- **geom-clip-line:** extract as own pkg (formerly @thi.ng/geom-clip)
|
package/README.md
CHANGED
|
@@ -44,15 +44,24 @@ This package has been extracted from the former (now obsolete)
|
|
|
44
44
|
yarn add @thi.ng/geom-clip-line
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
ES module import:
|
|
48
|
+
|
|
47
49
|
```html
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/geom-clip-line"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
54
|
+
|
|
55
|
+
For Node.js REPL:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
# with flag only for < v16
|
|
59
|
+
node --experimental-repl-await
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
<script src="https://unpkg.com/@thi.ng/geom-clip-line/lib/index.umd.js" crossorigin></script>
|
|
61
|
+
> const geomClipLine = await import("@thi.ng/geom-clip-line");
|
|
53
62
|
```
|
|
54
63
|
|
|
55
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
64
|
+
Package sizes (gzipped, pre-treeshake): ESM: 549 bytes
|
|
56
65
|
|
|
57
66
|
## Dependencies
|
|
58
67
|
|
package/clip-poly.d.ts
CHANGED
package/clip-poly.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { intersectLinePolylineAll
|
|
2
|
-
import {
|
|
1
|
+
import { intersectLinePolylineAll } from "@thi.ng/geom-isec/line-poly";
|
|
2
|
+
import { pointInPolygon2 } from "@thi.ng/geom-isec/point";
|
|
3
|
+
import { intersectRayPolylineAll } from "@thi.ng/geom-isec/ray-poly";
|
|
4
|
+
import { direction } from "@thi.ng/vectors/direction";
|
|
3
5
|
/**
|
|
4
6
|
* Computes all intersection points of the infinite line defined by `a`,
|
|
5
7
|
* `b` with the given polygon. Returns an array of segments where the
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./clip-poly";
|
|
2
|
-
export * from "./liang-barsky";
|
|
1
|
+
export * from "./clip-poly.js";
|
|
2
|
+
export * from "./liang-barsky.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./clip-poly";
|
|
2
|
-
export * from "./liang-barsky";
|
|
1
|
+
export * from "./clip-poly.js";
|
|
2
|
+
export * from "./liang-barsky.js";
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-clip-line",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "2D line clipping (Liang-Barsky)",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"module": "./index.js",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"umd:main": "./lib/index.umd.js",
|
|
8
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
@@ -24,29 +24,23 @@
|
|
|
24
24
|
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn clean &&
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"build:test": "rimraf build && tsc -p test/tsconfig.json",
|
|
31
|
-
"build:check": "tsc --isolatedModules --noEmit",
|
|
32
|
-
"test": "mocha test",
|
|
33
|
-
"cover": "nyc mocha test && nyc report --reporter=lcov",
|
|
34
|
-
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
|
|
35
|
-
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf *.js *.d.ts *.map doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
36
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
|
|
37
|
-
"doc": "
|
|
38
|
-
"
|
|
31
|
+
"doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
|
|
32
|
+
"doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
|
|
33
|
+
"pub": "yarn build && yarn publish --access public",
|
|
34
|
+
"test": "testament test"
|
|
39
35
|
},
|
|
40
36
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^
|
|
42
|
-
"@thi.ng/geom-isec": "^
|
|
43
|
-
"@thi.ng/vectors": "^
|
|
37
|
+
"@thi.ng/api": "^8.0.1",
|
|
38
|
+
"@thi.ng/geom-isec": "^2.0.1",
|
|
39
|
+
"@thi.ng/vectors": "^7.0.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@thi.ng/testament": "^0.1.1"
|
|
44
43
|
},
|
|
45
|
-
"files": [
|
|
46
|
-
"*.js",
|
|
47
|
-
"*.d.ts",
|
|
48
|
-
"lib"
|
|
49
|
-
],
|
|
50
44
|
"keywords": [
|
|
51
45
|
"2d",
|
|
52
46
|
"bbox",
|
|
@@ -60,7 +54,24 @@
|
|
|
60
54
|
"publishConfig": {
|
|
61
55
|
"access": "public"
|
|
62
56
|
},
|
|
63
|
-
"
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=12.7"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"*.js",
|
|
62
|
+
"*.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"exports": {
|
|
65
|
+
".": {
|
|
66
|
+
"import": "./index.js"
|
|
67
|
+
},
|
|
68
|
+
"./clip-poly": {
|
|
69
|
+
"import": "./clip-poly.js"
|
|
70
|
+
},
|
|
71
|
+
"./liang-barsky": {
|
|
72
|
+
"import": "./liang-barsky.js"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
64
75
|
"thi.ng": {
|
|
65
76
|
"parent": "@thi.ng/geom",
|
|
66
77
|
"related": [
|
|
@@ -68,5 +79,5 @@
|
|
|
68
79
|
],
|
|
69
80
|
"year": 2013
|
|
70
81
|
},
|
|
71
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "2e6b3d7c0f4c5686c1e9bdb4902ed7d3f90bcc19"
|
|
72
83
|
}
|
package/lib/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var geomIsec = require('@thi.ng/geom-isec');
|
|
6
|
-
var vectors = require('@thi.ng/vectors');
|
|
7
|
-
|
|
8
|
-
const clipLinePoly = (a, b, pts) => {
|
|
9
|
-
const isecs = geomIsec.intersectRayPolylineAll(a, vectors.direction([], a, b), pts, true).isec;
|
|
10
|
-
return isecs ? collectSegments(isecs) : undefined;
|
|
11
|
-
};
|
|
12
|
-
const clipLineSegmentPoly = (a, b, pts) => {
|
|
13
|
-
const isecs = geomIsec.intersectLinePolylineAll(a, b, pts, true).isec;
|
|
14
|
-
const isAInside = geomIsec.pointInPolygon2(a, pts);
|
|
15
|
-
const isBInside = geomIsec.pointInPolygon2(b, pts);
|
|
16
|
-
if (!isecs) {
|
|
17
|
-
return isAInside && isBInside ? [[a, b]] : undefined;
|
|
18
|
-
}
|
|
19
|
-
isAInside && isecs.unshift(a);
|
|
20
|
-
isBInside && isecs.push(b);
|
|
21
|
-
return collectSegments(isecs);
|
|
22
|
-
};
|
|
23
|
-
const collectSegments = (isecs) => {
|
|
24
|
-
const segments = [];
|
|
25
|
-
for (let i = 0, n = isecs.length - 1; i < n; i += 2) {
|
|
26
|
-
segments.push([isecs[i], isecs[i + 1]]);
|
|
27
|
-
}
|
|
28
|
-
return segments;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const liangBarsky2 = (a, b, min, max, ca = [], cb = []) => {
|
|
32
|
-
const res = liangBarsky2Raw(a[0], a[1], b[0], b[1], min[0], min[1], max[0], max[1]);
|
|
33
|
-
if (!res)
|
|
34
|
-
return;
|
|
35
|
-
ca[0] = res[0];
|
|
36
|
-
ca[1] = res[1];
|
|
37
|
-
cb[0] = res[2];
|
|
38
|
-
cb[1] = res[3];
|
|
39
|
-
return [ca, cb, res[4], res[5]];
|
|
40
|
-
};
|
|
41
|
-
const liangBarsky2Raw = (ax, ay, bx, by, minx, miny, maxx, maxy) => {
|
|
42
|
-
const dx = bx - ax;
|
|
43
|
-
const dy = by - ay;
|
|
44
|
-
let alpha = 0;
|
|
45
|
-
let beta = 1;
|
|
46
|
-
const clip = (p, q) => {
|
|
47
|
-
if (p < 0) {
|
|
48
|
-
const r = q / p;
|
|
49
|
-
if (r > beta) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if (r > alpha) {
|
|
53
|
-
alpha = r;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (p > 0) {
|
|
57
|
-
const r = q / p;
|
|
58
|
-
if (r < alpha) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (r < beta) {
|
|
62
|
-
beta = r;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else if (q < 0) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
};
|
|
70
|
-
return clip(-dx, ax - minx) &&
|
|
71
|
-
clip(dx, maxx - ax) &&
|
|
72
|
-
clip(-dy, ay - miny) &&
|
|
73
|
-
clip(dy, maxy - ay)
|
|
74
|
-
? [
|
|
75
|
-
alpha * dx + ax,
|
|
76
|
-
alpha * dy + ay,
|
|
77
|
-
beta * dx + ax,
|
|
78
|
-
beta * dy + ay,
|
|
79
|
-
alpha,
|
|
80
|
-
beta,
|
|
81
|
-
]
|
|
82
|
-
: undefined;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
exports.clipLinePoly = clipLinePoly;
|
|
86
|
-
exports.clipLineSegmentPoly = clipLineSegmentPoly;
|
|
87
|
-
exports.liangBarsky2 = liangBarsky2;
|
|
88
|
-
exports.liangBarsky2Raw = liangBarsky2Raw;
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../clip-poly.js","../liang-barsky.js"],"sourcesContent":null,"names":["intersectRayPolylineAll","direction","intersectLinePolylineAll","pointInPolygon2"],"mappings":";;;;;;;AAWY,MAAC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK;AAC3C,IAAI,MAAM,KAAK,GAAGA,gCAAuB,CAAC,CAAC,EAAEC,iBAAS,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAClF,IAAI,OAAO,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;AACtD,EAAE;AACU,MAAC,mBAAmB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK;AAClD,IAAI,MAAM,KAAK,GAAGC,iCAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACjE,IAAI,MAAM,SAAS,GAAGC,wBAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,IAAI,MAAM,SAAS,GAAGA,wBAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,OAAO,SAAS,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAC7D,KAAK;AACL,IAAI,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACl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,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;AAC/B,QAAQ,IAAI,CAAC,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC;AAC3B,QAAQ,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;AAC5B,QAAQ,IAAI,CAAC,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC;AAC3B,UAAU;AACV,YAAY,KAAK,GAAG,EAAE,GAAG,EAAE;AAC3B,YAAY,KAAK,GAAG,EAAE,GAAG,EAAE;AAC3B,YAAY,IAAI,GAAG,EAAE,GAAG,EAAE;AAC1B,YAAY,IAAI,GAAG,EAAE,GAAG,EAAE;AAC1B,YAAY,KAAK;AACjB,YAAY,IAAI;AAChB,SAAS;AACT,UAAU,SAAS,CAAC;AACpB;;;;;;;"}
|
package/lib/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@thi.ng/geom-isec"),require("@thi.ng/vectors")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/geom-isec","@thi.ng/vectors"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.geomClipLine={}),e.thi.ng.geomIsec,e.thi.ng.vectors)}(this,(function(e,n,t){"use strict";const i=e=>{const n=[];for(let t=0,i=e.length-1;t<i;t+=2)n.push([e[t],e[t+1]]);return n},o=(e,n,t,i,o,r,s,l)=>{const c=t-e,u=i-n;let f=0,g=1;const h=(e,n)=>{if(e<0){const t=n/e;if(t>g)return!1;t>f&&(f=t)}else if(e>0){const t=n/e;if(t<f)return!1;t<g&&(g=t)}else if(n<0)return!1;return!0};return h(-c,e-o)&&h(c,s-e)&&h(-u,n-r)&&h(u,l-n)?[f*c+e,f*u+n,g*c+e,g*u+n,f,g]:void 0};e.clipLinePoly=(e,o,r)=>{const s=n.intersectRayPolylineAll(e,t.direction([],e,o),r,!0).isec;return s?i(s):void 0},e.clipLineSegmentPoly=(e,t,o)=>{const r=n.intersectLinePolylineAll(e,t,o,!0).isec,s=n.pointInPolygon2(e,o),l=n.pointInPolygon2(t,o);return r?(s&&r.unshift(e),l&&r.push(t),i(r)):s&&l?[[e,t]]:void 0},e.liangBarsky2=(e,n,t,i,r=[],s=[])=>{const l=o(e[0],e[1],n[0],n[1],t[0],t[1],i[0],i[1]);if(l)return r[0]=l[0],r[1]=l[1],s[0]=l[2],s[1]=l[3],[r,s,l[4],l[5]]},e.liangBarsky2Raw=o,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/lib/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../clip-poly.js","../liang-barsky.js"],"sourcesContent":null,"names":["intersectRayPolylineAll","direction","intersectLinePolylineAll","pointInPolygon2"],"mappings":";;;;;;AAWY,UAAC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK;IAC3C,IAAI,MAAM,KAAK,GAAGA,gCAAuB,CAAC,CAAC,EAAEC,iBAAS,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;IAClF,IAAI,OAAO,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACtD,EAAE;AACU,UAAC,mBAAmB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK;IAClD,IAAI,MAAM,KAAK,GAAGC,iCAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;IACjE,IAAI,MAAM,SAAS,GAAGC,wBAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAI,MAAM,SAAS,GAAGA,wBAAe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