curvy 2.0.0-alpha.15 → 2.0.0-alpha.17

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.
Files changed (117) hide show
  1. package/dist/characteristic/characteristic.d.ts +21 -22
  2. package/dist/characteristic/index.mjs +1 -1
  3. package/dist/curve/cubic2d.d.ts +158 -50
  4. package/dist/curve/curve2d.d.ts +14 -6
  5. package/dist/curve/index.mjs +2 -1
  6. package/dist/curve/linear2d.d.ts +124 -57
  7. package/dist/curve/quadratic2d.d.ts +147 -41
  8. package/dist/curve/rationalCubic2d.d.ts +102 -62
  9. package/dist/dimensions.d.ts +42 -0
  10. package/dist/interval/index.mjs +2 -2
  11. package/dist/interval/interval.d.ts +190 -71
  12. package/dist/interval/interval2d.d.ts +65 -31
  13. package/dist/matrix/index.mjs +58 -41
  14. package/dist/matrix/index.mjs.map +1 -1
  15. package/dist/matrix/matrix2x2.d.ts +82 -114
  16. package/dist/matrix/matrix3x3.d.ts +111 -137
  17. package/dist/matrix/matrix4x4.d.ts +96 -102
  18. package/dist/matrix/traits.d.ts +10 -6
  19. package/dist/monotonicity/index.mjs +1 -1
  20. package/dist/monotonicity/monotonicity.d.ts +35 -28
  21. package/dist/number.d.ts +155 -131
  22. package/dist/number.mjs +77 -62
  23. package/dist/number.mjs.map +1 -1
  24. package/dist/path/cubic2d.d.ts +151 -43
  25. package/dist/path/index.mjs +3 -258
  26. package/dist/path/linear2d.d.ts +140 -40
  27. package/dist/path/path2d.d.ts +8 -4
  28. package/dist/path/quadratic2d.d.ts +143 -34
  29. package/dist/path/rationalCubic2d.d.ts +26 -21
  30. package/dist/path/traits.d.ts +4 -4
  31. package/dist/piecewise/index.d.ts +4 -0
  32. package/dist/piecewise/index.mjs +409 -0
  33. package/dist/piecewise/index.mjs.map +1 -0
  34. package/dist/piecewise/piecewise.d.ts +388 -0
  35. package/dist/piecewise/piecewise.internal.d.ts +2 -0
  36. package/dist/piecewise/traits.d.ts +63 -0
  37. package/dist/polynomial/cubic.d.ts +164 -88
  38. package/dist/polynomial/index.mjs +2 -2
  39. package/dist/polynomial/linear.d.ts +128 -72
  40. package/dist/polynomial/polynomial.d.ts +47 -0
  41. package/dist/polynomial/quadratic.d.ts +157 -79
  42. package/dist/polynomial/traits.d.ts +16 -5
  43. package/dist/shared/{affine2d-Dvna84gc.mjs → affine2d-CFfmB3LQ.mjs} +46 -43
  44. package/dist/shared/affine2d-CFfmB3LQ.mjs.map +1 -0
  45. package/dist/shared/{characteristic--7nC4Q_a.mjs → characteristic-CL3bnjgJ.mjs} +24 -25
  46. package/dist/shared/characteristic-CL3bnjgJ.mjs.map +1 -0
  47. package/dist/shared/{cubic-BiGuAnZ0.mjs → cubic-EPyClIq0.mjs} +116 -26
  48. package/dist/shared/cubic-EPyClIq0.mjs.map +1 -0
  49. package/dist/shared/cubic2d-CI82mN9o.mjs +1208 -0
  50. package/dist/shared/cubic2d-CI82mN9o.mjs.map +1 -0
  51. package/dist/shared/{rationalCubic2d-CZiP8nIq.mjs → cubic2d-q1HU0uM9.mjs} +247 -194
  52. package/dist/shared/cubic2d-q1HU0uM9.mjs.map +1 -0
  53. package/dist/shared/{interval-Dcqpo73t.mjs → interval-8-erxD4h.mjs} +108 -38
  54. package/dist/shared/interval-8-erxD4h.mjs.map +1 -0
  55. package/dist/shared/{interval2d-C2Pk66-2.mjs → interval2d-CVS66YmV.mjs} +14 -10
  56. package/dist/shared/interval2d-CVS66YmV.mjs.map +1 -0
  57. package/dist/shared/{matrix3x3.internal-Cod-r7H3.mjs → matrix3x3.internal-eK-9vsoI.mjs} +2 -2
  58. package/dist/shared/matrix3x3.internal-eK-9vsoI.mjs.map +1 -0
  59. package/dist/shared/{matrix4x4-BrqgYZCD.mjs → matrix4x4-DCRpqQsP.mjs} +34 -20
  60. package/dist/shared/matrix4x4-DCRpqQsP.mjs.map +1 -0
  61. package/dist/shared/{monotonicity-DNxBoC7F.mjs → monotonicity-C-lodqfb.mjs} +23 -13
  62. package/dist/shared/monotonicity-C-lodqfb.mjs.map +1 -0
  63. package/dist/shared/{quadratic-BmMqkvxx.mjs → quadratic-DY3a1MVJ.mjs} +112 -45
  64. package/dist/shared/quadratic-DY3a1MVJ.mjs.map +1 -0
  65. package/dist/shared/quadratic2d-CXlMyyCs.mjs +326 -0
  66. package/dist/shared/quadratic2d-CXlMyyCs.mjs.map +1 -0
  67. package/dist/shared/rationalCubic2d-CGU2mYjs.mjs +103 -0
  68. package/dist/shared/rationalCubic2d-CGU2mYjs.mjs.map +1 -0
  69. package/dist/shared/rationalCubic2d-aT1o6oCm.mjs +720 -0
  70. package/dist/shared/rationalCubic2d-aT1o6oCm.mjs.map +1 -0
  71. package/dist/shared/{solution-BW0BBMXI.mjs → solution-Bi6zCdQH.mjs} +53 -80
  72. package/dist/shared/solution-Bi6zCdQH.mjs.map +1 -0
  73. package/dist/shared/{vector2-DuA3EmfL.mjs → vector2-CrUOYb3v.mjs} +60 -30
  74. package/dist/shared/vector2-CrUOYb3v.mjs.map +1 -0
  75. package/dist/shared/{vector3-oxtggkDp.mjs → vector3-CFL7Yx16.mjs} +67 -36
  76. package/dist/shared/vector3-CFL7Yx16.mjs.map +1 -0
  77. package/dist/shared/vector3.internal-CfWHl9SG.mjs.map +1 -1
  78. package/dist/shared/{vector4-DGHuCvTV.mjs → vector4-syi93IOY.mjs} +41 -30
  79. package/dist/shared/vector4-syi93IOY.mjs.map +1 -0
  80. package/dist/solution/index.mjs +1 -1
  81. package/dist/solution/solution.d.ts +201 -93
  82. package/dist/splines/basis2d.d.ts +1 -1
  83. package/dist/splines/bezier2d.d.ts +109 -60
  84. package/dist/splines/cardinal2d.d.ts +52 -36
  85. package/dist/splines/hermite2d.d.ts +6 -6
  86. package/dist/splines/index.mjs +34 -30
  87. package/dist/splines/index.mjs.map +1 -1
  88. package/dist/splines/linear2d.d.ts +3 -3
  89. package/dist/splines/rationalBezier2d.d.ts +25 -24
  90. package/dist/transform/affine2d.d.ts +61 -57
  91. package/dist/transform/index.mjs +1 -1
  92. package/dist/transform/traits.d.ts +3 -3
  93. package/dist/utils.d.ts +114 -11
  94. package/dist/utils.mjs +49 -10
  95. package/dist/utils.mjs.map +1 -1
  96. package/dist/vector/index.mjs +3 -3
  97. package/dist/vector/vector2.d.ts +141 -74
  98. package/dist/vector/vector3.d.ts +114 -60
  99. package/dist/vector/vector4.d.ts +68 -50
  100. package/package.json +5 -1
  101. package/dist/path/index.mjs.map +0 -1
  102. package/dist/shared/affine2d-Dvna84gc.mjs.map +0 -1
  103. package/dist/shared/characteristic--7nC4Q_a.mjs.map +0 -1
  104. package/dist/shared/cubic-BiGuAnZ0.mjs.map +0 -1
  105. package/dist/shared/interval-Dcqpo73t.mjs.map +0 -1
  106. package/dist/shared/interval2d-C2Pk66-2.mjs.map +0 -1
  107. package/dist/shared/matrix3x3.internal-Cod-r7H3.mjs.map +0 -1
  108. package/dist/shared/matrix4x4-BrqgYZCD.mjs.map +0 -1
  109. package/dist/shared/monotonicity-DNxBoC7F.mjs.map +0 -1
  110. package/dist/shared/quadratic-BmMqkvxx.mjs.map +0 -1
  111. package/dist/shared/rationalCubic2d-CZiP8nIq.mjs.map +0 -1
  112. package/dist/shared/rationalCubic2d-gM7VeiiT.mjs +0 -1663
  113. package/dist/shared/rationalCubic2d-gM7VeiiT.mjs.map +0 -1
  114. package/dist/shared/solution-BW0BBMXI.mjs.map +0 -1
  115. package/dist/shared/vector2-DuA3EmfL.mjs.map +0 -1
  116. package/dist/shared/vector3-oxtggkDp.mjs.map +0 -1
  117. 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 `(P₀, P₁, P₂, P₃)` to monomial cubic
8
- * coefficients `(c₀, c₁, c₂, c₃)` for `c₀ + c₁·t + c₂·t² + c₃·t³`. The matrix
9
- * IS the Bézier spline family — combined with control points (via {@link apply}),
10
- * it produces the cubic polynomial that parameterizes the curve.
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 `(P₀, V₀, P₁, V₁)` — two endpoints and two
19
- * tangent vectors — to monomial cubic coefficients.
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 C² piecewise spline; the curve does not generally
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 `s` controls how tightly the curve hugs
40
- * the control points: `s = 0` produces straight-line segments between
41
- * adjacent points, `s = 0.5` is the Catmull-Rom variant (see
42
- * {@link cubicCatmullRom}), and higher values produce looser, more curved
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 — repeated calls with the same tension return
45
+ * Cached per tension value, so repeated calls with the same tension return
46
46
  * the same matrix instance.
47
47
  *
48
- * @param tension - The tension parameter.
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 — Cardinal with tension `0.5`.
55
- * The most common Cardinal-family variant; reused widely enough to deserve
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: `(v₀, v₁, v₂, v₃)`. The result tuple has the same arity
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
- * the rational 2D pipeline uses three (x, y, w) where `w` is the projective
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 — the characteristic matrix doesn't care about the geometric
73
- * domain, only about how to combine four samples per channel.
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--7nC4Q_a.mjs";
1
+ import { n as characteristic_exports } from "../shared/characteristic-CL3bnjgJ.mjs";
2
2
  export { characteristic_exports as Characteristic };
@@ -3,7 +3,7 @@ import type { TwoDimensional } from '../dimensions.ts';
3
3
  import type { Closed, Interval } from '../interval/interval.ts';
4
4
  import type { Pipeable } from '../utils.ts';
5
5
  import type { CubicPolynomial } from '../polynomial/cubic.ts';
6
- import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts';
6
+ import type { Decreasing, Increasing, Monotonic, Reflected } from '../polynomial/traits.ts';
7
7
  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';
@@ -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 and immutable, and all operations create new instances.
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: `c0`
39
- * holds the x⁰ term, `c1` holds the x¹ term, and so on. The resulting curve
40
- * evaluates to `c0 + c1·t + c2·t² + c3·t³` per axis.
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⁰ coefficients (x and y).
43
- * @param c1 - The x¹ coefficients (x and y).
44
- * @param c2 - The x² coefficients (x and y).
45
- * @param c3 - The x³ coefficients (x and y).
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: `p0` and `p3` are
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
- * Solves the cubic curve for a given parameter t.
76
+ * Evaluates the curve at parameter `t`.
77
77
  *
78
- * @param t - The parameter value.
79
- * @returns A function that takes a cubic curve and returns the point on the curve at parameter t.
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
- * Solves the cubic curve for a given parameter t.
84
+ * Evaluates the curve at parameter `t`.
85
85
  *
86
- * @param c - The cubic curve to solve.
87
- * @param t - The parameter value.
88
- * @returns The point on the curve at parameter t.
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 (approximates) the length of a cubic curve.
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 calculate the length of.
98
- * @param i - The interval over which to calculate the length.
99
- * @returns The length of the cubic curve.
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 (approximates) the length of a cubic curve.
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 over which to calculate the length.
107
- * @returns A function that takes a cubic curve and returns the length of the cubic curve.
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 — at most one y value.
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 — up to three solutions
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
- /** @since 2.0.0 */
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 — up to three solutions
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
- /** @since 2.0.0 */
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 `Box2d` enclosing the curve.
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 — `(c.x.c0, c.y.c0)`.
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 — the sum of the per-axis
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 — for a cubic
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
- * Type-narrowing predicate: refines the curve's x-axis trait to include
245
- * `Monotonic` when the x polynomial is strictly monotonic on the unit
246
- * interval `[0, 1]`. The y-axis trait is unchanged.
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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
- * Type-narrowing predicate: refines the curve's y-axis trait to include
257
- * `Monotonic`. The x-axis trait is unchanged.
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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
- * Type-narrowing predicate: refines both axes' traits to include `Monotonic`
268
- * when both x and y polynomials are monotonic over the unit interval `[0, 1]`.
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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
- /** @since 2.0.0 */
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 — `c0` receives
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.
@@ -302,3 +396,17 @@ export declare const transform: {
302
396
  */
303
397
  (a: Affine2d): (c: CubicCurve2d) => CubicCurve2d;
304
398
  };
399
+ /**
400
+ * Reverses the curve's parameter direction, returning the curve traced from
401
+ * `t = 1` back to `t = 0`. The geometric image is identical — the same points
402
+ * in the same places — but the start and end swap and each axis's monotonic
403
+ * sense inverts: an `Increasing` axis becomes `Decreasing` and vice versa
404
+ * (`Reflected`), a bare `Monotonic` axis stays monotonic. Per component this
405
+ * reflects each coordinate polynomial about its domain midpoint
406
+ * (`CubicPolynomial.reflectDomain`).
407
+ *
408
+ * @param c - The cubic curve to reverse.
409
+ * @returns The reversed curve, its per-axis direction brands flipped.
410
+ * @since 2.0.0
411
+ */
412
+ export declare const reverse: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<Reflected<XT>, Reflected<YT>>;
@@ -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 is intentionally small — anything that isn't shared
14
- * structurally across curve degrees stays on the per-degree module.
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 ∈ [0, 1]`.
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 {@link solveAtX}.
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 …`, `Q …`, `C …`),
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,11 +71,19 @@ 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: the
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
78
78
  * denominator. Path-level callers route through this op per curve.
79
79
  */
80
80
  transform(c: C, a: Affine2d): C;
81
+ /**
82
+ * Reverse the curve's parameter direction, returning the curve traced from
83
+ * t = 1 to t = 0. The geometric image is unchanged — start and end swap and
84
+ * any monotonic axis inverts — since per component this reflects each
85
+ * coordinate polynomial about its domain midpoint (`p(1 - u)`). Path-level
86
+ * `reverse` routes through this op per curve.
87
+ */
88
+ reverse(c: C): C;
81
89
  }
@@ -1,2 +1,3 @@
1
- import { i as rationalCubic2d_exports, m as quadratic2d_exports, s as cubic2d_exports, v as linear2d_exports } from "../shared/rationalCubic2d-gM7VeiiT.mjs";
1
+ import { n as cubic2d_exports, p as quadratic2d_exports, y as linear2d_exports } from "../shared/cubic2d-CI82mN9o.mjs";
2
+ import { i as rationalCubic2d_exports } from "../shared/rationalCubic2d-aT1o6oCm.mjs";
2
3
  export { cubic2d_exports as CubicCurve2d, linear2d_exports as LinearCurve2d, quadratic2d_exports as QuadraticCurve2d, rationalCubic2d_exports as RationalCubicCurve2d };