curvy 2.0.0-alpha.15 → 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 -49
- package/dist/curve/curve2d.d.ts +6 -6
- package/dist/curve/index.mjs +1 -1
- package/dist/curve/linear2d.d.ts +109 -56
- package/dist/curve/quadratic2d.d.ts +132 -40
- 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-CZiP8nIq.mjs → rationalCubic2d-D9bMCQ8P.mjs} +152 -62
- package/dist/shared/rationalCubic2d-D9bMCQ8P.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-gM7VeiiT.mjs → rationalCubic2d-D_TBd-3i.mjs} +332 -134
- 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-CZiP8nIq.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-gM7VeiiT.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
|
@@ -12,7 +12,7 @@ export type { Monotonic, Increasing, Decreasing } from '../polynomial/traits.ts'
|
|
|
12
12
|
/**
|
|
13
13
|
* A cubic curve in 2D space.
|
|
14
14
|
*
|
|
15
|
-
* All fields are readonly
|
|
15
|
+
* All fields are readonly. No operation mutates a curve.
|
|
16
16
|
*
|
|
17
17
|
* The two type parameters carry the trait sets of the curve's per-axis
|
|
18
18
|
* polynomials. Refiners check monotonicity over the unit interval `[0, 1]` —
|
|
@@ -35,14 +35,14 @@ export declare const fromPolynomials: (x: CubicPolynomial, y: CubicPolynomial) =
|
|
|
35
35
|
/**
|
|
36
36
|
* Creates a new `CubicCurve2d` instance from monomial coefficient vectors.
|
|
37
37
|
*
|
|
38
|
-
* Each argument bundles the per-axis coefficient at the given power
|
|
39
|
-
* holds the x
|
|
40
|
-
* 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.
|
|
41
41
|
*
|
|
42
|
-
* @param c0 - The x
|
|
43
|
-
* @param c1 - The x
|
|
44
|
-
* @param c2 - The x
|
|
45
|
-
* @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).
|
|
46
46
|
* @returns A new `CubicCurve2d` instance.
|
|
47
47
|
* @since 2.0.0
|
|
48
48
|
*/
|
|
@@ -50,7 +50,7 @@ export declare const fromCoefficients: (c0: Vector2, c1: Vector2, c2: Vector2, c
|
|
|
50
50
|
/**
|
|
51
51
|
* Creates a new `CubicCurve2d` instance from cubic Bézier control points.
|
|
52
52
|
*
|
|
53
|
-
* The four arguments are the Bernstein-basis control points
|
|
53
|
+
* The four arguments are the Bernstein-basis control points. `p0` and `p3` are
|
|
54
54
|
* the curve's endpoints and `p1` and `p2` are the off-curve control handles.
|
|
55
55
|
* The implementation converts to the curve's internal monomial form in closed
|
|
56
56
|
* form.
|
|
@@ -73,38 +73,43 @@ export declare const fromBezierPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p
|
|
|
73
73
|
export declare const isCubicCurve2d: (c: unknown) => c is CubicCurve2d;
|
|
74
74
|
export declare const solve: {
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Evaluates the curve at parameter `t`.
|
|
77
77
|
*
|
|
78
|
-
* @param t - The parameter
|
|
79
|
-
* @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`.
|
|
80
80
|
* @since 1.0.0
|
|
81
81
|
*/
|
|
82
82
|
(t: number): (c: CubicCurve2d) => Vector2;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* Evaluates the curve at parameter `t`.
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
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`.
|
|
89
92
|
* @since 1.0.0
|
|
90
93
|
*/
|
|
91
94
|
(c: CubicCurve2d, t: number): Vector2;
|
|
92
95
|
};
|
|
93
96
|
export declare const length: {
|
|
94
97
|
/**
|
|
95
|
-
* Calculates
|
|
98
|
+
* Calculates the arc length of a cubic curve over an interval of its
|
|
99
|
+
* parameter domain, approximated by numerical quadrature.
|
|
96
100
|
*
|
|
97
|
-
* @param c - The cubic curve to
|
|
98
|
-
* @param i - The interval
|
|
99
|
-
* @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.
|
|
100
104
|
* @since 1.0.0
|
|
101
105
|
*/
|
|
102
106
|
(c: CubicCurve2d, i: Interval): number;
|
|
103
107
|
/**
|
|
104
|
-
* Calculates
|
|
108
|
+
* Calculates the arc length of a cubic curve over an interval of its
|
|
109
|
+
* parameter domain, approximated by numerical quadrature.
|
|
105
110
|
*
|
|
106
|
-
* @param i - The interval
|
|
107
|
-
* @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.
|
|
108
113
|
* @since 1.0.0
|
|
109
114
|
*/
|
|
110
115
|
(i: Interval): (c: CubicCurve2d) => number;
|
|
@@ -112,7 +117,7 @@ export declare const length: {
|
|
|
112
117
|
export declare const solveAtX: {
|
|
113
118
|
/**
|
|
114
119
|
* Evaluates the curve's y values at a given x. Because the x polynomial is
|
|
115
|
-
* `Monotonic`, the inverse has at most one solution
|
|
120
|
+
* `Monotonic`, the inverse has at most one solution, at most one y value.
|
|
116
121
|
*
|
|
117
122
|
* @param c - The cubic curve.
|
|
118
123
|
* @param x - The x coordinate.
|
|
@@ -122,7 +127,7 @@ export declare const solveAtX: {
|
|
|
122
127
|
<XT extends Monotonic, YT>(c: CubicCurve2d<XT, YT>, x: number): Solution.AtMostOne<number>;
|
|
123
128
|
/**
|
|
124
129
|
* Evaluates the curve's y values at a given x. The result is the y values
|
|
125
|
-
* 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
|
|
126
131
|
* for a cubic curve.
|
|
127
132
|
*
|
|
128
133
|
* @param c - The cubic curve.
|
|
@@ -131,7 +136,13 @@ export declare const solveAtX: {
|
|
|
131
136
|
* @since 2.0.0
|
|
132
137
|
*/
|
|
133
138
|
<XT, YT>(c: CubicCurve2d<XT, YT>, x: number): Solution.AtMostThree<number>;
|
|
134
|
-
/**
|
|
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
|
+
*/
|
|
135
146
|
(x: number): {
|
|
136
147
|
<XT extends Monotonic, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostOne<number>;
|
|
137
148
|
<XT, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostThree<number>;
|
|
@@ -150,7 +161,7 @@ export declare const solveAtY: {
|
|
|
150
161
|
<XT, YT extends Monotonic>(c: CubicCurve2d<XT, YT>, y: number): Solution.AtMostOne<number>;
|
|
151
162
|
/**
|
|
152
163
|
* Evaluates the curve's x values at a given y. The result is the x values
|
|
153
|
-
* 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
|
|
154
165
|
* for a cubic curve.
|
|
155
166
|
*
|
|
156
167
|
* @param c - The cubic curve.
|
|
@@ -159,7 +170,13 @@ export declare const solveAtY: {
|
|
|
159
170
|
* @since 2.0.0
|
|
160
171
|
*/
|
|
161
172
|
<XT, YT>(c: CubicCurve2d<XT, YT>, y: number): Solution.AtMostThree<number>;
|
|
162
|
-
/**
|
|
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
|
+
*/
|
|
163
180
|
(y: number): {
|
|
164
181
|
<XT, YT extends Monotonic>(c: CubicCurve2d<XT, YT>): Solution.AtMostOne<number>;
|
|
165
182
|
<XT, YT>(c: CubicCurve2d<XT, YT>): Solution.AtMostThree<number>;
|
|
@@ -190,12 +207,12 @@ export declare const curvature: {
|
|
|
190
207
|
* box is tight against the curve and not just the control polygon.
|
|
191
208
|
*
|
|
192
209
|
* @param c - The cubic curve.
|
|
193
|
-
* @returns A closed `
|
|
210
|
+
* @returns A closed `Interval2d` enclosing the curve.
|
|
194
211
|
* @since 2.0.0
|
|
195
212
|
*/
|
|
196
213
|
export declare const boundingBox: (c: CubicCurve2d) => Interval2d<Closed, Closed>;
|
|
197
214
|
/**
|
|
198
|
-
* 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)`.
|
|
199
216
|
*
|
|
200
217
|
* @param c - The cubic curve.
|
|
201
218
|
* @returns The point at the start of the curve's parameter domain.
|
|
@@ -203,7 +220,7 @@ export declare const boundingBox: (c: CubicCurve2d) => Interval2d<Closed, Closed
|
|
|
203
220
|
*/
|
|
204
221
|
export declare const startPoint: (c: CubicCurve2d) => Vector2;
|
|
205
222
|
/**
|
|
206
|
-
* 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
|
|
207
224
|
* monomial coefficients.
|
|
208
225
|
*
|
|
209
226
|
* @param c - The cubic curve.
|
|
@@ -230,7 +247,7 @@ export declare const xRange: (c: CubicCurve2d) => Closed;
|
|
|
230
247
|
*/
|
|
231
248
|
export declare const yRange: (c: CubicCurve2d) => Closed;
|
|
232
249
|
/**
|
|
233
|
-
* 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
|
|
234
251
|
* curve, `C ctrl1X,ctrl1Y ctrl2X,ctrl2Y endX,endY`. Bernstein control points
|
|
235
252
|
* are recovered from the monomial coefficients in closed form. Does not
|
|
236
253
|
* include a leading `M`.
|
|
@@ -241,50 +258,127 @@ export declare const yRange: (c: CubicCurve2d) => Closed;
|
|
|
241
258
|
*/
|
|
242
259
|
export declare const toPathDataSegment: (c: CubicCurve2d) => string;
|
|
243
260
|
/**
|
|
244
|
-
*
|
|
245
|
-
* `Monotonic`
|
|
246
|
-
*
|
|
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.
|
|
247
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.
|
|
248
267
|
* @since 2.0.0
|
|
249
268
|
*/
|
|
250
269
|
export declare const isMonotonicX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Monotonic, YT>;
|
|
251
|
-
/**
|
|
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
|
+
*/
|
|
252
279
|
export declare const isIncreasingX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Increasing, YT>;
|
|
253
|
-
/**
|
|
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
|
+
*/
|
|
254
289
|
export declare const isDecreasingX: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Decreasing, YT>;
|
|
255
290
|
/**
|
|
256
|
-
*
|
|
257
|
-
* `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.
|
|
258
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.
|
|
259
297
|
* @since 2.0.0
|
|
260
298
|
*/
|
|
261
299
|
export declare const isMonotonicY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Monotonic>;
|
|
262
|
-
/**
|
|
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
|
+
*/
|
|
263
309
|
export declare const isIncreasingY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Increasing>;
|
|
264
|
-
/**
|
|
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
|
+
*/
|
|
265
319
|
export declare const isDecreasingY: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT, YT & Decreasing>;
|
|
266
320
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
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.
|
|
269
323
|
*
|
|
324
|
+
* @param c - The cubic curve to check.
|
|
325
|
+
* @returns `true` when both axes are strictly monotonic on `[0, 1]`, narrowing both traits.
|
|
270
326
|
* @since 2.0.0
|
|
271
327
|
*/
|
|
272
328
|
export declare const isMonotonic: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Monotonic, YT & Monotonic>;
|
|
273
|
-
/**
|
|
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
|
+
*/
|
|
274
337
|
export declare const isIncreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Increasing, YT & Increasing>;
|
|
275
|
-
/**
|
|
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
|
+
*/
|
|
276
346
|
export declare const isDecreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => c is CubicCurve2d<XT & Decreasing, YT & Decreasing>;
|
|
277
|
-
/**
|
|
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
|
+
*/
|
|
278
356
|
export declare const asMonotonic: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Monotonic, YT & Monotonic>;
|
|
279
|
-
/**
|
|
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
|
+
*/
|
|
280
366
|
export declare const asIncreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Increasing, YT & Increasing>;
|
|
281
|
-
/**
|
|
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
|
+
*/
|
|
282
376
|
export declare const asDecreasing: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<XT & Decreasing, YT & Decreasing>;
|
|
283
377
|
export declare const transform: {
|
|
284
378
|
/**
|
|
285
379
|
* Applies an `Affine2d` transform to a `CubicCurve2d`, returning a new
|
|
286
380
|
* curve whose image is the affine image of the original. Internally the
|
|
287
|
-
* transformation works directly on monomial coefficients
|
|
381
|
+
* transformation works directly on monomial coefficients. `c0` receives
|
|
288
382
|
* the full affine, `c1`/`c2`/`c3` receive only the linear part.
|
|
289
383
|
*
|
|
290
384
|
* @param c - The cubic curve.
|
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 { i as rationalCubic2d_exports, m as quadratic2d_exports, s as cubic2d_exports, v as linear2d_exports } from "../shared/rationalCubic2d-
|
|
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 };
|