@thi.ng/geom-clip-line 2.2.0 → 2.2.2
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/README.md +7 -10
- package/liang-barsky.d.ts +9 -10
- package/liang-barsky.js +9 -10
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/geom-clip-line)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -20,7 +20,7 @@ This project is part of the
|
|
|
20
20
|
|
|
21
21
|
## About
|
|
22
22
|
|
|
23
|
-
2D line clipping (Liang-Barsky)
|
|
23
|
+
2D line clipping (Liang-Barsky)
|
|
24
24
|
|
|
25
25
|
Current implementation is based on [toxiclibs](http://toxiclibs.org)
|
|
26
26
|
(Java) and Clojure version [thi.ng/geom-clj](http://thi.ng/geom-clj).
|
|
@@ -54,11 +54,8 @@ ES module import:
|
|
|
54
54
|
|
|
55
55
|
For Node.js REPL:
|
|
56
56
|
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
node --experimental-repl-await
|
|
60
|
-
|
|
61
|
-
> const geomClipLine = await import("@thi.ng/geom-clip-line");
|
|
57
|
+
```js
|
|
58
|
+
const geomClipLine = await import("@thi.ng/geom-clip-line");
|
|
62
59
|
```
|
|
63
60
|
|
|
64
61
|
Package sizes (brotli'd, pre-treeshake): ESM: 661 bytes
|
|
@@ -99,7 +96,7 @@ liangBarsky2(
|
|
|
99
96
|
|
|
100
97
|
## Authors
|
|
101
98
|
|
|
102
|
-
Karsten Schmidt
|
|
99
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
103
100
|
|
|
104
101
|
If this project contributes to an academic publication, please cite it as:
|
|
105
102
|
|
|
@@ -114,4 +111,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
114
111
|
|
|
115
112
|
## License
|
|
116
113
|
|
|
117
|
-
© 2013 - 2022 Karsten Schmidt // Apache
|
|
114
|
+
© 2013 - 2022 Karsten Schmidt // Apache License 2.0
|
package/liang-barsky.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { FnU8, Tuple } from "@thi.ng/api";
|
|
2
2
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
3
3
|
/**
|
|
4
|
-
* Performs Liang-Barsky clipping of the line segment with endpoints
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* outside the rect.
|
|
4
|
+
* Performs Liang-Barsky clipping of the line segment with endpoints `a`, `b`
|
|
5
|
+
* against the clipping rect defined by `min` and `max`. The optional `ca` and
|
|
6
|
+
* `cb` vectors can be given to store the result (clipped points). If omitted
|
|
7
|
+
* creates new vectors. Returns a tuple of `[ca, cb, a, b]`, where the latter
|
|
8
|
+
* two values represent the normalized distances of the clipped points relative
|
|
9
|
+
* to original given line segment. Returns `undefined` iff the line lies
|
|
10
|
+
* completely outside the rect.
|
|
12
11
|
*
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
12
|
+
* - https://en.wikipedia.org/wiki/Liang%E2%80%93Barsky_algorithm
|
|
13
|
+
* - https://github.com/thi-ng/c-thing/blob/develop/src/geom/clip/liangbarsky.c
|
|
15
14
|
*
|
|
16
15
|
* @param a - line endpoint
|
|
17
16
|
* @param b - line endpoint
|
package/liang-barsky.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Performs Liang-Barsky clipping of the line segment with endpoints
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* outside the rect.
|
|
2
|
+
* Performs Liang-Barsky clipping of the line segment with endpoints `a`, `b`
|
|
3
|
+
* against the clipping rect defined by `min` and `max`. The optional `ca` and
|
|
4
|
+
* `cb` vectors can be given to store the result (clipped points). If omitted
|
|
5
|
+
* creates new vectors. Returns a tuple of `[ca, cb, a, b]`, where the latter
|
|
6
|
+
* two values represent the normalized distances of the clipped points relative
|
|
7
|
+
* to original given line segment. Returns `undefined` iff the line lies
|
|
8
|
+
* completely outside the rect.
|
|
10
9
|
*
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
10
|
+
* - https://en.wikipedia.org/wiki/Liang%E2%80%93Barsky_algorithm
|
|
11
|
+
* - https://github.com/thi-ng/c-thing/blob/develop/src/geom/clip/liangbarsky.c
|
|
13
12
|
*
|
|
14
13
|
* @param a - line endpoint
|
|
15
14
|
* @param b - line endpoint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-clip-line",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "2D line clipping (Liang-Barsky)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
39
|
-
"@thi.ng/vectors": "^7.5.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
|
+
"@thi.ng/geom-isec": "^2.1.39",
|
|
39
|
+
"@thi.ng/vectors": "^7.5.28"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@microsoft/api-extractor": "^7.33.
|
|
43
|
-
"@thi.ng/testament": "^0.3.
|
|
42
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
43
|
+
"@thi.ng/testament": "^0.3.7",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"tools": "^0.0.1",
|
|
46
|
-
"typedoc": "^0.23.
|
|
47
|
-
"typescript": "^4.
|
|
46
|
+
"typedoc": "^0.23.22",
|
|
47
|
+
"typescript": "^4.9.4"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"2d",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
],
|
|
85
85
|
"year": 2013
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
88
88
|
}
|