curvy 2.0.0-alpha.2 → 2.0.0-alpha.5

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 (98) hide show
  1. package/dist/characteristic/{index.d.mts → characteristic.d.ts} +15 -23
  2. package/dist/characteristic/index.d.ts +1 -0
  3. package/dist/characteristic/index.mjs +1 -1
  4. package/dist/curve/cubic2d.d.ts +219 -0
  5. package/dist/curve/index.d.ts +12 -0
  6. package/dist/curve/index.mjs +1 -1
  7. package/dist/curve/linear2d.d.ts +199 -0
  8. package/dist/curve/quadratic2d.d.ts +227 -0
  9. package/dist/curve/rationalCubic2d.d.ts +200 -0
  10. package/dist/dimensions.d.ts +23 -0
  11. package/dist/interval/index.d.ts +6 -0
  12. package/dist/interval/index.mjs +2 -2
  13. package/dist/interval/interval.d.ts +525 -0
  14. package/dist/interval/interval2d.d.ts +167 -0
  15. package/dist/length.d.ts +32 -0
  16. package/dist/matrix/index.d.ts +9 -0
  17. package/dist/matrix/matrix2x2.d.ts +339 -0
  18. package/dist/matrix/matrix3x3.d.ts +400 -0
  19. package/dist/matrix/matrix4x4.d.ts +443 -0
  20. package/dist/number.d.ts +276 -0
  21. package/dist/path/cubic2d.d.ts +155 -0
  22. package/dist/path/index.d.ts +12 -0
  23. package/dist/path/index.mjs +6 -6
  24. package/dist/path/index.mjs.map +1 -1
  25. package/dist/path/linear2d.d.ts +135 -0
  26. package/dist/path/quadratic2d.d.ts +127 -0
  27. package/dist/path/rationalCubic2d.d.ts +120 -0
  28. package/dist/path/traits.d.ts +31 -0
  29. package/dist/polynomial/cubic.d.ts +381 -0
  30. package/dist/polynomial/index.d.ts +9 -0
  31. package/dist/polynomial/index.mjs +2 -2
  32. package/dist/polynomial/linear.d.ts +321 -0
  33. package/dist/polynomial/monotonicity.d.ts +3 -0
  34. package/dist/polynomial/quadratic.d.ts +375 -0
  35. package/dist/polynomial/traits.d.ts +56 -0
  36. package/dist/shared/{characteristic-B9nCh_cx.mjs → characteristic-DLlhja-I.mjs} +9 -9
  37. package/dist/shared/{characteristic-B9nCh_cx.mjs.map → characteristic-DLlhja-I.mjs.map} +1 -1
  38. package/dist/shared/{cubic-CpHAx8cC.mjs → cubic-CMonq6bg.mjs} +26 -5
  39. package/dist/shared/cubic-CMonq6bg.mjs.map +1 -0
  40. package/dist/shared/{interval-05CR6eBf.mjs → interval-X1EYuf-T.mjs} +2 -2
  41. package/dist/shared/{interval-05CR6eBf.mjs.map → interval-X1EYuf-T.mjs.map} +1 -1
  42. package/dist/shared/{interval2d-8IBZnUOq.mjs → interval2d-ca0J1NMr.mjs} +8 -8
  43. package/dist/shared/{interval2d-8IBZnUOq.mjs.map → interval2d-ca0J1NMr.mjs.map} +1 -1
  44. package/dist/shared/{quadratic-CamozcFc.mjs → quadratic-DyeMtvET.mjs} +20 -2
  45. package/dist/shared/quadratic-DyeMtvET.mjs.map +1 -0
  46. package/dist/shared/{rationalCubic2d-Bys2Uory.mjs → rationalCubic2d-D658ltUM.mjs} +17 -17
  47. package/dist/shared/{rationalCubic2d-Bys2Uory.mjs.map → rationalCubic2d-D658ltUM.mjs.map} +1 -1
  48. package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs → rationalCubic2d-Vw4qGPZj.mjs} +9 -9
  49. package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs.map → rationalCubic2d-Vw4qGPZj.mjs.map} +1 -1
  50. package/dist/shared/{solution-CrtLfqEq.mjs → solution-3TDATEMn.mjs} +28 -2
  51. package/dist/shared/solution-3TDATEMn.mjs.map +1 -0
  52. package/dist/shared/{vector2-CL1HDdPr.mjs → vector2-CCuJx1rX.mjs} +6 -6
  53. package/dist/shared/{vector2-CL1HDdPr.mjs.map → vector2-CCuJx1rX.mjs.map} +1 -1
  54. package/dist/shared/{vector3-D-tv_aKL.mjs → vector3-C-qgKAjR.mjs} +2 -2
  55. package/dist/shared/{vector3-D-tv_aKL.mjs.map → vector3-C-qgKAjR.mjs.map} +1 -1
  56. package/dist/shared/{vector4-5KbjoHVj.mjs → vector4-BhOKDhD5.mjs} +2 -2
  57. package/dist/shared/{vector4-5KbjoHVj.mjs.map → vector4-BhOKDhD5.mjs.map} +1 -1
  58. package/dist/solution/index.d.ts +3 -0
  59. package/dist/solution/index.mjs +1 -1
  60. package/dist/{shared/solution-sNQ-ZVhN.d.mts → solution/solution.d.ts} +81 -68
  61. package/dist/splines/basis2d.d.ts +122 -0
  62. package/dist/splines/bezier2d.d.ts +202 -0
  63. package/dist/splines/cardinal2d.d.ts +273 -0
  64. package/dist/splines/hermite2d.d.ts +117 -0
  65. package/dist/splines/index.d.ts +15 -0
  66. package/dist/splines/index.mjs +193 -35
  67. package/dist/splines/index.mjs.map +1 -1
  68. package/dist/splines/rationalBezier2d.d.ts +148 -0
  69. package/dist/splines/util.d.ts +5 -0
  70. package/dist/utils.d.ts +73 -0
  71. package/dist/vector/index.d.ts +9 -0
  72. package/dist/vector/index.mjs +3 -3
  73. package/dist/vector/vector2.d.ts +446 -0
  74. package/dist/vector/vector3.d.ts +449 -0
  75. package/dist/vector/vector4.d.ts +253 -0
  76. package/package.json +13 -13
  77. package/dist/curve/index.d.mts +0 -2
  78. package/dist/interval/index.d.mts +0 -3
  79. package/dist/matrix/index.d.mts +0 -2
  80. package/dist/number.d.mts +0 -280
  81. package/dist/path/index.d.mts +0 -261
  82. package/dist/polynomial/index.d.mts +0 -2
  83. package/dist/shared/cubic-BajUY0JT.d.mts +0 -1100
  84. package/dist/shared/cubic-CpHAx8cC.mjs.map +0 -1
  85. package/dist/shared/interval-Dy-RMEE3.d.mts +0 -533
  86. package/dist/shared/interval2d-C2id9u31.d.mts +0 -172
  87. package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +0 -1183
  88. package/dist/shared/quadratic-CamozcFc.mjs.map +0 -1
  89. package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +0 -308
  90. package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +0 -818
  91. package/dist/shared/solution-CrtLfqEq.mjs.map +0 -1
  92. package/dist/shared/utils-MCckigYk.d.mts +0 -76
  93. package/dist/shared/vector2-DPUY3_eA.d.mts +0 -470
  94. package/dist/shared/vector3-DqeOZtOB.d.mts +0 -703
  95. package/dist/solution/index.d.mts +0 -2
  96. package/dist/splines/index.d.mts +0 -701
  97. package/dist/utils.d.mts +0 -2
  98. package/dist/vector/index.d.mts +0 -3
@@ -0,0 +1,120 @@
1
+ import type { RationalCubicCurve2d } from '../curve/rationalCubic2d';
2
+ import type { Pipeable } from '../utils';
3
+ import type { Vector2 } from '../vector/vector2';
4
+ import type { CubicPath2d } from './cubic2d';
5
+
6
+ declare const RationalCubicPath2dTypeId: unique symbol;
7
+ type RationalCubicPath2dTypeId = typeof RationalCubicPath2dTypeId;
8
+
9
+
10
+ /**
11
+ * A rational cubic path in 2D space.
12
+ *
13
+ * Holds a non-empty sequence of `RationalCubicCurve2d` segments; iteration
14
+ * yields the segments in order. The path parameter `u ∈ [0, 1]` is mapped
15
+ * uniformly across segments — `u = 0` is the start of the first segment,
16
+ * `u = 1` is the end of the last segment, and intermediate values pick a
17
+ * segment by index and a local parameter within it.
18
+ *
19
+ * Counterpart to `CubicPath2d` for curves whose evaluation includes the
20
+ * homogeneous-to-plane projection.
21
+ *
22
+ * All fields are readonly and immutable, and all operations create new instances.
23
+ *
24
+ * @since 2.0.0
25
+ */
26
+ export interface RationalCubicPath2d extends Pipeable, Iterable<RationalCubicCurve2d> {
27
+ readonly [RationalCubicPath2dTypeId]: RationalCubicPath2dTypeId;
28
+ }
29
+ /**
30
+ * Checks if a value is a `RationalCubicPath2d`.
31
+ *
32
+ * @param p - The value to check.
33
+ * @returns `true` if the value is a `RationalCubicPath2d`, `false` otherwise.
34
+ * @since 2.0.0
35
+ */
36
+ export declare const isRationalCubicPath2d: (p: unknown) => p is RationalCubicPath2d;
37
+ /**
38
+ * Creates a new `RationalCubicPath2d` from a sequence of curves.
39
+ *
40
+ * @param curves - The curves to create the path from.
41
+ * @returns A new `RationalCubicPath2d` instance.
42
+ * @since 2.0.0
43
+ */
44
+ export declare const make: (...curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d;
45
+ /**
46
+ * Creates a new `RationalCubicPath2d` from an array of curves.
47
+ *
48
+ * @param curves - The curves to create the path from.
49
+ * @returns A new `RationalCubicPath2d` instance.
50
+ * @since 2.0.0
51
+ */
52
+ export declare const fromArray: (curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d;
53
+ export declare const append: {
54
+ /**
55
+ * Appends a curve to a `RationalCubicPath2d`.
56
+ *
57
+ * @param c - The curve to append.
58
+ * @returns A function that takes a path and returns a new path with the appended curve.
59
+ * @since 2.0.0
60
+ */
61
+ (c: RationalCubicCurve2d): (p: RationalCubicPath2d) => RationalCubicPath2d;
62
+ /**
63
+ * Appends a curve to a `RationalCubicPath2d`.
64
+ *
65
+ * @param p - The path to append to.
66
+ * @param c - The curve to append.
67
+ * @returns A new path with the appended curve.
68
+ * @since 2.0.0
69
+ */
70
+ (p: RationalCubicPath2d, c: RationalCubicCurve2d): RationalCubicPath2d;
71
+ };
72
+ export declare const solve: {
73
+ /**
74
+ * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.
75
+ *
76
+ * Picks the segment containing `u` (uniform mapping across segments) and
77
+ * delegates to `RationalCubicCurve2d.solve` on that segment with the local
78
+ * parameter.
79
+ *
80
+ * @param p - The path to evaluate.
81
+ * @param u - The path parameter in `[0, 1]`.
82
+ * @returns The point on the path at parameter `u`.
83
+ * @since 2.0.0
84
+ */
85
+ (p: RationalCubicPath2d, u: number): Vector2;
86
+ /**
87
+ * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.
88
+ *
89
+ * @param u - The path parameter in `[0, 1]`.
90
+ * @returns A function that takes a path and returns the point at `u`.
91
+ * @since 2.0.0
92
+ */
93
+ (u: number): (p: RationalCubicPath2d) => Vector2;
94
+ };
95
+ export declare const approximateAsCubicPath: {
96
+ /**
97
+ * Approximates the rational cubic path as a `CubicPath2d` via per-segment
98
+ * recursive subdivision. Each input segment is split until its midpoint
99
+ * deviates from a polynomial-cubic candidate by at most `tolerance`; the
100
+ * surviving candidates are concatenated into a new path.
101
+ *
102
+ * Lossy in general — only exact when every input segment has uniform
103
+ * weights, in which case segment count is preserved. Tighter tolerance
104
+ * produces more segments.
105
+ *
106
+ * @param p - The rational cubic path to approximate.
107
+ * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.
108
+ * @returns A new `CubicPath2d` approximating the input.
109
+ * @since 2.0.0
110
+ */
111
+ (p: RationalCubicPath2d, tolerance: number): CubicPath2d;
112
+ /**
113
+ * Approximates the rational cubic path as a `CubicPath2d`.
114
+ *
115
+ * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.
116
+ * @returns A function that takes a rational path and returns its approximation.
117
+ * @since 2.0.0
118
+ */
119
+ (tolerance: number): (p: RationalCubicPath2d) => CubicPath2d;
120
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Trait brands for paths.
3
+ *
4
+ * Brands are phantom types — they exist only at the type level and carry no
5
+ * runtime data. Refiners (`isContinuous`) and assertions (`asContinuous`) on
6
+ * each path module attach these brands to the path's `Trait` parameter at the
7
+ * type level.
8
+ *
9
+ * @since 2.0.0
10
+ */
11
+ declare const ContinuousId: unique symbol;
12
+ /**
13
+ * Brand for paths whose adjacent curves connect at their join points (G⁰
14
+ * continuity). Calling `toPathData` on a `Continuous` path skips the
15
+ * per-segment discontinuity check and emits a single `M` followed by drawing
16
+ * commands.
17
+ *
18
+ * @since 2.0.0
19
+ */
20
+ export type Continuous = {
21
+ readonly [ContinuousId]: 'continuous';
22
+ };
23
+ /**
24
+ * Phantom property key used by path interfaces to hold their `Trait` type
25
+ * parameter. The runtime object never has a value at this key.
26
+ *
27
+ * @since 2.0.0
28
+ */
29
+ export declare const PathTraits: unique symbol;
30
+ export type PathTraits = typeof PathTraits;
31
+ export {};
@@ -0,0 +1,381 @@
1
+ import type { Closed, Interval } from '../interval/interval';
2
+ import type { Pipeable } from '../utils';
3
+ import type * as Solution from '../solution/solution';
4
+ import type { Vector2 } from '../vector/vector2';
5
+ import type { Vector4 } from '../vector/vector4';
6
+
7
+ import type { Monotonicity } from './monotonicity';
8
+ import type { QuadraticPolynomial } from './quadratic';
9
+ import type { Decreasing, Increasing, Monotonic, PolynomialTraits } from './traits';
10
+
11
+ declare const CubicPolynomialTypeId: unique symbol;
12
+ type CubicPolynomialTypeId = typeof CubicPolynomialTypeId;
13
+
14
+ export type { Monotonic, Increasing, Decreasing } from './traits';
15
+ /**
16
+ * A cubic polynomial.
17
+ *
18
+ * All fields are readonly and immutable, and all operations create new instances.
19
+ *
20
+ * The `Traits` type parameter is a phantom marker that accumulates trait
21
+ * brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and
22
+ * friends. A cubic is monotonic only over an interval that avoids both of its
23
+ * extrema (or globally, when c2 = c3 = 0 and c1 ≠ 0).
24
+ *
25
+ * @since 1.0.0
26
+ */
27
+ export interface CubicPolynomial<out Traits = unknown> extends Pipeable {
28
+ readonly [CubicPolynomialTypeId]: CubicPolynomialTypeId;
29
+ readonly [PolynomialTraits]: Traits;
30
+ /**
31
+ * The coefficient of the x^0 term.
32
+ */
33
+ readonly c0: number;
34
+ /**
35
+ * The coefficient of the x^1 term.
36
+ */
37
+ readonly c1: number;
38
+ /**
39
+ * The coefficient of the x^2 term.
40
+ */
41
+ readonly c2: number;
42
+ /**
43
+ * The coefficient of the x^3 term.
44
+ */
45
+ readonly c3: number;
46
+ }
47
+ /**
48
+ * Checks if a value is a `CubicPolynomial`.
49
+ *
50
+ * @param value - The value to check.
51
+ * @returns `true` if the value is a `CubicPolynomial`, `false` otherwise.
52
+ * @since 1.0.0
53
+ */
54
+ export declare const isCubicPolynomial: (value: unknown) => value is CubicPolynomial;
55
+ export declare const equals: {
56
+ /**
57
+ * Checks if two `CubicPolynomial` instances are approximately equal within
58
+ * the default absolute tolerance ({@link EPSILON}).
59
+ *
60
+ * @param a - The first polynomial.
61
+ * @param b - The second polynomial.
62
+ * @returns `true` when each pair of coefficients is within tolerance.
63
+ * @since 1.1.0
64
+ */
65
+ (a: CubicPolynomial, b: CubicPolynomial): boolean;
66
+ /**
67
+ * Checks if two `CubicPolynomial` instances are approximately equal within
68
+ * the default absolute tolerance ({@link EPSILON}).
69
+ *
70
+ * @param b - The second polynomial.
71
+ * @returns A function that takes the first polynomial and returns the comparison result.
72
+ * @since 1.1.0
73
+ */
74
+ (b: CubicPolynomial): (a: CubicPolynomial) => boolean;
75
+ };
76
+ /**
77
+ * Creates a new `CubicPolynomial` instance.
78
+ *
79
+ * @param c0 - The coefficient of the x^0 term.
80
+ * @param c1 - The coefficient of the x^1 term.
81
+ * @param c2 - The coefficient of the x^2 term.
82
+ * @param c3 - The coefficient of the x^3 term.
83
+ */
84
+ export declare const make: (c0: number, c1: number, c2: number, c3: number) => CubicPolynomial;
85
+ /**
86
+ * Creates a new `CubicPolynomial` instance from a vector.
87
+ *
88
+ * @param v - The vector to convert.
89
+ * @returns A new `CubicPolynomial` instance.
90
+ * @since 1.0.0
91
+ */
92
+ export declare const fromVector: (v: Vector4) => CubicPolynomial;
93
+ /**
94
+ * Creates a new `CubicPolynomial` that interpolates the four given points,
95
+ * treating each `Vector2` as an `(x, y)` pair. The four input `x` values must
96
+ * be distinct.
97
+ *
98
+ * @param p0 - The first point.
99
+ * @param p1 - The second point.
100
+ * @param p2 - The third point.
101
+ * @param p3 - The fourth point.
102
+ * @returns The unique cubic polynomial passing through the four points.
103
+ * @since 2.0.0
104
+ */
105
+ export declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => CubicPolynomial;
106
+ export declare const solve: {
107
+ /**
108
+ * Solves a cubic polynomial for a given value of x.
109
+ *
110
+ * @param p - The cubic polynomial to solve.
111
+ * @param x - The value of x to solve for.
112
+ * @returns The result of the polynomial evaluation at x.
113
+ * @since 1.0.0
114
+ */
115
+ (p: CubicPolynomial, x: number): number;
116
+ /**
117
+ * Solves a cubic polynomial for a given value of x.
118
+ *
119
+ * @param x - The value of x to solve for.
120
+ * @returns A function that takes a cubic polynomial and returns the result of the polynomial evaluation at x.
121
+ * @since 1.0.0
122
+ */
123
+ (x: number): (p: CubicPolynomial) => number;
124
+ };
125
+ /**
126
+ * Converts a cubic polynomial to a solver function.
127
+ *
128
+ * @param p - The cubic polynomial to convert.
129
+ * @returns A function that takes a value of x and returns the result of the polynomial evaluation at x.
130
+ * @since 1.0.0
131
+ */
132
+ export declare const toSolver: (p: CubicPolynomial) => (x: number) => number;
133
+ export declare const solveInverse: {
134
+ /**
135
+ * Solves a monotonic cubic polynomial for a given value of y. Because the
136
+ * polynomial is strictly monotonic, the inverse has at most one solution.
137
+ *
138
+ * @param p - The monotonic cubic polynomial.
139
+ * @param y - The value of y to solve for.
140
+ * @returns Zero or one solutions.
141
+ * @since 2.0.0
142
+ */
143
+ <T extends Monotonic>(p: CubicPolynomial<T>, y: number): Solution.AtMostOne<number>;
144
+ /**
145
+ * Solves a cubic polynomial for a given value of y.
146
+ *
147
+ * @param p - The cubic polynomial to solve.
148
+ * @param y - The value of y to solve for.
149
+ * @returns The roots of the polynomial equation p(x) = y.
150
+ * @since 1.0.0
151
+ */
152
+ <T>(p: CubicPolynomial<T>, y: number): Solution.AtMostThree<number>;
153
+ /**
154
+ * Solves a cubic polynomial for a given value of y.
155
+ *
156
+ * @param y - The value of y to solve for.
157
+ * @returns A function that takes a cubic polynomial and returns the roots
158
+ * of the polynomial equation p(x) = y. Tightens to `Solution.AtMostOne<number>` for
159
+ * monotonic inputs.
160
+ * @since 1.0.0
161
+ */
162
+ (y: number): {
163
+ <T extends Monotonic>(p: CubicPolynomial<T>): Solution.AtMostOne<number>;
164
+ <T>(p: CubicPolynomial<T>): Solution.AtMostThree<number>;
165
+ };
166
+ };
167
+ /**
168
+ * Converts a cubic polynomial to an inverse solver function.
169
+ *
170
+ * @param p - The cubic polynomial to convert.
171
+ * @returns A function that takes a value of y and returns the roots of the polynomial equation p(x) = y.
172
+ * @since 1.0.0
173
+ */
174
+ export declare const toInverseSolver: (p: CubicPolynomial) => (y: number) => Solution.AtMostThree<number>;
175
+ /**
176
+ * Returns the polynomial's coefficients as a tuple `[c0, c1, c2, c3]`.
177
+ *
178
+ * @param p - The cubic polynomial.
179
+ * @returns The coefficients in monomial order.
180
+ * @since 2.0.0
181
+ */
182
+ export declare const coefficients: (p: CubicPolynomial) => readonly [number, number, number, number];
183
+ /**
184
+ * Calculates the derivative of a cubic polynomial.
185
+ *
186
+ * @param p - The cubic polynomial to differentiate.
187
+ * @returns The derivative of the cubic polynomial.
188
+ * @since 1.0.0
189
+ */
190
+ export declare const derivative: (p: CubicPolynomial) => QuadraticPolynomial;
191
+ export declare const subdivide: {
192
+ /**
193
+ * Subdivides a cubic polynomial at parameter `t ∈ (0, 1)` into two new
194
+ * cubic polynomials. The first polynomial's evaluation on `[0, 1]` matches
195
+ * the original's on `[0, t]`; the second matches the original's on
196
+ * `[t, 1]`. Equivalent to de Casteljau subdivision in Bernstein form,
197
+ * performed directly in monomial form.
198
+ *
199
+ * @param p - The cubic polynomial to subdivide.
200
+ * @param t - The split parameter; must be in the open interval `(0, 1)`.
201
+ * @returns A `[left, right]` tuple of cubic polynomials.
202
+ * @since 2.0.0
203
+ */
204
+ (p: CubicPolynomial, t: number): [CubicPolynomial, CubicPolynomial];
205
+ /**
206
+ * Subdivides a cubic polynomial at parameter `t ∈ (0, 1)`.
207
+ *
208
+ * @param t - The split parameter; must be in the open interval `(0, 1)`.
209
+ * @returns A function that takes a polynomial and returns its `[left, right]` halves.
210
+ * @since 2.0.0
211
+ */
212
+ (t: number): (p: CubicPolynomial) => [CubicPolynomial, CubicPolynomial];
213
+ };
214
+ /**
215
+ * Calculates the roots of a cubic polynomial.
216
+ *
217
+ * @param p - The cubic polynomial to find the roots of.
218
+ * @returns The roots of the cubic polynomial.
219
+ * @since 1.0.0
220
+ */
221
+ export declare const roots: (p: CubicPolynomial) => Solution.AtMostThree<number>;
222
+ /**
223
+ * Calculates the extrema of a cubic polynomial.
224
+ *
225
+ * @param p - The cubic polynomial to find the extrema of.
226
+ * @returns The extrema of the cubic polynomial.
227
+ * @since 1.0.0
228
+ */
229
+ export declare const extrema: (p: CubicPolynomial) => Solution.AtMostTwo<number>;
230
+ export declare const monotonicity: {
231
+ /**
232
+ * Calculates the monotonicity of a cubic polynomial. Throws when the
233
+ * interval has zero width — the question is undefined at a single point.
234
+ *
235
+ * @param p - The cubic polynomial to analyze.
236
+ * @param i - The interval to restrict the analysis to.
237
+ * @returns The monotonicity of the cubic polynomial in the specified interval.
238
+ * @since 1.0.0
239
+ */
240
+ (p: CubicPolynomial, i?: Interval): Monotonicity;
241
+ /**
242
+ * Calculates the monotonicity of a cubic polynomial. Throws when the
243
+ * interval has zero width.
244
+ *
245
+ * @param i - The interval to restrict the analysis to.
246
+ * @returns A function that takes a cubic polynomial and returns the
247
+ * monotonicity of the cubic polynomial in the specified interval.
248
+ * @since 1.0.0
249
+ */
250
+ (i: Interval): (p: CubicPolynomial) => Monotonicity;
251
+ };
252
+ /**
253
+ * Type-narrowing predicate: refines a `CubicPolynomial<T>` to
254
+ * `CubicPolynomial<T & Monotonic>` when the polynomial is strictly monotonic
255
+ * over the given interval (or globally, when no interval is given).
256
+ *
257
+ * @param p - The cubic polynomial to check.
258
+ * @param i - Optional interval over which to check monotonicity.
259
+ * @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.
260
+ * @since 2.0.0
261
+ */
262
+ export declare const isMonotonic: {
263
+ <T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Monotonic>;
264
+ (i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Monotonic>;
265
+ };
266
+ /**
267
+ * Type-narrowing predicate: refines to `CubicPolynomial<T & Increasing>`.
268
+ *
269
+ * @since 2.0.0
270
+ */
271
+ export declare const isIncreasing: {
272
+ <T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Increasing>;
273
+ (i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Increasing>;
274
+ };
275
+ /**
276
+ * Type-narrowing predicate: refines to `CubicPolynomial<T & Decreasing>`.
277
+ *
278
+ * @since 2.0.0
279
+ */
280
+ export declare const isDecreasing: {
281
+ <T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Decreasing>;
282
+ (i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Decreasing>;
283
+ };
284
+ /**
285
+ * Asserts that the cubic polynomial is monotonic, throwing on failure.
286
+ *
287
+ * @param p - The cubic polynomial to assert against.
288
+ * @param i - Optional interval over which to check monotonicity.
289
+ * @returns The same polynomial, typed with the `Monotonic` brand.
290
+ * @throws When the polynomial is not monotonic over the given (or global) interval.
291
+ * @since 2.0.0
292
+ */
293
+ export declare const asMonotonic: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Monotonic>;
294
+ /**
295
+ * Asserts that the cubic polynomial is increasing, throwing on failure.
296
+ *
297
+ * @since 2.0.0
298
+ */
299
+ export declare const asIncreasing: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Increasing>;
300
+ /**
301
+ * Asserts that the cubic polynomial is decreasing, throwing on failure.
302
+ *
303
+ * @since 2.0.0
304
+ */
305
+ export declare const asDecreasing: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Decreasing>;
306
+ export declare const domain: {
307
+ /**
308
+ * Calculates the domain of a cubic polynomial.
309
+ *
310
+ * @param p - The cubic polynomial to analyze.
311
+ * @param range - The range to restrict the analysis to.
312
+ * @returns The domain of the cubic polynomial in the specified range.
313
+ * @since 1.0.0
314
+ */
315
+ (p: CubicPolynomial, range: Interval): Interval;
316
+ /**
317
+ * Calculates the domain of a cubic polynomial.
318
+ *
319
+ * @param range - The range to restrict the analysis to.
320
+ * @returns A function that takes a cubic polynomial and returns the domain of the cubic polynomial in the specified range.
321
+ * @since 1.0.0
322
+ */
323
+ (range: Interval): (p: CubicPolynomial) => Interval;
324
+ };
325
+ export declare const range: {
326
+ /**
327
+ * Calculates the range of a cubic polynomial.
328
+ *
329
+ * @param p - The cubic polynomial to analyze.
330
+ * @param domain - The domain to restrict the analysis to.
331
+ * @returns The range of the cubic polynomial in the specified domain.
332
+ * @since 1.0.0
333
+ */
334
+ (p: CubicPolynomial, domain: Interval): Closed;
335
+ /**
336
+ * Calculates the range of a cubic polynomial.
337
+ *
338
+ * @param domain - The domain to restrict the analysis to.
339
+ * @returns A function that takes a cubic polynomial and returns the range of the cubic polynomial in the specified domain.
340
+ * @since 1.0.0
341
+ */
342
+ (domain: Interval): (p: CubicPolynomial) => Closed;
343
+ };
344
+ export declare const length: {
345
+ /**
346
+ * Calculates the length of a cubic polynomial.
347
+ *
348
+ * @param p - The cubic polynomial to analyze.
349
+ * @param domain - The domain to restrict the analysis to.
350
+ * @returns The length of the cubic polynomial in the specified domain.
351
+ * @since 1.0.0
352
+ */
353
+ (p: CubicPolynomial, domain: Interval): number;
354
+ /**
355
+ * Calculates the length of a cubic polynomial.
356
+ *
357
+ * @param domain - The domain to restrict the analysis to.
358
+ * @returns A function that takes a cubic polynomial and returns the length of the cubic polynomial in the specified domain.
359
+ * @since 1.0.0
360
+ */
361
+ (domain: Interval): (p: CubicPolynomial) => number;
362
+ };
363
+ export declare const curvature: {
364
+ /**
365
+ * Calculates the curvature of a cubic polynomial.
366
+ *
367
+ * @param p - The cubic polynomial to analyze.
368
+ * @param x - The value of x to calculate the curvature at.
369
+ * @returns The curvature of the cubic polynomial at the specified value of x.
370
+ * @since 1.0.0
371
+ */
372
+ (p: CubicPolynomial, x: number): number;
373
+ /**
374
+ * Calculates the curvature of a cubic polynomial.
375
+ *
376
+ * @param x - The value of x to calculate the curvature at.
377
+ * @returns A function that takes a cubic polynomial and returns the curvature of the cubic polynomial at the specified value of x.
378
+ * @since 1.0.0
379
+ */
380
+ (x: number): (p: CubicPolynomial) => number;
381
+ };
@@ -0,0 +1,9 @@
1
+ import * as LinearPolynomialNs from './linear';
2
+ import * as QuadraticPolynomialNs from './quadratic';
3
+ import * as CubicPolynomialNs from './cubic';
4
+ export { LinearPolynomialNs as LinearPolynomial };
5
+ export type LinearPolynomial = LinearPolynomialNs.LinearPolynomial;
6
+ export { QuadraticPolynomialNs as QuadraticPolynomial };
7
+ export type QuadraticPolynomial = QuadraticPolynomialNs.QuadraticPolynomial;
8
+ export { CubicPolynomialNs as CubicPolynomial };
9
+ export type CubicPolynomial = CubicPolynomialNs.CubicPolynomial;
@@ -1,3 +1,3 @@
1
- import { t as cubic_exports } from "../shared/cubic-CpHAx8cC.mjs";
2
- import { o as quadratic_exports, p as linear_exports } from "../shared/quadratic-CamozcFc.mjs";
1
+ import { t as cubic_exports } from "../shared/cubic-CMonq6bg.mjs";
2
+ import { o as quadratic_exports, p as linear_exports } from "../shared/quadratic-DyeMtvET.mjs";
3
3
  export { cubic_exports as CubicPolynomial, linear_exports as LinearPolynomial, quadratic_exports as QuadraticPolynomial };