curvy 2.0.0-alpha.14 → 2.0.0-alpha.16
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/dist/characteristic/characteristic.d.ts +21 -22
- package/dist/characteristic/index.mjs +1 -1
- package/dist/curve/cubic2d.d.ts +143 -59
- package/dist/curve/curve2d.d.ts +6 -6
- package/dist/curve/index.mjs +1 -1
- package/dist/curve/linear2d.d.ts +109 -65
- package/dist/curve/quadratic2d.d.ts +132 -51
- package/dist/curve/rationalCubic2d.d.ts +102 -62
- package/dist/dimensions.d.ts +42 -0
- package/dist/interval/index.mjs +2 -2
- package/dist/interval/interval.d.ts +190 -71
- package/dist/interval/interval2d.d.ts +65 -31
- package/dist/matrix/index.mjs +58 -41
- package/dist/matrix/index.mjs.map +1 -1
- package/dist/matrix/matrix2x2.d.ts +82 -114
- package/dist/matrix/matrix3x3.d.ts +111 -137
- package/dist/matrix/matrix4x4.d.ts +96 -102
- package/dist/matrix/traits.d.ts +10 -6
- package/dist/monotonicity/index.mjs +1 -1
- package/dist/monotonicity/monotonicity.d.ts +35 -28
- package/dist/number.d.ts +155 -131
- package/dist/number.mjs +77 -62
- package/dist/number.mjs.map +1 -1
- package/dist/path/cubic2d.d.ts +110 -43
- package/dist/path/index.mjs +72 -26
- package/dist/path/index.mjs.map +1 -1
- package/dist/path/linear2d.d.ts +99 -40
- package/dist/path/path2d.d.ts +6 -4
- package/dist/path/quadratic2d.d.ts +101 -34
- package/dist/path/rationalCubic2d.d.ts +26 -21
- package/dist/path/traits.d.ts +4 -4
- package/dist/polynomial/cubic.d.ts +150 -86
- package/dist/polynomial/index.mjs +2 -2
- package/dist/polynomial/linear.d.ts +114 -70
- package/dist/polynomial/quadratic.d.ts +143 -77
- package/dist/polynomial/traits.d.ts +5 -5
- package/dist/shared/{affine2d-Dvna84gc.mjs → affine2d-Bpn5tc1u.mjs} +46 -43
- package/dist/shared/affine2d-Bpn5tc1u.mjs.map +1 -0
- package/dist/shared/{characteristic--7nC4Q_a.mjs → characteristic-DQNPi4wd.mjs} +24 -25
- package/dist/shared/characteristic-DQNPi4wd.mjs.map +1 -0
- package/dist/shared/{cubic-BiGuAnZ0.mjs → cubic-Bly8kxxo.mjs} +58 -25
- package/dist/shared/cubic-Bly8kxxo.mjs.map +1 -0
- package/dist/shared/{interval-Dcqpo73t.mjs → interval-Dv6eHXJH.mjs} +107 -37
- package/dist/shared/interval-Dv6eHXJH.mjs.map +1 -0
- package/dist/shared/{interval2d-C2Pk66-2.mjs → interval2d-B8wt0szh.mjs} +14 -10
- package/dist/shared/interval2d-B8wt0szh.mjs.map +1 -0
- package/dist/shared/{matrix3x3.internal-Cod-r7H3.mjs → matrix3x3.internal-CFbYATcm.mjs} +2 -2
- package/dist/shared/matrix3x3.internal-CFbYATcm.mjs.map +1 -0
- package/dist/shared/{matrix4x4-BrqgYZCD.mjs → matrix4x4-DNcb1l5T.mjs} +34 -20
- package/dist/shared/matrix4x4-DNcb1l5T.mjs.map +1 -0
- package/dist/shared/{monotonicity-DNxBoC7F.mjs → monotonicity-C-lodqfb.mjs} +23 -13
- package/dist/shared/monotonicity-C-lodqfb.mjs.map +1 -0
- package/dist/shared/{quadratic-BmMqkvxx.mjs → quadratic-BBQDu0at.mjs} +85 -44
- package/dist/shared/quadratic-BBQDu0at.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-bveuGqBZ.mjs → rationalCubic2d-D9bMCQ8P.mjs} +152 -62
- package/dist/shared/rationalCubic2d-D9bMCQ8P.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-CZSwwKtS.mjs → rationalCubic2d-D_TBd-3i.mjs} +395 -203
- package/dist/shared/rationalCubic2d-D_TBd-3i.mjs.map +1 -0
- package/dist/shared/{solution-BW0BBMXI.mjs → solution-Cgq_KclT.mjs} +52 -79
- package/dist/shared/solution-Cgq_KclT.mjs.map +1 -0
- package/dist/shared/{vector2-DuA3EmfL.mjs → vector2-CrUOYb3v.mjs} +60 -30
- package/dist/shared/vector2-CrUOYb3v.mjs.map +1 -0
- package/dist/shared/{vector3-oxtggkDp.mjs → vector3-CFL7Yx16.mjs} +67 -36
- package/dist/shared/vector3-CFL7Yx16.mjs.map +1 -0
- package/dist/shared/vector3.internal-CfWHl9SG.mjs.map +1 -1
- package/dist/shared/{vector4-DGHuCvTV.mjs → vector4-syi93IOY.mjs} +41 -30
- package/dist/shared/vector4-syi93IOY.mjs.map +1 -0
- package/dist/solution/index.mjs +1 -1
- package/dist/solution/solution.d.ts +201 -93
- package/dist/splines/basis2d.d.ts +1 -1
- package/dist/splines/bezier2d.d.ts +109 -60
- package/dist/splines/cardinal2d.d.ts +52 -36
- package/dist/splines/hermite2d.d.ts +6 -6
- package/dist/splines/index.mjs +30 -28
- package/dist/splines/index.mjs.map +1 -1
- package/dist/splines/linear2d.d.ts +3 -3
- package/dist/splines/rationalBezier2d.d.ts +25 -24
- package/dist/transform/affine2d.d.ts +61 -57
- package/dist/transform/index.mjs +1 -1
- package/dist/transform/traits.d.ts +3 -3
- package/dist/utils.d.ts +114 -11
- package/dist/utils.mjs +49 -10
- package/dist/utils.mjs.map +1 -1
- package/dist/vector/index.mjs +3 -3
- package/dist/vector/vector2.d.ts +141 -74
- package/dist/vector/vector3.d.ts +114 -60
- package/dist/vector/vector4.d.ts +68 -50
- package/package.json +1 -1
- package/dist/shared/affine2d-Dvna84gc.mjs.map +0 -1
- package/dist/shared/characteristic--7nC4Q_a.mjs.map +0 -1
- package/dist/shared/cubic-BiGuAnZ0.mjs.map +0 -1
- package/dist/shared/interval-Dcqpo73t.mjs.map +0 -1
- package/dist/shared/interval2d-C2Pk66-2.mjs.map +0 -1
- package/dist/shared/matrix3x3.internal-Cod-r7H3.mjs.map +0 -1
- package/dist/shared/matrix4x4-BrqgYZCD.mjs.map +0 -1
- package/dist/shared/monotonicity-DNxBoC7F.mjs.map +0 -1
- package/dist/shared/quadratic-BmMqkvxx.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-CZSwwKtS.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-bveuGqBZ.mjs.map +0 -1
- package/dist/shared/solution-BW0BBMXI.mjs.map +0 -1
- package/dist/shared/vector2-DuA3EmfL.mjs.map +0 -1
- package/dist/shared/vector3-oxtggkDp.mjs.map +0 -1
- package/dist/shared/vector4-DGHuCvTV.mjs.map +0 -1
|
@@ -4,10 +4,11 @@ import type * as Vector4 from '../vector/vector4.ts';
|
|
|
4
4
|
/**
|
|
5
5
|
* The cubic Bézier characteristic matrix.
|
|
6
6
|
*
|
|
7
|
-
* Maps Bernstein-basis control points `(
|
|
8
|
-
* coefficients `(
|
|
9
|
-
*
|
|
10
|
-
* it produces the cubic polynomial that parameterizes
|
|
7
|
+
* Maps Bernstein-basis control points `(P0, P1, P2, P3)` to monomial cubic
|
|
8
|
+
* coefficients `(c0, c1, c2, c3)` for `c0 + c1*t + c2*t^2 + c3*t^3`. The
|
|
9
|
+
* matrix is the spline family's defining data. Combined with control
|
|
10
|
+
* points via `apply`, it produces the cubic polynomial that parameterizes
|
|
11
|
+
* the curve.
|
|
11
12
|
*
|
|
12
13
|
* @since 2.0.0
|
|
13
14
|
*/
|
|
@@ -15,8 +16,8 @@ export declare const cubicBezier: Matrix4x4.Matrix4x4;
|
|
|
15
16
|
/**
|
|
16
17
|
* The cubic Hermite characteristic matrix.
|
|
17
18
|
*
|
|
18
|
-
* Maps Hermite control data `(
|
|
19
|
-
* tangent vectors
|
|
19
|
+
* Maps Hermite control data `(P0, V0, P1, V1)`, two endpoints and two
|
|
20
|
+
* tangent vectors, to monomial cubic coefficients.
|
|
20
21
|
*
|
|
21
22
|
* @since 2.0.0
|
|
22
23
|
*/
|
|
@@ -26,7 +27,7 @@ export declare const cubicHermite: Matrix4x4.Matrix4x4;
|
|
|
26
27
|
*
|
|
27
28
|
* Maps a window of four control points to the monomial cubic coefficients
|
|
28
29
|
* of one segment of the corresponding uniform cubic B-spline. Stride-1
|
|
29
|
-
* application produces a
|
|
30
|
+
* application produces a C2 piecewise spline. The curve does not generally
|
|
30
31
|
* pass through the control points.
|
|
31
32
|
*
|
|
32
33
|
* @since 2.0.0
|
|
@@ -36,24 +37,22 @@ export declare const cubicBasisSpline: Matrix4x4.Matrix4x4;
|
|
|
36
37
|
* The cubic Cardinal spline characteristic matrix, parameterized by tension.
|
|
37
38
|
*
|
|
38
39
|
* Maps four control points to the monomial cubic coefficients of one
|
|
39
|
-
* Cardinal segment. The tension
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* shapes.
|
|
40
|
+
* Cardinal segment. The tension controls how tightly the curve hugs the
|
|
41
|
+
* control points. `0` produces straight-line segments between adjacent
|
|
42
|
+
* points, `0.5` is the Catmull-Rom variant (`cubicCatmullRom`), and
|
|
43
|
+
* higher values produce looser, more curved shapes.
|
|
44
44
|
*
|
|
45
|
-
* Cached per tension value
|
|
45
|
+
* Cached per tension value, so repeated calls with the same tension return
|
|
46
46
|
* the same matrix instance.
|
|
47
47
|
*
|
|
48
|
-
* @param tension -
|
|
48
|
+
* @param tension - How tightly the curve hugs the control points. `0` gives straight segments, `0.5` Catmull-Rom.
|
|
49
49
|
* @returns The characteristic matrix for that tension.
|
|
50
50
|
* @since 2.0.0
|
|
51
51
|
*/
|
|
52
52
|
export declare const cubicCardinal: (tension: number) => Matrix4x4.Matrix4x4;
|
|
53
53
|
/**
|
|
54
|
-
* The cubic Catmull-Rom characteristic matrix
|
|
55
|
-
*
|
|
56
|
-
* a constant.
|
|
54
|
+
* The cubic Catmull-Rom characteristic matrix: Cardinal with tension
|
|
55
|
+
* `0.5`, the most common Cardinal-family variant.
|
|
57
56
|
*
|
|
58
57
|
* @since 2.0.0
|
|
59
58
|
*/
|
|
@@ -63,14 +62,14 @@ export declare const cubicCatmullRom: Matrix4x4.Matrix4x4;
|
|
|
63
62
|
* N cubic polynomials in monomial form.
|
|
64
63
|
*
|
|
65
64
|
* Each channel is a `Vector4` packing one axis's values across the four
|
|
66
|
-
* control points: `(
|
|
65
|
+
* control points: `(v0, v1, v2, v3)`. The result tuple has the same arity
|
|
67
66
|
* as the input.
|
|
68
67
|
*
|
|
69
|
-
* The polynomial 2D spline pipeline applies this with two channels (x, y)
|
|
70
|
-
*
|
|
68
|
+
* The polynomial 2D spline pipeline applies this with two channels (x, y).
|
|
69
|
+
* The rational 2D pipeline uses three (x, y, w) where `w` is the projective
|
|
71
70
|
* denominator. Higher channel counts generalize to 3D, rational 3D, and
|
|
72
|
-
* beyond
|
|
73
|
-
* domain, only
|
|
71
|
+
* beyond, since the characteristic matrix reads nothing about the geometric
|
|
72
|
+
* domain, only how to combine four samples per channel.
|
|
74
73
|
*
|
|
75
74
|
* @param matrix - The characteristic matrix of the spline family.
|
|
76
75
|
* @param channels - One `Vector4` per output polynomial, packing the four control values for that channel.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as characteristic_exports } from "../shared/characteristic
|
|
1
|
+
import { n as characteristic_exports } from "../shared/characteristic-DQNPi4wd.mjs";
|
|
2
2
|
export { characteristic_exports as Characteristic };
|
package/dist/curve/cubic2d.d.ts
CHANGED
|
@@ -8,12 +8,11 @@ import type * as Solution from '../solution/solution.ts';
|
|
|
8
8
|
import type { Affine2d } from '../transform/affine2d.ts';
|
|
9
9
|
import type { Vector2 } from '../vector/vector2.ts';
|
|
10
10
|
import type { CubicCurve2dTypeId } from './cubic2d.internal.ts';
|
|
11
|
-
import type { Curve2dOps } from './curve2d.ts';
|
|
12
11
|
export type { Monotonic, Increasing, Decreasing } from '../polynomial/traits.ts';
|
|
13
12
|
/**
|
|
14
13
|
* A cubic curve in 2D space.
|
|
15
14
|
*
|
|
16
|
-
* All fields are readonly
|
|
15
|
+
* All fields are readonly. No operation mutates a curve.
|
|
17
16
|
*
|
|
18
17
|
* The two type parameters carry the trait sets of the curve's per-axis
|
|
19
18
|
* polynomials. Refiners check monotonicity over the unit interval `[0, 1]` —
|
|
@@ -36,14 +35,14 @@ export declare const fromPolynomials: (x: CubicPolynomial, y: CubicPolynomial) =
|
|
|
36
35
|
/**
|
|
37
36
|
* Creates a new `CubicCurve2d` instance from monomial coefficient vectors.
|
|
38
37
|
*
|
|
39
|
-
* Each argument bundles the per-axis coefficient at the given power
|
|
40
|
-
* holds the x
|
|
41
|
-
* evaluates to `c0 + c1
|
|
38
|
+
* Each argument bundles the per-axis coefficient at the given power. `c0`
|
|
39
|
+
* holds the x^0 term, `c1` holds the x^1 term, and so on. The resulting curve
|
|
40
|
+
* evaluates to `c0 + c1*t + c2*t^2 + c3*t^3` per axis.
|
|
42
41
|
*
|
|
43
|
-
* @param c0 - The x
|
|
44
|
-
* @param c1 - The x
|
|
45
|
-
* @param c2 - The x
|
|
46
|
-
* @param c3 - The x
|
|
42
|
+
* @param c0 - The x^0 coefficients (x and y).
|
|
43
|
+
* @param c1 - The x^1 coefficients (x and y).
|
|
44
|
+
* @param c2 - The x^2 coefficients (x and y).
|
|
45
|
+
* @param c3 - The x^3 coefficients (x and y).
|
|
47
46
|
* @returns A new `CubicCurve2d` instance.
|
|
48
47
|
* @since 2.0.0
|
|
49
48
|
*/
|
|
@@ -51,7 +50,7 @@ export declare const fromCoefficients: (c0: Vector2, c1: Vector2, c2: Vector2, c
|
|
|
51
50
|
/**
|
|
52
51
|
* Creates a new `CubicCurve2d` instance from cubic Bézier control points.
|
|
53
52
|
*
|
|
54
|
-
* The four arguments are the Bernstein-basis control points
|
|
53
|
+
* The four arguments are the Bernstein-basis control points. `p0` and `p3` are
|
|
55
54
|
* the curve's endpoints and `p1` and `p2` are the off-curve control handles.
|
|
56
55
|
* The implementation converts to the curve's internal monomial form in closed
|
|
57
56
|
* form.
|
|
@@ -74,38 +73,43 @@ export declare const fromBezierPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p
|
|
|
74
73
|
export declare const isCubicCurve2d: (c: unknown) => c is CubicCurve2d;
|
|
75
74
|
export declare const solve: {
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
76
|
+
* Evaluates the curve at parameter `t`.
|
|
78
77
|
*
|
|
79
|
-
* @param t - The parameter
|
|
80
|
-
* @returns A function that takes a cubic curve and returns the point
|
|
78
|
+
* @param t - The curve parameter, conventionally in `[0, 1]`.
|
|
79
|
+
* @returns A function that takes a cubic curve and returns the point at `t`.
|
|
81
80
|
* @since 1.0.0
|
|
82
81
|
*/
|
|
83
82
|
(t: number): (c: CubicCurve2d) => Vector2;
|
|
84
83
|
/**
|
|
85
|
-
*
|
|
84
|
+
* Evaluates the curve at parameter `t`.
|
|
86
85
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* `t` is not clamped. Values outside `[0, 1]` extrapolate the curve's
|
|
87
|
+
* polynomials.
|
|
88
|
+
*
|
|
89
|
+
* @param c - The cubic curve to evaluate.
|
|
90
|
+
* @param t - The curve parameter, conventionally in `[0, 1]`.
|
|
91
|
+
* @returns The point on the curve at parameter `t`.
|
|
90
92
|
* @since 1.0.0
|
|
91
93
|
*/
|
|
92
94
|
(c: CubicCurve2d, t: number): Vector2;
|
|
93
95
|
};
|
|
94
96
|
export declare const length: {
|
|
95
97
|
/**
|
|
96
|
-
* Calculates
|
|
98
|
+
* Calculates the arc length of a cubic curve over an interval of its
|
|
99
|
+
* parameter domain, approximated by numerical quadrature.
|
|
97
100
|
*
|
|
98
|
-
* @param c - The cubic curve to
|
|
99
|
-
* @param i - The interval
|
|
100
|
-
* @returns The length
|
|
101
|
+
* @param c - The cubic curve to measure.
|
|
102
|
+
* @param i - The parameter interval to measure over.
|
|
103
|
+
* @returns The arc length over the interval, to quadrature accuracy.
|
|
101
104
|
* @since 1.0.0
|
|
102
105
|
*/
|
|
103
106
|
(c: CubicCurve2d, i: Interval): number;
|
|
104
107
|
/**
|
|
105
|
-
* Calculates
|
|
108
|
+
* Calculates the arc length of a cubic curve over an interval of its
|
|
109
|
+
* parameter domain, approximated by numerical quadrature.
|
|
106
110
|
*
|
|
107
|
-
* @param i - The interval
|
|
108
|
-
* @returns A function that takes a cubic curve and returns the length
|
|
111
|
+
* @param i - The parameter interval to measure over.
|
|
112
|
+
* @returns A function that takes a cubic curve and returns the arc length.
|
|
109
113
|
* @since 1.0.0
|
|
110
114
|
*/
|
|
111
115
|
(i: Interval): (c: CubicCurve2d) => number;
|
|
@@ -113,7 +117,7 @@ export declare const length: {
|
|
|
113
117
|
export declare const solveAtX: {
|
|
114
118
|
/**
|
|
115
119
|
* Evaluates the curve's y values at a given x. Because the x polynomial is
|
|
116
|
-
* `Monotonic`, the inverse has at most one solution
|
|
120
|
+
* `Monotonic`, the inverse has at most one solution, at most one y value.
|
|
117
121
|
*
|
|
118
122
|
* @param c - The cubic curve.
|
|
119
123
|
* @param x - The x coordinate.
|
|
@@ -123,7 +127,7 @@ export declare const solveAtX: {
|
|
|
123
127
|
<XT extends Monotonic, YT>(c: CubicCurve2d<XT, YT>, x: number): Solution.AtMostOne<number>;
|
|
124
128
|
/**
|
|
125
129
|
* Evaluates the curve's y values at a given x. The result is the y values
|
|
126
|
-
* the curve passes through where x(t) = the given x
|
|
130
|
+
* the curve passes through where x(t) = the given x, up to three solutions
|
|
127
131
|
* for a cubic curve.
|
|
128
132
|
*
|
|
129
133
|
* @param c - The cubic curve.
|
|
@@ -132,7 +136,13 @@ export declare const solveAtX: {
|
|
|
132
136
|
* @since 2.0.0
|
|
133
137
|
*/
|
|
134
138
|
<XT, YT>(c: CubicCurve2d<XT, YT>, x: number): Solution.AtMostThree<number>;
|
|
135
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Evaluates the curve's y values at a given x.
|
|
141
|
+
*
|
|
142
|
+
* @param x - The x coordinate.
|
|
143
|
+
* @returns A function that takes a cubic curve and returns the y values at `x`.
|
|
144
|
+
* @since 2.0.0
|
|
145
|
+
*/
|
|
136
146
|
(x: number): {
|
|
137
147
|
<XT extends Monotonic, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostOne<number>;
|
|
138
148
|
<XT, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostThree<number>;
|
|
@@ -151,7 +161,7 @@ export declare const solveAtY: {
|
|
|
151
161
|
<XT, YT extends Monotonic>(c: CubicCurve2d<XT, YT>, y: number): Solution.AtMostOne<number>;
|
|
152
162
|
/**
|
|
153
163
|
* Evaluates the curve's x values at a given y. The result is the x values
|
|
154
|
-
* the curve passes through where y(t) = the given y
|
|
164
|
+
* the curve passes through where y(t) = the given y, up to three solutions
|
|
155
165
|
* for a cubic curve.
|
|
156
166
|
*
|
|
157
167
|
* @param c - The cubic curve.
|
|
@@ -160,7 +170,13 @@ export declare const solveAtY: {
|
|
|
160
170
|
* @since 2.0.0
|
|
161
171
|
*/
|
|
162
172
|
<XT, YT>(c: CubicCurve2d<XT, YT>, y: number): Solution.AtMostThree<number>;
|
|
163
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Evaluates the curve's x values at a given y.
|
|
175
|
+
*
|
|
176
|
+
* @param y - The y coordinate.
|
|
177
|
+
* @returns A function that takes a cubic curve and returns the x values at `y`.
|
|
178
|
+
* @since 2.0.0
|
|
179
|
+
*/
|
|
164
180
|
(y: number): {
|
|
165
181
|
<XT, YT extends Monotonic>(c: CubicCurve2d<XT, YT>): Solution.AtMostOne<number>;
|
|
166
182
|
<XT, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostThree<number>;
|
|
@@ -191,12 +207,12 @@ export declare const curvature: {
|
|
|
191
207
|
* box is tight against the curve and not just the control polygon.
|
|
192
208
|
*
|
|
193
209
|
* @param c - The cubic curve.
|
|
194
|
-
* @returns A closed `
|
|
210
|
+
* @returns A closed `Interval2d` enclosing the curve.
|
|
195
211
|
* @since 2.0.0
|
|
196
212
|
*/
|
|
197
213
|
export declare const boundingBox: (c: CubicCurve2d) => Interval2d<Closed, Closed>;
|
|
198
214
|
/**
|
|
199
|
-
* Evaluates the curve at `t = 0` in closed form
|
|
215
|
+
* Evaluates the curve at `t = 0` in closed form: `(c.x.c0, c.y.c0)`.
|
|
200
216
|
*
|
|
201
217
|
* @param c - The cubic curve.
|
|
202
218
|
* @returns The point at the start of the curve's parameter domain.
|
|
@@ -204,7 +220,7 @@ export declare const boundingBox: (c: CubicCurve2d) => Interval2d<Closed, Closed
|
|
|
204
220
|
*/
|
|
205
221
|
export declare const startPoint: (c: CubicCurve2d) => Vector2;
|
|
206
222
|
/**
|
|
207
|
-
* Evaluates the curve at `t = 1` in closed form
|
|
223
|
+
* Evaluates the curve at `t = 1` in closed form, the sum of the per-axis
|
|
208
224
|
* monomial coefficients.
|
|
209
225
|
*
|
|
210
226
|
* @param c - The cubic curve.
|
|
@@ -231,7 +247,7 @@ export declare const xRange: (c: CubicCurve2d) => Closed;
|
|
|
231
247
|
*/
|
|
232
248
|
export declare const yRange: (c: CubicCurve2d) => Closed;
|
|
233
249
|
/**
|
|
234
|
-
* Renders the curve as a single SVG path-data drawing command
|
|
250
|
+
* Renders the curve as a single SVG path-data drawing command. For a cubic
|
|
235
251
|
* curve, `C ctrl1X,ctrl1Y ctrl2X,ctrl2Y endX,endY`. Bernstein control points
|
|
236
252
|
* are recovered from the monomial coefficients in closed form. Does not
|
|
237
253
|
* include a leading `M`.
|
|
@@ -242,50 +258,127 @@ export declare const yRange: (c: CubicCurve2d) => Closed;
|
|
|
242
258
|
*/
|
|
243
259
|
export declare const toPathDataSegment: (c: CubicCurve2d) => string;
|
|
244
260
|
/**
|
|
245
|
-
*
|
|
246
|
-
* `Monotonic`
|
|
247
|
-
*
|
|
261
|
+
* Checks if the curve's x polynomial is strictly monotonic on the unit
|
|
262
|
+
* interval `[0, 1]`, adding `Monotonic` to the x-axis trait. The y-axis
|
|
263
|
+
* trait is unchanged.
|
|
248
264
|
*
|
|
265
|
+
* @param c - The cubic curve to check.
|
|
266
|
+
* @returns `true` when x is strictly monotonic on `[0, 1]`, narrowing the x-axis trait.
|
|
249
267
|
* @since 2.0.0
|
|
250
268
|
*/
|
|
251
269
|
export declare const isMonotonicX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Monotonic, YT>;
|
|
252
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Checks if the curve's x polynomial is strictly increasing on the
|
|
272
|
+
* unit interval `[0, 1]`, adding `Increasing` to the x-axis trait.
|
|
273
|
+
* The y-axis trait is unchanged.
|
|
274
|
+
*
|
|
275
|
+
* @param c - The cubic curve to check.
|
|
276
|
+
* @returns `true` when x is strictly increasing on `[0, 1]`, narrowing the x-axis trait.
|
|
277
|
+
* @since 2.0.0
|
|
278
|
+
*/
|
|
253
279
|
export declare const isIncreasingX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Increasing, YT>;
|
|
254
|
-
/**
|
|
280
|
+
/**
|
|
281
|
+
* Checks if the curve's x polynomial is strictly decreasing on the
|
|
282
|
+
* unit interval `[0, 1]`, adding `Decreasing` to the x-axis trait.
|
|
283
|
+
* The y-axis trait is unchanged.
|
|
284
|
+
*
|
|
285
|
+
* @param c - The cubic curve to check.
|
|
286
|
+
* @returns `true` when x is strictly decreasing on `[0, 1]`, narrowing the x-axis trait.
|
|
287
|
+
* @since 2.0.0
|
|
288
|
+
*/
|
|
255
289
|
export declare const isDecreasingX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Decreasing, YT>;
|
|
256
290
|
/**
|
|
257
|
-
*
|
|
258
|
-
* `Monotonic
|
|
291
|
+
* Checks if the curve's y polynomial is strictly monotonic on the unit
|
|
292
|
+
* interval `[0, 1]`, adding `Monotonic` to the y-axis trait. The x-axis
|
|
293
|
+
* trait is unchanged.
|
|
259
294
|
*
|
|
295
|
+
* @param c - The cubic curve to check.
|
|
296
|
+
* @returns `true` when y is strictly monotonic on `[0, 1]`, narrowing the y-axis trait.
|
|
260
297
|
* @since 2.0.0
|
|
261
298
|
*/
|
|
262
299
|
export declare const isMonotonicY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Monotonic>;
|
|
263
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* Checks if the curve's y polynomial is strictly increasing on the
|
|
302
|
+
* unit interval `[0, 1]`, adding `Increasing` to the y-axis trait.
|
|
303
|
+
* The x-axis trait is unchanged.
|
|
304
|
+
*
|
|
305
|
+
* @param c - The cubic curve to check.
|
|
306
|
+
* @returns `true` when y is strictly increasing on `[0, 1]`, narrowing the y-axis trait.
|
|
307
|
+
* @since 2.0.0
|
|
308
|
+
*/
|
|
264
309
|
export declare const isIncreasingY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Increasing>;
|
|
265
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Checks if the curve's y polynomial is strictly decreasing on the
|
|
312
|
+
* unit interval `[0, 1]`, adding `Decreasing` to the y-axis trait.
|
|
313
|
+
* The x-axis trait is unchanged.
|
|
314
|
+
*
|
|
315
|
+
* @param c - The cubic curve to check.
|
|
316
|
+
* @returns `true` when y is strictly decreasing on `[0, 1]`, narrowing the y-axis trait.
|
|
317
|
+
* @since 2.0.0
|
|
318
|
+
*/
|
|
266
319
|
export declare const isDecreasingY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Decreasing>;
|
|
267
320
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
321
|
+
* Checks if both the x and y polynomials are strictly monotonic on the
|
|
322
|
+
* unit interval `[0, 1]`, adding `Monotonic` to both axes' traits.
|
|
270
323
|
*
|
|
324
|
+
* @param c - The cubic curve to check.
|
|
325
|
+
* @returns `true` when both axes are strictly monotonic on `[0, 1]`, narrowing both traits.
|
|
271
326
|
* @since 2.0.0
|
|
272
327
|
*/
|
|
273
328
|
export declare const isMonotonic: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Monotonic, YT & Monotonic>;
|
|
274
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Checks if both the x and y polynomials are strictly increasing on
|
|
331
|
+
* the unit interval `[0, 1]`, adding `Increasing` to both axes' traits.
|
|
332
|
+
*
|
|
333
|
+
* @param c - The cubic curve to check.
|
|
334
|
+
* @returns `true` when both axes are strictly increasing on `[0, 1]`, narrowing both traits.
|
|
335
|
+
* @since 2.0.0
|
|
336
|
+
*/
|
|
275
337
|
export declare const isIncreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Increasing, YT & Increasing>;
|
|
276
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Checks if both the x and y polynomials are strictly decreasing on
|
|
340
|
+
* the unit interval `[0, 1]`, adding `Decreasing` to both axes' traits.
|
|
341
|
+
*
|
|
342
|
+
* @param c - The cubic curve to check.
|
|
343
|
+
* @returns `true` when both axes are strictly decreasing on `[0, 1]`, narrowing both traits.
|
|
344
|
+
* @since 2.0.0
|
|
345
|
+
*/
|
|
277
346
|
export declare const isDecreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Decreasing, YT & Decreasing>;
|
|
278
|
-
/**
|
|
347
|
+
/**
|
|
348
|
+
* Asserts that both axes are strictly monotonic on the unit interval
|
|
349
|
+
* `[0, 1]`, throwing on failure.
|
|
350
|
+
*
|
|
351
|
+
* @param c - The cubic curve to assert against.
|
|
352
|
+
* @returns The same curve, with `Monotonic` on both axes' traits.
|
|
353
|
+
* @throws `Error` when either axis fails the check.
|
|
354
|
+
* @since 2.0.0
|
|
355
|
+
*/
|
|
279
356
|
export declare const asMonotonic: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Monotonic, YT & Monotonic>;
|
|
280
|
-
/**
|
|
357
|
+
/**
|
|
358
|
+
* Asserts that both axes are strictly increasing on the unit interval
|
|
359
|
+
* `[0, 1]`, throwing on failure.
|
|
360
|
+
*
|
|
361
|
+
* @param c - The cubic curve to assert against.
|
|
362
|
+
* @returns The same curve, with `Increasing` on both axes' traits.
|
|
363
|
+
* @throws `Error` when either axis fails the check.
|
|
364
|
+
* @since 2.0.0
|
|
365
|
+
*/
|
|
281
366
|
export declare const asIncreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Increasing, YT & Increasing>;
|
|
282
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* Asserts that both axes are strictly decreasing on the unit interval
|
|
369
|
+
* `[0, 1]`, throwing on failure.
|
|
370
|
+
*
|
|
371
|
+
* @param c - The cubic curve to assert against.
|
|
372
|
+
* @returns The same curve, with `Decreasing` on both axes' traits.
|
|
373
|
+
* @throws `Error` when either axis fails the check.
|
|
374
|
+
* @since 2.0.0
|
|
375
|
+
*/
|
|
283
376
|
export declare const asDecreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Decreasing, YT & Decreasing>;
|
|
284
377
|
export declare const transform: {
|
|
285
378
|
/**
|
|
286
379
|
* Applies an `Affine2d` transform to a `CubicCurve2d`, returning a new
|
|
287
380
|
* curve whose image is the affine image of the original. Internally the
|
|
288
|
-
* transformation works directly on monomial coefficients
|
|
381
|
+
* transformation works directly on monomial coefficients. `c0` receives
|
|
289
382
|
* the full affine, `c1`/`c2`/`c3` receive only the linear part.
|
|
290
383
|
*
|
|
291
384
|
* @param c - The cubic curve.
|
|
@@ -303,12 +396,3 @@ export declare const transform: {
|
|
|
303
396
|
*/
|
|
304
397
|
(a: Affine2d): (c: CubicCurve2d) => CubicCurve2d;
|
|
305
398
|
};
|
|
306
|
-
/**
|
|
307
|
-
* The {@link Curve2dOps} bundle for `CubicCurve2d`. Used by `CubicPath2d`
|
|
308
|
-
* to wire up the path-level operation surface. The `solveAtX` / `solveAtY`
|
|
309
|
-
* entries narrow the curve's potentially-3-element result to `AtMostOne` —
|
|
310
|
-
* path callers enforce that via the path's `MonotonicX`/`MonotonicY` brand.
|
|
311
|
-
*
|
|
312
|
-
* @since 2.0.0
|
|
313
|
-
*/
|
|
314
|
-
export declare const Ops: Curve2dOps<CubicCurve2d>;
|
package/dist/curve/curve2d.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ import type { Vector2 } from '../vector/vector2.ts';
|
|
|
10
10
|
* instance which the corresponding path module passes to
|
|
11
11
|
* `Path2d.make(ops)` to derive its operation surface.
|
|
12
12
|
*
|
|
13
|
-
* The interface
|
|
14
|
-
*
|
|
13
|
+
* The interface stays small. Anything that isn't shared structurally
|
|
14
|
+
* across curve degrees stays on the per-degree module.
|
|
15
15
|
*
|
|
16
16
|
* @since 2.0.0
|
|
17
17
|
*/
|
|
18
18
|
export interface Curve2dOps<C> {
|
|
19
19
|
/**
|
|
20
|
-
* Evaluate the curve at parameter `t
|
|
20
|
+
* Evaluate the curve at parameter `t in [0, 1]`.
|
|
21
21
|
*/
|
|
22
22
|
solve(c: C, t: number): Vector2;
|
|
23
23
|
/**
|
|
@@ -42,11 +42,11 @@ export interface Curve2dOps<C> {
|
|
|
42
42
|
*/
|
|
43
43
|
solveAtX(c: C, x: number): Solution.AtMostOne<number>;
|
|
44
44
|
/**
|
|
45
|
-
* y-axis analog of
|
|
45
|
+
* y-axis analog of `solveAtX`.
|
|
46
46
|
*/
|
|
47
47
|
solveAtY(c: C, y: number): Solution.AtMostOne<number>;
|
|
48
48
|
/**
|
|
49
|
-
* SVG path-data drawing command for one segment (`L
|
|
49
|
+
* SVG path-data drawing command for one segment (`L ...`, `Q ...`, `C ...`),
|
|
50
50
|
* without a leading `M`. Move-insertion is decided by the path-level
|
|
51
51
|
* `toPathData` based on continuity with the previous segment.
|
|
52
52
|
*/
|
|
@@ -71,7 +71,7 @@ export interface Curve2dOps<C> {
|
|
|
71
71
|
* Apply an affine transform to the curve, returning a new curve whose
|
|
72
72
|
* geometric image is the affine image of the original.
|
|
73
73
|
*
|
|
74
|
-
* For non-rational coefficient-form curves this is per-coefficient
|
|
74
|
+
* For non-rational coefficient-form curves this is per-coefficient. The
|
|
75
75
|
* constant coefficient receives the full affine, and all higher-degree
|
|
76
76
|
* coefficients receive only the linear part. For rational curves the
|
|
77
77
|
* translation is folded into the numerator polynomials weighted by the
|
package/dist/curve/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as rationalCubic2d_exports, m as quadratic2d_exports, s as cubic2d_exports, v as linear2d_exports } from "../shared/rationalCubic2d-D_TBd-3i.mjs";
|
|
2
2
|
export { cubic2d_exports as CubicCurve2d, linear2d_exports as LinearCurve2d, quadratic2d_exports as QuadraticCurve2d, rationalCubic2d_exports as RationalCubicCurve2d };
|