curvy 1.0.8 → 2.0.0-alpha.0
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 +2 -0
- package/dist/interval/index.mjs +2 -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 +241 -0
- package/dist/path/index.mjs +292 -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-BGRxcxUH.mjs +104 -0
- package/dist/shared/characteristic-BGRxcxUH.mjs.map +1 -0
- package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
- package/dist/shared/cubic-CYYEUHNm.mjs +479 -0
- package/dist/shared/cubic-CYYEUHNm.mjs.map +1 -0
- package/dist/shared/cubic-Dfn6DB02.d.mts +1099 -0
- package/dist/shared/interval-CCEqzPgA.mjs +376 -0
- package/dist/shared/interval-CCEqzPgA.mjs.map +1 -0
- package/dist/shared/interval-hQDiKqj0.d.mts +494 -0
- package/dist/shared/matrix4x4-Bt_DBlP0.d.mts +1182 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
- package/dist/shared/quadratic-DEhuAKuE.mjs +330 -0
- package/dist/shared/quadratic-DEhuAKuE.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-BPLohNuI.d.mts +787 -0
- package/dist/shared/rationalCubic2d-CP4oGpnk.mjs +658 -0
- package/dist/shared/rationalCubic2d-CP4oGpnk.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-CXa7Yren.mjs +278 -0
- package/dist/shared/rationalCubic2d-CXa7Yren.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-D_-XWxcm.d.mts +297 -0
- package/dist/shared/solution-BjoW7ov4.d.mts +251 -0
- package/dist/shared/solution-CbSWzXCn.mjs +306 -0
- package/dist/shared/solution-CbSWzXCn.mjs.map +1 -0
- package/dist/{pipe.d.mts → shared/utils-DqTGyXrP.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-TV0UnlxY.d.mts +1168 -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/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 -27
- package/dist/utils.mjs +88 -43
- package/dist/utils.mjs.map +1 -0
- package/dist/vector/index.d.mts +2 -0
- package/dist/vector/index.mjs +4 -0
- package/package.json +49 -92
- package/dist/curve/cubic2d.d.mts +0 -31
- package/dist/curve/cubic2d.d.ts +0 -31
- package/dist/curve/cubic2d.mjs +0 -97
- package/dist/curve/linear2d.d.mts +0 -28
- package/dist/curve/linear2d.d.ts +0 -28
- package/dist/curve/linear2d.mjs +0 -49
- package/dist/curve/quadratic2d.d.mts +0 -33
- package/dist/curve/quadratic2d.d.ts +0 -33
- package/dist/curve/quadratic2d.mjs +0 -87
- package/dist/interval.d.mts +0 -58
- package/dist/interval.d.ts +0 -58
- package/dist/interval.mjs +0 -89
- package/dist/matrix/matrix2x2.d.mts +0 -49
- package/dist/matrix/matrix2x2.d.ts +0 -49
- package/dist/matrix/matrix2x2.mjs +0 -24
- package/dist/matrix/matrix3x3.d.mts +0 -63
- package/dist/matrix/matrix3x3.d.ts +0 -63
- package/dist/matrix/matrix3x3.mjs +0 -27
- package/dist/matrix/matrix4x4.d.mts +0 -72
- package/dist/matrix/matrix4x4.d.ts +0 -72
- package/dist/matrix/matrix4x4.mjs +0 -215
- package/dist/path/cubic2d.d.mts +0 -29
- package/dist/path/cubic2d.d.ts +0 -29
- package/dist/path/cubic2d.mjs +0 -62
- package/dist/path/linear2d.d.mts +0 -29
- package/dist/path/linear2d.d.ts +0 -29
- package/dist/path/linear2d.mjs +0 -55
- package/dist/path/quadratic2d.d.mts +0 -30
- package/dist/path/quadratic2d.d.ts +0 -30
- package/dist/path/quadratic2d.mjs +0 -61
- package/dist/pipe.d.ts +0 -58
- package/dist/pipe.mjs +0 -91
- package/dist/polynomial/cubic.d.mts +0 -7
- package/dist/polynomial/cubic.d.ts +0 -7
- package/dist/polynomial/cubic.mjs +0 -148
- package/dist/polynomial/linear.d.mts +0 -7
- package/dist/polynomial/linear.d.ts +0 -7
- package/dist/polynomial/linear.mjs +0 -23
- package/dist/polynomial/quadratic.d.mts +0 -7
- package/dist/polynomial/quadratic.d.ts +0 -7
- package/dist/polynomial/quadratic.mjs +0 -24
- package/dist/shared/curvy.BDhiZ7He.mjs +0 -80
- package/dist/shared/curvy.BZ_mTkJe.mjs +0 -60
- package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
- package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
- package/dist/shared/curvy.BsHoYJNv.d.ts +0 -155
- package/dist/shared/curvy.BzVmUIKm.mjs +0 -131
- package/dist/shared/curvy.C2XGH0R0.mjs +0 -75
- package/dist/shared/curvy.CE4X6_Is.mjs +0 -181
- package/dist/shared/curvy.Cps2R_RU.mjs +0 -120
- package/dist/shared/curvy.Cv-wIzDr.mjs +0 -124
- package/dist/shared/curvy.DmVFTi0N.mjs +0 -34
- package/dist/shared/curvy.NsmY7zcr.d.mts +0 -155
- package/dist/shared/curvy.wYJQhFW-.mjs +0 -87
- package/dist/splines/basis2d.d.mts +0 -38
- package/dist/splines/basis2d.d.ts +0 -38
- package/dist/splines/basis2d.mjs +0 -89
- package/dist/splines/bezier2d.d.mts +0 -48
- package/dist/splines/bezier2d.d.ts +0 -48
- package/dist/splines/bezier2d.mjs +0 -22
- package/dist/splines/cardinal2d.d.mts +0 -49
- package/dist/splines/cardinal2d.d.ts +0 -49
- package/dist/splines/cardinal2d.mjs +0 -123
- package/dist/splines/hermite2d.d.mts +0 -33
- package/dist/splines/hermite2d.d.ts +0 -33
- package/dist/splines/hermite2d.mjs +0 -77
- package/dist/utils.d.ts +0 -27
- package/dist/vector/vector2.d.mts +0 -66
- package/dist/vector/vector2.d.ts +0 -66
- package/dist/vector/vector2.mjs +0 -28
- package/dist/vector/vector3.d.mts +0 -77
- package/dist/vector/vector3.d.ts +0 -77
- package/dist/vector/vector3.mjs +0 -32
- package/dist/vector/vector4.d.mts +0 -43
- package/dist/vector/vector4.d.ts +0 -43
- package/dist/vector/vector4.mjs +0 -18
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { t as Pipeable } from "./utils-DqTGyXrP.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/interval/interval.d.ts
|
|
4
|
+
declare namespace interval_d_exports {
|
|
5
|
+
export { Bounds, Closed, Interval, Open, OpenEnd, OpenStart, ScaleShift, aligned, biunit, clamp, contains, equals, filter, fromMinMax, fromSize, isClosed, isClosedAtEnd, isClosedAtStart, isInterval, isOpen, isOpenAtEnd, isOpenAtStart, isOpenEnd, isOpenStart, lerp, make, makeOpen, makeOpenEnd, makeOpenStart, normalize, remap, scaleShift, size, toClosed, toEndClosed, toEndOpen, toLerpFn, toNormalizeFn, toOpen, toRemapFn, toStartClosed, toStartOpen, unit, unitOpen };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The structural minimum: any value with numeric `start` and `end` fields.
|
|
9
|
+
*
|
|
10
|
+
* Operations that don't read endpoint inclusivity (e.g. `lerp`, `normalize`,
|
|
11
|
+
* `remap`, `size`) accept `Bounds` so the signature itself documents what
|
|
12
|
+
* the operation depends on.
|
|
13
|
+
*
|
|
14
|
+
* @since 2.0.0
|
|
15
|
+
*/
|
|
16
|
+
interface Bounds {
|
|
17
|
+
readonly start: number;
|
|
18
|
+
readonly end: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A mathematical interval. Discriminated union of four variants by endpoint
|
|
22
|
+
* inclusivity: `Closed`, `OpenStart`, `OpenEnd`, `Open`. Operations that
|
|
23
|
+
* depend on inclusivity (e.g. `contains`, `filter`, `equals`) dispatch on
|
|
24
|
+
* the `kind` field; operations that don't accept the broader `Bounds` type.
|
|
25
|
+
*
|
|
26
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.0.0
|
|
29
|
+
*/
|
|
30
|
+
type Interval = Closed | OpenStart | OpenEnd | Open;
|
|
31
|
+
/**
|
|
32
|
+
* `[start, end]` — both endpoints included.
|
|
33
|
+
*
|
|
34
|
+
* @since 2.0.0
|
|
35
|
+
*/
|
|
36
|
+
interface Closed extends Pipeable, Bounds {
|
|
37
|
+
readonly kind: 'closed';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `(start, end]` — start excluded, end included.
|
|
41
|
+
*
|
|
42
|
+
* @since 2.0.0
|
|
43
|
+
*/
|
|
44
|
+
interface OpenStart extends Pipeable, Bounds {
|
|
45
|
+
readonly kind: 'open-start';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `[start, end)` — start included, end excluded.
|
|
49
|
+
*
|
|
50
|
+
* @since 2.0.0
|
|
51
|
+
*/
|
|
52
|
+
interface OpenEnd extends Pipeable, Bounds {
|
|
53
|
+
readonly kind: 'open-end';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `(start, end)` — both endpoints excluded.
|
|
57
|
+
*
|
|
58
|
+
* @since 2.0.0
|
|
59
|
+
*/
|
|
60
|
+
interface Open extends Pipeable, Bounds {
|
|
61
|
+
readonly kind: 'open';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a value is an `Interval`.
|
|
65
|
+
*
|
|
66
|
+
* @param v - The value to check.
|
|
67
|
+
* @returns `true` if the value is an `Interval`, `false` otherwise.
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
*/
|
|
70
|
+
declare const isInterval: (v: unknown) => v is Interval;
|
|
71
|
+
declare const equals: {
|
|
72
|
+
/**
|
|
73
|
+
* Checks if two `Interval` instances are approximately equal within the
|
|
74
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
75
|
+
*
|
|
76
|
+
* Both endpoints AND the kind must match — a `Closed` and an `OpenStart` with
|
|
77
|
+
* the same numeric endpoints are not equal. Use `aligned` for the looser
|
|
78
|
+
* "same numeric range" check.
|
|
79
|
+
*
|
|
80
|
+
* @param a - The first interval.
|
|
81
|
+
* @param b - The second interval.
|
|
82
|
+
* @returns `true` when both intervals share a kind and both endpoints are within tolerance.
|
|
83
|
+
* @since 1.1.0
|
|
84
|
+
*/
|
|
85
|
+
(a: Interval, b: Interval): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if two `Interval` instances are approximately equal within the
|
|
88
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
89
|
+
*
|
|
90
|
+
* @param b - The second interval.
|
|
91
|
+
* @returns A function that takes the first interval and returns the comparison result.
|
|
92
|
+
* @since 1.1.0
|
|
93
|
+
*/
|
|
94
|
+
(b: Interval): (a: Interval) => boolean;
|
|
95
|
+
};
|
|
96
|
+
declare const aligned: {
|
|
97
|
+
/**
|
|
98
|
+
* Checks if two values share the same numeric range, ignoring endpoint
|
|
99
|
+
* inclusivity. Accepts any `Bounds`-shaped value.
|
|
100
|
+
*
|
|
101
|
+
* @param a - The first bounds.
|
|
102
|
+
* @param b - The second bounds.
|
|
103
|
+
* @returns `true` when both endpoints are within the default tolerance ({@link EPSILON}).
|
|
104
|
+
* @since 2.0.0
|
|
105
|
+
*/
|
|
106
|
+
(a: Bounds, b: Bounds): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* @param b - The second bounds.
|
|
109
|
+
* @returns A function that takes the first bounds and returns the comparison result.
|
|
110
|
+
* @since 2.0.0
|
|
111
|
+
*/
|
|
112
|
+
(b: Bounds): (a: Bounds) => boolean;
|
|
113
|
+
};
|
|
114
|
+
declare const make: {
|
|
115
|
+
/**
|
|
116
|
+
* Creates a new closed `Interval` instance.
|
|
117
|
+
*
|
|
118
|
+
* @param point - The point of the interval.
|
|
119
|
+
* @returns A new `Closed` interval `[point, point]`.
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
(point: number): Closed;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new closed `Interval` instance.
|
|
125
|
+
*
|
|
126
|
+
* @param start - The start of the interval.
|
|
127
|
+
* @param end - The end of the interval.
|
|
128
|
+
* @returns A new `Closed` interval `[start, end]`.
|
|
129
|
+
* @since 1.0.0
|
|
130
|
+
*/
|
|
131
|
+
(start: number, end: number): Closed;
|
|
132
|
+
};
|
|
133
|
+
declare const makeOpenStart: {
|
|
134
|
+
/**
|
|
135
|
+
* Creates a new left-open `Interval` instance.
|
|
136
|
+
*
|
|
137
|
+
* @param point - The point of the interval.
|
|
138
|
+
* @returns A new `OpenStart` interval `(point, point]` (degenerate, empty).
|
|
139
|
+
* @since 2.0.0
|
|
140
|
+
*/
|
|
141
|
+
(point: number): OpenStart;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a new left-open `Interval` instance.
|
|
144
|
+
*
|
|
145
|
+
* @param start - The start of the interval (excluded).
|
|
146
|
+
* @param end - The end of the interval (included).
|
|
147
|
+
* @returns A new `OpenStart` interval `(start, end]`.
|
|
148
|
+
* @since 2.0.0
|
|
149
|
+
*/
|
|
150
|
+
(start: number, end: number): OpenStart;
|
|
151
|
+
};
|
|
152
|
+
declare const makeOpenEnd: {
|
|
153
|
+
/**
|
|
154
|
+
* Creates a new right-open `Interval` instance.
|
|
155
|
+
*
|
|
156
|
+
* @param point - The point of the interval.
|
|
157
|
+
* @returns A new `OpenEnd` interval `[point, point)` (degenerate, empty).
|
|
158
|
+
* @since 2.0.0
|
|
159
|
+
*/
|
|
160
|
+
(point: number): OpenEnd;
|
|
161
|
+
/**
|
|
162
|
+
* Creates a new right-open `Interval` instance.
|
|
163
|
+
*
|
|
164
|
+
* @param start - The start of the interval (included).
|
|
165
|
+
* @param end - The end of the interval (excluded).
|
|
166
|
+
* @returns A new `OpenEnd` interval `[start, end)`.
|
|
167
|
+
* @since 2.0.0
|
|
168
|
+
*/
|
|
169
|
+
(start: number, end: number): OpenEnd;
|
|
170
|
+
};
|
|
171
|
+
declare const makeOpen: {
|
|
172
|
+
/**
|
|
173
|
+
* Creates a new fully open `Interval` instance.
|
|
174
|
+
*
|
|
175
|
+
* @param point - The point of the interval.
|
|
176
|
+
* @returns A new `Open` interval `(point, point)` (degenerate, empty).
|
|
177
|
+
* @since 2.0.0
|
|
178
|
+
*/
|
|
179
|
+
(point: number): Open;
|
|
180
|
+
/**
|
|
181
|
+
* Creates a new fully open `Interval` instance.
|
|
182
|
+
*
|
|
183
|
+
* @param start - The start of the interval (excluded).
|
|
184
|
+
* @param end - The end of the interval (excluded).
|
|
185
|
+
* @returns A new `Open` interval `(start, end)`.
|
|
186
|
+
* @since 2.0.0
|
|
187
|
+
*/
|
|
188
|
+
(start: number, end: number): Open;
|
|
189
|
+
};
|
|
190
|
+
declare const fromSize: {
|
|
191
|
+
/**
|
|
192
|
+
* Creates a new closed `Interval` instance from a size.
|
|
193
|
+
*
|
|
194
|
+
* @param size - The size of the interval.
|
|
195
|
+
* @returns A new `Closed` interval `[0, size]`.
|
|
196
|
+
* @since 1.0.0
|
|
197
|
+
*/
|
|
198
|
+
(size: number): Closed;
|
|
199
|
+
/**
|
|
200
|
+
* Creates a new closed `Interval` instance from a size.
|
|
201
|
+
*
|
|
202
|
+
* @param start - The start of the interval.
|
|
203
|
+
* @param size - The size of the interval.
|
|
204
|
+
* @returns A new `Closed` interval `[start, start + size]`.
|
|
205
|
+
* @since 1.0.0
|
|
206
|
+
*/
|
|
207
|
+
(start: number, size: number): Closed;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Creates a new closed `Interval` from a minimum and maximum value, in any order.
|
|
211
|
+
*
|
|
212
|
+
* @param values - The values to take the min and max of.
|
|
213
|
+
* @returns A new `Closed` interval `[min(values), max(values)]`.
|
|
214
|
+
* @since 1.0.0
|
|
215
|
+
*/
|
|
216
|
+
declare const fromMinMax: (...values: ReadonlyArray<number>) => Closed;
|
|
217
|
+
/**
|
|
218
|
+
* Calculates the size of an interval.
|
|
219
|
+
*
|
|
220
|
+
* Kind-agnostic — `size` of `[0, 1]` and `(0, 1)` are both `1`.
|
|
221
|
+
*
|
|
222
|
+
* @param i - The bounds to calculate the size of.
|
|
223
|
+
* @returns The size of the bounds.
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
*/
|
|
226
|
+
declare const size: (i: Bounds) => number;
|
|
227
|
+
declare const contains: {
|
|
228
|
+
/**
|
|
229
|
+
* Checks if a value is contained within an interval. Endpoint inclusivity
|
|
230
|
+
* follows the interval's `kind`.
|
|
231
|
+
*
|
|
232
|
+
* @param interval - The interval to check.
|
|
233
|
+
* @param value - The value to check.
|
|
234
|
+
* @returns `true` if the value is contained within the interval, `false` otherwise.
|
|
235
|
+
* @since 1.0.0
|
|
236
|
+
*/
|
|
237
|
+
(interval: Interval, value: number): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Checks if a value is contained within an interval. Endpoint inclusivity
|
|
240
|
+
* follows the interval's `kind`.
|
|
241
|
+
*
|
|
242
|
+
* @param value - The value to check.
|
|
243
|
+
* @returns A function that takes an interval and returns `true` if the value is contained within the interval, `false` otherwise.
|
|
244
|
+
* @since 1.0.0
|
|
245
|
+
*/
|
|
246
|
+
(value: number): (interval: Interval) => boolean;
|
|
247
|
+
};
|
|
248
|
+
declare const filter: {
|
|
249
|
+
/**
|
|
250
|
+
* Filters an array of values to those contained within an interval.
|
|
251
|
+
* Endpoint inclusivity follows the interval's `kind`.
|
|
252
|
+
*
|
|
253
|
+
* @param interval - The interval to filter the values to.
|
|
254
|
+
* @param value - The values to filter.
|
|
255
|
+
* @returns The filtered values.
|
|
256
|
+
* @since 1.0.0
|
|
257
|
+
*/
|
|
258
|
+
<V extends ReadonlyArray<number>>(interval: Interval, value: V): V;
|
|
259
|
+
/**
|
|
260
|
+
* Filters an array of values to those contained within an interval.
|
|
261
|
+
*
|
|
262
|
+
* @param value - The values to filter.
|
|
263
|
+
* @returns A function that takes an interval and returns the filtered values.
|
|
264
|
+
* @since 1.0.0
|
|
265
|
+
*/
|
|
266
|
+
<V extends ReadonlyArray<number>>(value: V): (interval: Interval) => V;
|
|
267
|
+
};
|
|
268
|
+
declare const clamp: {
|
|
269
|
+
/**
|
|
270
|
+
* Clamps a value to be within bounds. Kind-agnostic — clamps to the numeric
|
|
271
|
+
* range regardless of endpoint inclusivity.
|
|
272
|
+
*
|
|
273
|
+
* @param interval - The bounds to clamp the value to.
|
|
274
|
+
* @param value - The value to clamp.
|
|
275
|
+
* @returns The clamped value.
|
|
276
|
+
* @since 1.0.0
|
|
277
|
+
*/
|
|
278
|
+
(interval: Bounds, value: number): number;
|
|
279
|
+
/**
|
|
280
|
+
* Clamps a value to be within bounds. Kind-agnostic.
|
|
281
|
+
*
|
|
282
|
+
* @param value - The value to clamp.
|
|
283
|
+
* @returns A function that takes bounds and returns the clamped value.
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
*/
|
|
286
|
+
(value: number): (interval: Bounds) => number;
|
|
287
|
+
/**
|
|
288
|
+
* Clamps an array of values to be within bounds. Kind-agnostic.
|
|
289
|
+
*
|
|
290
|
+
* @param interval - The bounds to clamp the values to.
|
|
291
|
+
* @param value - The values to clamp.
|
|
292
|
+
* @returns The clamped values.
|
|
293
|
+
* @since 1.0.0
|
|
294
|
+
*/
|
|
295
|
+
(interval: Bounds, value: ReadonlyArray<number>): ReadonlyArray<number>;
|
|
296
|
+
/**
|
|
297
|
+
* Clamps an array of values to be within bounds. Kind-agnostic.
|
|
298
|
+
*
|
|
299
|
+
* @param value - The values to clamp.
|
|
300
|
+
* @returns A function that takes bounds and returns the clamped values.
|
|
301
|
+
* @since 1.0.0
|
|
302
|
+
*/
|
|
303
|
+
(value: ReadonlyArray<number>): (interval: Bounds) => ReadonlyArray<number>;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Returns an interval with the start endpoint open. Preserves the end endpoint's inclusivity.
|
|
307
|
+
*
|
|
308
|
+
* @since 2.0.0
|
|
309
|
+
*/
|
|
310
|
+
declare const toStartOpen: {
|
|
311
|
+
(i: Closed | OpenStart): OpenStart;
|
|
312
|
+
(i: OpenEnd | Open): Open;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Returns an interval with the start endpoint closed. Preserves the end endpoint's inclusivity.
|
|
316
|
+
*
|
|
317
|
+
* @since 2.0.0
|
|
318
|
+
*/
|
|
319
|
+
declare const toStartClosed: {
|
|
320
|
+
(i: Closed | OpenEnd): Closed;
|
|
321
|
+
(i: OpenStart | Open): OpenEnd;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Returns an interval with the end endpoint open. Preserves the start endpoint's inclusivity.
|
|
325
|
+
*
|
|
326
|
+
* @since 2.0.0
|
|
327
|
+
*/
|
|
328
|
+
declare const toEndOpen: {
|
|
329
|
+
(i: Closed | OpenEnd): OpenEnd;
|
|
330
|
+
(i: OpenStart | Open): Open;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Returns an interval with the end endpoint closed. Preserves the start endpoint's inclusivity.
|
|
334
|
+
*
|
|
335
|
+
* @since 2.0.0
|
|
336
|
+
*/
|
|
337
|
+
declare const toEndClosed: {
|
|
338
|
+
(i: Closed | OpenEnd): Closed;
|
|
339
|
+
(i: OpenStart | Open): OpenStart;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Returns a closed interval over the same numeric range.
|
|
343
|
+
*
|
|
344
|
+
* @since 2.0.0
|
|
345
|
+
*/
|
|
346
|
+
declare const toClosed: (i: Interval) => Closed;
|
|
347
|
+
/**
|
|
348
|
+
* Returns a fully open interval over the same numeric range.
|
|
349
|
+
*
|
|
350
|
+
* @since 2.0.0
|
|
351
|
+
*/
|
|
352
|
+
declare const toOpen: (i: Interval) => Open;
|
|
353
|
+
/**
|
|
354
|
+
* Type-narrowing predicate: refines `Interval` to `Closed`.
|
|
355
|
+
*
|
|
356
|
+
* @since 2.0.0
|
|
357
|
+
*/
|
|
358
|
+
declare const isClosed: (i: Interval) => i is Closed;
|
|
359
|
+
/**
|
|
360
|
+
* Type-narrowing predicate: refines `Interval` to `Open`.
|
|
361
|
+
*
|
|
362
|
+
* @since 2.0.0
|
|
363
|
+
*/
|
|
364
|
+
declare const isOpen: (i: Interval) => i is Open;
|
|
365
|
+
/**
|
|
366
|
+
* Type-narrowing predicate: refines `Interval` to `OpenStart`.
|
|
367
|
+
*
|
|
368
|
+
* @since 2.0.0
|
|
369
|
+
*/
|
|
370
|
+
declare const isOpenStart: (i: Interval) => i is OpenStart;
|
|
371
|
+
/**
|
|
372
|
+
* Type-narrowing predicate: refines `Interval` to `OpenEnd`.
|
|
373
|
+
*
|
|
374
|
+
* @since 2.0.0
|
|
375
|
+
*/
|
|
376
|
+
declare const isOpenEnd: (i: Interval) => i is OpenEnd;
|
|
377
|
+
/**
|
|
378
|
+
* Type-narrowing predicate: refines `Interval` to those with an open start endpoint.
|
|
379
|
+
*
|
|
380
|
+
* @since 2.0.0
|
|
381
|
+
*/
|
|
382
|
+
declare const isOpenAtStart: (i: Interval) => i is OpenStart | Open;
|
|
383
|
+
/**
|
|
384
|
+
* Type-narrowing predicate: refines `Interval` to those with an open end endpoint.
|
|
385
|
+
*
|
|
386
|
+
* @since 2.0.0
|
|
387
|
+
*/
|
|
388
|
+
declare const isOpenAtEnd: (i: Interval) => i is OpenEnd | Open;
|
|
389
|
+
/**
|
|
390
|
+
* Type-narrowing predicate: refines `Interval` to those with a closed start endpoint.
|
|
391
|
+
*
|
|
392
|
+
* @since 2.0.0
|
|
393
|
+
*/
|
|
394
|
+
declare const isClosedAtStart: (i: Interval) => i is Closed | OpenEnd;
|
|
395
|
+
/**
|
|
396
|
+
* Type-narrowing predicate: refines `Interval` to those with a closed end endpoint.
|
|
397
|
+
*
|
|
398
|
+
* @since 2.0.0
|
|
399
|
+
*/
|
|
400
|
+
declare const isClosedAtEnd: (i: Interval) => i is Closed | OpenStart;
|
|
401
|
+
/**
|
|
402
|
+
* The unit interval, `[0, 1]`.
|
|
403
|
+
*
|
|
404
|
+
* @since 1.0.0
|
|
405
|
+
*/
|
|
406
|
+
declare const unit: Closed;
|
|
407
|
+
/**
|
|
408
|
+
* The open unit interval, `(0, 1)`. The symmetric open analog of {@link unit};
|
|
409
|
+
* convenient for "strict interior" use cases such as filtering roots that
|
|
410
|
+
* must lie strictly inside the unit parameter range.
|
|
411
|
+
*
|
|
412
|
+
* @since 2.1.0
|
|
413
|
+
*/
|
|
414
|
+
declare const unitOpen: Open;
|
|
415
|
+
/**
|
|
416
|
+
* The biunit interval, `[-1, 1]`.
|
|
417
|
+
*
|
|
418
|
+
* @since 1.0.0
|
|
419
|
+
*/
|
|
420
|
+
declare const biunit: Closed;
|
|
421
|
+
/**
|
|
422
|
+
* Linearly interpolates a value within bounds.
|
|
423
|
+
*
|
|
424
|
+
* @param interval - The bounds to interpolate within.
|
|
425
|
+
* @param t - The interpolation factor, typically between 0 and 1.
|
|
426
|
+
* @returns The interpolated value.
|
|
427
|
+
* @since 1.0.0
|
|
428
|
+
*/
|
|
429
|
+
declare const lerp: (interval: Bounds, t: number) => number;
|
|
430
|
+
/**
|
|
431
|
+
* Creates a linear interpolation function for given bounds.
|
|
432
|
+
*
|
|
433
|
+
* @param interval - The bounds to create the interpolation function for.
|
|
434
|
+
* @returns A function that takes a factor `t` and returns the interpolated value.
|
|
435
|
+
* @since 1.0.0
|
|
436
|
+
*/
|
|
437
|
+
declare const toLerpFn: (interval: Bounds) => (t: number) => number;
|
|
438
|
+
/**
|
|
439
|
+
* Normalizes a value within bounds.
|
|
440
|
+
*
|
|
441
|
+
* @param interval - The bounds to normalize within.
|
|
442
|
+
* @param x - The value to normalize.
|
|
443
|
+
* @returns The normalized value.
|
|
444
|
+
* @since 1.0.0
|
|
445
|
+
*/
|
|
446
|
+
declare const normalize: (interval: Bounds, x: number) => number;
|
|
447
|
+
/**
|
|
448
|
+
* Creates a normalization function for given bounds.
|
|
449
|
+
*
|
|
450
|
+
* @param interval - The bounds to create the normalization function for.
|
|
451
|
+
* @returns A function that takes a value `x` and returns the normalized value.
|
|
452
|
+
* @since 1.0.0
|
|
453
|
+
*/
|
|
454
|
+
declare const toNormalizeFn: (interval: Bounds) => (x: number) => number;
|
|
455
|
+
/**
|
|
456
|
+
* Remaps a value from one bounds to another.
|
|
457
|
+
*
|
|
458
|
+
* @param source - The source bounds.
|
|
459
|
+
* @param target - The target bounds.
|
|
460
|
+
* @param x - The value to remap.
|
|
461
|
+
* @returns The remapped value.
|
|
462
|
+
* @since 1.0.0
|
|
463
|
+
*/
|
|
464
|
+
declare const remap: (source: Bounds, target: Bounds, x: number) => number;
|
|
465
|
+
/**
|
|
466
|
+
* Creates a remapping function for given bounds.
|
|
467
|
+
*
|
|
468
|
+
* @param source - The source bounds.
|
|
469
|
+
* @param target - The target bounds.
|
|
470
|
+
* @returns A function that takes a value `x` and returns the remapped value.
|
|
471
|
+
* @since 1.0.0
|
|
472
|
+
*/
|
|
473
|
+
declare const toRemapFn: (source: Bounds, target: Bounds) => (x: number) => number;
|
|
474
|
+
/**
|
|
475
|
+
* Calculates the scale and shift needed to map a source bounds to a target bounds.
|
|
476
|
+
*
|
|
477
|
+
* @param source - The source bounds.
|
|
478
|
+
* @param target - The target bounds.
|
|
479
|
+
* @returns An object containing the scale and shift values.
|
|
480
|
+
* @since 1.0.0
|
|
481
|
+
*/
|
|
482
|
+
declare const scaleShift: (source: Bounds, target: Bounds) => ScaleShift;
|
|
483
|
+
/**
|
|
484
|
+
* The scale and shift needed to map a source bounds to a target bounds.
|
|
485
|
+
*
|
|
486
|
+
* @since 1.0.0
|
|
487
|
+
*/
|
|
488
|
+
interface ScaleShift {
|
|
489
|
+
readonly scale: number;
|
|
490
|
+
readonly shift: number;
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
export { interval_d_exports as n, Interval as t };
|
|
494
|
+
//# sourceMappingURL=interval-hQDiKqj0.d.mts.map
|