@thi.ng/geom-splines 2.2.13 → 2.2.15
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 +1 -1
- 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 +10 -10
- package/quadratic-closest-point.d.ts +5 -6
- package/quadratic-closest-point.js +5 -6
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -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. This is a support package for [@thi.ng/geom](https://github.com/thi-ng/umbrella/tree/develop/packages/geom).
|
|
28
28
|
|
|
29
29
|
Current implementations partially based on
|
|
30
30
|
[toxiclibs](http://toxiclibs.org) (Java) and Clojure version of
|
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.15",
|
|
4
4
|
"description": "nD cubic & quadratic curve analysis, conversion, interpolation, splitting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.6.
|
|
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.2",
|
|
38
|
+
"@thi.ng/checks": "^3.3.6",
|
|
39
|
+
"@thi.ng/geom-api": "^3.3.23",
|
|
40
|
+
"@thi.ng/geom-arc": "^2.1.41",
|
|
41
|
+
"@thi.ng/geom-resample": "^2.1.41",
|
|
42
|
+
"@thi.ng/math": "^5.3.18",
|
|
43
|
+
"@thi.ng/vectors": "^7.5.29"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@microsoft/api-extractor": "^7.33.7",
|
|
47
|
-
"@thi.ng/testament": "^0.3.
|
|
47
|
+
"@thi.ng/testament": "^0.3.8",
|
|
48
48
|
"rimraf": "^3.0.2",
|
|
49
49
|
"tools": "^0.0.1",
|
|
50
50
|
"typedoc": "^0.23.22",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"geom-subdiv-curve"
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\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
|