curvy 2.0.0-alpha.11 → 2.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/characteristic/index.mjs +1 -1
  2. package/dist/curve/index.mjs +1 -1
  3. package/dist/curve/rationalCubic2d.d.ts +195 -11
  4. package/dist/interval/index.mjs +1 -1
  5. package/dist/monotonicity/index.d.ts +4 -0
  6. package/dist/monotonicity/index.mjs +2 -0
  7. package/dist/monotonicity/monotonicity.d.ts +80 -0
  8. package/dist/path/index.mjs +16 -387
  9. package/dist/path/index.mjs.map +1 -1
  10. package/dist/path/rationalCubic2d.d.ts +27 -0
  11. package/dist/polynomial/cubic.d.ts +2 -2
  12. package/dist/polynomial/index.mjs +2 -2
  13. package/dist/polynomial/linear.d.ts +7 -7
  14. package/dist/polynomial/quadratic.d.ts +2 -2
  15. package/dist/shared/{characteristic-Hb7F8SBw.mjs → characteristic-BkEr-rr8.mjs} +2 -2
  16. package/dist/shared/{characteristic-Hb7F8SBw.mjs.map → characteristic-BkEr-rr8.mjs.map} +1 -1
  17. package/dist/shared/{cubic-DHJrzZJN.mjs → cubic-BL6dpuHh.mjs} +18 -30
  18. package/dist/shared/cubic-BL6dpuHh.mjs.map +1 -0
  19. package/dist/shared/{interval2d-DPmvk_Qe.mjs → interval2d-AtneyI45.mjs} +1 -1
  20. package/dist/shared/{interval2d-DPmvk_Qe.mjs.map → interval2d-AtneyI45.mjs.map} +1 -1
  21. package/dist/shared/monotonicity-BdebFOtv.mjs +34 -0
  22. package/dist/shared/monotonicity-BdebFOtv.mjs.map +1 -0
  23. package/dist/shared/{quadratic-BZmfZE71.mjs → quadratic-DPrUsFCp.mjs} +9 -9
  24. package/dist/shared/quadratic-DPrUsFCp.mjs.map +1 -0
  25. package/dist/shared/{rationalCubic2d-IroMR6AA.mjs → rationalCubic2d-CeHgpNht.mjs} +373 -79
  26. package/dist/shared/rationalCubic2d-CeHgpNht.mjs.map +1 -0
  27. package/dist/shared/{rationalCubic2d-nN-oSrLr.mjs → rationalCubic2d-H1J2Fjyy.mjs} +404 -23
  28. package/dist/shared/rationalCubic2d-H1J2Fjyy.mjs.map +1 -0
  29. package/dist/shared/{solution-B6KY1E7M.mjs → solution-B2JdOZpe.mjs} +1 -1
  30. package/dist/shared/{solution-B6KY1E7M.mjs.map → solution-B2JdOZpe.mjs.map} +1 -1
  31. package/dist/solution/index.mjs +1 -1
  32. package/dist/splines/index.d.ts +3 -0
  33. package/dist/splines/index.mjs +218 -120
  34. package/dist/splines/index.mjs.map +1 -1
  35. package/dist/splines/linear2d.d.ts +102 -0
  36. package/dist/splines/linear2d.internal.d.ts +2 -0
  37. package/package.json +5 -1
  38. package/dist/polynomial/monotonicity.d.ts +0 -3
  39. package/dist/shared/cubic-DHJrzZJN.mjs.map +0 -1
  40. package/dist/shared/quadratic-BZmfZE71.mjs.map +0 -1
  41. package/dist/shared/rationalCubic2d-IroMR6AA.mjs.map +0 -1
  42. package/dist/shared/rationalCubic2d-nN-oSrLr.mjs.map +0 -1
@@ -2,11 +2,383 @@ import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
2
  import { Pipeable, dual, invariant } from "../utils.mjs";
3
3
  import { epsEquals } from "../number.mjs";
4
4
  import { i as magnitude } from "./vector2-CSkaMXvp.mjs";
5
- import { c as make$4, p as unit } from "./interval-Dm35Xhy4.mjs";
6
- import { o as none, r as isNone, s as one } from "./solution-B6KY1E7M.mjs";
7
- import { a as isIncreasing, i as isDecreasing } from "./cubic-DHJrzZJN.mjs";
8
- import { a as union } from "./interval2d-DPmvk_Qe.mjs";
9
- import { _ as solve$5, a as boundingBox$2, d as solveAtX$2, f as solveAtY$2, i as solve$6, l as length$2, p as derivative, t as approximateAsCubicCurves, u as solve$4 } from "./rationalCubic2d-IroMR6AA.mjs";
5
+ import { c as make$6, p as unit } from "./interval-Dm35Xhy4.mjs";
6
+ import { o as none, r as isNone, s as one } from "./solution-B2JdOZpe.mjs";
7
+ import { a as isIncreasing, i as isDecreasing } from "./cubic-BL6dpuHh.mjs";
8
+ import { d as isIncreasing$1, u as isDecreasing$1 } from "./quadratic-DPrUsFCp.mjs";
9
+ import { a as union } from "./interval2d-AtneyI45.mjs";
10
+ import { C as length$4, D as solveAtY$4, E as solveAtX$4, T as solve$6, a as solve$9, d as solve$7, f as solveAtX$5, m as derivative, n as boundingBox$8, o as boundingBox$7, p as solveAtY$5, t as approximateAsCubicCurves, u as length$5, v as solve$8, x as boundingBox$6 } from "./rationalCubic2d-CeHgpNht.mjs";
11
+ //#region src/path/linear2d.internal.ts
12
+ const LinearPath2dTypeId = Symbol("curvy/path/linear2d");
13
+ /** @internal */
14
+ var LinearPath2dImpl = class extends Pipeable {
15
+ [LinearPath2dTypeId] = LinearPath2dTypeId;
16
+ curves;
17
+ constructor(curves) {
18
+ super();
19
+ this.curves = curves;
20
+ }
21
+ [Symbol.iterator]() {
22
+ return this.curves[Symbol.iterator]();
23
+ }
24
+ };
25
+ /** @internal */
26
+ const isLinearPath2d$1 = (p) => typeof p === "object" && p !== null && LinearPath2dTypeId in p;
27
+ /** @internal */
28
+ const make$5 = (...curves) => new LinearPath2dImpl(curves);
29
+ /** @internal */
30
+ const fromArray$5 = (curves) => new LinearPath2dImpl(curves);
31
+ /** @internal */
32
+ const append$5 = dual(2, (p, c) => fromArray$5([...p, c]));
33
+ /** @internal */
34
+ const length$3 = (p) => {
35
+ let total = 0;
36
+ for (const curve of p) total += length$4(curve, unit);
37
+ return total;
38
+ };
39
+ /** @internal */
40
+ const solve$5 = dual(2, (p, u) => {
41
+ const curves = p instanceof LinearPath2dImpl ? p.curves : [...p];
42
+ if (u === 1) return solve$6(curves.at(-1), 1);
43
+ const t = u * curves.length;
44
+ const i = Math.floor(t);
45
+ const curve = curves[i];
46
+ return solve$6(curve, t - i);
47
+ });
48
+ /** @internal */
49
+ const toPathData$3 = (p) => {
50
+ let result = "";
51
+ let prevEndX = NaN;
52
+ let prevEndY = NaN;
53
+ for (const curve of p) {
54
+ const startX = curve.x.c0;
55
+ const startY = curve.y.c0;
56
+ const endX = curve.x.c0 + curve.x.c1;
57
+ const endY = curve.y.c0 + curve.y.c1;
58
+ if (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY)) result += ` M ${startX},${startY}`;
59
+ result += ` L ${endX},${endY}`;
60
+ prevEndX = endX;
61
+ prevEndY = endY;
62
+ }
63
+ return result.slice(1);
64
+ };
65
+ /** @internal */
66
+ const isContinuous$3 = (p) => {
67
+ let prevEndX = NaN;
68
+ let prevEndY = NaN;
69
+ let first = true;
70
+ for (const curve of p) {
71
+ const startX = curve.x.c0;
72
+ const startY = curve.y.c0;
73
+ if (!first && (!epsEquals(startX, prevEndX) || !epsEquals(startY, prevEndY))) return false;
74
+ prevEndX = curve.x.c0 + curve.x.c1;
75
+ prevEndY = curve.y.c0 + curve.y.c1;
76
+ first = false;
77
+ }
78
+ return true;
79
+ };
80
+ /** @internal */
81
+ const asContinuous$3 = (p) => {
82
+ invariant(isContinuous$3(p), "linear path is not continuous");
83
+ return p;
84
+ };
85
+ /** @internal */
86
+ const isIncreasingX$3 = (p) => {
87
+ let prevEnd = Number.NEGATIVE_INFINITY;
88
+ for (const c of p) {
89
+ if (!isIncreasing$1(c.x)) return false;
90
+ if (c.x.c0 < prevEnd - 1e-10) return false;
91
+ prevEnd = c.x.c0 + c.x.c1;
92
+ }
93
+ return true;
94
+ };
95
+ /** @internal */
96
+ const isDecreasingX$3 = (p) => {
97
+ let prevEnd = Number.POSITIVE_INFINITY;
98
+ for (const c of p) {
99
+ if (!isDecreasing$1(c.x)) return false;
100
+ if (c.x.c0 > prevEnd + 1e-10) return false;
101
+ prevEnd = c.x.c0 + c.x.c1;
102
+ }
103
+ return true;
104
+ };
105
+ /** @internal */
106
+ const isMonotonicX$3 = (p) => isIncreasingX$3(p) || isDecreasingX$3(p);
107
+ /** @internal */
108
+ const isIncreasingY$3 = (p) => {
109
+ let prevEnd = Number.NEGATIVE_INFINITY;
110
+ for (const c of p) {
111
+ if (!isIncreasing$1(c.y)) return false;
112
+ if (c.y.c0 < prevEnd - 1e-10) return false;
113
+ prevEnd = c.y.c0 + c.y.c1;
114
+ }
115
+ return true;
116
+ };
117
+ /** @internal */
118
+ const isDecreasingY$3 = (p) => {
119
+ let prevEnd = Number.POSITIVE_INFINITY;
120
+ for (const c of p) {
121
+ if (!isDecreasing$1(c.y)) return false;
122
+ if (c.y.c0 > prevEnd + 1e-10) return false;
123
+ prevEnd = c.y.c0 + c.y.c1;
124
+ }
125
+ return true;
126
+ };
127
+ /** @internal */
128
+ const isMonotonicY$3 = (p) => isIncreasingY$3(p) || isDecreasingY$3(p);
129
+ /** @internal */
130
+ const asIncreasingX$3 = (p) => {
131
+ invariant(isIncreasingX$3(p), "linear path is not increasing in x");
132
+ return p;
133
+ };
134
+ /** @internal */
135
+ const asDecreasingX$3 = (p) => {
136
+ invariant(isDecreasingX$3(p), "linear path is not decreasing in x");
137
+ return p;
138
+ };
139
+ /** @internal */
140
+ const asMonotonicX$3 = (p) => {
141
+ invariant(isMonotonicX$3(p), "linear path is not monotonic in x");
142
+ return p;
143
+ };
144
+ /** @internal */
145
+ const asIncreasingY$3 = (p) => {
146
+ invariant(isIncreasingY$3(p), "linear path is not increasing in y");
147
+ return p;
148
+ };
149
+ /** @internal */
150
+ const asDecreasingY$3 = (p) => {
151
+ invariant(isDecreasingY$3(p), "linear path is not decreasing in y");
152
+ return p;
153
+ };
154
+ /** @internal */
155
+ const asMonotonicY$3 = (p) => {
156
+ invariant(isMonotonicY$3(p), "linear path is not monotonic in y");
157
+ return p;
158
+ };
159
+ /** @internal */
160
+ const solveAtX$3 = dual(2, (p, x) => {
161
+ for (const c of p) {
162
+ const sx = c.x.c0;
163
+ const ex = c.x.c0 + c.x.c1;
164
+ const lo = Math.min(sx, ex);
165
+ const hi = Math.max(sx, ex);
166
+ if (x >= lo - 1e-10 && x <= hi + 1e-10) {
167
+ if (epsEquals(x, sx)) return one(c.y.c0);
168
+ if (epsEquals(x, ex)) return one(c.y.c0 + c.y.c1);
169
+ const sol = solveAtX$4(c, x);
170
+ if (!isNone(sol)) return sol;
171
+ }
172
+ }
173
+ return none;
174
+ });
175
+ /** @internal */
176
+ const solveAtY$3 = dual(2, (p, y) => {
177
+ for (const c of p) {
178
+ const sy = c.y.c0;
179
+ const ey = c.y.c0 + c.y.c1;
180
+ const lo = Math.min(sy, ey);
181
+ const hi = Math.max(sy, ey);
182
+ if (y >= lo - 1e-10 && y <= hi + 1e-10) {
183
+ if (epsEquals(y, sy)) return one(c.x.c0);
184
+ if (epsEquals(y, ey)) return one(c.x.c0 + c.x.c1);
185
+ const sol = solveAtY$4(c, y);
186
+ if (!isNone(sol)) return sol;
187
+ }
188
+ }
189
+ return none;
190
+ });
191
+ /** @internal */
192
+ const boundingBox$5 = (p) => {
193
+ const iter = p[Symbol.iterator]();
194
+ let acc = boundingBox$6(iter.next().value);
195
+ for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$6(next.value));
196
+ return acc;
197
+ };
198
+ //#endregion
199
+ //#region src/path/linear2d.ts
200
+ var linear2d_exports = /* @__PURE__ */ __exportAll({
201
+ append: () => append$4,
202
+ asContinuous: () => asContinuous$2,
203
+ asDecreasingX: () => asDecreasingX$2,
204
+ asDecreasingY: () => asDecreasingY$2,
205
+ asIncreasingX: () => asIncreasingX$2,
206
+ asIncreasingY: () => asIncreasingY$2,
207
+ asMonotonicX: () => asMonotonicX$2,
208
+ asMonotonicY: () => asMonotonicY$2,
209
+ boundingBox: () => boundingBox$4,
210
+ fromArray: () => fromArray$4,
211
+ isContinuous: () => isContinuous$2,
212
+ isDecreasingX: () => isDecreasingX$2,
213
+ isDecreasingY: () => isDecreasingY$2,
214
+ isIncreasingX: () => isIncreasingX$2,
215
+ isIncreasingY: () => isIncreasingY$2,
216
+ isLinearPath2d: () => isLinearPath2d,
217
+ isMonotonicX: () => isMonotonicX$2,
218
+ isMonotonicY: () => isMonotonicY$2,
219
+ length: () => length$2,
220
+ make: () => make$4,
221
+ solve: () => solve$4,
222
+ solveAtX: () => solveAtX$2,
223
+ solveAtY: () => solveAtY$2,
224
+ toPathData: () => toPathData$2
225
+ });
226
+ /**
227
+ * Creates a new `LinearPath2d` instance from a sequence of curves.
228
+ *
229
+ * @param curves - The curves to create the path from.
230
+ * @returns A new `LinearPath2d` instance.
231
+ * @since 2.0.0
232
+ */
233
+ const make$4 = make$5;
234
+ /**
235
+ * Creates a new `LinearPath2d` instance from an array of curves.
236
+ *
237
+ * @param curves - The curves to create the path from.
238
+ * @returns A new `LinearPath2d` instance.
239
+ * @since 2.0.0
240
+ */
241
+ const fromArray$4 = fromArray$5;
242
+ /**
243
+ * Checks if a value is a `LinearPath2d`.
244
+ *
245
+ * @param p - The value to check.
246
+ * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.
247
+ * @since 1.0.0
248
+ */
249
+ const isLinearPath2d = isLinearPath2d$1;
250
+ const append$4 = append$5;
251
+ /**
252
+ * Calculates the length of a linear path.
253
+ *
254
+ * @param p - The linear path to calculate the length of.
255
+ * @returns The length of the linear path.
256
+ * @since 1.0.0
257
+ */
258
+ const length$2 = length$3;
259
+ const solve$4 = solve$5;
260
+ /**
261
+ * Serializes a linear path as an SVG path data string (the value of a `<path>`
262
+ * element's `d` attribute), using `M` and `L` commands. Discontinuities between
263
+ * curves emit a fresh `M` command.
264
+ *
265
+ * @param p - The linear path to serialize.
266
+ * @returns The SVG path data string.
267
+ * @since 2.0.0
268
+ */
269
+ const toPathData$2 = toPathData$3;
270
+ /**
271
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
272
+ * `LinearPath2d<T & Continuous>` when adjacent curves connect at their join
273
+ * points.
274
+ *
275
+ * @param p - The linear path to check.
276
+ * @returns `true` when the path is continuous (G⁰).
277
+ * @since 2.0.0
278
+ */
279
+ const isContinuous$2 = isContinuous$3;
280
+ /**
281
+ * Asserts that the linear path is continuous, throwing on failure.
282
+ *
283
+ * @param p - The linear path to assert against.
284
+ * @returns The same path, typed with the `Continuous` brand.
285
+ * @throws When the path has a discontinuity between adjacent curves.
286
+ * @since 2.0.0
287
+ */
288
+ const asContinuous$2 = asContinuous$3;
289
+ /**
290
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
291
+ * `LinearPath2d<T & IncreasingX>` when every segment's x-polynomial is
292
+ * strictly increasing and adjacent segments' x-ranges don't overlap.
293
+ *
294
+ * @since 2.0.0
295
+ */
296
+ const isIncreasingX$2 = isIncreasingX$3;
297
+ /**
298
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
299
+ * `LinearPath2d<T & DecreasingX>` when every segment's x-polynomial is
300
+ * strictly decreasing and adjacent segments' x-ranges don't overlap.
301
+ *
302
+ * @since 2.0.0
303
+ */
304
+ const isDecreasingX$2 = isDecreasingX$3;
305
+ /**
306
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
307
+ * `LinearPath2d<T & MonotonicX>` when the path is either increasing or
308
+ * decreasing in x along its full parameter domain.
309
+ *
310
+ * @since 2.0.0
311
+ */
312
+ const isMonotonicX$2 = isMonotonicX$3;
313
+ /**
314
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
315
+ * `LinearPath2d<T & IncreasingY>`. The y-axis analog of {@link isIncreasingX}.
316
+ *
317
+ * @since 2.0.0
318
+ */
319
+ const isIncreasingY$2 = isIncreasingY$3;
320
+ /**
321
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
322
+ * `LinearPath2d<T & DecreasingY>`. The y-axis analog of {@link isDecreasingX}.
323
+ *
324
+ * @since 2.0.0
325
+ */
326
+ const isDecreasingY$2 = isDecreasingY$3;
327
+ /**
328
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
329
+ * `LinearPath2d<T & MonotonicY>`. The y-axis analog of {@link isMonotonicX}.
330
+ *
331
+ * @since 2.0.0
332
+ */
333
+ const isMonotonicY$2 = isMonotonicY$3;
334
+ /**
335
+ * Asserts that the path is strictly increasing in x, throwing on failure.
336
+ *
337
+ * @since 2.0.0
338
+ */
339
+ const asIncreasingX$2 = asIncreasingX$3;
340
+ /**
341
+ * Asserts that the path is strictly decreasing in x, throwing on failure.
342
+ *
343
+ * @since 2.0.0
344
+ */
345
+ const asDecreasingX$2 = asDecreasingX$3;
346
+ /**
347
+ * Asserts that the path is monotonic in x, throwing on failure.
348
+ *
349
+ * @since 2.0.0
350
+ */
351
+ const asMonotonicX$2 = asMonotonicX$3;
352
+ /**
353
+ * Asserts that the path is strictly increasing in y, throwing on failure.
354
+ *
355
+ * @since 2.0.0
356
+ */
357
+ const asIncreasingY$2 = asIncreasingY$3;
358
+ /**
359
+ * Asserts that the path is strictly decreasing in y, throwing on failure.
360
+ *
361
+ * @since 2.0.0
362
+ */
363
+ const asDecreasingY$2 = asDecreasingY$3;
364
+ /**
365
+ * Asserts that the path is monotonic in y, throwing on failure.
366
+ *
367
+ * @since 2.0.0
368
+ */
369
+ const asMonotonicY$2 = asMonotonicY$3;
370
+ const solveAtX$2 = solveAtX$3;
371
+ const solveAtY$2 = solveAtY$3;
372
+ /**
373
+ * Computes the axis-aligned bounding box of the path — the smallest closed
374
+ * `Box2d` enclosing every segment.
375
+ *
376
+ * @param p - The linear path.
377
+ * @returns A closed `Box2d` enclosing the path.
378
+ * @since 2.0.0
379
+ */
380
+ const boundingBox$4 = boundingBox$5;
381
+ //#endregion
10
382
  //#region src/path/cubic2d.internal.ts
11
383
  const CubicPath2dTypeId = Symbol("curvy/path/cubic2d");
12
384
  /** @internal */
@@ -33,17 +405,17 @@ const append$3 = dual(2, (p, c) => fromArray$3([...p, c]));
33
405
  /** @internal */
34
406
  const length$1 = (p) => {
35
407
  let total = 0;
36
- for (const curve of p) total += length$2(curve, unit);
408
+ for (const curve of p) total += length$5(curve, unit);
37
409
  return total;
38
410
  };
39
411
  /** @internal */
40
412
  const solve$3 = dual(2, (p, u) => {
41
413
  const curves = p instanceof CubicPath2dImpl ? p.curves : [...p];
42
- if (u === 1) return solve$4(curves.at(-1), 1);
414
+ if (u === 1) return solve$7(curves.at(-1), 1);
43
415
  const t = u * curves.length;
44
416
  const i = Math.floor(t);
45
417
  const curve = curves[i];
46
- return solve$4(curve, t - i);
418
+ return solve$7(curve, t - i);
47
419
  });
48
420
  const cumulativeLengthCache = /* @__PURE__ */ new WeakMap();
49
421
  const getCumulativeLengths = (p) => {
@@ -52,7 +424,7 @@ const getCumulativeLengths = (p) => {
52
424
  const lengths = [];
53
425
  let total = 0;
54
426
  for (const curve of p) {
55
- total += length$2(curve, unit);
427
+ total += length$5(curve, unit);
56
428
  lengths.push(total);
57
429
  }
58
430
  cached = lengths;
@@ -68,11 +440,11 @@ const solveCurveByDistance = (curve, target, segmentLength) => {
68
440
  let lo = 0;
69
441
  let hi = 1;
70
442
  for (let iter = 0; iter < 16; iter++) {
71
- const error = length$2(curve, make$4(0, t)) - target;
443
+ const error = length$5(curve, make$6(0, t)) - target;
72
444
  if (Math.abs(error) < 1e-10) return t;
73
445
  if (error > 0) hi = t;
74
446
  else lo = t;
75
- const speed = magnitude(solve$5(derivative$1, t));
447
+ const speed = magnitude(solve$8(derivative$1, t));
76
448
  if (speed === 0) {
77
449
  t = (lo + hi) / 2;
78
450
  continue;
@@ -215,7 +587,7 @@ const solveAtX$1 = dual(2, (p, x) => {
215
587
  if (x >= lo - 1e-10 && x <= hi + 1e-10) {
216
588
  if (epsEquals(x, sx)) return one(c.y.c0);
217
589
  if (epsEquals(x, ex)) return one(c.y.c0 + c.y.c1 + c.y.c2 + c.y.c3);
218
- const sol = solveAtX$2(c, x);
590
+ const sol = solveAtX$5(c, x);
219
591
  if (!isNone(sol)) return sol;
220
592
  }
221
593
  }
@@ -231,7 +603,7 @@ const solveAtY$1 = dual(2, (p, y) => {
231
603
  if (y >= lo - 1e-10 && y <= hi + 1e-10) {
232
604
  if (epsEquals(y, sy)) return one(c.x.c0);
233
605
  if (epsEquals(y, ey)) return one(c.x.c0 + c.x.c1 + c.x.c2 + c.x.c3);
234
- const sol = solveAtY$2(c, y);
606
+ const sol = solveAtY$5(c, y);
235
607
  if (!isNone(sol)) return sol;
236
608
  }
237
609
  }
@@ -249,13 +621,13 @@ const solveByDistance$1 = dual(2, (p, s) => {
249
621
  const segmentLength = lengths[k] - segmentStart;
250
622
  const segmentTarget = target - segmentStart;
251
623
  const curve = (p instanceof CubicPath2dImpl ? p.curves : [...p])[k];
252
- return solve$4(curve, solveCurveByDistance(curve, segmentTarget, segmentLength));
624
+ return solve$7(curve, solveCurveByDistance(curve, segmentTarget, segmentLength));
253
625
  });
254
626
  /** @internal */
255
- const boundingBox$1 = (p) => {
627
+ const boundingBox$3 = (p) => {
256
628
  const iter = p[Symbol.iterator]();
257
- let acc = boundingBox$2(iter.next().value);
258
- for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$2(next.value));
629
+ let acc = boundingBox$7(iter.next().value);
630
+ for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$7(next.value));
259
631
  return acc;
260
632
  };
261
633
  //#endregion
@@ -269,7 +641,7 @@ var cubic2d_exports = /* @__PURE__ */ __exportAll({
269
641
  asIncreasingY: () => asIncreasingY,
270
642
  asMonotonicX: () => asMonotonicX,
271
643
  asMonotonicY: () => asMonotonicY,
272
- boundingBox: () => boundingBox,
644
+ boundingBox: () => boundingBox$2,
273
645
  fromArray: () => fromArray$2,
274
646
  isContinuous: () => isContinuous,
275
647
  isCubicPath2d: () => isCubicPath2d,
@@ -435,7 +807,7 @@ const solveByDistance = solveByDistance$1;
435
807
  * @returns A closed `Box2d` enclosing the path.
436
808
  * @since 2.0.0
437
809
  */
438
- const boundingBox = boundingBox$1;
810
+ const boundingBox$2 = boundingBox$3;
439
811
  //#endregion
440
812
  //#region src/path/rationalCubic2d.internal.ts
441
813
  const RationalCubicPath2dTypeId = Symbol("curvy/path/rationalCubic2d");
@@ -463,11 +835,18 @@ const append$1 = dual(2, (p, c) => fromArray$1([...p, c]));
463
835
  /** @internal */
464
836
  const solve$1 = dual(2, (p, u) => {
465
837
  const curves = p instanceof RationalCubicPath2dImpl ? p.curves : [...p];
466
- if (u === 1) return solve$6(curves.at(-1), 1);
838
+ if (u === 1) return solve$9(curves.at(-1), 1);
467
839
  const t = u * curves.length;
468
840
  const i = Math.floor(t);
469
841
  const curve = curves[i];
470
- return solve$6(curve, t - i);
842
+ return solve$9(curve, t - i);
843
+ });
844
+ /** @internal */
845
+ const boundingBox$1 = dual(2, (p, tolerance) => {
846
+ const iter = p[Symbol.iterator]();
847
+ let acc = boundingBox$8(iter.next().value, tolerance);
848
+ for (let next = iter.next(); !next.done; next = iter.next()) acc = union(acc, boundingBox$8(next.value, tolerance));
849
+ return acc;
471
850
  });
472
851
  /** @internal */
473
852
  const approximateAsCubicPath$1 = dual(2, (p, tolerance) => {
@@ -480,6 +859,7 @@ const approximateAsCubicPath$1 = dual(2, (p, tolerance) => {
480
859
  var rationalCubic2d_exports = /* @__PURE__ */ __exportAll({
481
860
  append: () => append,
482
861
  approximateAsCubicPath: () => approximateAsCubicPath,
862
+ boundingBox: () => boundingBox,
483
863
  fromArray: () => fromArray,
484
864
  isRationalCubicPath2d: () => isRationalCubicPath2d,
485
865
  make: () => make,
@@ -511,8 +891,9 @@ const make = make$1;
511
891
  const fromArray = fromArray$1;
512
892
  const append = append$1;
513
893
  const solve = solve$1;
894
+ const boundingBox = boundingBox$1;
514
895
  const approximateAsCubicPath = approximateAsCubicPath$1;
515
896
  //#endregion
516
- export { make$2 as i, rationalCubic2d_exports as n, cubic2d_exports as r, fromArray as t };
897
+ export { fromArray$4 as a, make$2 as i, rationalCubic2d_exports as n, linear2d_exports as o, cubic2d_exports as r, fromArray as t };
517
898
 
518
- //# sourceMappingURL=rationalCubic2d-nN-oSrLr.mjs.map
899
+ //# sourceMappingURL=rationalCubic2d-H1J2Fjyy.mjs.map