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.
- package/dist/characteristic/index.d.mts +88 -0
- package/dist/characteristic/index.mjs +2 -0
- package/dist/curve/index.d.mts +2 -0
- package/dist/curve/index.mjs +2 -0
- package/dist/interval/index.d.mts +3 -0
- package/dist/interval/index.mjs +3 -0
- package/dist/matrix/index.d.mts +2 -0
- package/dist/matrix/index.mjs +267 -0
- package/dist/matrix/index.mjs.map +1 -0
- package/dist/number.d.mts +280 -0
- package/dist/number.mjs +140 -0
- package/dist/number.mjs.map +1 -0
- package/dist/path/index.d.mts +261 -0
- package/dist/path/index.mjs +325 -0
- package/dist/path/index.mjs.map +1 -0
- package/dist/polynomial/index.d.mts +2 -0
- package/dist/polynomial/index.mjs +3 -0
- package/dist/shared/characteristic-B9nCh_cx.mjs +104 -0
- package/dist/shared/characteristic-B9nCh_cx.mjs.map +1 -0
- package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
- package/dist/shared/cubic-BajUY0JT.d.mts +1100 -0
- package/dist/shared/cubic-CpHAx8cC.mjs +479 -0
- package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
- package/dist/shared/interval-05CR6eBf.mjs +421 -0
- package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
- package/dist/shared/interval-Dy-RMEE3.d.mts +533 -0
- package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
- package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
- package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
- package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +1183 -0
- package/dist/shared/quadratic-CamozcFc.mjs +330 -0
- package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +308 -0
- package/dist/shared/rationalCubic2d-BEgUGSFf.mjs +295 -0
- package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-Bys2Uory.mjs +695 -0
- package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +818 -0
- package/dist/shared/solution-CrtLfqEq.mjs +306 -0
- package/dist/shared/solution-CrtLfqEq.mjs.map +1 -0
- package/dist/shared/solution-sNQ-ZVhN.d.mts +251 -0
- package/dist/{pipe.d.mts → shared/utils-MCckigYk.d.mts} +44 -26
- package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
- package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
- package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
- package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
- package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
- package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
- package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
- package/dist/shared/vector3-DqeOZtOB.d.mts +703 -0
- package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
- package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
- package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
- package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
- package/dist/solution/index.d.mts +2 -0
- package/dist/solution/index.mjs +2 -0
- package/dist/splines/index.d.mts +701 -0
- package/dist/splines/index.mjs +734 -0
- package/dist/splines/index.mjs.map +1 -0
- package/dist/utils.d.mts +2 -205
- package/dist/utils.mjs +88 -52
- package/dist/utils.mjs.map +1 -1
- package/dist/vector/index.d.mts +3 -0
- package/dist/vector/index.mjs +4 -0
- package/package.json +49 -92
- package/dist/curve/cubic2d.d.mts +0 -109
- package/dist/curve/cubic2d.d.ts +0 -109
- package/dist/curve/cubic2d.mjs +0 -80
- package/dist/curve/cubic2d.mjs.map +0 -1
- package/dist/curve/linear2d.d.mts +0 -94
- package/dist/curve/linear2d.d.ts +0 -94
- package/dist/curve/linear2d.mjs +0 -46
- package/dist/curve/linear2d.mjs.map +0 -1
- package/dist/curve/quadratic2d.d.mts +0 -117
- package/dist/curve/quadratic2d.d.ts +0 -117
- package/dist/curve/quadratic2d.mjs +0 -82
- package/dist/curve/quadratic2d.mjs.map +0 -1
- package/dist/interval.d.mts +0 -251
- package/dist/interval.d.ts +0 -251
- package/dist/interval.mjs +0 -86
- package/dist/interval.mjs.map +0 -1
- package/dist/matrix/matrix2x2.d.mts +0 -320
- package/dist/matrix/matrix2x2.d.ts +0 -320
- package/dist/matrix/matrix2x2.mjs +0 -25
- package/dist/matrix/matrix2x2.mjs.map +0 -1
- package/dist/matrix/matrix3x3.d.mts +0 -370
- package/dist/matrix/matrix3x3.d.ts +0 -370
- package/dist/matrix/matrix3x3.mjs +0 -28
- package/dist/matrix/matrix3x3.mjs.map +0 -1
- package/dist/matrix/matrix4x4.d.mts +0 -381
- package/dist/matrix/matrix4x4.d.ts +0 -381
- package/dist/matrix/matrix4x4.mjs +0 -178
- package/dist/matrix/matrix4x4.mjs.map +0 -1
- package/dist/path/cubic2d.d.mts +0 -95
- package/dist/path/cubic2d.d.ts +0 -95
- package/dist/path/cubic2d.mjs +0 -60
- package/dist/path/cubic2d.mjs.map +0 -1
- package/dist/path/linear2d.d.mts +0 -95
- package/dist/path/linear2d.d.ts +0 -95
- package/dist/path/linear2d.mjs +0 -53
- package/dist/path/linear2d.mjs.map +0 -1
- package/dist/path/quadratic2d.d.mts +0 -95
- package/dist/path/quadratic2d.d.ts +0 -95
- package/dist/path/quadratic2d.mjs +0 -57
- package/dist/path/quadratic2d.mjs.map +0 -1
- package/dist/pipe.d.ts +0 -58
- package/dist/pipe.mjs +0 -92
- package/dist/pipe.mjs.map +0 -1
- package/dist/polynomial/cubic.d.mts +0 -7
- package/dist/polynomial/cubic.d.ts +0 -7
- package/dist/polynomial/cubic.mjs +0 -133
- package/dist/polynomial/cubic.mjs.map +0 -1
- package/dist/polynomial/linear.d.mts +0 -7
- package/dist/polynomial/linear.d.ts +0 -7
- package/dist/polynomial/linear.mjs +0 -24
- package/dist/polynomial/linear.mjs.map +0 -1
- package/dist/polynomial/quadratic.d.mts +0 -7
- package/dist/polynomial/quadratic.d.ts +0 -7
- package/dist/polynomial/quadratic.mjs +0 -27
- package/dist/polynomial/quadratic.mjs.map +0 -1
- package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
- package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
- package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
- package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
- package/dist/shared/curvy.BxdGW9he.mjs +0 -116
- package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
- package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
- package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
- package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
- package/dist/shared/curvy.DCt1gGII.mjs +0 -147
- package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
- package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
- package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
- package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
- package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
- package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
- package/dist/shared/curvy.lktriTpx.mjs +0 -101
- package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
- package/dist/shared/curvy.mLFprrGm.mjs +0 -85
- package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
- package/dist/shared/curvy.r6f1j287.mjs +0 -76
- package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
- package/dist/splines/basis2d.d.mts +0 -130
- package/dist/splines/basis2d.d.ts +0 -130
- package/dist/splines/basis2d.mjs +0 -90
- package/dist/splines/basis2d.mjs.map +0 -1
- package/dist/splines/bezier2d.d.mts +0 -182
- package/dist/splines/bezier2d.d.ts +0 -182
- package/dist/splines/bezier2d.mjs +0 -23
- package/dist/splines/bezier2d.mjs.map +0 -1
- package/dist/splines/cardinal2d.d.mts +0 -178
- package/dist/splines/cardinal2d.d.ts +0 -178
- package/dist/splines/cardinal2d.mjs +0 -114
- package/dist/splines/cardinal2d.mjs.map +0 -1
- package/dist/splines/hermite2d.d.mts +0 -124
- package/dist/splines/hermite2d.d.ts +0 -124
- package/dist/splines/hermite2d.mjs +0 -63
- package/dist/splines/hermite2d.mjs.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/vector/vector2.d.mts +0 -324
- package/dist/vector/vector2.d.ts +0 -324
- package/dist/vector/vector2.mjs +0 -30
- package/dist/vector/vector2.mjs.map +0 -1
- package/dist/vector/vector3.d.mts +0 -417
- package/dist/vector/vector3.d.ts +0 -417
- package/dist/vector/vector3.mjs +0 -38
- package/dist/vector/vector3.mjs.map +0 -1
- package/dist/vector/vector4.d.mts +0 -205
- package/dist/vector/vector4.d.ts +0 -205
- package/dist/vector/vector4.mjs +0 -20
- package/dist/vector/vector4.mjs.map +0 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
|
|
2
|
+
import { $ as extreme$1, At as make$2, Ct as fromPoints$2, Dt as isLinearPolynomial$1, Et as isIncreasing$2, Ft as toInverseSolver$2, G as antiderivative$3, It as toSolver$2, J as asMonotonic$3, K as asDecreasing$3, Mt as range$2, Nt as solve$2, Ot as isMonotonic$2, Pt as solveInverse$2, Q as equals$3, St as fromPointSlope$1, Tt as isDecreasing$2, X as derivative$3, Y as curvature$1, Z as domain$3, _t as asIncreasing$2, at as isQuadraticPolynomial$1, bt as domain$2, ct as monotonicity$3, dt as solve$3, et as fromPoints$3, ft as solveInverse$3, gt as asDecreasing$2, ht as antiderivative$2, it as isMonotonic$3, jt as monotonicity$2, kt as length$2, lt as range$3, mt as toSolver$3, nt as isDecreasing$3, ot as length$3, pt as toInverseSolver$3, q as asIncreasing$3, rt as isIncreasing$3, st as make$3, tt as fromVector$3, ut as roots$1, vt as asMonotonic$2, wt as fromVector$2, xt as equals$2, yt as derivative$2 } from "./cubic-CpHAx8cC.mjs";
|
|
3
|
+
//#region src/polynomial/linear.ts
|
|
4
|
+
var linear_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
antiderivative: () => antiderivative$1,
|
|
6
|
+
asDecreasing: () => asDecreasing$1,
|
|
7
|
+
asIncreasing: () => asIncreasing$1,
|
|
8
|
+
asMonotonic: () => asMonotonic$1,
|
|
9
|
+
derivative: () => derivative$1,
|
|
10
|
+
domain: () => domain$1,
|
|
11
|
+
equals: () => equals$1,
|
|
12
|
+
fromPointSlope: () => fromPointSlope,
|
|
13
|
+
fromPoints: () => fromPoints$1,
|
|
14
|
+
fromVector: () => fromVector$1,
|
|
15
|
+
isDecreasing: () => isDecreasing$1,
|
|
16
|
+
isIncreasing: () => isIncreasing$1,
|
|
17
|
+
isLinearPolynomial: () => isLinearPolynomial,
|
|
18
|
+
isMonotonic: () => isMonotonic$1,
|
|
19
|
+
length: () => length$1,
|
|
20
|
+
make: () => make$1,
|
|
21
|
+
monotonicity: () => monotonicity$1,
|
|
22
|
+
range: () => range$1,
|
|
23
|
+
root: () => root,
|
|
24
|
+
solve: () => solve$1,
|
|
25
|
+
solveInverse: () => solveInverse$1,
|
|
26
|
+
toInverseSolver: () => toInverseSolver$1,
|
|
27
|
+
toSolver: () => toSolver$1
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a value is a `LinearPolynomial`.
|
|
31
|
+
*
|
|
32
|
+
* @param v - The value to check.
|
|
33
|
+
* @returns `true` if the value is a `LinearPolynomial`, `false` otherwise.
|
|
34
|
+
* @since 1.0.0
|
|
35
|
+
*/
|
|
36
|
+
const isLinearPolynomial = isLinearPolynomial$1;
|
|
37
|
+
const equals$1 = equals$2;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new `LinearPolynomial` instance.
|
|
40
|
+
*
|
|
41
|
+
* @param c0 - The coefficient of the x^0 term. Defaults to 0.
|
|
42
|
+
* @param c1 - The coefficient of the x^1 term. Defaults to 0.
|
|
43
|
+
* @returns A new `LinearPolynomial` instance.
|
|
44
|
+
* @since 1.0.0
|
|
45
|
+
*/
|
|
46
|
+
const make$1 = make$2;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new `LinearPolynomial` instance from a vector.
|
|
49
|
+
*
|
|
50
|
+
* @param v - The vector to create the polynomial from.
|
|
51
|
+
* @returns A new `LinearPolynomial` instance.
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
*/
|
|
54
|
+
const fromVector$1 = fromVector$2;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new `LinearPolynomial` instance from a point and slope.
|
|
57
|
+
*
|
|
58
|
+
* @param p - The point on the line.
|
|
59
|
+
* @param slope - The slope of the line.
|
|
60
|
+
* @returns A new `LinearPolynomial` instance.
|
|
61
|
+
* @since 1.0.0
|
|
62
|
+
*/
|
|
63
|
+
const fromPointSlope = fromPointSlope$1;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new `LinearPolynomial` instance from two points.
|
|
66
|
+
*
|
|
67
|
+
* @param p1 - The first point.
|
|
68
|
+
* @param p2 - The second point.
|
|
69
|
+
* @returns A new `LinearPolynomial` instance.
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
*/
|
|
72
|
+
const fromPoints$1 = fromPoints$2;
|
|
73
|
+
const solve$1 = solve$2;
|
|
74
|
+
/**
|
|
75
|
+
* Converts a linear polynomial to a solver function.
|
|
76
|
+
*
|
|
77
|
+
* @param p - The linear polynomial to convert.
|
|
78
|
+
* @returns A function that takes a value of x and returns the result of the polynomial evaluated at x.
|
|
79
|
+
* @since 1.0.0
|
|
80
|
+
*/
|
|
81
|
+
const toSolver$1 = toSolver$2;
|
|
82
|
+
const solveInverse$1 = solveInverse$2;
|
|
83
|
+
/**
|
|
84
|
+
* Converts a linear polynomial to an inverse solver function.
|
|
85
|
+
*
|
|
86
|
+
* @param p - The linear polynomial to convert.
|
|
87
|
+
* @since 1.0.0
|
|
88
|
+
*/
|
|
89
|
+
const toInverseSolver$1 = toInverseSolver$2;
|
|
90
|
+
/**
|
|
91
|
+
* Finds the roots of a linear polynomial.
|
|
92
|
+
*
|
|
93
|
+
* @param p - The linear polynomial to find the roots of.
|
|
94
|
+
* @since 1.0.0
|
|
95
|
+
*/
|
|
96
|
+
const root = (p) => solveInverse$2(p, 0);
|
|
97
|
+
/**
|
|
98
|
+
* Calculates the monotonicity of a linear polynomial.
|
|
99
|
+
*
|
|
100
|
+
* @param p - The linear polynomial to check.
|
|
101
|
+
* @returns The guaranteed monotonicity of the polynomial.
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
*/
|
|
104
|
+
const monotonicity$1 = monotonicity$2;
|
|
105
|
+
/**
|
|
106
|
+
* Type-narrowing predicate: refines a `LinearPolynomial<T>` to
|
|
107
|
+
* `LinearPolynomial<T & Monotonic>` when the polynomial is strictly monotonic.
|
|
108
|
+
*
|
|
109
|
+
* @param p - The linear polynomial to check.
|
|
110
|
+
* @returns `true` when `monotonicity(p)` is `'increasing'` or `'decreasing'`.
|
|
111
|
+
* @since 2.0.0
|
|
112
|
+
*/
|
|
113
|
+
const isMonotonic$1 = isMonotonic$2;
|
|
114
|
+
/**
|
|
115
|
+
* Type-narrowing predicate: refines to `LinearPolynomial<T & Increasing>`.
|
|
116
|
+
*
|
|
117
|
+
* @param p - The linear polynomial to check.
|
|
118
|
+
* @returns `true` when `monotonicity(p)` is `'increasing'`.
|
|
119
|
+
* @since 2.0.0
|
|
120
|
+
*/
|
|
121
|
+
const isIncreasing$1 = isIncreasing$2;
|
|
122
|
+
/**
|
|
123
|
+
* Type-narrowing predicate: refines to `LinearPolynomial<T & Decreasing>`.
|
|
124
|
+
*
|
|
125
|
+
* @param p - The linear polynomial to check.
|
|
126
|
+
* @returns `true` when `monotonicity(p)` is `'decreasing'`.
|
|
127
|
+
* @since 2.0.0
|
|
128
|
+
*/
|
|
129
|
+
const isDecreasing$1 = isDecreasing$2;
|
|
130
|
+
/**
|
|
131
|
+
* Asserts that the linear polynomial is monotonic, throwing on failure.
|
|
132
|
+
*
|
|
133
|
+
* @param p - The linear polynomial to assert against.
|
|
134
|
+
* @returns The same polynomial, typed with the `Monotonic` brand.
|
|
135
|
+
* @throws When `monotonicity(p)` is `'constant'`.
|
|
136
|
+
* @since 2.0.0
|
|
137
|
+
*/
|
|
138
|
+
const asMonotonic$1 = asMonotonic$2;
|
|
139
|
+
/**
|
|
140
|
+
* Asserts that the linear polynomial is increasing, throwing on failure.
|
|
141
|
+
*
|
|
142
|
+
* @param p - The linear polynomial to assert against.
|
|
143
|
+
* @returns The same polynomial, typed with the `Increasing` brand.
|
|
144
|
+
* @throws When `monotonicity(p)` is not `'increasing'`.
|
|
145
|
+
* @since 2.0.0
|
|
146
|
+
*/
|
|
147
|
+
const asIncreasing$1 = asIncreasing$2;
|
|
148
|
+
/**
|
|
149
|
+
* Asserts that the linear polynomial is decreasing, throwing on failure.
|
|
150
|
+
*
|
|
151
|
+
* @param p - The linear polynomial to assert against.
|
|
152
|
+
* @returns The same polynomial, typed with the `Decreasing` brand.
|
|
153
|
+
* @throws When `monotonicity(p)` is not `'decreasing'`.
|
|
154
|
+
* @since 2.0.0
|
|
155
|
+
*/
|
|
156
|
+
const asDecreasing$1 = asDecreasing$2;
|
|
157
|
+
/**
|
|
158
|
+
* Calculates the derivative of a linear polynomial.
|
|
159
|
+
*
|
|
160
|
+
* @param p - The linear polynomial to differentiate.
|
|
161
|
+
* @returns The derivative of the linear polynomial.
|
|
162
|
+
* @since 1.0.0
|
|
163
|
+
*/
|
|
164
|
+
const derivative$1 = derivative$2;
|
|
165
|
+
const antiderivative$1 = antiderivative$2;
|
|
166
|
+
const domain$1 = domain$2;
|
|
167
|
+
const range$1 = range$2;
|
|
168
|
+
const length$1 = length$2;
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/polynomial/quadratic.ts
|
|
171
|
+
var quadratic_exports = /* @__PURE__ */ __exportAll({
|
|
172
|
+
antiderivative: () => antiderivative,
|
|
173
|
+
asDecreasing: () => asDecreasing,
|
|
174
|
+
asIncreasing: () => asIncreasing,
|
|
175
|
+
asMonotonic: () => asMonotonic,
|
|
176
|
+
curvature: () => curvature,
|
|
177
|
+
derivative: () => derivative,
|
|
178
|
+
domain: () => domain,
|
|
179
|
+
equals: () => equals,
|
|
180
|
+
extreme: () => extreme,
|
|
181
|
+
fromPoints: () => fromPoints,
|
|
182
|
+
fromVector: () => fromVector,
|
|
183
|
+
isDecreasing: () => isDecreasing,
|
|
184
|
+
isIncreasing: () => isIncreasing,
|
|
185
|
+
isMonotonic: () => isMonotonic,
|
|
186
|
+
isQuadraticPolynomial: () => isQuadraticPolynomial,
|
|
187
|
+
length: () => length,
|
|
188
|
+
make: () => make,
|
|
189
|
+
monotonicity: () => monotonicity,
|
|
190
|
+
range: () => range,
|
|
191
|
+
roots: () => roots,
|
|
192
|
+
solve: () => solve,
|
|
193
|
+
solveInverse: () => solveInverse,
|
|
194
|
+
toInverseSolver: () => toInverseSolver,
|
|
195
|
+
toSolver: () => toSolver
|
|
196
|
+
});
|
|
197
|
+
/**
|
|
198
|
+
* Checks if a value is a `QuadraticPolynomial`.
|
|
199
|
+
*
|
|
200
|
+
* @param v - The value to check.
|
|
201
|
+
* @returns `true` if the value is a `QuadraticPolynomial`, `false` otherwise.
|
|
202
|
+
* @since 1.0.0
|
|
203
|
+
*/
|
|
204
|
+
const isQuadraticPolynomial = isQuadraticPolynomial$1;
|
|
205
|
+
const equals = equals$3;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a new `QuadraticPolynomial` instance.
|
|
208
|
+
*
|
|
209
|
+
* @param c0 - The coefficient of the x^0 term. Defaults to 0.
|
|
210
|
+
* @param c1 - The coefficient of the x^1 term. Defaults to 0.
|
|
211
|
+
* @param c2 - The coefficient of the x^2 term. Defaults to 1.
|
|
212
|
+
* @returns A new `QuadraticPolynomial` instance.
|
|
213
|
+
* @since 1.0.0
|
|
214
|
+
*/
|
|
215
|
+
const make = make$3;
|
|
216
|
+
/**
|
|
217
|
+
* Creates a new `QuadraticPolynomial` instance from a vector.
|
|
218
|
+
*
|
|
219
|
+
* @param v - The vector to create the polynomial from.
|
|
220
|
+
* @returns A new `QuadraticPolynomial` instance.
|
|
221
|
+
* @since 1.0.0
|
|
222
|
+
*/
|
|
223
|
+
const fromVector = fromVector$3;
|
|
224
|
+
/**
|
|
225
|
+
* Creates a new `QuadraticPolynomial` that interpolates the three given
|
|
226
|
+
* points, treating each `Vector2` as an `(x, y)` pair. The three input `x`
|
|
227
|
+
* values must be distinct.
|
|
228
|
+
*
|
|
229
|
+
* @param p0 - The first point.
|
|
230
|
+
* @param p1 - The second point.
|
|
231
|
+
* @param p2 - The third point.
|
|
232
|
+
* @returns The unique quadratic polynomial passing through the three points.
|
|
233
|
+
* @since 2.0.0
|
|
234
|
+
*/
|
|
235
|
+
const fromPoints = fromPoints$3;
|
|
236
|
+
const solve = solve$3;
|
|
237
|
+
/**
|
|
238
|
+
* Creates a solver function for the quadratic polynomial.
|
|
239
|
+
*
|
|
240
|
+
* @param p - The quadratic polynomial.
|
|
241
|
+
* @returns A function that takes an x value and returns the result of the polynomial at that x value.
|
|
242
|
+
*/
|
|
243
|
+
const toSolver = toSolver$3;
|
|
244
|
+
const solveInverse = solveInverse$3;
|
|
245
|
+
/**
|
|
246
|
+
* Creates an inverse solver function for the quadratic polynomial.
|
|
247
|
+
*
|
|
248
|
+
* @param p - The quadratic polynomial.
|
|
249
|
+
* @returns A function that takes a y value and returns the solutions to the polynomial at that y value.
|
|
250
|
+
*/
|
|
251
|
+
const toInverseSolver = toInverseSolver$3;
|
|
252
|
+
/**
|
|
253
|
+
* Computes the derivative of the quadratic polynomial.
|
|
254
|
+
*
|
|
255
|
+
* @param p - The quadratic polynomial.
|
|
256
|
+
* @returns The derivative of the polynomial as a linear polynomial.
|
|
257
|
+
* @since 1.0.0
|
|
258
|
+
*/
|
|
259
|
+
const derivative = derivative$3;
|
|
260
|
+
/**
|
|
261
|
+
* Finds the roots of the quadratic polynomial.
|
|
262
|
+
*
|
|
263
|
+
* @param p - The quadratic polynomial.
|
|
264
|
+
* @returns The roots of the polynomial as a tuple of solutions.
|
|
265
|
+
* @since 1.0.0
|
|
266
|
+
*/
|
|
267
|
+
const roots = roots$1;
|
|
268
|
+
/**
|
|
269
|
+
* Finds the extreme point of the quadratic polynomial.
|
|
270
|
+
*
|
|
271
|
+
* @param p - The quadratic polynomial.
|
|
272
|
+
* @returns The extreme point of the polynomial as a solution.
|
|
273
|
+
* @since 1.0.0
|
|
274
|
+
*/
|
|
275
|
+
const extreme = extreme$1;
|
|
276
|
+
const monotonicity = monotonicity$3;
|
|
277
|
+
/**
|
|
278
|
+
* Type-narrowing predicate: refines a `QuadraticPolynomial<T>` to
|
|
279
|
+
* `QuadraticPolynomial<T & Monotonic>` when the polynomial is strictly
|
|
280
|
+
* monotonic over the given interval (or globally, when no interval is given).
|
|
281
|
+
*
|
|
282
|
+
* @param p - The quadratic polynomial to check.
|
|
283
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
284
|
+
* @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.
|
|
285
|
+
* @since 2.0.0
|
|
286
|
+
*/
|
|
287
|
+
const isMonotonic = isMonotonic$3;
|
|
288
|
+
/**
|
|
289
|
+
* Type-narrowing predicate: refines to `QuadraticPolynomial<T & Increasing>`.
|
|
290
|
+
*
|
|
291
|
+
* @since 2.0.0
|
|
292
|
+
*/
|
|
293
|
+
const isIncreasing = isIncreasing$3;
|
|
294
|
+
/**
|
|
295
|
+
* Type-narrowing predicate: refines to `QuadraticPolynomial<T & Decreasing>`.
|
|
296
|
+
*
|
|
297
|
+
* @since 2.0.0
|
|
298
|
+
*/
|
|
299
|
+
const isDecreasing = isDecreasing$3;
|
|
300
|
+
/**
|
|
301
|
+
* Asserts that the quadratic polynomial is monotonic, throwing on failure.
|
|
302
|
+
*
|
|
303
|
+
* @param p - The quadratic polynomial to assert against.
|
|
304
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
305
|
+
* @returns The same polynomial, typed with the `Monotonic` brand.
|
|
306
|
+
* @throws When the polynomial is not monotonic over the given (or global) interval.
|
|
307
|
+
* @since 2.0.0
|
|
308
|
+
*/
|
|
309
|
+
const asMonotonic = asMonotonic$3;
|
|
310
|
+
/**
|
|
311
|
+
* Asserts that the quadratic polynomial is increasing, throwing on failure.
|
|
312
|
+
*
|
|
313
|
+
* @since 2.0.0
|
|
314
|
+
*/
|
|
315
|
+
const asIncreasing = asIncreasing$3;
|
|
316
|
+
/**
|
|
317
|
+
* Asserts that the quadratic polynomial is decreasing, throwing on failure.
|
|
318
|
+
*
|
|
319
|
+
* @since 2.0.0
|
|
320
|
+
*/
|
|
321
|
+
const asDecreasing = asDecreasing$3;
|
|
322
|
+
const antiderivative = antiderivative$3;
|
|
323
|
+
const domain = domain$3;
|
|
324
|
+
const range = range$3;
|
|
325
|
+
const length = length$3;
|
|
326
|
+
const curvature = curvature$1;
|
|
327
|
+
//#endregion
|
|
328
|
+
export { solveInverse$1 as _, make as a, solve as c, isIncreasing$1 as d, isMonotonic$1 as f, solve$1 as g, range$1 as h, isMonotonic as i, solveInverse as l, make$1 as m, isDecreasing as n, quadratic_exports as o, linear_exports as p, isIncreasing as r, range as s, derivative as t, isDecreasing$1 as u };
|
|
329
|
+
|
|
330
|
+
//# sourceMappingURL=quadratic-CamozcFc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quadratic-CamozcFc.mjs","names":["internal.isLinearPolynomial","equals","internal.equals","make","internal.make","fromVector","internal.fromVector","internal.fromPointSlope","fromPoints","internal.fromPoints","solve","internal.solve","toSolver","internal.toSolver","solveInverse","internal.solveInverse","toInverseSolver","internal.toInverseSolver","monotonicity","internal.monotonicity","isMonotonic","internal.isMonotonic","isIncreasing","internal.isIncreasing","isDecreasing","internal.isDecreasing","asMonotonic","internal.asMonotonic","asIncreasing","internal.asIncreasing","asDecreasing","internal.asDecreasing","derivative","internal.derivative","antiderivative","internal.antiderivative","domain","internal.domain","range","internal.range","length","internal.length","internal.isQuadraticPolynomial","internal.equals","internal.make","internal.fromVector","internal.fromPoints","internal.solve","internal.toSolver","internal.solveInverse","internal.toInverseSolver","internal.derivative","internal.roots","internal.extreme","internal.monotonicity","internal.isMonotonic","internal.isIncreasing","internal.isDecreasing","internal.asMonotonic","internal.asIncreasing","internal.asDecreasing","internal.antiderivative","internal.domain","internal.range","internal.length","internal.curvature"],"sources":["../../src/polynomial/linear.ts","../../src/polynomial/quadratic.ts"],"sourcesContent":["import type { Closed, Interval } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type * as Solution from '../solution/solution'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPolynomialTypeId } from './linear.internal'\nimport * as internal from './linear.internal'\nimport type { GuaranteedMonotonicity } from './monotonicity'\nimport type { QuadraticPolynomial } from './quadratic'\nimport type { Decreasing, Increasing, Monotonic, PolynomialTraits } from './traits'\n\nexport type { Monotonic, Increasing, Decreasing } from './traits'\n\n/**\n * A linear polynomial.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Traits` type parameter is a phantom marker that accumulates trait\n * brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and\n * friends. The runtime value carries no trait data — `Traits` only flows\n * through the type system to enable tighter return types on operations like\n * `solveInverse`.\n *\n * @since 1.0.0\n */\nexport interface LinearPolynomial<out Traits = unknown> extends Pipeable {\n readonly [LinearPolynomialTypeId]: LinearPolynomialTypeId\n readonly [PolynomialTraits]: Traits\n\n /**\n * The coefficient of the x^0 term.\n */\n readonly c0: number\n\n /**\n * The coefficient of the x^1 term.\n */\n readonly c1: number\n}\n\n/**\n * Checks if a value is a `LinearPolynomial`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `LinearPolynomial`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPolynomial: (v: unknown) => v is LinearPolynomial = internal.isLinearPolynomial\n\nexport const equals: {\n /**\n * Checks if two `LinearPolynomial` instances are approximately equal within\n * the default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first polynomial.\n * @param b - The second polynomial.\n * @returns `true` when each pair of coefficients is within tolerance.\n * @since 1.1.0\n */\n (a: LinearPolynomial, b: LinearPolynomial): boolean\n /**\n * Checks if two `LinearPolynomial` instances are approximately equal within\n * the default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second polynomial.\n * @returns A function that takes the first polynomial and returns the comparison result.\n * @since 1.1.0\n */\n (b: LinearPolynomial): (a: LinearPolynomial) => boolean\n} = internal.equals\n\n/**\n * Creates a new `LinearPolynomial` instance.\n *\n * @param c0 - The coefficient of the x^0 term. Defaults to 0.\n * @param c1 - The coefficient of the x^1 term. Defaults to 0.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const make: (c0?: number, c1?: number) => LinearPolynomial = internal.make\n\n/**\n * Creates a new `LinearPolynomial` instance from a vector.\n *\n * @param v - The vector to create the polynomial from.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromVector: (v: Vector2) => LinearPolynomial = internal.fromVector\n\n/**\n * Creates a new `LinearPolynomial` instance from a point and slope.\n *\n * @param p - The point on the line.\n * @param slope - The slope of the line.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromPointSlope: (p: Vector2, slope: number) => LinearPolynomial =\n internal.fromPointSlope\n\n/**\n * Creates a new `LinearPolynomial` instance from two points.\n *\n * @param p1 - The first point.\n * @param p2 - The second point.\n * @returns A new `LinearPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromPoints: (p1: Vector2, p2: Vector2) => LinearPolynomial = internal.fromPoints\n\nexport const solve: {\n /**\n * Solves a linear polynomial for a given value of x.\n *\n * @param p - The linear polynomial to solve.\n * @param x - The value of x to solve for.\n * @returns The result of the polynomial evaluated at x.\n * @since 1.0.0\n */\n (p: LinearPolynomial, x: number): number\n /**\n * Solves a linear polynomial for a given value of x.\n *\n * @param x - The value of x to solve for.\n * @returns A function that takes a `LinearPolynomial` and returns the result of the polynomial evaluated at x.\n * @since 1.0.0\n */\n (x: number): (p: LinearPolynomial) => number\n} = internal.solve\n\n/**\n * Converts a linear polynomial to a solver function.\n *\n * @param p - The linear polynomial to convert.\n * @returns A function that takes a value of x and returns the result of the polynomial evaluated at x.\n * @since 1.0.0\n */\nexport const toSolver: (p: LinearPolynomial) => (x: number) => number = internal.toSolver\n\n// The implementation always runs the same `c1 === 0 ? Solution.none : ...`\n// branch. For `Monotonic`-branded polynomials the empty branch is provably\n// unreachable, but TS can't see that — the cast pairs the type-level promise\n// with the runtime brand check.\nexport const solveInverse: {\n /**\n * Solves a monotonic linear polynomial for a given value of y. Because the\n * polynomial is strictly monotonic, the inverse always has exactly one\n * solution — wrapped in `Solution.One`.\n *\n * @param p - The monotonic linear polynomial to solve.\n * @param y - The value of y to solve for.\n * @since 2.0.0\n */\n <T extends Monotonic>(p: LinearPolynomial<T>, y: number): Solution.One<number>\n /**\n * Solves a linear polynomial for a given value of y. Returns `Solution.none`\n * for constant polynomials (no inverse).\n *\n * @param p - The linear polynomial to solve.\n * @param y - The value of y to solve for.\n * @since 1.0.0\n */\n <T>(p: LinearPolynomial<T>, y: number): Solution.AtMostOne<number>\n /** @since 1.0.0 */\n (y: number): {\n <T extends Monotonic>(p: LinearPolynomial<T>): Solution.One<number>\n <T>(p: LinearPolynomial<T>): Solution.AtMostOne<number>\n }\n} = internal.solveInverse as never\n\n/**\n * Converts a linear polynomial to an inverse solver function.\n *\n * @param p - The linear polynomial to convert.\n * @since 1.0.0\n */\nexport const toInverseSolver: (p: LinearPolynomial) => (y: number) => Solution.AtMostOne<number> =\n internal.toInverseSolver\n\n/**\n * Finds the roots of a linear polynomial.\n *\n * @param p - The linear polynomial to find the roots of.\n * @since 1.0.0\n */\nexport const root: (p: LinearPolynomial) => Solution.AtMostOne<number> = (p) =>\n internal.solveInverse(p, 0)\n\n/**\n * Calculates the monotonicity of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @returns The guaranteed monotonicity of the polynomial.\n * @since 1.0.0\n */\nexport const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity = internal.monotonicity\n\n/**\n * Type-narrowing predicate: refines a `LinearPolynomial<T>` to\n * `LinearPolynomial<T & Monotonic>` when the polynomial is strictly monotonic.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'increasing'` or `'decreasing'`.\n * @since 2.0.0\n */\nexport const isMonotonic: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Monotonic> =\n internal.isMonotonic\n\n/**\n * Type-narrowing predicate: refines to `LinearPolynomial<T & Increasing>`.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'increasing'`.\n * @since 2.0.0\n */\nexport const isIncreasing: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Increasing> =\n internal.isIncreasing\n\n/**\n * Type-narrowing predicate: refines to `LinearPolynomial<T & Decreasing>`.\n *\n * @param p - The linear polynomial to check.\n * @returns `true` when `monotonicity(p)` is `'decreasing'`.\n * @since 2.0.0\n */\nexport const isDecreasing: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Decreasing> =\n internal.isDecreasing\n\n/**\n * Asserts that the linear polynomial is monotonic, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Monotonic` brand.\n * @throws When `monotonicity(p)` is `'constant'`.\n * @since 2.0.0\n */\nexport const asMonotonic: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Monotonic> =\n internal.asMonotonic\n\n/**\n * Asserts that the linear polynomial is increasing, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Increasing` brand.\n * @throws When `monotonicity(p)` is not `'increasing'`.\n * @since 2.0.0\n */\nexport const asIncreasing: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Increasing> =\n internal.asIncreasing\n\n/**\n * Asserts that the linear polynomial is decreasing, throwing on failure.\n *\n * @param p - The linear polynomial to assert against.\n * @returns The same polynomial, typed with the `Decreasing` brand.\n * @throws When `monotonicity(p)` is not `'decreasing'`.\n * @since 2.0.0\n */\nexport const asDecreasing: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Decreasing> =\n internal.asDecreasing\n\n/**\n * Calculates the derivative of a linear polynomial.\n *\n * @param p - The linear polynomial to differentiate.\n * @returns The derivative of the linear polynomial.\n * @since 1.0.0\n */\nexport const derivative: (p: LinearPolynomial) => number = internal.derivative\n\nexport const antiderivative: {\n /**\n * Calculates the antiderivative of a linear polynomial.\n *\n * @param p - The linear polynomial to integrate.\n * @param constant - The constant of integration. Defaults to 0.\n * @returns The antiderivative of the linear polynomial.\n * @since 1.0.0\n */\n (p: LinearPolynomial, constant?: number): QuadraticPolynomial\n /**\n * Calculates the antiderivative of a linear polynomial.\n *\n * @param constant - The constant of integration. Defaults to 0.\n * @returns A function that takes a `LinearPolynomial` and returns the antiderivative of the polynomial.\n * @since 1.0.0\n */\n (constant: number): (p: LinearPolynomial) => QuadraticPolynomial\n} = internal.antiderivative\n\nexport const domain: {\n /**\n * Calculates the domain of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @param range - The range to check against.\n * @returns The domain of the polynomial within the given range.\n * @since 1.0.0\n */\n (p: LinearPolynomial, range: Interval): Solution.AtMostOne<Interval>\n /**\n * Calculates the domain of a linear polynomial.\n *\n * @param range - The range to check against.\n * @returns A function that takes a `LinearPolynomial` and returns the domain of the polynomial within the given range.\n * @since 1.0.0\n */\n (range: Interval): (p: LinearPolynomial) => Solution.AtMostOne<Interval>\n} = internal.domain\n\nexport const range: {\n /**\n * Calculates the range of a linear polynomial.\n *\n * @param p - The linear polynomial to check.\n * @param domain - The domain to check against.\n * @returns The range of the polynomial within the given domain.\n * @since 1.0.0\n */\n (p: LinearPolynomial, domain: Interval): Closed\n /**\n * Calculates the range of a linear polynomial.\n *\n * @param domain - The domain to check against.\n * @returns A function that takes a `LinearPolynomial` and returns the range of the polynomial within the given domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: LinearPolynomial) => Closed\n} = internal.range\n\nexport const length: {\n /**\n * Calculates the length of a linear polynomial within a particular domain `Interval`.\n *\n * @param p - The linear polynomial to analyze.\n * @param domain - The domain to restrict the analysis to.\n * @returns The length of the linear polynomial in the specified domain.\n * @since 1.0.0\n */\n (p: LinearPolynomial, domain: Interval): number\n /**\n * Calculates the length of a linear polynomial within a particular domain `Interval`.\n *\n * @param domain - The domain to restrict the analysis to.\n * @returns A function that takes a `LinearPolynomial` and returns the length of the polynomial in the specified domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: LinearPolynomial) => number\n} = internal.length\n","import type { Closed, Interval } from '../interval/interval'\nimport type { Pipeable } from '../utils'\nimport type * as Solution from '../solution/solution'\nimport type { Vector2 } from '../vector/vector2'\nimport type { Vector3 } from '../vector/vector3'\nimport type { CubicPolynomial } from './cubic'\nimport type { LinearPolynomial } from './linear'\nimport type { Monotonicity } from './monotonicity'\nimport * as internal from './quadratic.internal'\nimport type { QuadraticPolynomialTypeId } from './quadratic.internal.circular'\nimport type { Decreasing, Increasing, Monotonic, PolynomialTraits } from './traits'\n\nexport type { Monotonic, Increasing, Decreasing } from './traits'\n\n/**\n * A quadratic polynomial.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Traits` type parameter is a phantom marker that accumulates trait\n * brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and\n * friends. Refinements may be parameterized by an `Interval` — a quadratic is\n * monotonic on an interval that avoids its extremum, even though it is not\n * monotonic globally.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPolynomial<out Traits = unknown> extends Pipeable {\n readonly [QuadraticPolynomialTypeId]: QuadraticPolynomialTypeId\n readonly [PolynomialTraits]: Traits\n\n /**\n * The coefficient of the x^0 term.\n */\n readonly c0: number\n /**\n * The coefficient of the x^1 term.\n */\n readonly c1: number\n /**\n * The coefficient of the x^2 term.\n */\n readonly c2: number\n}\n\n/**\n * Checks if a value is a `QuadraticPolynomial`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `QuadraticPolynomial`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPolynomial: (v: unknown) => v is QuadraticPolynomial =\n internal.isQuadraticPolynomial\n\nexport const equals: {\n /**\n * Checks if two `QuadraticPolynomial` instances are approximately equal\n * within the default absolute tolerance ({@link EPSILON}).\n *\n * @param a - The first polynomial.\n * @param b - The second polynomial.\n * @returns `true` when each pair of coefficients is within tolerance.\n * @since 1.1.0\n */\n (a: QuadraticPolynomial, b: QuadraticPolynomial): boolean\n /**\n * Checks if two `QuadraticPolynomial` instances are approximately equal\n * within the default absolute tolerance ({@link EPSILON}).\n *\n * @param b - The second polynomial.\n * @returns A function that takes the first polynomial and returns the comparison result.\n * @since 1.1.0\n */\n (b: QuadraticPolynomial): (a: QuadraticPolynomial) => boolean\n} = internal.equals\n\n/**\n * Creates a new `QuadraticPolynomial` instance.\n *\n * @param c0 - The coefficient of the x^0 term. Defaults to 0.\n * @param c1 - The coefficient of the x^1 term. Defaults to 0.\n * @param c2 - The coefficient of the x^2 term. Defaults to 1.\n * @returns A new `QuadraticPolynomial` instance.\n * @since 1.0.0\n */\nexport const make: (c0?: number, c1?: number, c2?: number) => QuadraticPolynomial = internal.make\n\n/**\n * Creates a new `QuadraticPolynomial` instance from a vector.\n *\n * @param v - The vector to create the polynomial from.\n * @returns A new `QuadraticPolynomial` instance.\n * @since 1.0.0\n */\nexport const fromVector: (v: Vector3) => QuadraticPolynomial = internal.fromVector\n\n/**\n * Creates a new `QuadraticPolynomial` that interpolates the three given\n * points, treating each `Vector2` as an `(x, y)` pair. The three input `x`\n * values must be distinct.\n *\n * @param p0 - The first point.\n * @param p1 - The second point.\n * @param p2 - The third point.\n * @returns The unique quadratic polynomial passing through the three points.\n * @since 2.0.0\n */\nexport const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticPolynomial =\n internal.fromPoints\n\nexport const solve: {\n /**\n * Solves the quadratic polynomial for a given x value.\n *\n * @param p - The quadratic polynomial.\n * @param x - The x value to solve for.\n * @returns The result of the polynomial at the given x value.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, x: number): number\n /**\n * Solves the quadratic polynomial for a given x value.\n *\n * @param x - The x value to solve for.\n * @returns A function that takes a quadratic polynomial and returns the result of the polynomial at the given x value.\n * @since 1.0.0\n */\n (x: number): (p: QuadraticPolynomial) => number\n} = internal.solve\n\n/**\n * Creates a solver function for the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns A function that takes an x value and returns the result of the polynomial at that x value.\n */\nexport const toSolver: (p: QuadraticPolynomial) => (x: number) => number = internal.toSolver\n\nexport const solveInverse: {\n /**\n * Solves a monotonic quadratic polynomial for a given y value. Because the\n * polynomial is strictly monotonic (either globally, or over the interval\n * the `Monotonic` brand was attached for), the inverse has at most one\n * solution.\n *\n * @param p - The monotonic quadratic polynomial.\n * @param y - The y value to solve for.\n * @returns Zero or one solutions.\n * @since 2.0.0\n */\n <T extends Monotonic>(p: QuadraticPolynomial<T>, y: number): Solution.AtMostOne<number>\n /**\n * Solves the quadratic polynomial for a given y value.\n *\n * @param p - The quadratic polynomial.\n * @param y - The y value to solve for.\n * @returns The solutions to the polynomial at the given y value.\n * @since 1.0.0\n */\n <T>(p: QuadraticPolynomial<T>, y: number): Solution.AtMostTwo<number>\n /**\n * Solves the quadratic polynomial for a given y value.\n *\n * @param y - The y value to solve for.\n * @returns A function that takes a quadratic polynomial and returns the\n * solutions. Tightens to `Solution.AtMostOne<number>` for monotonic inputs.\n * @since 1.0.0\n */\n (y: number): {\n <T extends Monotonic>(p: QuadraticPolynomial<T>): Solution.AtMostOne<number>\n <T>(p: QuadraticPolynomial<T>): Solution.AtMostTwo<number>\n }\n} = internal.solveInverse as never\n\n/**\n * Creates an inverse solver function for the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns A function that takes a y value and returns the solutions to the polynomial at that y value.\n */\nexport const toInverseSolver: (\n p: QuadraticPolynomial,\n) => (y: number) => Solution.AtMostTwo<number> = internal.toInverseSolver\n\n/**\n * Computes the derivative of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The derivative of the polynomial as a linear polynomial.\n * @since 1.0.0\n */\nexport const derivative: (p: QuadraticPolynomial) => LinearPolynomial = internal.derivative\n\n/**\n * Finds the roots of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The roots of the polynomial as a tuple of solutions.\n * @since 1.0.0\n */\nexport const roots: (p: QuadraticPolynomial) => Solution.AtMostTwo<number> = internal.roots\n\n/**\n * Finds the extreme point of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @returns The extreme point of the polynomial as a solution.\n * @since 1.0.0\n */\nexport const extreme: (p: QuadraticPolynomial) => Vector2 | null = internal.extreme\n\nexport const monotonicity: {\n /**\n * Computes the monotonicity of the quadratic polynomial over a given\n * interval. Throws when the interval has zero width — the question is\n * undefined at a single point.\n *\n * @param p - The quadratic polynomial.\n * @param i - The interval to compute the monotonicity over.\n * @returns The monotonicity of the polynomial over the interval.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, i?: Interval): Monotonicity\n /**\n * Computes the monotonicity of the quadratic polynomial over a given\n * interval. Throws when the interval has zero width.\n *\n * @param i - The interval to compute the monotonicity over.\n * @returns A function that takes a quadratic polynomial and returns the\n * monotonicity of the polynomial over the interval.\n * @since 1.0.0\n */\n (i: Interval): (p: QuadraticPolynomial) => Monotonicity\n} = internal.monotonicity\n\n/**\n * Type-narrowing predicate: refines a `QuadraticPolynomial<T>` to\n * `QuadraticPolynomial<T & Monotonic>` when the polynomial is strictly\n * monotonic over the given interval (or globally, when no interval is given).\n *\n * @param p - The quadratic polynomial to check.\n * @param i - Optional interval over which to check monotonicity.\n * @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.\n * @since 2.0.0\n */\nexport const isMonotonic: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Monotonic>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Monotonic>\n} = internal.isMonotonic\n\n/**\n * Type-narrowing predicate: refines to `QuadraticPolynomial<T & Increasing>`.\n *\n * @since 2.0.0\n */\nexport const isIncreasing: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Increasing>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Increasing>\n} = internal.isIncreasing\n\n/**\n * Type-narrowing predicate: refines to `QuadraticPolynomial<T & Decreasing>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasing: {\n <T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Decreasing>\n (i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Decreasing>\n} = internal.isDecreasing\n\n/**\n * Asserts that the quadratic polynomial is monotonic, throwing on failure.\n *\n * @param p - The quadratic polynomial to assert against.\n * @param i - Optional interval over which to check monotonicity.\n * @returns The same polynomial, typed with the `Monotonic` brand.\n * @throws When the polynomial is not monotonic over the given (or global) interval.\n * @since 2.0.0\n */\nexport const asMonotonic: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Monotonic> = internal.asMonotonic\n\n/**\n * Asserts that the quadratic polynomial is increasing, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasing: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Increasing> = internal.asIncreasing\n\n/**\n * Asserts that the quadratic polynomial is decreasing, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasing: <T>(\n p: QuadraticPolynomial<T>,\n i?: Interval,\n) => QuadraticPolynomial<T & Decreasing> = internal.asDecreasing\n\nexport const antiderivative: {\n /**\n * Computes the antiderivative of the quadratic polynomial.\n *\n * @param p - The quadratic polynomial.\n * @param constant - The constant of integration. Defaults to 0.\n * @returns The antiderivative of the polynomial as a cubic polynomial.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, constant?: number): CubicPolynomial\n /**\n * Computes the antiderivative of the quadratic polynomial.\n *\n * @param constant - The constant of integration. Defaults to 0.\n * @returns A function that takes a quadratic polynomial and returns the antiderivative of the polynomial as a cubic polynomial.\n * @since 1.0.0\n */\n (constant: number): (p: QuadraticPolynomial) => CubicPolynomial\n} = internal.antiderivative\n\nexport const domain: {\n /**\n * Computes the domain of the quadratic polynomial over a given range.\n *\n * @param p - The quadratic polynomial.\n * @param range - The range to compute the domain over.\n * @returns The domain of the polynomial over the range.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, range: Interval): Solution.AtMostOne<Interval>\n /**\n * Computes the domain of the quadratic polynomial over a given range.\n *\n * @param range - The range to compute the domain over.\n * @returns A function that takes a quadratic polynomial and returns the domain of the polynomial over the range.\n * @since 1.0.0\n */\n (range: Interval): (p: QuadraticPolynomial) => Solution.AtMostOne<Interval>\n} = internal.domain\n\nexport const range: {\n /**\n * Computes the range of the quadratic polynomial over a given domain.\n *\n * @param p - The quadratic polynomial.\n * @param domain - The domain to compute the range over.\n * @returns The range of the polynomial over the domain.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, domain: Interval): Closed\n /**\n * Computes the range of the quadratic polynomial over a given domain.\n *\n * @param domain - The domain to compute the range over.\n * @returns A function that takes a quadratic polynomial and returns the range of the polynomial over the domain.\n * @since 1.0.0\n */\n (domain: Interval): (p: QuadraticPolynomial) => Closed\n} = internal.range\n\nexport const length: {\n /**\n * Computes the length of the quadratic polynomial over a given interval.\n *\n * @param p - The quadratic polynomial.\n * @param i - The interval to compute the length over.\n * @returns The length of the polynomial over the interval.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, i: Interval): number\n /**\n * Computes the length of the quadratic polynomial over a given interval.\n *\n * @param i - The interval to compute the length over.\n * @returns A function that takes a quadratic polynomial and returns the length of the polynomial over the interval.\n * @since 1.0.0\n */\n (i: Interval): (p: QuadraticPolynomial) => number\n} = internal.length\n\nexport const curvature: {\n /**\n * Computes the curvature of the quadratic polynomial at a given x value.\n *\n * @param p - The quadratic polynomial.\n * @param x - The x value to compute the curvature at.\n * @returns The curvature of the polynomial at the given x value.\n * @since 1.0.0\n */\n (p: QuadraticPolynomial, x: number): number\n /**\n * Computes the curvature of the quadratic polynomial at a given x value.\n *\n * @param x - The x value to compute the curvature at.\n * @returns A function that takes a quadratic polynomial and returns the curvature of the polynomial at the given x value.\n * @since 1.0.0\n */\n (x: number): (p: QuadraticPolynomial) => number\n} = internal.curvature\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,qBAA4DA;AAEzE,MAAaC,WAoBTC;;;;;;;;;AAUJ,MAAaC,SAAuDC;;;;;;;;AASpE,MAAaC,eAA+CC;;;;;;;;;AAU5D,MAAa,iBACXC;;;;;;;;;AAUF,MAAaC,eAA6DC;AAE1E,MAAaC,UAkBTC;;;;;;;;AASJ,MAAaC,aAA2DC;AAMxE,MAAaC,iBAyBTC;;;;;;;AAQJ,MAAaC,oBACXC;;;;;;;AAQF,MAAa,QAA6D,MACxEF,eAAsB,GAAG,EAAE;;;;;;;;AAS7B,MAAaG,iBAAgEC;;;;;;;;;AAU7E,MAAaC,gBACXC;;;;;;;;AASF,MAAaC,iBACXC;;;;;;;;AASF,MAAaC,iBACXC;;;;;;;;;AAUF,MAAaC,gBACXC;;;;;;;;;AAUF,MAAaC,iBACXC;;;;;;;;;AAUF,MAAaC,iBACXC;;;;;;;;AASF,MAAaC,eAA8CC;AAE3D,MAAaC,mBAkBTC;AAEJ,MAAaC,WAkBTC;AAEJ,MAAaC,UAkBTC;AAEJ,MAAaC,WAkBTC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzSJ,MAAa,wBACXC;AAEF,MAAa,SAoBTC;;;;;;;;;;AAWJ,MAAa,OAAuEC;;;;;;;;AASpF,MAAa,aAAkDC;;;;;;;;;;;;AAa/D,MAAa,aACXC;AAEF,MAAa,QAkBTC;;;;;;;AAQJ,MAAa,WAA8DC;AAE3E,MAAa,eAkCTC;;;;;;;AAQJ,MAAa,kBAEoCC;;;;;;;;AASjD,MAAa,aAA2DC;;;;;;;;AASxE,MAAa,QAAgEC;;;;;;;;AAS7E,MAAa,UAAsDC;AAEnE,MAAa,eAsBTC;;;;;;;;;;;AAYJ,MAAa,cAGTC;;;;;;AAOJ,MAAa,eAGTC;;;;;;AAOJ,MAAa,eAGTC;;;;;;;;;;AAWJ,MAAa,cAG6BC;;;;;;AAO1C,MAAa,eAG8BC;;;;;;AAO3C,MAAa,eAG8BC;AAE3C,MAAa,iBAkBTC;AAEJ,MAAa,SAkBTC;AAEJ,MAAa,QAkBTC;AAEJ,MAAa,SAkBTC;AAEJ,MAAa,YAkBTC"}
|