curvy 1.0.9 → 2.0.0-alpha.2

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 (173) hide show
  1. package/dist/characteristic/index.d.mts +88 -0
  2. package/dist/characteristic/index.mjs +2 -0
  3. package/dist/curve/index.d.mts +2 -0
  4. package/dist/curve/index.mjs +2 -0
  5. package/dist/interval/index.d.mts +3 -0
  6. package/dist/interval/index.mjs +3 -0
  7. package/dist/matrix/index.d.mts +2 -0
  8. package/dist/matrix/index.mjs +267 -0
  9. package/dist/matrix/index.mjs.map +1 -0
  10. package/dist/number.d.mts +280 -0
  11. package/dist/number.mjs +140 -0
  12. package/dist/number.mjs.map +1 -0
  13. package/dist/path/index.d.mts +261 -0
  14. package/dist/path/index.mjs +325 -0
  15. package/dist/path/index.mjs.map +1 -0
  16. package/dist/polynomial/index.d.mts +2 -0
  17. package/dist/polynomial/index.mjs +3 -0
  18. package/dist/shared/characteristic-B9nCh_cx.mjs +104 -0
  19. package/dist/shared/characteristic-B9nCh_cx.mjs.map +1 -0
  20. package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
  21. package/dist/shared/cubic-BajUY0JT.d.mts +1100 -0
  22. package/dist/shared/cubic-CpHAx8cC.mjs +479 -0
  23. package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
  24. package/dist/shared/interval-05CR6eBf.mjs +421 -0
  25. package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
  26. package/dist/shared/interval-Dy-RMEE3.d.mts +533 -0
  27. package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
  28. package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
  29. package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
  30. package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
  31. package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
  32. package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +1183 -0
  33. package/dist/shared/quadratic-CamozcFc.mjs +330 -0
  34. package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
  35. package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +308 -0
  36. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs +295 -0
  37. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
  38. package/dist/shared/rationalCubic2d-Bys2Uory.mjs +695 -0
  39. package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
  40. package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +818 -0
  41. package/dist/shared/solution-CrtLfqEq.mjs +306 -0
  42. package/dist/shared/solution-CrtLfqEq.mjs.map +1 -0
  43. package/dist/shared/solution-sNQ-ZVhN.d.mts +251 -0
  44. package/dist/{pipe.d.mts → shared/utils-MCckigYk.d.mts} +44 -26
  45. package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
  46. package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
  47. package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
  48. package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
  49. package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
  50. package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
  51. package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
  52. package/dist/shared/vector3-DqeOZtOB.d.mts +703 -0
  53. package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
  54. package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
  55. package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
  56. package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
  57. package/dist/solution/index.d.mts +2 -0
  58. package/dist/solution/index.mjs +2 -0
  59. package/dist/splines/index.d.mts +701 -0
  60. package/dist/splines/index.mjs +734 -0
  61. package/dist/splines/index.mjs.map +1 -0
  62. package/dist/utils.d.mts +2 -205
  63. package/dist/utils.mjs +88 -52
  64. package/dist/utils.mjs.map +1 -1
  65. package/dist/vector/index.d.mts +3 -0
  66. package/dist/vector/index.mjs +4 -0
  67. package/package.json +49 -92
  68. package/dist/curve/cubic2d.d.mts +0 -109
  69. package/dist/curve/cubic2d.d.ts +0 -109
  70. package/dist/curve/cubic2d.mjs +0 -80
  71. package/dist/curve/cubic2d.mjs.map +0 -1
  72. package/dist/curve/linear2d.d.mts +0 -94
  73. package/dist/curve/linear2d.d.ts +0 -94
  74. package/dist/curve/linear2d.mjs +0 -46
  75. package/dist/curve/linear2d.mjs.map +0 -1
  76. package/dist/curve/quadratic2d.d.mts +0 -117
  77. package/dist/curve/quadratic2d.d.ts +0 -117
  78. package/dist/curve/quadratic2d.mjs +0 -82
  79. package/dist/curve/quadratic2d.mjs.map +0 -1
  80. package/dist/interval.d.mts +0 -251
  81. package/dist/interval.d.ts +0 -251
  82. package/dist/interval.mjs +0 -86
  83. package/dist/interval.mjs.map +0 -1
  84. package/dist/matrix/matrix2x2.d.mts +0 -320
  85. package/dist/matrix/matrix2x2.d.ts +0 -320
  86. package/dist/matrix/matrix2x2.mjs +0 -25
  87. package/dist/matrix/matrix2x2.mjs.map +0 -1
  88. package/dist/matrix/matrix3x3.d.mts +0 -370
  89. package/dist/matrix/matrix3x3.d.ts +0 -370
  90. package/dist/matrix/matrix3x3.mjs +0 -28
  91. package/dist/matrix/matrix3x3.mjs.map +0 -1
  92. package/dist/matrix/matrix4x4.d.mts +0 -381
  93. package/dist/matrix/matrix4x4.d.ts +0 -381
  94. package/dist/matrix/matrix4x4.mjs +0 -178
  95. package/dist/matrix/matrix4x4.mjs.map +0 -1
  96. package/dist/path/cubic2d.d.mts +0 -95
  97. package/dist/path/cubic2d.d.ts +0 -95
  98. package/dist/path/cubic2d.mjs +0 -60
  99. package/dist/path/cubic2d.mjs.map +0 -1
  100. package/dist/path/linear2d.d.mts +0 -95
  101. package/dist/path/linear2d.d.ts +0 -95
  102. package/dist/path/linear2d.mjs +0 -53
  103. package/dist/path/linear2d.mjs.map +0 -1
  104. package/dist/path/quadratic2d.d.mts +0 -95
  105. package/dist/path/quadratic2d.d.ts +0 -95
  106. package/dist/path/quadratic2d.mjs +0 -57
  107. package/dist/path/quadratic2d.mjs.map +0 -1
  108. package/dist/pipe.d.ts +0 -58
  109. package/dist/pipe.mjs +0 -92
  110. package/dist/pipe.mjs.map +0 -1
  111. package/dist/polynomial/cubic.d.mts +0 -7
  112. package/dist/polynomial/cubic.d.ts +0 -7
  113. package/dist/polynomial/cubic.mjs +0 -133
  114. package/dist/polynomial/cubic.mjs.map +0 -1
  115. package/dist/polynomial/linear.d.mts +0 -7
  116. package/dist/polynomial/linear.d.ts +0 -7
  117. package/dist/polynomial/linear.mjs +0 -24
  118. package/dist/polynomial/linear.mjs.map +0 -1
  119. package/dist/polynomial/quadratic.d.mts +0 -7
  120. package/dist/polynomial/quadratic.d.ts +0 -7
  121. package/dist/polynomial/quadratic.mjs +0 -27
  122. package/dist/polynomial/quadratic.mjs.map +0 -1
  123. package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
  124. package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
  125. package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
  126. package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
  127. package/dist/shared/curvy.BxdGW9he.mjs +0 -116
  128. package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
  129. package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
  130. package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
  131. package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
  132. package/dist/shared/curvy.DCt1gGII.mjs +0 -147
  133. package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
  134. package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
  135. package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
  136. package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
  137. package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
  138. package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
  139. package/dist/shared/curvy.lktriTpx.mjs +0 -101
  140. package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
  141. package/dist/shared/curvy.mLFprrGm.mjs +0 -85
  142. package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
  143. package/dist/shared/curvy.r6f1j287.mjs +0 -76
  144. package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
  145. package/dist/splines/basis2d.d.mts +0 -130
  146. package/dist/splines/basis2d.d.ts +0 -130
  147. package/dist/splines/basis2d.mjs +0 -90
  148. package/dist/splines/basis2d.mjs.map +0 -1
  149. package/dist/splines/bezier2d.d.mts +0 -182
  150. package/dist/splines/bezier2d.d.ts +0 -182
  151. package/dist/splines/bezier2d.mjs +0 -23
  152. package/dist/splines/bezier2d.mjs.map +0 -1
  153. package/dist/splines/cardinal2d.d.mts +0 -178
  154. package/dist/splines/cardinal2d.d.ts +0 -178
  155. package/dist/splines/cardinal2d.mjs +0 -114
  156. package/dist/splines/cardinal2d.mjs.map +0 -1
  157. package/dist/splines/hermite2d.d.mts +0 -124
  158. package/dist/splines/hermite2d.d.ts +0 -124
  159. package/dist/splines/hermite2d.mjs +0 -63
  160. package/dist/splines/hermite2d.mjs.map +0 -1
  161. package/dist/utils.d.ts +0 -205
  162. package/dist/vector/vector2.d.mts +0 -324
  163. package/dist/vector/vector2.d.ts +0 -324
  164. package/dist/vector/vector2.mjs +0 -30
  165. package/dist/vector/vector2.mjs.map +0 -1
  166. package/dist/vector/vector3.d.mts +0 -417
  167. package/dist/vector/vector3.d.ts +0 -417
  168. package/dist/vector/vector3.mjs +0 -38
  169. package/dist/vector/vector3.mjs.map +0 -1
  170. package/dist/vector/vector4.d.mts +0 -205
  171. package/dist/vector/vector4.d.ts +0 -205
  172. package/dist/vector/vector4.mjs +0 -20
  173. package/dist/vector/vector4.mjs.map +0 -1
@@ -1,688 +0,0 @@
1
- import { Interval } from '../interval.mjs';
2
- import { Pipeable } from '../pipe.mjs';
3
- import { Vector2 } from '../vector/vector2.mjs';
4
- import { Vector3 } from '../vector/vector3.mjs';
5
- import { Vector4 } from '../vector/vector4.mjs';
6
-
7
- declare const CubicPolynomialTypeId: unique symbol;
8
- type CubicPolynomialTypeId = typeof CubicPolynomialTypeId;
9
-
10
- type Monotonicity = 'none' | 'increasing' | 'decreasing' | 'constant';
11
- type GuaranteedMonotonicity = 'increasing' | 'decreasing' | 'constant';
12
-
13
- type ZeroOrOne<T = number> = T | null;
14
- type ZeroToTwo<T = number> = readonly [] | readonly [T] | readonly [T, T];
15
- type ZeroToThree<T = number> = readonly [] | readonly [T] | readonly [T, T] | readonly [T, T, T];
16
-
17
- /**
18
- * A cubic polynomial.
19
- *
20
- * All fields are readonly and immutable, and all operations create new instances.
21
- *
22
- * @since 1.0.0
23
- */
24
- interface CubicPolynomial extends Pipeable {
25
- readonly [CubicPolynomialTypeId]: CubicPolynomialTypeId;
26
- /**
27
- * The coefficient of the x^0 term.
28
- */
29
- readonly c0: number;
30
- /**
31
- * The coefficient of the x^1 term.
32
- */
33
- readonly c1: number;
34
- /**
35
- * The coefficient of the x^2 term.
36
- */
37
- readonly c2: number;
38
- /**
39
- * The coefficient of the x^3 term.
40
- */
41
- readonly c3: number;
42
- }
43
- /**
44
- * Checks if a value is a `CubicPolynomial`.
45
- *
46
- * @param value - The value to check.
47
- * @returns `true` if the value is a `CubicPolynomial`, `false` otherwise.
48
- * @since 1.0.0
49
- */
50
- declare const isCubicPolynomial: (value: unknown) => value is CubicPolynomial;
51
- /**
52
- * Creates a new `CubicPolynomial` instance.
53
- *
54
- * @param c0 - The coefficient of the x^0 term.
55
- * @param c1 - The coefficient of the x^1 term.
56
- * @param c2 - The coefficient of the x^2 term.
57
- * @param c3 - The coefficient of the x^3 term.
58
- */
59
- declare const make$2: (c0: number, c1: number, c2: number, c3: number) => CubicPolynomial;
60
- /**
61
- * Creates a new `CubicPolynomial` instance from a vector.
62
- *
63
- * @param v - The vector to convert.
64
- * @returns A new `CubicPolynomial` instance.
65
- * @since 1.0.0
66
- */
67
- declare const fromVector$2: (v: Vector4) => CubicPolynomial;
68
- declare const solve$2: {
69
- /**
70
- * Solves a cubic polynomial for a given value of x.
71
- *
72
- * @param p - The cubic polynomial to solve.
73
- * @param x - The value of x to solve for.
74
- * @returns The result of the polynomial evaluation at x.
75
- * @since 1.0.0
76
- */
77
- (p: CubicPolynomial, x: number): number;
78
- /**
79
- * Solves a cubic polynomial for a given value of x.
80
- *
81
- * @param x - The value of x to solve for.
82
- * @returns A function that takes a cubic polynomial and returns the result of the polynomial evaluation at x.
83
- * @since 1.0.0
84
- */
85
- (x: number): (p: CubicPolynomial) => number;
86
- };
87
- /**
88
- * Converts a cubic polynomial to a solver function.
89
- *
90
- * @param p - The cubic polynomial to convert.
91
- * @returns A function that takes a value of x and returns the result of the polynomial evaluation at x.
92
- * @since 1.0.0
93
- */
94
- declare const toSolver$2: (p: CubicPolynomial) => (x: number) => number;
95
- declare const solveInverse$2: {
96
- /**
97
- * Solves a cubic polynomial for a given value of y.
98
- *
99
- * @param p - The cubic polynomial to solve.
100
- * @param y - The value of y to solve for.
101
- * @returns The roots of the polynomial equation p(x) = y.
102
- * @since 1.0.0
103
- */
104
- (p: CubicPolynomial, y: number): ZeroToThree;
105
- /**
106
- * Solves a cubic polynomial for a given value of y.
107
- *
108
- * @param y - The value of y to solve for.
109
- * @returns A function that takes a cubic polynomial and returns the roots of the polynomial equation p(x) = y.
110
- * @since 1.0.0
111
- */
112
- (y: number): (p: CubicPolynomial) => ZeroToThree;
113
- };
114
- /**
115
- * Converts a cubic polynomial to an inverse solver function.
116
- *
117
- * @param p - The cubic polynomial to convert.
118
- * @returns A function that takes a value of y and returns the roots of the polynomial equation p(x) = y.
119
- * @since 1.0.0
120
- */
121
- declare const toInverseSolver$2: (p: CubicPolynomial) => (y: number) => ZeroToThree;
122
- /**
123
- * Calculates the derivative of a cubic polynomial.
124
- *
125
- * @param p - The cubic polynomial to differentiate.
126
- * @returns The derivative of the cubic polynomial.
127
- * @since 1.0.0
128
- */
129
- declare const derivative$2: (p: CubicPolynomial) => QuadraticPolynomial;
130
- /**
131
- * Calculates the roots of a cubic polynomial.
132
- *
133
- * @param p - The cubic polynomial to find the roots of.
134
- * @returns The roots of the cubic polynomial.
135
- * @since 1.0.0
136
- */
137
- declare const roots$1: (p: CubicPolynomial) => ZeroToThree;
138
- /**
139
- * Calculates the extrema of a cubic polynomial.
140
- *
141
- * @param p - The cubic polynomial to find the extrema of.
142
- * @returns The extrema of the cubic polynomial.
143
- * @since 1.0.0
144
- */
145
- declare const extrema: (p: CubicPolynomial) => ZeroToTwo;
146
- declare const monotonicity$2: {
147
- /**
148
- * Calculates the monotonicity of a cubic polynomial.
149
- *
150
- * @param p - The cubic polynomial to analyze.
151
- * @param i - The interval to restrict the analysis to.
152
- * @returns The monotonicity of the cubic polynomial in the specified interval.
153
- * @since 1.0.0
154
- */
155
- (p: CubicPolynomial, i?: Interval): Monotonicity;
156
- /**
157
- * Calculates the monotonicity of a cubic polynomial.
158
- *
159
- * @param i - The interval to restrict the analysis to.
160
- * @returns A function that takes a cubic polynomial and returns the monotonicity of the cubic polynomial in the specified interval.
161
- * @since 1.0.0
162
- */
163
- (i: Interval): (p: CubicPolynomial) => Monotonicity;
164
- };
165
- declare const domain$2: {
166
- /**
167
- * Calculates the domain of a cubic polynomial.
168
- *
169
- * @param p - The cubic polynomial to analyze.
170
- * @param range - The range to restrict the analysis to.
171
- * @returns The domain of the cubic polynomial in the specified range.
172
- * @since 1.0.0
173
- */
174
- (p: CubicPolynomial, range: Interval): Interval;
175
- /**
176
- * Calculates the domain of a cubic polynomial.
177
- *
178
- * @param range - The range to restrict the analysis to.
179
- * @returns A function that takes a cubic polynomial and returns the domain of the cubic polynomial in the specified range.
180
- * @since 1.0.0
181
- */
182
- (range: Interval): (p: CubicPolynomial) => Interval;
183
- };
184
- declare const range$2: {
185
- /**
186
- * Calculates the range of a cubic polynomial.
187
- *
188
- * @param p - The cubic polynomial to analyze.
189
- * @param domain - The domain to restrict the analysis to.
190
- * @returns The range of the cubic polynomial in the specified domain.
191
- * @since 1.0.0
192
- */
193
- (p: CubicPolynomial, domain: Interval): Interval;
194
- /**
195
- * Calculates the range of a cubic polynomial.
196
- *
197
- * @param domain - The domain to restrict the analysis to.
198
- * @returns A function that takes a cubic polynomial and returns the range of the cubic polynomial in the specified domain.
199
- * @since 1.0.0
200
- */
201
- (domain: Interval): (p: CubicPolynomial) => Interval;
202
- };
203
- declare const length$2: {
204
- /**
205
- * Calculates the length of a cubic polynomial.
206
- *
207
- * @param p - The cubic polynomial to analyze.
208
- * @param domain - The domain to restrict the analysis to.
209
- * @returns The length of the cubic polynomial in the specified domain.
210
- * @since 1.0.0
211
- */
212
- (p: CubicPolynomial, domain: Interval): number;
213
- /**
214
- * Calculates the length of a cubic polynomial.
215
- *
216
- * @param domain - The domain to restrict the analysis to.
217
- * @returns A function that takes a cubic polynomial and returns the length of the cubic polynomial in the specified domain.
218
- * @since 1.0.0
219
- */
220
- (domain: Interval): (p: CubicPolynomial) => number;
221
- };
222
- declare const curvature$1: {
223
- /**
224
- * Calculates the curvature of a cubic polynomial.
225
- *
226
- * @param p - The cubic polynomial to analyze.
227
- * @param x - The value of x to calculate the curvature at.
228
- * @returns The curvature of the cubic polynomial at the specified value of x.
229
- * @since 1.0.0
230
- */
231
- (p: CubicPolynomial, x: number): number;
232
- /**
233
- * Calculates the curvature of a cubic polynomial.
234
- *
235
- * @param x - The value of x to calculate the curvature at.
236
- * @returns A function that takes a cubic polynomial and returns the curvature of the cubic polynomial at the specified value of x.
237
- * @since 1.0.0
238
- */
239
- (x: number): (p: CubicPolynomial) => number;
240
- };
241
-
242
- declare const QuadraticPolynomialTypeId: unique symbol;
243
- type QuadraticPolynomialTypeId = typeof QuadraticPolynomialTypeId;
244
-
245
- /**
246
- * A quadratic polynomial.
247
- *
248
- * All fields are readonly and immutable, and all operations create new instances.
249
- *
250
- * @since 1.0.0
251
- */
252
- interface QuadraticPolynomial extends Pipeable {
253
- readonly [QuadraticPolynomialTypeId]: QuadraticPolynomialTypeId;
254
- /**
255
- * The coefficient of the x^0 term.
256
- */
257
- readonly c0: number;
258
- /**
259
- * The coefficient of the x^1 term.
260
- */
261
- readonly c1: number;
262
- /**
263
- * The coefficient of the x^2 term.
264
- */
265
- readonly c2: number;
266
- }
267
- /**
268
- * Checks if a value is a `QuadraticPolynomial`.
269
- *
270
- * @param v - The value to check.
271
- * @returns `true` if the value is a `QuadraticPolynomial`, `false` otherwise.
272
- * @since 1.0.0
273
- */
274
- declare const isQuadraticPolynomial: (v: unknown) => v is QuadraticPolynomial;
275
- /**
276
- * Creates a new `QuadraticPolynomial` instance.
277
- *
278
- * @param c0 - The coefficient of the x^0 term. Defaults to 0.
279
- * @param c1 - The coefficient of the x^1 term. Defaults to 0.
280
- * @param c2 - The coefficient of the x^2 term. Defaults to 1.
281
- * @returns A new `QuadraticPolynomial` instance.
282
- * @since 1.0.0
283
- */
284
- declare const make$1: (c0?: number, c1?: number, c2?: number) => QuadraticPolynomial;
285
- /**
286
- * Creates a new `QuadraticPolynomial` instance from a vector.
287
- *
288
- * @param v - The vector to create the polynomial from.
289
- * @returns A new `QuadraticPolynomial` instance.
290
- * @since 1.0.0
291
- */
292
- declare const fromVector$1: (v: Vector3) => QuadraticPolynomial;
293
- declare const solve$1: {
294
- /**
295
- * Solves the quadratic polynomial for a given x value.
296
- *
297
- * @param p - The quadratic polynomial.
298
- * @param x - The x value to solve for.
299
- * @returns The result of the polynomial at the given x value.
300
- */
301
- (p: QuadraticPolynomial, x: number): number;
302
- /**
303
- * Solves the quadratic polynomial for a given x value.
304
- *
305
- * @param x - The x value to solve for.
306
- * @returns A function that takes a quadratic polynomial and returns the result of the polynomial at the given x value.
307
- */
308
- (x: number): (p: QuadraticPolynomial) => number;
309
- };
310
- /**
311
- * Creates a solver function for the quadratic polynomial.
312
- *
313
- * @param p - The quadratic polynomial.
314
- * @returns A function that takes an x value and returns the result of the polynomial at that x value.
315
- */
316
- declare const toSolver$1: (p: QuadraticPolynomial) => (x: number) => number;
317
- declare const solveInverse$1: {
318
- /**
319
- * Solves the quadratic polynomial for a given y value.
320
- *
321
- * @param p - The quadratic polynomial.
322
- * @param y - The y value to solve for.
323
- * @returns The solutions to the polynomial at the given y value.
324
- */
325
- (p: QuadraticPolynomial, y: number): ZeroToTwo;
326
- /**
327
- * Solves the quadratic polynomial for a given y value.
328
- *
329
- * @param y - The y value to solve for.
330
- * @returns A function that takes a quadratic polynomial and returns the solutions to the polynomial at the given y value.
331
- */
332
- (y: number): (p: QuadraticPolynomial) => ZeroToTwo;
333
- };
334
- /**
335
- * Creates an inverse solver function for the quadratic polynomial.
336
- *
337
- * @param p - The quadratic polynomial.
338
- * @returns A function that takes a y value and returns the solutions to the polynomial at that y value.
339
- */
340
- declare const toInverseSolver$1: (p: QuadraticPolynomial) => (y: number) => ZeroToTwo;
341
- /**
342
- * Computes the derivative of the quadratic polynomial.
343
- *
344
- * @param p - The quadratic polynomial.
345
- * @returns The derivative of the polynomial as a linear polynomial.
346
- * @since 1.0.0
347
- */
348
- declare const derivative$1: (p: QuadraticPolynomial) => LinearPolynomial;
349
- /**
350
- * Finds the roots of the quadratic polynomial.
351
- *
352
- * @param p - The quadratic polynomial.
353
- * @returns The roots of the polynomial as a tuple of solutions.
354
- * @since 1.0.0
355
- */
356
- declare const roots: (p: QuadraticPolynomial) => ZeroToTwo;
357
- /**
358
- * Finds the extreme point of the quadratic polynomial.
359
- *
360
- * @param p - The quadratic polynomial.
361
- * @returns The extreme point of the polynomial as a solution.
362
- * @since 1.0.0
363
- */
364
- declare const extreme: (p: QuadraticPolynomial) => ZeroOrOne<Vector2>;
365
- declare const monotonicity$1: {
366
- /**
367
- * Computes the monotonicity of the quadratic polynomial over a given interval.
368
- *
369
- * @param p - The quadratic polynomial.
370
- * @param i - The interval to compute the monotonicity over.
371
- * @returns The monotonicity of the polynomial over the interval.
372
- */
373
- (p: QuadraticPolynomial, i?: Interval): Monotonicity;
374
- /**
375
- * Computes the monotonicity of the quadratic polynomial over a given interval.
376
- *
377
- * @param i - The interval to compute the monotonicity over.
378
- * @returns A function that takes a quadratic polynomial and returns the monotonicity of the polynomial over the interval.
379
- */
380
- (i: Interval): (p: QuadraticPolynomial) => Monotonicity;
381
- };
382
- declare const antiderivative$1: {
383
- /**
384
- * Computes the antiderivative of the quadratic polynomial.
385
- *
386
- * @param p - The quadratic polynomial.
387
- * @param constant - The constant of integration. Defaults to 0.
388
- * @returns The antiderivative of the polynomial as a cubic polynomial.
389
- */
390
- (p: QuadraticPolynomial, constant?: number): CubicPolynomial;
391
- /**
392
- * Computes the antiderivative of the quadratic polynomial.
393
- *
394
- * @param constant - The constant of integration. Defaults to 0.
395
- * @returns A function that takes a quadratic polynomial and returns the antiderivative of the polynomial as a cubic polynomial.
396
- */
397
- (constant: number): (p: QuadraticPolynomial) => CubicPolynomial;
398
- };
399
- declare const domain$1: {
400
- /**
401
- * Computes the domain of the quadratic polynomial over a given range.
402
- *
403
- * @param p - The quadratic polynomial.
404
- * @param range - The range to compute the domain over.
405
- * @returns The domain of the polynomial over the range.
406
- */
407
- (p: QuadraticPolynomial, range: Interval): Interval | null;
408
- /**
409
- * Computes the domain of the quadratic polynomial over a given range.
410
- *
411
- * @param range - The range to compute the domain over.
412
- * @returns A function that takes a quadratic polynomial and returns the domain of the polynomial over the range.
413
- */
414
- (range: Interval): (p: QuadraticPolynomial) => Interval | null;
415
- };
416
- declare const range$1: {
417
- /**
418
- * Computes the range of the quadratic polynomial over a given domain.
419
- *
420
- * @param p - The quadratic polynomial.
421
- * @param domain - The domain to compute the range over.
422
- * @returns The range of the polynomial over the domain.
423
- */
424
- (p: QuadraticPolynomial, domain: Interval): Interval;
425
- /**
426
- * Computes the range of the quadratic polynomial over a given domain.
427
- *
428
- * @param domain - The domain to compute the range over.
429
- * @returns A function that takes a quadratic polynomial and returns the range of the polynomial over the domain.
430
- */
431
- (domain: Interval): (p: QuadraticPolynomial) => Interval;
432
- };
433
- declare const length$1: {
434
- /**
435
- * Computes the length of the quadratic polynomial over a given interval.
436
- *
437
- * @param p - The quadratic polynomial.
438
- * @param i - The interval to compute the length over.
439
- * @returns The length of the polynomial over the interval.
440
- */
441
- (p: QuadraticPolynomial, i: Interval): number;
442
- /**
443
- * Computes the length of the quadratic polynomial over a given interval.
444
- *
445
- * @param i - The interval to compute the length over.
446
- * @returns A function that takes a quadratic polynomial and returns the length of the polynomial over the interval.
447
- */
448
- (i: Interval): (p: QuadraticPolynomial) => number;
449
- };
450
- declare const curvature: {
451
- /**
452
- * Computes the curvature of the quadratic polynomial at a given x value.
453
- *
454
- * @param p - The quadratic polynomial.
455
- * @param x - The x value to compute the curvature at.
456
- * @returns The curvature of the polynomial at the given x value.
457
- */
458
- (p: QuadraticPolynomial, x: number): number;
459
- /**
460
- * Computes the curvature of the quadratic polynomial at a given x value.
461
- *
462
- * @param x - The x value to compute the curvature at.
463
- * @returns A function that takes a quadratic polynomial and returns the curvature of the polynomial at the given x value.
464
- */
465
- (x: number): (p: QuadraticPolynomial) => number;
466
- };
467
-
468
- declare const LinearPolynomialTypeId: unique symbol;
469
- type LinearPolynomialTypeId = typeof LinearPolynomialTypeId;
470
-
471
- /**
472
- * A linear polynomial.
473
- *
474
- * All fields are readonly and immutable, and all operations create new instances.
475
- *
476
- * @since 1.0.0
477
- */
478
- interface LinearPolynomial extends Pipeable {
479
- readonly [LinearPolynomialTypeId]: LinearPolynomialTypeId;
480
- /**
481
- * The coefficient of the x^0 term.
482
- */
483
- readonly c0: number;
484
- /**
485
- * The coefficient of the x^1 term.
486
- */
487
- readonly c1: number;
488
- }
489
- /**
490
- * Checks if a value is a `LinearPolynomial`.
491
- *
492
- * @param v - The value to check.
493
- * @returns `true` if the value is a `LinearPolynomial`, `false` otherwise.
494
- * @since 1.0.0
495
- */
496
- declare const isLinearPolynomial: (v: unknown) => v is LinearPolynomial;
497
- /**
498
- * Creates a new `LinearPolynomial` instance.
499
- *
500
- * @param c0 - The coefficient of the x^0 term. Defaults to 0.
501
- * @param c1 - The coefficient of the x^1 term. Defaults to 0.
502
- * @returns A new `LinearPolynomial` instance.
503
- * @since 1.0.0
504
- */
505
- declare const make: (c0?: number, c1?: number) => LinearPolynomial;
506
- /**
507
- * Creates a new `LinearPolynomial` instance from a vector.
508
- *
509
- * @param v - The vector to create the polynomial from.
510
- * @returns A new `LinearPolynomial` instance.
511
- * @since 1.0.0
512
- */
513
- declare const fromVector: (v: Vector2) => LinearPolynomial;
514
- /**
515
- * Creates a new `LinearPolynomial` instance from a point and slope.
516
- *
517
- * @param p - The point on the line.
518
- * @param slope - The slope of the line.
519
- * @returns A new `LinearPolynomial` instance.
520
- * @since 1.0.0
521
- */
522
- declare const fromPointSlope: (p: Vector2, slope: number) => LinearPolynomial;
523
- /**
524
- * Creates a new `LinearPolynomial` instance from two points.
525
- *
526
- * @param p1 - The first point.
527
- * @param p2 - The second point.
528
- * @returns A new `LinearPolynomial` instance.
529
- * @since 1.0.0
530
- */
531
- declare const fromPoints: (p1: Vector2, p2: Vector2) => LinearPolynomial;
532
- declare const solve: {
533
- /**
534
- * Solves a linear polynomial for a given value of x.
535
- *
536
- * @param p - The linear polynomial to solve.
537
- * @param x - The value of x to solve for.
538
- * @returns The result of the polynomial evaluated at x.
539
- * @since 1.0.0
540
- */
541
- (p: LinearPolynomial, x: number): number;
542
- /**
543
- * Solves a linear polynomial for a given value of x.
544
- *
545
- * @param x - The value of x to solve for.
546
- * @returns A function that takes a `LinearPolynomial` and returns the result of the polynomial evaluated at x.
547
- * @since 1.0.0
548
- */
549
- (x: number): (p: LinearPolynomial) => number;
550
- };
551
- /**
552
- * Converts a linear polynomial to a solver function.
553
- *
554
- * @param p - The linear polynomial to convert.
555
- * @returns A function that takes a value of x and returns the result of the polynomial evaluated at x.
556
- * @since 1.0.0
557
- */
558
- declare const toSolver: (p: LinearPolynomial) => (x: number) => number;
559
- declare const solveInverse: {
560
- /**
561
- * Solves a linear polynomial for a given value of y.
562
- *
563
- * @param p - The linear polynomial to solve.
564
- * @param y - The value of y to solve for.
565
- * @returns The roots of the polynomial equation p(x) = y.
566
- * @since 1.0.0
567
- */
568
- (p: LinearPolynomial, y: number): ZeroOrOne;
569
- /**
570
- * Solves a linear polynomial for a given value of y.
571
- *
572
- * @param y - The value of y to solve for.
573
- * @returns A function that takes a `LinearPolynomial` and returns the roots of the polynomial equation p(x) = y.
574
- * @since 1.0.0
575
- */
576
- (y: number): (p: LinearPolynomial) => ZeroOrOne;
577
- };
578
- /**
579
- * Converts a linear polynomial to an inverse solver function.
580
- *
581
- * @param p - The linear polynomial to convert.
582
- * @returns A function that takes a value of y and returns the roots of the polynomial equation p(x) = y.
583
- * @since 1.0.0
584
- */
585
- declare const toInverseSolver: (p: LinearPolynomial) => (y: number) => ZeroOrOne;
586
- /**
587
- * Finds the roots of a linear polynomial.
588
- *
589
- * @param p - The linear polynomial to find the roots of.
590
- * @returns The roots of the polynomial equation p(x) = 0.
591
- * @since 1.0.0
592
- */
593
- declare const root: (p: LinearPolynomial) => ZeroOrOne;
594
- /**
595
- * Calculates the monotonicity of a linear polynomial.
596
- *
597
- * @param p - The linear polynomial to check.
598
- * @returns The guaranteed monotonicity of the polynomial.
599
- * @since 1.0.0
600
- */
601
- declare const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity;
602
- /**
603
- * Calculates the derivative of a linear polynomial.
604
- *
605
- * @param p - The linear polynomial to differentiate.
606
- * @returns The derivative of the linear polynomial.
607
- * @since 1.0.0
608
- */
609
- declare const derivative: (p: LinearPolynomial) => number;
610
- declare const antiderivative: {
611
- /**
612
- * Calculates the antiderivative of a linear polynomial.
613
- *
614
- * @param p - The linear polynomial to integrate.
615
- * @param constant - The constant of integration. Defaults to 0.
616
- * @returns The antiderivative of the linear polynomial.
617
- * @since 1.0.0
618
- */
619
- (p: LinearPolynomial, constant?: number): QuadraticPolynomial;
620
- /**
621
- * Calculates the antiderivative of a linear polynomial.
622
- *
623
- * @param constant - The constant of integration. Defaults to 0.
624
- * @returns A function that takes a `LinearPolynomial` and returns the antiderivative of the polynomial.
625
- * @since 1.0.0
626
- */
627
- (constant: number): (p: LinearPolynomial) => QuadraticPolynomial;
628
- };
629
- declare const domain: {
630
- /**
631
- * Calculates the domain of a linear polynomial.
632
- *
633
- * @param p - The linear polynomial to check.
634
- * @param range - The range to check against.
635
- * @returns The domain of the polynomial within the given range.
636
- * @since 1.0.0
637
- */
638
- (p: LinearPolynomial, range: Interval): ZeroOrOne<Interval>;
639
- /**
640
- * Calculates the domain of a linear polynomial.
641
- *
642
- * @param range - The range to check against.
643
- * @returns A function that takes a `LinearPolynomial` and returns the domain of the polynomial within the given range.
644
- * @since 1.0.0
645
- */
646
- (range: Interval): (p: LinearPolynomial) => ZeroOrOne<Interval>;
647
- };
648
- declare const range: {
649
- /**
650
- * Calculates the range of a linear polynomial.
651
- *
652
- * @param p - The linear polynomial to check.
653
- * @param domain - The domain to check against.
654
- * @returns The range of the polynomial within the given domain.
655
- * @since 1.0.0
656
- */
657
- (p: LinearPolynomial, domain: Interval): Interval;
658
- /**
659
- * Calculates the range of a linear polynomial.
660
- *
661
- * @param domain - The domain to check against.
662
- * @returns A function that takes a `LinearPolynomial` and returns the range of the polynomial within the given domain.
663
- * @since 1.0.0
664
- */
665
- (domain: Interval): (p: LinearPolynomial) => Interval;
666
- };
667
- declare const length: {
668
- /**
669
- * Calculates the length of a linear polynomial within a particular domain `Interval`.
670
- *
671
- * @param p - The linear polynomial to analyze.
672
- * @param domain - The domain to restrict the analysis to.
673
- * @returns The length of the linear polynomial in the specified domain.
674
- * @since 1.0.0
675
- */
676
- (p: LinearPolynomial, domain: Interval): number;
677
- /**
678
- * Calculates the length of a linear polynomial within a particular domain `Interval`.
679
- *
680
- * @param domain - The domain to restrict the analysis to.
681
- * @returns A function that takes a `LinearPolynomial` and returns the length of the polynomial in the specified domain.
682
- * @since 1.0.0
683
- */
684
- (domain: Interval): (p: LinearPolynomial) => number;
685
- };
686
-
687
- export { antiderivative$1 as A, domain$1 as B, range$1 as D, length$1 as E, curvature as F, isLinearPolynomial as G, make as H, fromVector as I, fromPointSlope as J, fromPoints as K, solve as M, toSolver as N, solveInverse as O, toInverseSolver as P, root as R, monotonicity as S, derivative as T, antiderivative as U, domain as V, range as W, length as X, solveInverse$2 as a, toInverseSolver$2 as b, monotonicity$2 as c, derivative$2 as d, extrema as e, fromVector$2 as f, domain$2 as g, range$2 as h, isCubicPolynomial as i, curvature$1 as j, isQuadraticPolynomial as k, length$2 as l, make$2 as m, make$1 as n, fromVector$1 as o, solve$1 as p, toSolver$1 as q, roots$1 as r, solve$2 as s, toSolver$2 as t, solveInverse$1 as u, toInverseSolver$1 as v, derivative$1 as w, roots as x, extreme as y, monotonicity$1 as z };
688
- export type { CubicPolynomial as C, LinearPolynomial as L, QuadraticPolynomial as Q };