@thi.ng/geom-splines 2.2.12 → 2.2.14
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/cubic-arc.d.ts +3 -3
- package/cubic-arc.js +3 -3
- package/cubic-bounds.js +1 -2
- package/cubic-closest-point.d.ts +5 -6
- package/cubic-closest-point.js +5 -6
- package/package.json +14 -14
- package/quadratic-closest-point.d.ts +5 -6
- package/quadratic-closest-point.js +5 -6
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-splines)
|
|
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.
|
|
@@ -24,7 +24,7 @@ This project is part of the
|
|
|
24
24
|
|
|
25
25
|
## About
|
|
26
26
|
|
|
27
|
-
nD cubic & quadratic curve analysis, conversion, interpolation, splitting
|
|
27
|
+
nD cubic & quadratic curve analysis, conversion, interpolation, splitting
|
|
28
28
|
|
|
29
29
|
Current implementations partially based on
|
|
30
30
|
[toxiclibs](http://toxiclibs.org) (Java) and Clojure version of
|
|
@@ -56,11 +56,8 @@ ES module import:
|
|
|
56
56
|
|
|
57
57
|
For Node.js REPL:
|
|
58
58
|
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
node --experimental-repl-await
|
|
62
|
-
|
|
63
|
-
> const geomSplines = await import("@thi.ng/geom-splines");
|
|
59
|
+
```js
|
|
60
|
+
const geomSplines = await import("@thi.ng/geom-splines");
|
|
64
61
|
```
|
|
65
62
|
|
|
66
63
|
Package sizes (brotli'd, pre-treeshake): ESM: 2.38 KB
|
|
@@ -126,7 +123,7 @@ each vertex corner, taking into the convexity of each poly vertex.
|
|
|
126
123
|
|
|
127
124
|
## Authors
|
|
128
125
|
|
|
129
|
-
Karsten Schmidt
|
|
126
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
130
127
|
|
|
131
128
|
If this project contributes to an academic publication, please cite it as:
|
|
132
129
|
|
|
@@ -141,4 +138,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
141
138
|
|
|
142
139
|
## License
|
|
143
140
|
|
|
144
|
-
© 2016 - 2022 Karsten Schmidt // Apache
|
|
141
|
+
© 2016 - 2022 Karsten Schmidt // Apache License 2.0
|
package/cubic-arc.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
2
2
|
/**
|
|
3
|
-
* Converts elliptic arc into a 1-4 cubic curve segments, depending on
|
|
4
|
-
*
|
|
3
|
+
* Converts elliptic arc into a 1-4 cubic curve segments, depending on arc's
|
|
4
|
+
* angle range.
|
|
5
5
|
*
|
|
6
6
|
* Partially based on:
|
|
7
|
-
*
|
|
7
|
+
* https://github.com/chromium/chromium/blob/develop/third_party/blink/renderer/core/svg/svg_path_parser.cc#L253
|
|
8
8
|
*
|
|
9
9
|
* @param pos - ellipse center
|
|
10
10
|
* @param r - ellipse radii
|
package/cubic-arc.js
CHANGED
|
@@ -5,11 +5,11 @@ import { roundEps } from "@thi.ng/math/prec";
|
|
|
5
5
|
import { magSq2 } from "@thi.ng/vectors/magsq";
|
|
6
6
|
import { cubicFromLine } from "./cubic-line.js";
|
|
7
7
|
/**
|
|
8
|
-
* Converts elliptic arc into a 1-4 cubic curve segments, depending on
|
|
9
|
-
*
|
|
8
|
+
* Converts elliptic arc into a 1-4 cubic curve segments, depending on arc's
|
|
9
|
+
* angle range.
|
|
10
10
|
*
|
|
11
11
|
* Partially based on:
|
|
12
|
-
*
|
|
12
|
+
* https://github.com/chromium/chromium/blob/develop/third_party/blink/renderer/core/svg/svg_path_parser.cc#L253
|
|
13
13
|
*
|
|
14
14
|
* @param pos - ellipse center
|
|
15
15
|
* @param r - ellipse radii
|
package/cubic-bounds.js
CHANGED
|
@@ -2,8 +2,7 @@ import { mixCubic } from "@thi.ng/math/mix";
|
|
|
2
2
|
/**
|
|
3
3
|
* Computes cubic spline bounds for a single vector component.
|
|
4
4
|
*
|
|
5
|
-
* Based on:
|
|
6
|
-
* {@link http://www.iquilezles.org/www/articles/bezierbbox/bezierbbox.htm}
|
|
5
|
+
* Based on: http://www.iquilezles.org/www/articles/bezierbbox/bezierbbox.htm
|
|
7
6
|
*
|
|
8
7
|
* @param min - min accumulator
|
|
9
8
|
* @param max - max accumulator
|
package/cubic-closest-point.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
2
2
|
/**
|
|
3
|
-
* Performs recursive search for closest point to `p` on cubic curve
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* distance than `eps` is found.
|
|
3
|
+
* Performs recursive search for closest point to `p` on cubic curve defined by
|
|
4
|
+
* control points `a`,`b`,`c`,`d`. The `res` and `recur` params are used to
|
|
5
|
+
* control the recursion behavior. If `eps` is given, the search is terminated
|
|
6
|
+
* as soon as a point with a shorter *squared* distance than `eps` is found.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* [`minError()`](https://docs.thi.ng/umbrella/math/functions/minError.html)
|
|
10
9
|
*
|
|
11
10
|
* @param p - query point
|
|
12
11
|
* @param a - control point 1
|
package/cubic-closest-point.js
CHANGED
|
@@ -2,13 +2,12 @@ import { minError } from "@thi.ng/math/min-error";
|
|
|
2
2
|
import { distSq } from "@thi.ng/vectors/distsq";
|
|
3
3
|
import { mixCubic } from "@thi.ng/vectors/mix-cubic";
|
|
4
4
|
/**
|
|
5
|
-
* Performs recursive search for closest point to `p` on cubic curve
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* distance than `eps` is found.
|
|
5
|
+
* Performs recursive search for closest point to `p` on cubic curve defined by
|
|
6
|
+
* control points `a`,`b`,`c`,`d`. The `res` and `recur` params are used to
|
|
7
|
+
* control the recursion behavior. If `eps` is given, the search is terminated
|
|
8
|
+
* as soon as a point with a shorter *squared* distance than `eps` is found.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
10
|
+
* [`minError()`](https://docs.thi.ng/umbrella/math/functions/minError.html)
|
|
12
11
|
*
|
|
13
12
|
* @param p - query point
|
|
14
13
|
* @param a - control point 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-splines",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.14",
|
|
4
4
|
"description": "nD cubic & quadratic curve analysis, conversion, interpolation, splitting",
|
|
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,21 +34,21 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/geom-api": "^3.3.
|
|
40
|
-
"@thi.ng/geom-arc": "^2.1.
|
|
41
|
-
"@thi.ng/geom-resample": "^2.1.
|
|
42
|
-
"@thi.ng/math": "^5.3.
|
|
43
|
-
"@thi.ng/vectors": "^7.5.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
|
+
"@thi.ng/checks": "^3.3.5",
|
|
39
|
+
"@thi.ng/geom-api": "^3.3.22",
|
|
40
|
+
"@thi.ng/geom-arc": "^2.1.40",
|
|
41
|
+
"@thi.ng/geom-resample": "^2.1.40",
|
|
42
|
+
"@thi.ng/math": "^5.3.17",
|
|
43
|
+
"@thi.ng/vectors": "^7.5.28"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@microsoft/api-extractor": "^7.33.
|
|
47
|
-
"@thi.ng/testament": "^0.3.
|
|
46
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
47
|
+
"@thi.ng/testament": "^0.3.7",
|
|
48
48
|
"rimraf": "^3.0.2",
|
|
49
49
|
"tools": "^0.0.1",
|
|
50
|
-
"typedoc": "^0.23.
|
|
51
|
-
"typescript": "^4.
|
|
50
|
+
"typedoc": "^0.23.22",
|
|
51
|
+
"typescript": "^4.9.4"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"2d",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"geom-subdiv-curve"
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
148
148
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
2
2
|
/**
|
|
3
|
-
* Performs recursive search for closest point to `p` on quadratic curve
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* distance than `eps` is found.
|
|
3
|
+
* Performs recursive search for closest point to `p` on quadratic curve defined
|
|
4
|
+
* by control points `a`,`b`,`c`. The `res` and `recur` params are used to
|
|
5
|
+
* control the recursion behavior. If `eps` is given, the search is terminated
|
|
6
|
+
* as soon as a point with a shorter *squared* distance than `eps` is found.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* [`minError()`](https://docs.thi.ng/umbrella/math/functions/minError.html)
|
|
10
9
|
*
|
|
11
10
|
* @param p - query point
|
|
12
11
|
* @param a - control point 1
|
|
@@ -2,13 +2,12 @@ import { minError } from "@thi.ng/math/min-error";
|
|
|
2
2
|
import { distSq } from "@thi.ng/vectors/distsq";
|
|
3
3
|
import { mixQuadratic } from "@thi.ng/vectors/mix-quadratic";
|
|
4
4
|
/**
|
|
5
|
-
* Performs recursive search for closest point to `p` on quadratic curve
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* distance than `eps` is found.
|
|
5
|
+
* Performs recursive search for closest point to `p` on quadratic curve defined
|
|
6
|
+
* by control points `a`,`b`,`c`. The `res` and `recur` params are used to
|
|
7
|
+
* control the recursion behavior. If `eps` is given, the search is terminated
|
|
8
|
+
* as soon as a point with a shorter *squared* distance than `eps` is found.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
10
|
+
* [`minError()`](https://docs.thi.ng/umbrella/math/functions/minError.html)
|
|
12
11
|
*
|
|
13
12
|
* @param p - query point
|
|
14
13
|
* @param a - control point 1
|