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,1100 @@
|
|
|
1
|
+
import { t as Vector2 } from "./vector2-DPUY3_eA.mjs";
|
|
2
|
+
import { t as Pipeable } from "./utils-MCckigYk.mjs";
|
|
3
|
+
import { r as Vector4, t as Vector3 } from "./vector3-DqeOZtOB.mjs";
|
|
4
|
+
import { n as Closed, r as Interval } from "./interval-Dy-RMEE3.mjs";
|
|
5
|
+
import { i as One, n as AtMostThree, r as AtMostTwo, t as AtMostOne } from "./solution-sNQ-ZVhN.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/polynomial/traits.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Trait brands for polynomials.
|
|
10
|
+
*
|
|
11
|
+
* Brands are phantom types — they exist only at the type level and carry no
|
|
12
|
+
* runtime data. A polynomial value at runtime is identical regardless of the
|
|
13
|
+
* traits attached to its type. Refiners (`isMonotonic`, `isIncreasing`, …) and
|
|
14
|
+
* assertions (`asMonotonic`, …) on each polynomial module attach these brands
|
|
15
|
+
* to the polynomial's `Traits` parameter at the type level.
|
|
16
|
+
*
|
|
17
|
+
* The intersection model is "trait accumulation": a polynomial typed as
|
|
18
|
+
* `LinearPolynomial<Increasing>` carries both the `Monotonic` and `Increasing`
|
|
19
|
+
* brands, since `Increasing` extends `Monotonic`.
|
|
20
|
+
*
|
|
21
|
+
* @since 2.0.0
|
|
22
|
+
*/
|
|
23
|
+
declare const MonotonicId: unique symbol;
|
|
24
|
+
/**
|
|
25
|
+
* Brand for *strictly* monotonic polynomials — `monotonicity()` returns
|
|
26
|
+
* `'increasing'` or `'decreasing'`. The constant case is excluded; constants
|
|
27
|
+
* have no useful inverse refinement.
|
|
28
|
+
*
|
|
29
|
+
* @since 2.0.0
|
|
30
|
+
*/
|
|
31
|
+
type Monotonic = {
|
|
32
|
+
readonly [MonotonicId]: 'monotonic';
|
|
33
|
+
};
|
|
34
|
+
declare const IncreasingId: unique symbol;
|
|
35
|
+
/**
|
|
36
|
+
* Brand for strictly increasing polynomials. Implies `Monotonic`.
|
|
37
|
+
*
|
|
38
|
+
* @since 2.0.0
|
|
39
|
+
*/
|
|
40
|
+
type Increasing = Monotonic & {
|
|
41
|
+
readonly [IncreasingId]: 'increasing';
|
|
42
|
+
};
|
|
43
|
+
declare const DecreasingId: unique symbol;
|
|
44
|
+
/**
|
|
45
|
+
* Brand for strictly decreasing polynomials. Implies `Monotonic`.
|
|
46
|
+
*
|
|
47
|
+
* @since 2.0.0
|
|
48
|
+
*/
|
|
49
|
+
type Decreasing = Monotonic & {
|
|
50
|
+
readonly [DecreasingId]: 'decreasing';
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Phantom property key used by polynomial interfaces to hold their `Traits`
|
|
54
|
+
* type parameter. The runtime object never has a value at this key — the
|
|
55
|
+
* `declare` modifier on the impl class makes the property type-visible only.
|
|
56
|
+
* The symbol itself is exported as a real value so that bundlers can resolve
|
|
57
|
+
* the computed key reference even though the property is never assigned.
|
|
58
|
+
*
|
|
59
|
+
* @since 2.0.0
|
|
60
|
+
*/
|
|
61
|
+
declare const PolynomialTraits: unique symbol;
|
|
62
|
+
type PolynomialTraits = typeof PolynomialTraits;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/polynomial/cubic.internal.circular.d.ts
|
|
65
|
+
declare const CubicPolynomialTypeId: unique symbol;
|
|
66
|
+
type CubicPolynomialTypeId = typeof CubicPolynomialTypeId;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/polynomial/monotonicity.d.ts
|
|
69
|
+
type Monotonicity = 'none' | 'increasing' | 'decreasing' | 'constant';
|
|
70
|
+
type GuaranteedMonotonicity = 'increasing' | 'decreasing' | 'constant';
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/polynomial/linear.internal.d.ts
|
|
73
|
+
declare const LinearPolynomialTypeId: unique symbol;
|
|
74
|
+
type LinearPolynomialTypeId = typeof LinearPolynomialTypeId;
|
|
75
|
+
declare namespace linear_d_exports {
|
|
76
|
+
export { Decreasing, Increasing, LinearPolynomial, Monotonic, antiderivative$1 as antiderivative, asDecreasing$2 as asDecreasing, asIncreasing$2 as asIncreasing, asMonotonic$2 as asMonotonic, derivative$2 as derivative, domain$2 as domain, equals$2 as equals, fromPointSlope, fromPoints$2 as fromPoints, fromVector$2 as fromVector, isDecreasing$2 as isDecreasing, isIncreasing$2 as isIncreasing, isLinearPolynomial, isMonotonic$2 as isMonotonic, length$2 as length, make$2 as make, monotonicity$2 as monotonicity, range$2 as range, root, solve$2 as solve, solveInverse$2 as solveInverse, toInverseSolver$2 as toInverseSolver, toSolver$2 as toSolver };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A linear polynomial.
|
|
80
|
+
*
|
|
81
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
82
|
+
*
|
|
83
|
+
* The `Traits` type parameter is a phantom marker that accumulates trait
|
|
84
|
+
* brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and
|
|
85
|
+
* friends. The runtime value carries no trait data — `Traits` only flows
|
|
86
|
+
* through the type system to enable tighter return types on operations like
|
|
87
|
+
* `solveInverse`.
|
|
88
|
+
*
|
|
89
|
+
* @since 1.0.0
|
|
90
|
+
*/
|
|
91
|
+
interface LinearPolynomial<out Traits = unknown> extends Pipeable {
|
|
92
|
+
readonly [LinearPolynomialTypeId]: LinearPolynomialTypeId;
|
|
93
|
+
readonly [PolynomialTraits]: Traits;
|
|
94
|
+
/**
|
|
95
|
+
* The coefficient of the x^0 term.
|
|
96
|
+
*/
|
|
97
|
+
readonly c0: number;
|
|
98
|
+
/**
|
|
99
|
+
* The coefficient of the x^1 term.
|
|
100
|
+
*/
|
|
101
|
+
readonly c1: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Checks if a value is a `LinearPolynomial`.
|
|
105
|
+
*
|
|
106
|
+
* @param v - The value to check.
|
|
107
|
+
* @returns `true` if the value is a `LinearPolynomial`, `false` otherwise.
|
|
108
|
+
* @since 1.0.0
|
|
109
|
+
*/
|
|
110
|
+
declare const isLinearPolynomial: (v: unknown) => v is LinearPolynomial;
|
|
111
|
+
declare const equals$2: {
|
|
112
|
+
/**
|
|
113
|
+
* Checks if two `LinearPolynomial` instances are approximately equal within
|
|
114
|
+
* the default absolute tolerance ({@link EPSILON}).
|
|
115
|
+
*
|
|
116
|
+
* @param a - The first polynomial.
|
|
117
|
+
* @param b - The second polynomial.
|
|
118
|
+
* @returns `true` when each pair of coefficients is within tolerance.
|
|
119
|
+
* @since 1.1.0
|
|
120
|
+
*/
|
|
121
|
+
(a: LinearPolynomial, b: LinearPolynomial): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if two `LinearPolynomial` instances are approximately equal within
|
|
124
|
+
* the default absolute tolerance ({@link EPSILON}).
|
|
125
|
+
*
|
|
126
|
+
* @param b - The second polynomial.
|
|
127
|
+
* @returns A function that takes the first polynomial and returns the comparison result.
|
|
128
|
+
* @since 1.1.0
|
|
129
|
+
*/
|
|
130
|
+
(b: LinearPolynomial): (a: LinearPolynomial) => boolean;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new `LinearPolynomial` instance.
|
|
134
|
+
*
|
|
135
|
+
* @param c0 - The coefficient of the x^0 term. Defaults to 0.
|
|
136
|
+
* @param c1 - The coefficient of the x^1 term. Defaults to 0.
|
|
137
|
+
* @returns A new `LinearPolynomial` instance.
|
|
138
|
+
* @since 1.0.0
|
|
139
|
+
*/
|
|
140
|
+
declare const make$2: (c0?: number, c1?: number) => LinearPolynomial;
|
|
141
|
+
/**
|
|
142
|
+
* Creates a new `LinearPolynomial` instance from a vector.
|
|
143
|
+
*
|
|
144
|
+
* @param v - The vector to create the polynomial from.
|
|
145
|
+
* @returns A new `LinearPolynomial` instance.
|
|
146
|
+
* @since 1.0.0
|
|
147
|
+
*/
|
|
148
|
+
declare const fromVector$2: (v: Vector2) => LinearPolynomial;
|
|
149
|
+
/**
|
|
150
|
+
* Creates a new `LinearPolynomial` instance from a point and slope.
|
|
151
|
+
*
|
|
152
|
+
* @param p - The point on the line.
|
|
153
|
+
* @param slope - The slope of the line.
|
|
154
|
+
* @returns A new `LinearPolynomial` instance.
|
|
155
|
+
* @since 1.0.0
|
|
156
|
+
*/
|
|
157
|
+
declare const fromPointSlope: (p: Vector2, slope: number) => LinearPolynomial;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new `LinearPolynomial` instance from two points.
|
|
160
|
+
*
|
|
161
|
+
* @param p1 - The first point.
|
|
162
|
+
* @param p2 - The second point.
|
|
163
|
+
* @returns A new `LinearPolynomial` instance.
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
*/
|
|
166
|
+
declare const fromPoints$2: (p1: Vector2, p2: Vector2) => LinearPolynomial;
|
|
167
|
+
declare const solve$2: {
|
|
168
|
+
/**
|
|
169
|
+
* Solves a linear polynomial for a given value of x.
|
|
170
|
+
*
|
|
171
|
+
* @param p - The linear polynomial to solve.
|
|
172
|
+
* @param x - The value of x to solve for.
|
|
173
|
+
* @returns The result of the polynomial evaluated at x.
|
|
174
|
+
* @since 1.0.0
|
|
175
|
+
*/
|
|
176
|
+
(p: LinearPolynomial, x: number): number;
|
|
177
|
+
/**
|
|
178
|
+
* Solves a linear polynomial for a given value of x.
|
|
179
|
+
*
|
|
180
|
+
* @param x - The value of x to solve for.
|
|
181
|
+
* @returns A function that takes a `LinearPolynomial` and returns the result of the polynomial evaluated at x.
|
|
182
|
+
* @since 1.0.0
|
|
183
|
+
*/
|
|
184
|
+
(x: number): (p: LinearPolynomial) => number;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Converts a linear polynomial to a solver function.
|
|
188
|
+
*
|
|
189
|
+
* @param p - The linear polynomial to convert.
|
|
190
|
+
* @returns A function that takes a value of x and returns the result of the polynomial evaluated at x.
|
|
191
|
+
* @since 1.0.0
|
|
192
|
+
*/
|
|
193
|
+
declare const toSolver$2: (p: LinearPolynomial) => (x: number) => number;
|
|
194
|
+
declare const solveInverse$2: {
|
|
195
|
+
/**
|
|
196
|
+
* Solves a monotonic linear polynomial for a given value of y. Because the
|
|
197
|
+
* polynomial is strictly monotonic, the inverse always has exactly one
|
|
198
|
+
* solution — wrapped in `Solution.One`.
|
|
199
|
+
*
|
|
200
|
+
* @param p - The monotonic linear polynomial to solve.
|
|
201
|
+
* @param y - The value of y to solve for.
|
|
202
|
+
* @since 2.0.0
|
|
203
|
+
*/
|
|
204
|
+
<T extends Monotonic>(p: LinearPolynomial<T>, y: number): One<number>;
|
|
205
|
+
/**
|
|
206
|
+
* Solves a linear polynomial for a given value of y. Returns `Solution.none`
|
|
207
|
+
* for constant polynomials (no inverse).
|
|
208
|
+
*
|
|
209
|
+
* @param p - The linear polynomial to solve.
|
|
210
|
+
* @param y - The value of y to solve for.
|
|
211
|
+
* @since 1.0.0
|
|
212
|
+
*/
|
|
213
|
+
<T>(p: LinearPolynomial<T>, y: number): AtMostOne<number>; /** @since 1.0.0 */
|
|
214
|
+
(y: number): {
|
|
215
|
+
<T extends Monotonic>(p: LinearPolynomial<T>): One<number>;
|
|
216
|
+
<T>(p: LinearPolynomial<T>): AtMostOne<number>;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Converts a linear polynomial to an inverse solver function.
|
|
221
|
+
*
|
|
222
|
+
* @param p - The linear polynomial to convert.
|
|
223
|
+
* @since 1.0.0
|
|
224
|
+
*/
|
|
225
|
+
declare const toInverseSolver$2: (p: LinearPolynomial) => (y: number) => AtMostOne<number>;
|
|
226
|
+
/**
|
|
227
|
+
* Finds the roots of a linear polynomial.
|
|
228
|
+
*
|
|
229
|
+
* @param p - The linear polynomial to find the roots of.
|
|
230
|
+
* @since 1.0.0
|
|
231
|
+
*/
|
|
232
|
+
declare const root: (p: LinearPolynomial) => AtMostOne<number>;
|
|
233
|
+
/**
|
|
234
|
+
* Calculates the monotonicity of a linear polynomial.
|
|
235
|
+
*
|
|
236
|
+
* @param p - The linear polynomial to check.
|
|
237
|
+
* @returns The guaranteed monotonicity of the polynomial.
|
|
238
|
+
* @since 1.0.0
|
|
239
|
+
*/
|
|
240
|
+
declare const monotonicity$2: (p: LinearPolynomial) => GuaranteedMonotonicity;
|
|
241
|
+
/**
|
|
242
|
+
* Type-narrowing predicate: refines a `LinearPolynomial<T>` to
|
|
243
|
+
* `LinearPolynomial<T & Monotonic>` when the polynomial is strictly monotonic.
|
|
244
|
+
*
|
|
245
|
+
* @param p - The linear polynomial to check.
|
|
246
|
+
* @returns `true` when `monotonicity(p)` is `'increasing'` or `'decreasing'`.
|
|
247
|
+
* @since 2.0.0
|
|
248
|
+
*/
|
|
249
|
+
declare const isMonotonic$2: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Monotonic>;
|
|
250
|
+
/**
|
|
251
|
+
* Type-narrowing predicate: refines to `LinearPolynomial<T & Increasing>`.
|
|
252
|
+
*
|
|
253
|
+
* @param p - The linear polynomial to check.
|
|
254
|
+
* @returns `true` when `monotonicity(p)` is `'increasing'`.
|
|
255
|
+
* @since 2.0.0
|
|
256
|
+
*/
|
|
257
|
+
declare const isIncreasing$2: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Increasing>;
|
|
258
|
+
/**
|
|
259
|
+
* Type-narrowing predicate: refines to `LinearPolynomial<T & Decreasing>`.
|
|
260
|
+
*
|
|
261
|
+
* @param p - The linear polynomial to check.
|
|
262
|
+
* @returns `true` when `monotonicity(p)` is `'decreasing'`.
|
|
263
|
+
* @since 2.0.0
|
|
264
|
+
*/
|
|
265
|
+
declare const isDecreasing$2: <T>(p: LinearPolynomial<T>) => p is LinearPolynomial<T & Decreasing>;
|
|
266
|
+
/**
|
|
267
|
+
* Asserts that the linear polynomial is monotonic, throwing on failure.
|
|
268
|
+
*
|
|
269
|
+
* @param p - The linear polynomial to assert against.
|
|
270
|
+
* @returns The same polynomial, typed with the `Monotonic` brand.
|
|
271
|
+
* @throws When `monotonicity(p)` is `'constant'`.
|
|
272
|
+
* @since 2.0.0
|
|
273
|
+
*/
|
|
274
|
+
declare const asMonotonic$2: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Monotonic>;
|
|
275
|
+
/**
|
|
276
|
+
* Asserts that the linear polynomial is increasing, throwing on failure.
|
|
277
|
+
*
|
|
278
|
+
* @param p - The linear polynomial to assert against.
|
|
279
|
+
* @returns The same polynomial, typed with the `Increasing` brand.
|
|
280
|
+
* @throws When `monotonicity(p)` is not `'increasing'`.
|
|
281
|
+
* @since 2.0.0
|
|
282
|
+
*/
|
|
283
|
+
declare const asIncreasing$2: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Increasing>;
|
|
284
|
+
/**
|
|
285
|
+
* Asserts that the linear polynomial is decreasing, throwing on failure.
|
|
286
|
+
*
|
|
287
|
+
* @param p - The linear polynomial to assert against.
|
|
288
|
+
* @returns The same polynomial, typed with the `Decreasing` brand.
|
|
289
|
+
* @throws When `monotonicity(p)` is not `'decreasing'`.
|
|
290
|
+
* @since 2.0.0
|
|
291
|
+
*/
|
|
292
|
+
declare const asDecreasing$2: <T>(p: LinearPolynomial<T>) => LinearPolynomial<T & Decreasing>;
|
|
293
|
+
/**
|
|
294
|
+
* Calculates the derivative of a linear polynomial.
|
|
295
|
+
*
|
|
296
|
+
* @param p - The linear polynomial to differentiate.
|
|
297
|
+
* @returns The derivative of the linear polynomial.
|
|
298
|
+
* @since 1.0.0
|
|
299
|
+
*/
|
|
300
|
+
declare const derivative$2: (p: LinearPolynomial) => number;
|
|
301
|
+
declare const antiderivative$1: {
|
|
302
|
+
/**
|
|
303
|
+
* Calculates the antiderivative of a linear polynomial.
|
|
304
|
+
*
|
|
305
|
+
* @param p - The linear polynomial to integrate.
|
|
306
|
+
* @param constant - The constant of integration. Defaults to 0.
|
|
307
|
+
* @returns The antiderivative of the linear polynomial.
|
|
308
|
+
* @since 1.0.0
|
|
309
|
+
*/
|
|
310
|
+
(p: LinearPolynomial, constant?: number): QuadraticPolynomial;
|
|
311
|
+
/**
|
|
312
|
+
* Calculates the antiderivative of a linear polynomial.
|
|
313
|
+
*
|
|
314
|
+
* @param constant - The constant of integration. Defaults to 0.
|
|
315
|
+
* @returns A function that takes a `LinearPolynomial` and returns the antiderivative of the polynomial.
|
|
316
|
+
* @since 1.0.0
|
|
317
|
+
*/
|
|
318
|
+
(constant: number): (p: LinearPolynomial) => QuadraticPolynomial;
|
|
319
|
+
};
|
|
320
|
+
declare const domain$2: {
|
|
321
|
+
/**
|
|
322
|
+
* Calculates the domain of a linear polynomial.
|
|
323
|
+
*
|
|
324
|
+
* @param p - The linear polynomial to check.
|
|
325
|
+
* @param range - The range to check against.
|
|
326
|
+
* @returns The domain of the polynomial within the given range.
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
*/
|
|
329
|
+
(p: LinearPolynomial, range: Interval): AtMostOne<Interval>;
|
|
330
|
+
/**
|
|
331
|
+
* Calculates the domain of a linear polynomial.
|
|
332
|
+
*
|
|
333
|
+
* @param range - The range to check against.
|
|
334
|
+
* @returns A function that takes a `LinearPolynomial` and returns the domain of the polynomial within the given range.
|
|
335
|
+
* @since 1.0.0
|
|
336
|
+
*/
|
|
337
|
+
(range: Interval): (p: LinearPolynomial) => AtMostOne<Interval>;
|
|
338
|
+
};
|
|
339
|
+
declare const range$2: {
|
|
340
|
+
/**
|
|
341
|
+
* Calculates the range of a linear polynomial.
|
|
342
|
+
*
|
|
343
|
+
* @param p - The linear polynomial to check.
|
|
344
|
+
* @param domain - The domain to check against.
|
|
345
|
+
* @returns The range of the polynomial within the given domain.
|
|
346
|
+
* @since 1.0.0
|
|
347
|
+
*/
|
|
348
|
+
(p: LinearPolynomial, domain: Interval): Closed;
|
|
349
|
+
/**
|
|
350
|
+
* Calculates the range of a linear polynomial.
|
|
351
|
+
*
|
|
352
|
+
* @param domain - The domain to check against.
|
|
353
|
+
* @returns A function that takes a `LinearPolynomial` and returns the range of the polynomial within the given domain.
|
|
354
|
+
* @since 1.0.0
|
|
355
|
+
*/
|
|
356
|
+
(domain: Interval): (p: LinearPolynomial) => Closed;
|
|
357
|
+
};
|
|
358
|
+
declare const length$2: {
|
|
359
|
+
/**
|
|
360
|
+
* Calculates the length of a linear polynomial within a particular domain `Interval`.
|
|
361
|
+
*
|
|
362
|
+
* @param p - The linear polynomial to analyze.
|
|
363
|
+
* @param domain - The domain to restrict the analysis to.
|
|
364
|
+
* @returns The length of the linear polynomial in the specified domain.
|
|
365
|
+
* @since 1.0.0
|
|
366
|
+
*/
|
|
367
|
+
(p: LinearPolynomial, domain: Interval): number;
|
|
368
|
+
/**
|
|
369
|
+
* Calculates the length of a linear polynomial within a particular domain `Interval`.
|
|
370
|
+
*
|
|
371
|
+
* @param domain - The domain to restrict the analysis to.
|
|
372
|
+
* @returns A function that takes a `LinearPolynomial` and returns the length of the polynomial in the specified domain.
|
|
373
|
+
* @since 1.0.0
|
|
374
|
+
*/
|
|
375
|
+
(domain: Interval): (p: LinearPolynomial) => number;
|
|
376
|
+
};
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/polynomial/quadratic.internal.circular.d.ts
|
|
379
|
+
declare const QuadraticPolynomialTypeId: unique symbol;
|
|
380
|
+
type QuadraticPolynomialTypeId = typeof QuadraticPolynomialTypeId;
|
|
381
|
+
declare namespace quadratic_d_exports {
|
|
382
|
+
export { Decreasing, Increasing, Monotonic, QuadraticPolynomial, antiderivative, asDecreasing$1 as asDecreasing, asIncreasing$1 as asIncreasing, asMonotonic$1 as asMonotonic, curvature$1 as curvature, derivative$1 as derivative, domain$1 as domain, equals$1 as equals, extreme, fromPoints$1 as fromPoints, fromVector$1 as fromVector, isDecreasing$1 as isDecreasing, isIncreasing$1 as isIncreasing, isMonotonic$1 as isMonotonic, isQuadraticPolynomial, length$1 as length, make$1 as make, monotonicity$1 as monotonicity, range$1 as range, roots$1 as roots, solve$1 as solve, solveInverse$1 as solveInverse, toInverseSolver$1 as toInverseSolver, toSolver$1 as toSolver };
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* A quadratic polynomial.
|
|
386
|
+
*
|
|
387
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
388
|
+
*
|
|
389
|
+
* The `Traits` type parameter is a phantom marker that accumulates trait
|
|
390
|
+
* brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and
|
|
391
|
+
* friends. Refinements may be parameterized by an `Interval` — a quadratic is
|
|
392
|
+
* monotonic on an interval that avoids its extremum, even though it is not
|
|
393
|
+
* monotonic globally.
|
|
394
|
+
*
|
|
395
|
+
* @since 1.0.0
|
|
396
|
+
*/
|
|
397
|
+
interface QuadraticPolynomial<out Traits = unknown> extends Pipeable {
|
|
398
|
+
readonly [QuadraticPolynomialTypeId]: QuadraticPolynomialTypeId;
|
|
399
|
+
readonly [PolynomialTraits]: Traits;
|
|
400
|
+
/**
|
|
401
|
+
* The coefficient of the x^0 term.
|
|
402
|
+
*/
|
|
403
|
+
readonly c0: number;
|
|
404
|
+
/**
|
|
405
|
+
* The coefficient of the x^1 term.
|
|
406
|
+
*/
|
|
407
|
+
readonly c1: number;
|
|
408
|
+
/**
|
|
409
|
+
* The coefficient of the x^2 term.
|
|
410
|
+
*/
|
|
411
|
+
readonly c2: number;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Checks if a value is a `QuadraticPolynomial`.
|
|
415
|
+
*
|
|
416
|
+
* @param v - The value to check.
|
|
417
|
+
* @returns `true` if the value is a `QuadraticPolynomial`, `false` otherwise.
|
|
418
|
+
* @since 1.0.0
|
|
419
|
+
*/
|
|
420
|
+
declare const isQuadraticPolynomial: (v: unknown) => v is QuadraticPolynomial;
|
|
421
|
+
declare const equals$1: {
|
|
422
|
+
/**
|
|
423
|
+
* Checks if two `QuadraticPolynomial` instances are approximately equal
|
|
424
|
+
* within the default absolute tolerance ({@link EPSILON}).
|
|
425
|
+
*
|
|
426
|
+
* @param a - The first polynomial.
|
|
427
|
+
* @param b - The second polynomial.
|
|
428
|
+
* @returns `true` when each pair of coefficients is within tolerance.
|
|
429
|
+
* @since 1.1.0
|
|
430
|
+
*/
|
|
431
|
+
(a: QuadraticPolynomial, b: QuadraticPolynomial): boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Checks if two `QuadraticPolynomial` instances are approximately equal
|
|
434
|
+
* within the default absolute tolerance ({@link EPSILON}).
|
|
435
|
+
*
|
|
436
|
+
* @param b - The second polynomial.
|
|
437
|
+
* @returns A function that takes the first polynomial and returns the comparison result.
|
|
438
|
+
* @since 1.1.0
|
|
439
|
+
*/
|
|
440
|
+
(b: QuadraticPolynomial): (a: QuadraticPolynomial) => boolean;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Creates a new `QuadraticPolynomial` instance.
|
|
444
|
+
*
|
|
445
|
+
* @param c0 - The coefficient of the x^0 term. Defaults to 0.
|
|
446
|
+
* @param c1 - The coefficient of the x^1 term. Defaults to 0.
|
|
447
|
+
* @param c2 - The coefficient of the x^2 term. Defaults to 1.
|
|
448
|
+
* @returns A new `QuadraticPolynomial` instance.
|
|
449
|
+
* @since 1.0.0
|
|
450
|
+
*/
|
|
451
|
+
declare const make$1: (c0?: number, c1?: number, c2?: number) => QuadraticPolynomial;
|
|
452
|
+
/**
|
|
453
|
+
* Creates a new `QuadraticPolynomial` instance from a vector.
|
|
454
|
+
*
|
|
455
|
+
* @param v - The vector to create the polynomial from.
|
|
456
|
+
* @returns A new `QuadraticPolynomial` instance.
|
|
457
|
+
* @since 1.0.0
|
|
458
|
+
*/
|
|
459
|
+
declare const fromVector$1: (v: Vector3) => QuadraticPolynomial;
|
|
460
|
+
/**
|
|
461
|
+
* Creates a new `QuadraticPolynomial` that interpolates the three given
|
|
462
|
+
* points, treating each `Vector2` as an `(x, y)` pair. The three input `x`
|
|
463
|
+
* values must be distinct.
|
|
464
|
+
*
|
|
465
|
+
* @param p0 - The first point.
|
|
466
|
+
* @param p1 - The second point.
|
|
467
|
+
* @param p2 - The third point.
|
|
468
|
+
* @returns The unique quadratic polynomial passing through the three points.
|
|
469
|
+
* @since 2.0.0
|
|
470
|
+
*/
|
|
471
|
+
declare const fromPoints$1: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticPolynomial;
|
|
472
|
+
declare const solve$1: {
|
|
473
|
+
/**
|
|
474
|
+
* Solves the quadratic polynomial for a given x value.
|
|
475
|
+
*
|
|
476
|
+
* @param p - The quadratic polynomial.
|
|
477
|
+
* @param x - The x value to solve for.
|
|
478
|
+
* @returns The result of the polynomial at the given x value.
|
|
479
|
+
* @since 1.0.0
|
|
480
|
+
*/
|
|
481
|
+
(p: QuadraticPolynomial, x: number): number;
|
|
482
|
+
/**
|
|
483
|
+
* Solves the quadratic polynomial for a given x value.
|
|
484
|
+
*
|
|
485
|
+
* @param x - The x value to solve for.
|
|
486
|
+
* @returns A function that takes a quadratic polynomial and returns the result of the polynomial at the given x value.
|
|
487
|
+
* @since 1.0.0
|
|
488
|
+
*/
|
|
489
|
+
(x: number): (p: QuadraticPolynomial) => number;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Creates a solver function for the quadratic polynomial.
|
|
493
|
+
*
|
|
494
|
+
* @param p - The quadratic polynomial.
|
|
495
|
+
* @returns A function that takes an x value and returns the result of the polynomial at that x value.
|
|
496
|
+
*/
|
|
497
|
+
declare const toSolver$1: (p: QuadraticPolynomial) => (x: number) => number;
|
|
498
|
+
declare const solveInverse$1: {
|
|
499
|
+
/**
|
|
500
|
+
* Solves a monotonic quadratic polynomial for a given y value. Because the
|
|
501
|
+
* polynomial is strictly monotonic (either globally, or over the interval
|
|
502
|
+
* the `Monotonic` brand was attached for), the inverse has at most one
|
|
503
|
+
* solution.
|
|
504
|
+
*
|
|
505
|
+
* @param p - The monotonic quadratic polynomial.
|
|
506
|
+
* @param y - The y value to solve for.
|
|
507
|
+
* @returns Zero or one solutions.
|
|
508
|
+
* @since 2.0.0
|
|
509
|
+
*/
|
|
510
|
+
<T extends Monotonic>(p: QuadraticPolynomial<T>, y: number): AtMostOne<number>;
|
|
511
|
+
/**
|
|
512
|
+
* Solves the quadratic polynomial for a given y value.
|
|
513
|
+
*
|
|
514
|
+
* @param p - The quadratic polynomial.
|
|
515
|
+
* @param y - The y value to solve for.
|
|
516
|
+
* @returns The solutions to the polynomial at the given y value.
|
|
517
|
+
* @since 1.0.0
|
|
518
|
+
*/
|
|
519
|
+
<T>(p: QuadraticPolynomial<T>, y: number): AtMostTwo<number>;
|
|
520
|
+
/**
|
|
521
|
+
* Solves the quadratic polynomial for a given y value.
|
|
522
|
+
*
|
|
523
|
+
* @param y - The y value to solve for.
|
|
524
|
+
* @returns A function that takes a quadratic polynomial and returns the
|
|
525
|
+
* solutions. Tightens to `Solution.AtMostOne<number>` for monotonic inputs.
|
|
526
|
+
* @since 1.0.0
|
|
527
|
+
*/
|
|
528
|
+
(y: number): {
|
|
529
|
+
<T extends Monotonic>(p: QuadraticPolynomial<T>): AtMostOne<number>;
|
|
530
|
+
<T>(p: QuadraticPolynomial<T>): AtMostTwo<number>;
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Creates an inverse solver function for the quadratic polynomial.
|
|
535
|
+
*
|
|
536
|
+
* @param p - The quadratic polynomial.
|
|
537
|
+
* @returns A function that takes a y value and returns the solutions to the polynomial at that y value.
|
|
538
|
+
*/
|
|
539
|
+
declare const toInverseSolver$1: (p: QuadraticPolynomial) => (y: number) => AtMostTwo<number>;
|
|
540
|
+
/**
|
|
541
|
+
* Computes the derivative of the quadratic polynomial.
|
|
542
|
+
*
|
|
543
|
+
* @param p - The quadratic polynomial.
|
|
544
|
+
* @returns The derivative of the polynomial as a linear polynomial.
|
|
545
|
+
* @since 1.0.0
|
|
546
|
+
*/
|
|
547
|
+
declare const derivative$1: (p: QuadraticPolynomial) => LinearPolynomial;
|
|
548
|
+
/**
|
|
549
|
+
* Finds the roots of the quadratic polynomial.
|
|
550
|
+
*
|
|
551
|
+
* @param p - The quadratic polynomial.
|
|
552
|
+
* @returns The roots of the polynomial as a tuple of solutions.
|
|
553
|
+
* @since 1.0.0
|
|
554
|
+
*/
|
|
555
|
+
declare const roots$1: (p: QuadraticPolynomial) => AtMostTwo<number>;
|
|
556
|
+
/**
|
|
557
|
+
* Finds the extreme point of the quadratic polynomial.
|
|
558
|
+
*
|
|
559
|
+
* @param p - The quadratic polynomial.
|
|
560
|
+
* @returns The extreme point of the polynomial as a solution.
|
|
561
|
+
* @since 1.0.0
|
|
562
|
+
*/
|
|
563
|
+
declare const extreme: (p: QuadraticPolynomial) => Vector2 | null;
|
|
564
|
+
declare const monotonicity$1: {
|
|
565
|
+
/**
|
|
566
|
+
* Computes the monotonicity of the quadratic polynomial over a given
|
|
567
|
+
* interval. Throws when the interval has zero width — the question is
|
|
568
|
+
* undefined at a single point.
|
|
569
|
+
*
|
|
570
|
+
* @param p - The quadratic polynomial.
|
|
571
|
+
* @param i - The interval to compute the monotonicity over.
|
|
572
|
+
* @returns The monotonicity of the polynomial over the interval.
|
|
573
|
+
* @since 1.0.0
|
|
574
|
+
*/
|
|
575
|
+
(p: QuadraticPolynomial, i?: Interval): Monotonicity;
|
|
576
|
+
/**
|
|
577
|
+
* Computes the monotonicity of the quadratic polynomial over a given
|
|
578
|
+
* interval. Throws when the interval has zero width.
|
|
579
|
+
*
|
|
580
|
+
* @param i - The interval to compute the monotonicity over.
|
|
581
|
+
* @returns A function that takes a quadratic polynomial and returns the
|
|
582
|
+
* monotonicity of the polynomial over the interval.
|
|
583
|
+
* @since 1.0.0
|
|
584
|
+
*/
|
|
585
|
+
(i: Interval): (p: QuadraticPolynomial) => Monotonicity;
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* Type-narrowing predicate: refines a `QuadraticPolynomial<T>` to
|
|
589
|
+
* `QuadraticPolynomial<T & Monotonic>` when the polynomial is strictly
|
|
590
|
+
* monotonic over the given interval (or globally, when no interval is given).
|
|
591
|
+
*
|
|
592
|
+
* @param p - The quadratic polynomial to check.
|
|
593
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
594
|
+
* @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.
|
|
595
|
+
* @since 2.0.0
|
|
596
|
+
*/
|
|
597
|
+
declare const isMonotonic$1: {
|
|
598
|
+
<T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Monotonic>;
|
|
599
|
+
(i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Monotonic>;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* Type-narrowing predicate: refines to `QuadraticPolynomial<T & Increasing>`.
|
|
603
|
+
*
|
|
604
|
+
* @since 2.0.0
|
|
605
|
+
*/
|
|
606
|
+
declare const isIncreasing$1: {
|
|
607
|
+
<T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Increasing>;
|
|
608
|
+
(i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Increasing>;
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* Type-narrowing predicate: refines to `QuadraticPolynomial<T & Decreasing>`.
|
|
612
|
+
*
|
|
613
|
+
* @since 2.0.0
|
|
614
|
+
*/
|
|
615
|
+
declare const isDecreasing$1: {
|
|
616
|
+
<T>(p: QuadraticPolynomial<T>, i?: Interval): p is QuadraticPolynomial<T & Decreasing>;
|
|
617
|
+
(i: Interval): <T>(p: QuadraticPolynomial<T>) => p is QuadraticPolynomial<T & Decreasing>;
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Asserts that the quadratic polynomial is monotonic, throwing on failure.
|
|
621
|
+
*
|
|
622
|
+
* @param p - The quadratic polynomial to assert against.
|
|
623
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
624
|
+
* @returns The same polynomial, typed with the `Monotonic` brand.
|
|
625
|
+
* @throws When the polynomial is not monotonic over the given (or global) interval.
|
|
626
|
+
* @since 2.0.0
|
|
627
|
+
*/
|
|
628
|
+
declare const asMonotonic$1: <T>(p: QuadraticPolynomial<T>, i?: Interval) => QuadraticPolynomial<T & Monotonic>;
|
|
629
|
+
/**
|
|
630
|
+
* Asserts that the quadratic polynomial is increasing, throwing on failure.
|
|
631
|
+
*
|
|
632
|
+
* @since 2.0.0
|
|
633
|
+
*/
|
|
634
|
+
declare const asIncreasing$1: <T>(p: QuadraticPolynomial<T>, i?: Interval) => QuadraticPolynomial<T & Increasing>;
|
|
635
|
+
/**
|
|
636
|
+
* Asserts that the quadratic polynomial is decreasing, throwing on failure.
|
|
637
|
+
*
|
|
638
|
+
* @since 2.0.0
|
|
639
|
+
*/
|
|
640
|
+
declare const asDecreasing$1: <T>(p: QuadraticPolynomial<T>, i?: Interval) => QuadraticPolynomial<T & Decreasing>;
|
|
641
|
+
declare const antiderivative: {
|
|
642
|
+
/**
|
|
643
|
+
* Computes the antiderivative of the quadratic polynomial.
|
|
644
|
+
*
|
|
645
|
+
* @param p - The quadratic polynomial.
|
|
646
|
+
* @param constant - The constant of integration. Defaults to 0.
|
|
647
|
+
* @returns The antiderivative of the polynomial as a cubic polynomial.
|
|
648
|
+
* @since 1.0.0
|
|
649
|
+
*/
|
|
650
|
+
(p: QuadraticPolynomial, constant?: number): CubicPolynomial;
|
|
651
|
+
/**
|
|
652
|
+
* Computes the antiderivative of the quadratic polynomial.
|
|
653
|
+
*
|
|
654
|
+
* @param constant - The constant of integration. Defaults to 0.
|
|
655
|
+
* @returns A function that takes a quadratic polynomial and returns the antiderivative of the polynomial as a cubic polynomial.
|
|
656
|
+
* @since 1.0.0
|
|
657
|
+
*/
|
|
658
|
+
(constant: number): (p: QuadraticPolynomial) => CubicPolynomial;
|
|
659
|
+
};
|
|
660
|
+
declare const domain$1: {
|
|
661
|
+
/**
|
|
662
|
+
* Computes the domain of the quadratic polynomial over a given range.
|
|
663
|
+
*
|
|
664
|
+
* @param p - The quadratic polynomial.
|
|
665
|
+
* @param range - The range to compute the domain over.
|
|
666
|
+
* @returns The domain of the polynomial over the range.
|
|
667
|
+
* @since 1.0.0
|
|
668
|
+
*/
|
|
669
|
+
(p: QuadraticPolynomial, range: Interval): AtMostOne<Interval>;
|
|
670
|
+
/**
|
|
671
|
+
* Computes the domain of the quadratic polynomial over a given range.
|
|
672
|
+
*
|
|
673
|
+
* @param range - The range to compute the domain over.
|
|
674
|
+
* @returns A function that takes a quadratic polynomial and returns the domain of the polynomial over the range.
|
|
675
|
+
* @since 1.0.0
|
|
676
|
+
*/
|
|
677
|
+
(range: Interval): (p: QuadraticPolynomial) => AtMostOne<Interval>;
|
|
678
|
+
};
|
|
679
|
+
declare const range$1: {
|
|
680
|
+
/**
|
|
681
|
+
* Computes the range of the quadratic polynomial over a given domain.
|
|
682
|
+
*
|
|
683
|
+
* @param p - The quadratic polynomial.
|
|
684
|
+
* @param domain - The domain to compute the range over.
|
|
685
|
+
* @returns The range of the polynomial over the domain.
|
|
686
|
+
* @since 1.0.0
|
|
687
|
+
*/
|
|
688
|
+
(p: QuadraticPolynomial, domain: Interval): Closed;
|
|
689
|
+
/**
|
|
690
|
+
* Computes the range of the quadratic polynomial over a given domain.
|
|
691
|
+
*
|
|
692
|
+
* @param domain - The domain to compute the range over.
|
|
693
|
+
* @returns A function that takes a quadratic polynomial and returns the range of the polynomial over the domain.
|
|
694
|
+
* @since 1.0.0
|
|
695
|
+
*/
|
|
696
|
+
(domain: Interval): (p: QuadraticPolynomial) => Closed;
|
|
697
|
+
};
|
|
698
|
+
declare const length$1: {
|
|
699
|
+
/**
|
|
700
|
+
* Computes the length of the quadratic polynomial over a given interval.
|
|
701
|
+
*
|
|
702
|
+
* @param p - The quadratic polynomial.
|
|
703
|
+
* @param i - The interval to compute the length over.
|
|
704
|
+
* @returns The length of the polynomial over the interval.
|
|
705
|
+
* @since 1.0.0
|
|
706
|
+
*/
|
|
707
|
+
(p: QuadraticPolynomial, i: Interval): number;
|
|
708
|
+
/**
|
|
709
|
+
* Computes the length of the quadratic polynomial over a given interval.
|
|
710
|
+
*
|
|
711
|
+
* @param i - The interval to compute the length over.
|
|
712
|
+
* @returns A function that takes a quadratic polynomial and returns the length of the polynomial over the interval.
|
|
713
|
+
* @since 1.0.0
|
|
714
|
+
*/
|
|
715
|
+
(i: Interval): (p: QuadraticPolynomial) => number;
|
|
716
|
+
};
|
|
717
|
+
declare const curvature$1: {
|
|
718
|
+
/**
|
|
719
|
+
* Computes the curvature of the quadratic polynomial at a given x value.
|
|
720
|
+
*
|
|
721
|
+
* @param p - The quadratic polynomial.
|
|
722
|
+
* @param x - The x value to compute the curvature at.
|
|
723
|
+
* @returns The curvature of the polynomial at the given x value.
|
|
724
|
+
* @since 1.0.0
|
|
725
|
+
*/
|
|
726
|
+
(p: QuadraticPolynomial, x: number): number;
|
|
727
|
+
/**
|
|
728
|
+
* Computes the curvature of the quadratic polynomial at a given x value.
|
|
729
|
+
*
|
|
730
|
+
* @param x - The x value to compute the curvature at.
|
|
731
|
+
* @returns A function that takes a quadratic polynomial and returns the curvature of the polynomial at the given x value.
|
|
732
|
+
* @since 1.0.0
|
|
733
|
+
*/
|
|
734
|
+
(x: number): (p: QuadraticPolynomial) => number;
|
|
735
|
+
};
|
|
736
|
+
declare namespace cubic_d_exports {
|
|
737
|
+
export { CubicPolynomial, Decreasing, Increasing, Monotonic, asDecreasing, asIncreasing, asMonotonic, curvature, derivative, domain, equals, extrema, fromPoints, fromVector, isCubicPolynomial, isDecreasing, isIncreasing, isMonotonic, length, make, monotonicity, range, roots, solve, solveInverse, subdivide, toInverseSolver, toSolver };
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* A cubic polynomial.
|
|
741
|
+
*
|
|
742
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
743
|
+
*
|
|
744
|
+
* The `Traits` type parameter is a phantom marker that accumulates trait
|
|
745
|
+
* brands as the polynomial is refined via `isMonotonic` / `asMonotonic` and
|
|
746
|
+
* friends. A cubic is monotonic only over an interval that avoids both of its
|
|
747
|
+
* extrema (or globally, when c2 = c3 = 0 and c1 ≠ 0).
|
|
748
|
+
*
|
|
749
|
+
* @since 1.0.0
|
|
750
|
+
*/
|
|
751
|
+
interface CubicPolynomial<out Traits = unknown> extends Pipeable {
|
|
752
|
+
readonly [CubicPolynomialTypeId]: CubicPolynomialTypeId;
|
|
753
|
+
readonly [PolynomialTraits]: Traits;
|
|
754
|
+
/**
|
|
755
|
+
* The coefficient of the x^0 term.
|
|
756
|
+
*/
|
|
757
|
+
readonly c0: number;
|
|
758
|
+
/**
|
|
759
|
+
* The coefficient of the x^1 term.
|
|
760
|
+
*/
|
|
761
|
+
readonly c1: number;
|
|
762
|
+
/**
|
|
763
|
+
* The coefficient of the x^2 term.
|
|
764
|
+
*/
|
|
765
|
+
readonly c2: number;
|
|
766
|
+
/**
|
|
767
|
+
* The coefficient of the x^3 term.
|
|
768
|
+
*/
|
|
769
|
+
readonly c3: number;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Checks if a value is a `CubicPolynomial`.
|
|
773
|
+
*
|
|
774
|
+
* @param value - The value to check.
|
|
775
|
+
* @returns `true` if the value is a `CubicPolynomial`, `false` otherwise.
|
|
776
|
+
* @since 1.0.0
|
|
777
|
+
*/
|
|
778
|
+
declare const isCubicPolynomial: (value: unknown) => value is CubicPolynomial;
|
|
779
|
+
declare const equals: {
|
|
780
|
+
/**
|
|
781
|
+
* Checks if two `CubicPolynomial` instances are approximately equal within
|
|
782
|
+
* the default absolute tolerance ({@link EPSILON}).
|
|
783
|
+
*
|
|
784
|
+
* @param a - The first polynomial.
|
|
785
|
+
* @param b - The second polynomial.
|
|
786
|
+
* @returns `true` when each pair of coefficients is within tolerance.
|
|
787
|
+
* @since 1.1.0
|
|
788
|
+
*/
|
|
789
|
+
(a: CubicPolynomial, b: CubicPolynomial): boolean;
|
|
790
|
+
/**
|
|
791
|
+
* Checks if two `CubicPolynomial` instances are approximately equal within
|
|
792
|
+
* the default absolute tolerance ({@link EPSILON}).
|
|
793
|
+
*
|
|
794
|
+
* @param b - The second polynomial.
|
|
795
|
+
* @returns A function that takes the first polynomial and returns the comparison result.
|
|
796
|
+
* @since 1.1.0
|
|
797
|
+
*/
|
|
798
|
+
(b: CubicPolynomial): (a: CubicPolynomial) => boolean;
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* Creates a new `CubicPolynomial` instance.
|
|
802
|
+
*
|
|
803
|
+
* @param c0 - The coefficient of the x^0 term.
|
|
804
|
+
* @param c1 - The coefficient of the x^1 term.
|
|
805
|
+
* @param c2 - The coefficient of the x^2 term.
|
|
806
|
+
* @param c3 - The coefficient of the x^3 term.
|
|
807
|
+
*/
|
|
808
|
+
declare const make: (c0: number, c1: number, c2: number, c3: number) => CubicPolynomial;
|
|
809
|
+
/**
|
|
810
|
+
* Creates a new `CubicPolynomial` instance from a vector.
|
|
811
|
+
*
|
|
812
|
+
* @param v - The vector to convert.
|
|
813
|
+
* @returns A new `CubicPolynomial` instance.
|
|
814
|
+
* @since 1.0.0
|
|
815
|
+
*/
|
|
816
|
+
declare const fromVector: (v: Vector4) => CubicPolynomial;
|
|
817
|
+
/**
|
|
818
|
+
* Creates a new `CubicPolynomial` that interpolates the four given points,
|
|
819
|
+
* treating each `Vector2` as an `(x, y)` pair. The four input `x` values must
|
|
820
|
+
* be distinct.
|
|
821
|
+
*
|
|
822
|
+
* @param p0 - The first point.
|
|
823
|
+
* @param p1 - The second point.
|
|
824
|
+
* @param p2 - The third point.
|
|
825
|
+
* @param p3 - The fourth point.
|
|
826
|
+
* @returns The unique cubic polynomial passing through the four points.
|
|
827
|
+
* @since 2.0.0
|
|
828
|
+
*/
|
|
829
|
+
declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => CubicPolynomial;
|
|
830
|
+
declare const solve: {
|
|
831
|
+
/**
|
|
832
|
+
* Solves a cubic polynomial for a given value of x.
|
|
833
|
+
*
|
|
834
|
+
* @param p - The cubic polynomial to solve.
|
|
835
|
+
* @param x - The value of x to solve for.
|
|
836
|
+
* @returns The result of the polynomial evaluation at x.
|
|
837
|
+
* @since 1.0.0
|
|
838
|
+
*/
|
|
839
|
+
(p: CubicPolynomial, x: number): number;
|
|
840
|
+
/**
|
|
841
|
+
* Solves a cubic polynomial for a given value of x.
|
|
842
|
+
*
|
|
843
|
+
* @param x - The value of x to solve for.
|
|
844
|
+
* @returns A function that takes a cubic polynomial and returns the result of the polynomial evaluation at x.
|
|
845
|
+
* @since 1.0.0
|
|
846
|
+
*/
|
|
847
|
+
(x: number): (p: CubicPolynomial) => number;
|
|
848
|
+
};
|
|
849
|
+
/**
|
|
850
|
+
* Converts a cubic polynomial to a solver function.
|
|
851
|
+
*
|
|
852
|
+
* @param p - The cubic polynomial to convert.
|
|
853
|
+
* @returns A function that takes a value of x and returns the result of the polynomial evaluation at x.
|
|
854
|
+
* @since 1.0.0
|
|
855
|
+
*/
|
|
856
|
+
declare const toSolver: (p: CubicPolynomial) => (x: number) => number;
|
|
857
|
+
declare const solveInverse: {
|
|
858
|
+
/**
|
|
859
|
+
* Solves a monotonic cubic polynomial for a given value of y. Because the
|
|
860
|
+
* polynomial is strictly monotonic, the inverse has at most one solution.
|
|
861
|
+
*
|
|
862
|
+
* @param p - The monotonic cubic polynomial.
|
|
863
|
+
* @param y - The value of y to solve for.
|
|
864
|
+
* @returns Zero or one solutions.
|
|
865
|
+
* @since 2.0.0
|
|
866
|
+
*/
|
|
867
|
+
<T extends Monotonic>(p: CubicPolynomial<T>, y: number): AtMostOne<number>;
|
|
868
|
+
/**
|
|
869
|
+
* Solves a cubic polynomial for a given value of y.
|
|
870
|
+
*
|
|
871
|
+
* @param p - The cubic polynomial to solve.
|
|
872
|
+
* @param y - The value of y to solve for.
|
|
873
|
+
* @returns The roots of the polynomial equation p(x) = y.
|
|
874
|
+
* @since 1.0.0
|
|
875
|
+
*/
|
|
876
|
+
<T>(p: CubicPolynomial<T>, y: number): AtMostThree<number>;
|
|
877
|
+
/**
|
|
878
|
+
* Solves a cubic polynomial for a given value of y.
|
|
879
|
+
*
|
|
880
|
+
* @param y - The value of y to solve for.
|
|
881
|
+
* @returns A function that takes a cubic polynomial and returns the roots
|
|
882
|
+
* of the polynomial equation p(x) = y. Tightens to `Solution.AtMostOne<number>` for
|
|
883
|
+
* monotonic inputs.
|
|
884
|
+
* @since 1.0.0
|
|
885
|
+
*/
|
|
886
|
+
(y: number): {
|
|
887
|
+
<T extends Monotonic>(p: CubicPolynomial<T>): AtMostOne<number>;
|
|
888
|
+
<T>(p: CubicPolynomial<T>): AtMostThree<number>;
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* Converts a cubic polynomial to an inverse solver function.
|
|
893
|
+
*
|
|
894
|
+
* @param p - The cubic polynomial to convert.
|
|
895
|
+
* @returns A function that takes a value of y and returns the roots of the polynomial equation p(x) = y.
|
|
896
|
+
* @since 1.0.0
|
|
897
|
+
*/
|
|
898
|
+
declare const toInverseSolver: (p: CubicPolynomial) => (y: number) => AtMostThree<number>;
|
|
899
|
+
/**
|
|
900
|
+
* Calculates the derivative of a cubic polynomial.
|
|
901
|
+
*
|
|
902
|
+
* @param p - The cubic polynomial to differentiate.
|
|
903
|
+
* @returns The derivative of the cubic polynomial.
|
|
904
|
+
* @since 1.0.0
|
|
905
|
+
*/
|
|
906
|
+
declare const derivative: (p: CubicPolynomial) => QuadraticPolynomial;
|
|
907
|
+
declare const subdivide: {
|
|
908
|
+
/**
|
|
909
|
+
* Subdivides a cubic polynomial at parameter `t ∈ (0, 1)` into two new
|
|
910
|
+
* cubic polynomials. The first polynomial's evaluation on `[0, 1]` matches
|
|
911
|
+
* the original's on `[0, t]`; the second matches the original's on
|
|
912
|
+
* `[t, 1]`. Equivalent to de Casteljau subdivision in Bernstein form,
|
|
913
|
+
* performed directly in monomial form.
|
|
914
|
+
*
|
|
915
|
+
* @param p - The cubic polynomial to subdivide.
|
|
916
|
+
* @param t - The split parameter; must be in the open interval `(0, 1)`.
|
|
917
|
+
* @returns A `[left, right]` tuple of cubic polynomials.
|
|
918
|
+
* @since 2.1.0
|
|
919
|
+
*/
|
|
920
|
+
(p: CubicPolynomial, t: number): [CubicPolynomial, CubicPolynomial];
|
|
921
|
+
/**
|
|
922
|
+
* Subdivides a cubic polynomial at parameter `t ∈ (0, 1)`.
|
|
923
|
+
*
|
|
924
|
+
* @param t - The split parameter; must be in the open interval `(0, 1)`.
|
|
925
|
+
* @returns A function that takes a polynomial and returns its `[left, right]` halves.
|
|
926
|
+
* @since 2.1.0
|
|
927
|
+
*/
|
|
928
|
+
(t: number): (p: CubicPolynomial) => [CubicPolynomial, CubicPolynomial];
|
|
929
|
+
};
|
|
930
|
+
/**
|
|
931
|
+
* Calculates the roots of a cubic polynomial.
|
|
932
|
+
*
|
|
933
|
+
* @param p - The cubic polynomial to find the roots of.
|
|
934
|
+
* @returns The roots of the cubic polynomial.
|
|
935
|
+
* @since 1.0.0
|
|
936
|
+
*/
|
|
937
|
+
declare const roots: (p: CubicPolynomial) => AtMostThree<number>;
|
|
938
|
+
/**
|
|
939
|
+
* Calculates the extrema of a cubic polynomial.
|
|
940
|
+
*
|
|
941
|
+
* @param p - The cubic polynomial to find the extrema of.
|
|
942
|
+
* @returns The extrema of the cubic polynomial.
|
|
943
|
+
* @since 1.0.0
|
|
944
|
+
*/
|
|
945
|
+
declare const extrema: (p: CubicPolynomial) => AtMostTwo<number>;
|
|
946
|
+
declare const monotonicity: {
|
|
947
|
+
/**
|
|
948
|
+
* Calculates the monotonicity of a cubic polynomial. Throws when the
|
|
949
|
+
* interval has zero width — the question is undefined at a single point.
|
|
950
|
+
*
|
|
951
|
+
* @param p - The cubic polynomial to analyze.
|
|
952
|
+
* @param i - The interval to restrict the analysis to.
|
|
953
|
+
* @returns The monotonicity of the cubic polynomial in the specified interval.
|
|
954
|
+
* @since 1.0.0
|
|
955
|
+
*/
|
|
956
|
+
(p: CubicPolynomial, i?: Interval): Monotonicity;
|
|
957
|
+
/**
|
|
958
|
+
* Calculates the monotonicity of a cubic polynomial. Throws when the
|
|
959
|
+
* interval has zero width.
|
|
960
|
+
*
|
|
961
|
+
* @param i - The interval to restrict the analysis to.
|
|
962
|
+
* @returns A function that takes a cubic polynomial and returns the
|
|
963
|
+
* monotonicity of the cubic polynomial in the specified interval.
|
|
964
|
+
* @since 1.0.0
|
|
965
|
+
*/
|
|
966
|
+
(i: Interval): (p: CubicPolynomial) => Monotonicity;
|
|
967
|
+
};
|
|
968
|
+
/**
|
|
969
|
+
* Type-narrowing predicate: refines a `CubicPolynomial<T>` to
|
|
970
|
+
* `CubicPolynomial<T & Monotonic>` when the polynomial is strictly monotonic
|
|
971
|
+
* over the given interval (or globally, when no interval is given).
|
|
972
|
+
*
|
|
973
|
+
* @param p - The cubic polynomial to check.
|
|
974
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
975
|
+
* @returns `true` when monotonicity is `'increasing'` or `'decreasing'`.
|
|
976
|
+
* @since 2.0.0
|
|
977
|
+
*/
|
|
978
|
+
declare const isMonotonic: {
|
|
979
|
+
<T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Monotonic>;
|
|
980
|
+
(i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Monotonic>;
|
|
981
|
+
};
|
|
982
|
+
/**
|
|
983
|
+
* Type-narrowing predicate: refines to `CubicPolynomial<T & Increasing>`.
|
|
984
|
+
*
|
|
985
|
+
* @since 2.0.0
|
|
986
|
+
*/
|
|
987
|
+
declare const isIncreasing: {
|
|
988
|
+
<T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Increasing>;
|
|
989
|
+
(i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Increasing>;
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* Type-narrowing predicate: refines to `CubicPolynomial<T & Decreasing>`.
|
|
993
|
+
*
|
|
994
|
+
* @since 2.0.0
|
|
995
|
+
*/
|
|
996
|
+
declare const isDecreasing: {
|
|
997
|
+
<T>(p: CubicPolynomial<T>, i?: Interval): p is CubicPolynomial<T & Decreasing>;
|
|
998
|
+
(i: Interval): <T>(p: CubicPolynomial<T>) => p is CubicPolynomial<T & Decreasing>;
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* Asserts that the cubic polynomial is monotonic, throwing on failure.
|
|
1002
|
+
*
|
|
1003
|
+
* @param p - The cubic polynomial to assert against.
|
|
1004
|
+
* @param i - Optional interval over which to check monotonicity.
|
|
1005
|
+
* @returns The same polynomial, typed with the `Monotonic` brand.
|
|
1006
|
+
* @throws When the polynomial is not monotonic over the given (or global) interval.
|
|
1007
|
+
* @since 2.0.0
|
|
1008
|
+
*/
|
|
1009
|
+
declare const asMonotonic: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Monotonic>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Asserts that the cubic polynomial is increasing, throwing on failure.
|
|
1012
|
+
*
|
|
1013
|
+
* @since 2.0.0
|
|
1014
|
+
*/
|
|
1015
|
+
declare const asIncreasing: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Increasing>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Asserts that the cubic polynomial is decreasing, throwing on failure.
|
|
1018
|
+
*
|
|
1019
|
+
* @since 2.0.0
|
|
1020
|
+
*/
|
|
1021
|
+
declare const asDecreasing: <T>(p: CubicPolynomial<T>, i?: Interval) => CubicPolynomial<T & Decreasing>;
|
|
1022
|
+
declare const domain: {
|
|
1023
|
+
/**
|
|
1024
|
+
* Calculates the domain of a cubic polynomial.
|
|
1025
|
+
*
|
|
1026
|
+
* @param p - The cubic polynomial to analyze.
|
|
1027
|
+
* @param range - The range to restrict the analysis to.
|
|
1028
|
+
* @returns The domain of the cubic polynomial in the specified range.
|
|
1029
|
+
* @since 1.0.0
|
|
1030
|
+
*/
|
|
1031
|
+
(p: CubicPolynomial, range: Interval): Interval;
|
|
1032
|
+
/**
|
|
1033
|
+
* Calculates the domain of a cubic polynomial.
|
|
1034
|
+
*
|
|
1035
|
+
* @param range - The range to restrict the analysis to.
|
|
1036
|
+
* @returns A function that takes a cubic polynomial and returns the domain of the cubic polynomial in the specified range.
|
|
1037
|
+
* @since 1.0.0
|
|
1038
|
+
*/
|
|
1039
|
+
(range: Interval): (p: CubicPolynomial) => Interval;
|
|
1040
|
+
};
|
|
1041
|
+
declare const range: {
|
|
1042
|
+
/**
|
|
1043
|
+
* Calculates the range of a cubic polynomial.
|
|
1044
|
+
*
|
|
1045
|
+
* @param p - The cubic polynomial to analyze.
|
|
1046
|
+
* @param domain - The domain to restrict the analysis to.
|
|
1047
|
+
* @returns The range of the cubic polynomial in the specified domain.
|
|
1048
|
+
* @since 1.0.0
|
|
1049
|
+
*/
|
|
1050
|
+
(p: CubicPolynomial, domain: Interval): Closed;
|
|
1051
|
+
/**
|
|
1052
|
+
* Calculates the range of a cubic polynomial.
|
|
1053
|
+
*
|
|
1054
|
+
* @param domain - The domain to restrict the analysis to.
|
|
1055
|
+
* @returns A function that takes a cubic polynomial and returns the range of the cubic polynomial in the specified domain.
|
|
1056
|
+
* @since 1.0.0
|
|
1057
|
+
*/
|
|
1058
|
+
(domain: Interval): (p: CubicPolynomial) => Closed;
|
|
1059
|
+
};
|
|
1060
|
+
declare const length: {
|
|
1061
|
+
/**
|
|
1062
|
+
* Calculates the length of a cubic polynomial.
|
|
1063
|
+
*
|
|
1064
|
+
* @param p - The cubic polynomial to analyze.
|
|
1065
|
+
* @param domain - The domain to restrict the analysis to.
|
|
1066
|
+
* @returns The length of the cubic polynomial in the specified domain.
|
|
1067
|
+
* @since 1.0.0
|
|
1068
|
+
*/
|
|
1069
|
+
(p: CubicPolynomial, domain: Interval): number;
|
|
1070
|
+
/**
|
|
1071
|
+
* Calculates the length of a cubic polynomial.
|
|
1072
|
+
*
|
|
1073
|
+
* @param domain - The domain to restrict the analysis to.
|
|
1074
|
+
* @returns A function that takes a cubic polynomial and returns the length of the cubic polynomial in the specified domain.
|
|
1075
|
+
* @since 1.0.0
|
|
1076
|
+
*/
|
|
1077
|
+
(domain: Interval): (p: CubicPolynomial) => number;
|
|
1078
|
+
};
|
|
1079
|
+
declare const curvature: {
|
|
1080
|
+
/**
|
|
1081
|
+
* Calculates the curvature of a cubic polynomial.
|
|
1082
|
+
*
|
|
1083
|
+
* @param p - The cubic polynomial to analyze.
|
|
1084
|
+
* @param x - The value of x to calculate the curvature at.
|
|
1085
|
+
* @returns The curvature of the cubic polynomial at the specified value of x.
|
|
1086
|
+
* @since 1.0.0
|
|
1087
|
+
*/
|
|
1088
|
+
(p: CubicPolynomial, x: number): number;
|
|
1089
|
+
/**
|
|
1090
|
+
* Calculates the curvature of a cubic polynomial.
|
|
1091
|
+
*
|
|
1092
|
+
* @param x - The value of x to calculate the curvature at.
|
|
1093
|
+
* @returns A function that takes a cubic polynomial and returns the curvature of the cubic polynomial at the specified value of x.
|
|
1094
|
+
* @since 1.0.0
|
|
1095
|
+
*/
|
|
1096
|
+
(x: number): (p: CubicPolynomial) => number;
|
|
1097
|
+
};
|
|
1098
|
+
//#endregion
|
|
1099
|
+
export { LinearPolynomial as a, Increasing as c, quadratic_d_exports as i, Monotonic as l, cubic_d_exports as n, linear_d_exports as o, QuadraticPolynomial as r, Decreasing as s, CubicPolynomial as t };
|
|
1100
|
+
//# sourceMappingURL=cubic-BajUY0JT.d.mts.map
|