curvy 2.0.0-alpha.5 → 2.0.0-alpha.7

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 (120) hide show
  1. package/dist/characteristic/characteristic.d.ts +3 -3
  2. package/dist/characteristic/index.d.ts +1 -1
  3. package/dist/characteristic/index.mjs +1 -1
  4. package/dist/curve/cubic2d.d.ts +10 -14
  5. package/dist/curve/cubic2d.internal.d.ts +2 -0
  6. package/dist/curve/index.d.ts +8 -8
  7. package/dist/curve/index.mjs +1 -1
  8. package/dist/curve/linear2d.d.ts +11 -15
  9. package/dist/curve/linear2d.internal.d.ts +2 -0
  10. package/dist/curve/quadratic2d.d.ts +11 -15
  11. package/dist/curve/quadratic2d.internal.d.ts +2 -0
  12. package/dist/curve/rationalCubic2d.d.ts +63 -22
  13. package/dist/curve/rationalCubic2d.internal.d.ts +2 -0
  14. package/dist/interval/index.d.ts +4 -4
  15. package/dist/interval/index.mjs +2 -2
  16. package/dist/interval/interval.d.ts +1 -1
  17. package/dist/interval/interval.internal.d.ts +1 -0
  18. package/dist/interval/interval2d.d.ts +45 -8
  19. package/dist/interval/interval2d.internal.d.ts +2 -0
  20. package/dist/matrix/index.d.ts +6 -6
  21. package/dist/matrix/index.mjs +1 -1
  22. package/dist/matrix/index.mjs.map +1 -1
  23. package/dist/matrix/matrix2x2.d.ts +4 -8
  24. package/dist/matrix/matrix2x2.internal.d.ts +2 -0
  25. package/dist/matrix/matrix3x3.d.ts +5 -9
  26. package/dist/matrix/matrix3x3.internal.d.ts +4 -0
  27. package/dist/matrix/matrix4x4.d.ts +5 -9
  28. package/dist/matrix/matrix4x4.internal.d.ts +2 -0
  29. package/dist/number.mjs.map +1 -1
  30. package/dist/path/cubic2d.d.ts +119 -12
  31. package/dist/path/cubic2d.internal.d.ts +2 -0
  32. package/dist/path/index.d.ts +8 -8
  33. package/dist/path/index.mjs +413 -4
  34. package/dist/path/index.mjs.map +1 -1
  35. package/dist/path/linear2d.d.ts +122 -12
  36. package/dist/path/linear2d.internal.d.ts +2 -0
  37. package/dist/path/quadratic2d.d.ts +119 -12
  38. package/dist/path/quadratic2d.internal.d.ts +2 -0
  39. package/dist/path/rationalCubic2d.d.ts +5 -9
  40. package/dist/path/rationalCubic2d.internal.d.ts +2 -0
  41. package/dist/path/traits.d.ts +64 -0
  42. package/dist/polynomial/cubic.d.ts +10 -14
  43. package/dist/polynomial/cubic.internal.circular.d.ts +2 -0
  44. package/dist/polynomial/cubic.internal.d.ts +1 -0
  45. package/dist/polynomial/index.d.ts +6 -6
  46. package/dist/polynomial/index.mjs +2 -2
  47. package/dist/polynomial/linear.d.ts +9 -13
  48. package/dist/polynomial/linear.internal.d.ts +2 -0
  49. package/dist/polynomial/quadratic.d.ts +11 -15
  50. package/dist/polynomial/quadratic.internal.circular.d.ts +2 -0
  51. package/dist/polynomial/quadratic.internal.d.ts +1 -0
  52. package/dist/shared/{characteristic-DLlhja-I.mjs → characteristic-D9yZWCym.mjs} +3 -3
  53. package/dist/shared/characteristic-D9yZWCym.mjs.map +1 -0
  54. package/dist/shared/{cubic-CMonq6bg.mjs → cubic-BK8xjSkd.mjs} +79 -4
  55. package/dist/shared/cubic-BK8xjSkd.mjs.map +1 -0
  56. package/dist/shared/{interval-X1EYuf-T.mjs → interval-CqC3ZIqj.mjs} +40 -1
  57. package/dist/shared/interval-CqC3ZIqj.mjs.map +1 -0
  58. package/dist/shared/{interval2d-ca0J1NMr.mjs → interval2d-BMDmeL1M.mjs} +45 -4
  59. package/dist/shared/interval2d-BMDmeL1M.mjs.map +1 -0
  60. package/dist/shared/{matrix4x4-Ck2WROK-.mjs → matrix4x4-qyRufxfs.mjs} +62 -3
  61. package/dist/shared/matrix4x4-qyRufxfs.mjs.map +1 -0
  62. package/dist/shared/{quadratic-DyeMtvET.mjs → quadratic-CWXIRh42.mjs} +2 -2
  63. package/dist/shared/quadratic-CWXIRh42.mjs.map +1 -0
  64. package/dist/shared/{rationalCubic2d-Vw4qGPZj.mjs → rationalCubic2d-BZvT9s5N.mjs} +218 -5
  65. package/dist/shared/rationalCubic2d-BZvT9s5N.mjs.map +1 -0
  66. package/dist/shared/{rationalCubic2d-D658ltUM.mjs → rationalCubic2d-DaFTrUXw.mjs} +250 -36
  67. package/dist/shared/rationalCubic2d-DaFTrUXw.mjs.map +1 -0
  68. package/dist/shared/{solution-3TDATEMn.mjs → solution-UKGK826h.mjs} +22 -2
  69. package/dist/shared/solution-UKGK826h.mjs.map +1 -0
  70. package/dist/shared/{vector2-CCuJx1rX.mjs → vector2-CWU3cPB2.mjs} +12 -2
  71. package/dist/shared/vector2-CWU3cPB2.mjs.map +1 -0
  72. package/dist/shared/{vector2.internal-DU_E808S.mjs → vector2.internal-BL8hFl1c.mjs} +31 -2
  73. package/dist/shared/vector2.internal-BL8hFl1c.mjs.map +1 -0
  74. package/dist/shared/{vector3-C-qgKAjR.mjs → vector3-DmMm6pX8.mjs} +12 -2
  75. package/dist/shared/vector3-DmMm6pX8.mjs.map +1 -0
  76. package/dist/shared/{vector4-BhOKDhD5.mjs → vector4-oqPPp45j.mjs} +12 -2
  77. package/dist/shared/vector4-oqPPp45j.mjs.map +1 -0
  78. package/dist/shared/{vector4.internal-5XcaX12X.mjs → vector4.internal-BnnTjVIr.mjs} +45 -2
  79. package/dist/shared/vector4.internal-BnnTjVIr.mjs.map +1 -0
  80. package/dist/solution/index.d.ts +1 -3
  81. package/dist/solution/index.mjs +1 -1
  82. package/dist/solution/solution.d.ts +2 -2
  83. package/dist/solution/solution.internal.d.ts +2 -0
  84. package/dist/splines/basis2d.d.ts +5 -9
  85. package/dist/splines/basis2d.internal.d.ts +2 -0
  86. package/dist/splines/bezier2d.d.ts +6 -10
  87. package/dist/splines/bezier2d.internal.d.ts +2 -0
  88. package/dist/splines/cardinal2d.d.ts +5 -9
  89. package/dist/splines/cardinal2d.internal.d.ts +2 -0
  90. package/dist/splines/hermite2d.d.ts +5 -9
  91. package/dist/splines/hermite2d.internal.d.ts +2 -0
  92. package/dist/splines/index.d.ts +10 -10
  93. package/dist/splines/index.mjs +62 -8
  94. package/dist/splines/index.mjs.map +1 -1
  95. package/dist/splines/rationalBezier2d.d.ts +5 -9
  96. package/dist/splines/rationalBezier2d.internal.d.ts +2 -0
  97. package/dist/splines/util.d.ts +3 -3
  98. package/dist/vector/index.d.ts +6 -6
  99. package/dist/vector/index.mjs +3 -3
  100. package/dist/vector/vector2.d.ts +12 -9
  101. package/dist/vector/vector2.internal.d.ts +4 -0
  102. package/dist/vector/vector3.d.ts +12 -7
  103. package/dist/vector/vector3.internal.d.ts +2 -0
  104. package/dist/vector/vector4.d.ts +12 -7
  105. package/dist/vector/vector4.internal.d.ts +2 -0
  106. package/package.json +2 -2
  107. package/dist/shared/characteristic-DLlhja-I.mjs.map +0 -1
  108. package/dist/shared/cubic-CMonq6bg.mjs.map +0 -1
  109. package/dist/shared/interval-X1EYuf-T.mjs.map +0 -1
  110. package/dist/shared/interval2d-ca0J1NMr.mjs.map +0 -1
  111. package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +0 -1
  112. package/dist/shared/quadratic-DyeMtvET.mjs.map +0 -1
  113. package/dist/shared/rationalCubic2d-D658ltUM.mjs.map +0 -1
  114. package/dist/shared/rationalCubic2d-Vw4qGPZj.mjs.map +0 -1
  115. package/dist/shared/solution-3TDATEMn.mjs.map +0 -1
  116. package/dist/shared/vector2-CCuJx1rX.mjs.map +0 -1
  117. package/dist/shared/vector2.internal-DU_E808S.mjs.map +0 -1
  118. package/dist/shared/vector3-C-qgKAjR.mjs.map +0 -1
  119. package/dist/shared/vector4-BhOKDhD5.mjs.map +0 -1
  120. package/dist/shared/vector4.internal-5XcaX12X.mjs.map +0 -1
@@ -1,12 +1,15 @@
1
1
  import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
2
2
  import { Pipeable, dual, invariant } from "../utils.mjs";
3
3
  import { epsEquals } from "../number.mjs";
4
- import { p as unit } from "../shared/interval-X1EYuf-T.mjs";
5
- import { r as union } from "../shared/interval2d-ca0J1NMr.mjs";
6
- import { _ as length$4, f as boundingBox$5, g as boundingBox$4, h as solve$5, p as length$5, y as solve$4 } from "../shared/rationalCubic2d-D658ltUM.mjs";
7
- import { n as rationalCubic2d_exports, r as cubic2d_exports } from "../shared/rationalCubic2d-Vw4qGPZj.mjs";
4
+ import { p as unit } from "../shared/interval-CqC3ZIqj.mjs";
5
+ import { o as none } from "../shared/solution-UKGK826h.mjs";
6
+ import { d as isIncreasing, n as isDecreasing$1, r as isIncreasing$1, u as isDecreasing } from "../shared/quadratic-CWXIRh42.mjs";
7
+ import { a as union } from "../shared/interval2d-BMDmeL1M.mjs";
8
+ import { C as solve$4, T as solveAtY$4, _ as solve$5, b as boundingBox$4, h as length$5, m as boundingBox$5, v as solveAtX$5, w as solveAtX$4, x as length$4, y as solveAtY$5 } from "../shared/rationalCubic2d-DaFTrUXw.mjs";
9
+ import { n as rationalCubic2d_exports, r as cubic2d_exports } from "../shared/rationalCubic2d-BZvT9s5N.mjs";
8
10
  //#region src/path/linear2d.internal.ts
9
11
  const LinearPath2dTypeId = Symbol("curvy/path/linear2d");
12
+ /** @internal */
10
13
  var LinearPath2dImpl = class extends Pipeable {
11
14
  [LinearPath2dTypeId] = LinearPath2dTypeId;
12
15
  curves;
@@ -18,15 +21,21 @@ var LinearPath2dImpl = class extends Pipeable {
18
21
  return this.curves[Symbol.iterator]();
19
22
  }
20
23
  };
24
+ /** @internal */
21
25
  const isLinearPath2d$1 = (p) => typeof p === "object" && p !== null && LinearPath2dTypeId in p;
26
+ /** @internal */
22
27
  const make$3 = (...curves) => new LinearPath2dImpl(curves);
28
+ /** @internal */
23
29
  const fromArray$3 = (curves) => new LinearPath2dImpl(curves);
30
+ /** @internal */
24
31
  const append$3 = dual(2, (p, c) => fromArray$3([...p, c]));
32
+ /** @internal */
25
33
  const length$3 = (p) => {
26
34
  let total = 0;
27
35
  for (const curve of p) total += length$4(curve, unit);
28
36
  return total;
29
37
  };
38
+ /** @internal */
30
39
  const solve$3 = dual(2, (p, u) => {
31
40
  const curves = p instanceof LinearPath2dImpl ? p.curves : [...p];
32
41
  if (u === 1) return solve$4(curves.at(-1), 1);
@@ -35,6 +44,7 @@ const solve$3 = dual(2, (p, u) => {
35
44
  const curve = curves[i];
36
45
  return solve$4(curve, t - i);
37
46
  });
47
+ /** @internal */
38
48
  const toPathData$3 = (p) => {
39
49
  let result = "";
40
50
  let prevEndX = NaN;
@@ -51,6 +61,7 @@ const toPathData$3 = (p) => {
51
61
  }
52
62
  return result.slice(1);
53
63
  };
64
+ /** @internal */
54
65
  const isContinuous$3 = (p) => {
55
66
  let prevEndX = NaN;
56
67
  let prevEndY = NaN;
@@ -65,10 +76,108 @@ const isContinuous$3 = (p) => {
65
76
  }
66
77
  return true;
67
78
  };
79
+ /** @internal */
68
80
  const asContinuous$3 = (p) => {
69
81
  invariant(isContinuous$3(p), "linear path is not continuous");
70
82
  return p;
71
83
  };
84
+ /** @internal */
85
+ const isIncreasingX$3 = (p) => {
86
+ let prevEnd = Number.NEGATIVE_INFINITY;
87
+ for (const c of p) {
88
+ if (!isIncreasing(c.x)) return false;
89
+ if (c.x.c0 < prevEnd - 1e-10) return false;
90
+ prevEnd = c.x.c0 + c.x.c1;
91
+ }
92
+ return true;
93
+ };
94
+ /** @internal */
95
+ const isDecreasingX$3 = (p) => {
96
+ let prevEnd = Number.POSITIVE_INFINITY;
97
+ for (const c of p) {
98
+ if (!isDecreasing(c.x)) return false;
99
+ if (c.x.c0 > prevEnd + 1e-10) return false;
100
+ prevEnd = c.x.c0 + c.x.c1;
101
+ }
102
+ return true;
103
+ };
104
+ /** @internal */
105
+ const isMonotonicX$3 = (p) => isIncreasingX$3(p) || isDecreasingX$3(p);
106
+ /** @internal */
107
+ const isIncreasingY$3 = (p) => {
108
+ let prevEnd = Number.NEGATIVE_INFINITY;
109
+ for (const c of p) {
110
+ if (!isIncreasing(c.y)) return false;
111
+ if (c.y.c0 < prevEnd - 1e-10) return false;
112
+ prevEnd = c.y.c0 + c.y.c1;
113
+ }
114
+ return true;
115
+ };
116
+ /** @internal */
117
+ const isDecreasingY$3 = (p) => {
118
+ let prevEnd = Number.POSITIVE_INFINITY;
119
+ for (const c of p) {
120
+ if (!isDecreasing(c.y)) return false;
121
+ if (c.y.c0 > prevEnd + 1e-10) return false;
122
+ prevEnd = c.y.c0 + c.y.c1;
123
+ }
124
+ return true;
125
+ };
126
+ /** @internal */
127
+ const isMonotonicY$3 = (p) => isIncreasingY$3(p) || isDecreasingY$3(p);
128
+ /** @internal */
129
+ const asIncreasingX$3 = (p) => {
130
+ invariant(isIncreasingX$3(p), "linear path is not increasing in x");
131
+ return p;
132
+ };
133
+ /** @internal */
134
+ const asDecreasingX$3 = (p) => {
135
+ invariant(isDecreasingX$3(p), "linear path is not decreasing in x");
136
+ return p;
137
+ };
138
+ /** @internal */
139
+ const asMonotonicX$3 = (p) => {
140
+ invariant(isMonotonicX$3(p), "linear path is not monotonic in x");
141
+ return p;
142
+ };
143
+ /** @internal */
144
+ const asIncreasingY$3 = (p) => {
145
+ invariant(isIncreasingY$3(p), "linear path is not increasing in y");
146
+ return p;
147
+ };
148
+ /** @internal */
149
+ const asDecreasingY$3 = (p) => {
150
+ invariant(isDecreasingY$3(p), "linear path is not decreasing in y");
151
+ return p;
152
+ };
153
+ /** @internal */
154
+ const asMonotonicY$3 = (p) => {
155
+ invariant(isMonotonicY$3(p), "linear path is not monotonic in y");
156
+ return p;
157
+ };
158
+ /** @internal */
159
+ const solveAtX$3 = dual(2, (p, x) => {
160
+ for (const c of p) {
161
+ const sx = c.x.c0;
162
+ const ex = c.x.c0 + c.x.c1;
163
+ const lo = Math.min(sx, ex);
164
+ const hi = Math.max(sx, ex);
165
+ if (x >= lo - 1e-10 && x <= hi + 1e-10) return solveAtX$4(c, x);
166
+ }
167
+ return none;
168
+ });
169
+ /** @internal */
170
+ const solveAtY$3 = dual(2, (p, y) => {
171
+ for (const c of p) {
172
+ const sy = c.y.c0;
173
+ const ey = c.y.c0 + c.y.c1;
174
+ const lo = Math.min(sy, ey);
175
+ const hi = Math.max(sy, ey);
176
+ if (y >= lo - 1e-10 && y <= hi + 1e-10) return solveAtY$4(c, y);
177
+ }
178
+ return none;
179
+ });
180
+ /** @internal */
72
181
  const boundingBox$3 = (p) => {
73
182
  const iter = p[Symbol.iterator]();
74
183
  let acc = boundingBox$4(iter.next().value);
@@ -80,13 +189,27 @@ const boundingBox$3 = (p) => {
80
189
  var linear2d_exports = /* @__PURE__ */ __exportAll({
81
190
  append: () => append$2,
82
191
  asContinuous: () => asContinuous$2,
192
+ asDecreasingX: () => asDecreasingX$2,
193
+ asDecreasingY: () => asDecreasingY$2,
194
+ asIncreasingX: () => asIncreasingX$2,
195
+ asIncreasingY: () => asIncreasingY$2,
196
+ asMonotonicX: () => asMonotonicX$2,
197
+ asMonotonicY: () => asMonotonicY$2,
83
198
  boundingBox: () => boundingBox$2,
84
199
  fromArray: () => fromArray$2,
85
200
  isContinuous: () => isContinuous$2,
201
+ isDecreasingX: () => isDecreasingX$2,
202
+ isDecreasingY: () => isDecreasingY$2,
203
+ isIncreasingX: () => isIncreasingX$2,
204
+ isIncreasingY: () => isIncreasingY$2,
86
205
  isLinearPath2d: () => isLinearPath2d,
206
+ isMonotonicX: () => isMonotonicX$2,
207
+ isMonotonicY: () => isMonotonicY$2,
87
208
  length: () => length$2,
88
209
  make: () => make$2,
89
210
  solve: () => solve$2,
211
+ solveAtX: () => solveAtX$2,
212
+ solveAtY: () => solveAtY$2,
90
213
  toPathData: () => toPathData$2
91
214
  });
92
215
  /**
@@ -153,6 +276,89 @@ const isContinuous$2 = isContinuous$3;
153
276
  */
154
277
  const asContinuous$2 = asContinuous$3;
155
278
  /**
279
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
280
+ * `LinearPath2d<T & IncreasingX>` when every segment's x-polynomial is
281
+ * strictly increasing and adjacent segments' x-ranges don't overlap.
282
+ *
283
+ * @since 2.0.0
284
+ */
285
+ const isIncreasingX$2 = isIncreasingX$3;
286
+ /**
287
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
288
+ * `LinearPath2d<T & DecreasingX>` when every segment's x-polynomial is
289
+ * strictly decreasing and adjacent segments' x-ranges don't overlap.
290
+ *
291
+ * @since 2.0.0
292
+ */
293
+ const isDecreasingX$2 = isDecreasingX$3;
294
+ /**
295
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
296
+ * `LinearPath2d<T & MonotonicX>` when the path is either increasing or
297
+ * decreasing in x along its full parameter domain.
298
+ *
299
+ * @since 2.0.0
300
+ */
301
+ const isMonotonicX$2 = isMonotonicX$3;
302
+ /**
303
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
304
+ * `LinearPath2d<T & IncreasingY>`. The y-axis analog of {@link isIncreasingX}.
305
+ *
306
+ * @since 2.0.0
307
+ */
308
+ const isIncreasingY$2 = isIncreasingY$3;
309
+ /**
310
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
311
+ * `LinearPath2d<T & DecreasingY>`. The y-axis analog of {@link isDecreasingX}.
312
+ *
313
+ * @since 2.0.0
314
+ */
315
+ const isDecreasingY$2 = isDecreasingY$3;
316
+ /**
317
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
318
+ * `LinearPath2d<T & MonotonicY>`. The y-axis analog of {@link isMonotonicX}.
319
+ *
320
+ * @since 2.0.0
321
+ */
322
+ const isMonotonicY$2 = isMonotonicY$3;
323
+ /**
324
+ * Asserts that the path is strictly increasing in x, throwing on failure.
325
+ *
326
+ * @since 2.0.0
327
+ */
328
+ const asIncreasingX$2 = asIncreasingX$3;
329
+ /**
330
+ * Asserts that the path is strictly decreasing in x, throwing on failure.
331
+ *
332
+ * @since 2.0.0
333
+ */
334
+ const asDecreasingX$2 = asDecreasingX$3;
335
+ /**
336
+ * Asserts that the path is monotonic in x, throwing on failure.
337
+ *
338
+ * @since 2.0.0
339
+ */
340
+ const asMonotonicX$2 = asMonotonicX$3;
341
+ /**
342
+ * Asserts that the path is strictly increasing in y, throwing on failure.
343
+ *
344
+ * @since 2.0.0
345
+ */
346
+ const asIncreasingY$2 = asIncreasingY$3;
347
+ /**
348
+ * Asserts that the path is strictly decreasing in y, throwing on failure.
349
+ *
350
+ * @since 2.0.0
351
+ */
352
+ const asDecreasingY$2 = asDecreasingY$3;
353
+ /**
354
+ * Asserts that the path is monotonic in y, throwing on failure.
355
+ *
356
+ * @since 2.0.0
357
+ */
358
+ const asMonotonicY$2 = asMonotonicY$3;
359
+ const solveAtX$2 = solveAtX$3;
360
+ const solveAtY$2 = solveAtY$3;
361
+ /**
156
362
  * Computes the axis-aligned bounding box of the path — the smallest closed
157
363
  * `Box2d` enclosing every segment.
158
364
  *
@@ -164,6 +370,7 @@ const boundingBox$2 = boundingBox$3;
164
370
  //#endregion
165
371
  //#region src/path/quadratic2d.internal.ts
166
372
  const QuadraticPath2dTypeId = Symbol("curvy/path/quadratic2d");
373
+ /** @internal */
167
374
  var QuadraticPath2dImpl = class extends Pipeable {
168
375
  [QuadraticPath2dTypeId] = QuadraticPath2dTypeId;
169
376
  curves;
@@ -175,15 +382,21 @@ var QuadraticPath2dImpl = class extends Pipeable {
175
382
  return this.curves[Symbol.iterator]();
176
383
  }
177
384
  };
385
+ /** @internal */
178
386
  const isQuadraticPath2d$1 = (p) => typeof p === "object" && p !== null && QuadraticPath2dTypeId in p;
387
+ /** @internal */
179
388
  const make$1 = (...curves) => new QuadraticPath2dImpl(curves);
389
+ /** @internal */
180
390
  const fromArray$1 = (curves) => new QuadraticPath2dImpl(curves);
391
+ /** @internal */
181
392
  const append$1 = dual(2, (p, c) => fromArray$1([...p, c]));
393
+ /** @internal */
182
394
  const length$1 = (p) => {
183
395
  let total = 0;
184
396
  for (const curve of p) total += length$5(curve, unit);
185
397
  return total;
186
398
  };
399
+ /** @internal */
187
400
  const solve$1 = dual(2, (p, u) => {
188
401
  const curves = p instanceof QuadraticPath2dImpl ? p.curves : [...p];
189
402
  if (u === 1) return solve$5(curves.at(-1), 1);
@@ -192,6 +405,7 @@ const solve$1 = dual(2, (p, u) => {
192
405
  const curve = curves[i];
193
406
  return solve$5(curve, t - i);
194
407
  });
408
+ /** @internal */
195
409
  const toPathData$1 = (p) => {
196
410
  let result = "";
197
411
  let prevEndX = NaN;
@@ -216,6 +430,7 @@ const toPathData$1 = (p) => {
216
430
  }
217
431
  return result.slice(1);
218
432
  };
433
+ /** @internal */
219
434
  const isContinuous$1 = (p) => {
220
435
  let prevEndX = NaN;
221
436
  let prevEndY = NaN;
@@ -230,10 +445,108 @@ const isContinuous$1 = (p) => {
230
445
  }
231
446
  return true;
232
447
  };
448
+ /** @internal */
233
449
  const asContinuous$1 = (p) => {
234
450
  invariant(isContinuous$1(p), "quadratic path is not continuous");
235
451
  return p;
236
452
  };
453
+ /** @internal */
454
+ const isIncreasingX$1 = (p) => {
455
+ let prevEnd = Number.NEGATIVE_INFINITY;
456
+ for (const c of p) {
457
+ if (!isIncreasing$1(c.x, unit)) return false;
458
+ if (c.x.c0 < prevEnd - 1e-10) return false;
459
+ prevEnd = c.x.c0 + c.x.c1 + c.x.c2;
460
+ }
461
+ return true;
462
+ };
463
+ /** @internal */
464
+ const isDecreasingX$1 = (p) => {
465
+ let prevEnd = Number.POSITIVE_INFINITY;
466
+ for (const c of p) {
467
+ if (!isDecreasing$1(c.x, unit)) return false;
468
+ if (c.x.c0 > prevEnd + 1e-10) return false;
469
+ prevEnd = c.x.c0 + c.x.c1 + c.x.c2;
470
+ }
471
+ return true;
472
+ };
473
+ /** @internal */
474
+ const isMonotonicX$1 = (p) => isIncreasingX$1(p) || isDecreasingX$1(p);
475
+ /** @internal */
476
+ const isIncreasingY$1 = (p) => {
477
+ let prevEnd = Number.NEGATIVE_INFINITY;
478
+ for (const c of p) {
479
+ if (!isIncreasing$1(c.y, unit)) return false;
480
+ if (c.y.c0 < prevEnd - 1e-10) return false;
481
+ prevEnd = c.y.c0 + c.y.c1 + c.y.c2;
482
+ }
483
+ return true;
484
+ };
485
+ /** @internal */
486
+ const isDecreasingY$1 = (p) => {
487
+ let prevEnd = Number.POSITIVE_INFINITY;
488
+ for (const c of p) {
489
+ if (!isDecreasing$1(c.y, unit)) return false;
490
+ if (c.y.c0 > prevEnd + 1e-10) return false;
491
+ prevEnd = c.y.c0 + c.y.c1 + c.y.c2;
492
+ }
493
+ return true;
494
+ };
495
+ /** @internal */
496
+ const isMonotonicY$1 = (p) => isIncreasingY$1(p) || isDecreasingY$1(p);
497
+ /** @internal */
498
+ const asIncreasingX$1 = (p) => {
499
+ invariant(isIncreasingX$1(p), "quadratic path is not increasing in x");
500
+ return p;
501
+ };
502
+ /** @internal */
503
+ const asDecreasingX$1 = (p) => {
504
+ invariant(isDecreasingX$1(p), "quadratic path is not decreasing in x");
505
+ return p;
506
+ };
507
+ /** @internal */
508
+ const asMonotonicX$1 = (p) => {
509
+ invariant(isMonotonicX$1(p), "quadratic path is not monotonic in x");
510
+ return p;
511
+ };
512
+ /** @internal */
513
+ const asIncreasingY$1 = (p) => {
514
+ invariant(isIncreasingY$1(p), "quadratic path is not increasing in y");
515
+ return p;
516
+ };
517
+ /** @internal */
518
+ const asDecreasingY$1 = (p) => {
519
+ invariant(isDecreasingY$1(p), "quadratic path is not decreasing in y");
520
+ return p;
521
+ };
522
+ /** @internal */
523
+ const asMonotonicY$1 = (p) => {
524
+ invariant(isMonotonicY$1(p), "quadratic path is not monotonic in y");
525
+ return p;
526
+ };
527
+ /** @internal */
528
+ const solveAtX$1 = dual(2, (p, x) => {
529
+ for (const c of p) {
530
+ const sx = c.x.c0;
531
+ const ex = c.x.c0 + c.x.c1 + c.x.c2;
532
+ const lo = Math.min(sx, ex);
533
+ const hi = Math.max(sx, ex);
534
+ if (x >= lo - 1e-10 && x <= hi + 1e-10) return solveAtX$5(c, x);
535
+ }
536
+ return none;
537
+ });
538
+ /** @internal */
539
+ const solveAtY$1 = dual(2, (p, y) => {
540
+ for (const c of p) {
541
+ const sy = c.y.c0;
542
+ const ey = c.y.c0 + c.y.c1 + c.y.c2;
543
+ const lo = Math.min(sy, ey);
544
+ const hi = Math.max(sy, ey);
545
+ if (y >= lo - 1e-10 && y <= hi + 1e-10) return solveAtY$5(c, y);
546
+ }
547
+ return none;
548
+ });
549
+ /** @internal */
237
550
  const boundingBox$1 = (p) => {
238
551
  const iter = p[Symbol.iterator]();
239
552
  let acc = boundingBox$5(iter.next().value);
@@ -245,13 +558,27 @@ const boundingBox$1 = (p) => {
245
558
  var quadratic2d_exports = /* @__PURE__ */ __exportAll({
246
559
  append: () => append,
247
560
  asContinuous: () => asContinuous,
561
+ asDecreasingX: () => asDecreasingX,
562
+ asDecreasingY: () => asDecreasingY,
563
+ asIncreasingX: () => asIncreasingX,
564
+ asIncreasingY: () => asIncreasingY,
565
+ asMonotonicX: () => asMonotonicX,
566
+ asMonotonicY: () => asMonotonicY,
248
567
  boundingBox: () => boundingBox,
249
568
  fromArray: () => fromArray,
250
569
  isContinuous: () => isContinuous,
570
+ isDecreasingX: () => isDecreasingX,
571
+ isDecreasingY: () => isDecreasingY,
572
+ isIncreasingX: () => isIncreasingX,
573
+ isIncreasingY: () => isIncreasingY,
574
+ isMonotonicX: () => isMonotonicX,
575
+ isMonotonicY: () => isMonotonicY,
251
576
  isQuadraticPath2d: () => isQuadraticPath2d,
252
577
  length: () => length,
253
578
  make: () => make,
254
579
  solve: () => solve,
580
+ solveAtX: () => solveAtX,
581
+ solveAtY: () => solveAtY,
255
582
  toPathData: () => toPathData
256
583
  });
257
584
  /**
@@ -311,6 +638,88 @@ const isContinuous = isContinuous$1;
311
638
  */
312
639
  const asContinuous = asContinuous$1;
313
640
  /**
641
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
642
+ * `QuadraticPath2d<T & IncreasingX>` when every segment's x-polynomial is
643
+ * strictly increasing on `[0, 1]` and adjacent segments' x-ranges don't
644
+ * overlap.
645
+ *
646
+ * @since 2.0.0
647
+ */
648
+ const isIncreasingX = isIncreasingX$1;
649
+ /**
650
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
651
+ * `QuadraticPath2d<T & DecreasingX>`.
652
+ *
653
+ * @since 2.0.0
654
+ */
655
+ const isDecreasingX = isDecreasingX$1;
656
+ /**
657
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
658
+ * `QuadraticPath2d<T & MonotonicX>`.
659
+ *
660
+ * @since 2.0.0
661
+ */
662
+ const isMonotonicX = isMonotonicX$1;
663
+ /**
664
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
665
+ * `QuadraticPath2d<T & IncreasingY>`.
666
+ *
667
+ * @since 2.0.0
668
+ */
669
+ const isIncreasingY = isIncreasingY$1;
670
+ /**
671
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
672
+ * `QuadraticPath2d<T & DecreasingY>`.
673
+ *
674
+ * @since 2.0.0
675
+ */
676
+ const isDecreasingY = isDecreasingY$1;
677
+ /**
678
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
679
+ * `QuadraticPath2d<T & MonotonicY>`.
680
+ *
681
+ * @since 2.0.0
682
+ */
683
+ const isMonotonicY = isMonotonicY$1;
684
+ /**
685
+ * Asserts that the path is strictly increasing in x, throwing on failure.
686
+ *
687
+ * @since 2.0.0
688
+ */
689
+ const asIncreasingX = asIncreasingX$1;
690
+ /**
691
+ * Asserts that the path is strictly decreasing in x, throwing on failure.
692
+ *
693
+ * @since 2.0.0
694
+ */
695
+ const asDecreasingX = asDecreasingX$1;
696
+ /**
697
+ * Asserts that the path is monotonic in x, throwing on failure.
698
+ *
699
+ * @since 2.0.0
700
+ */
701
+ const asMonotonicX = asMonotonicX$1;
702
+ /**
703
+ * Asserts that the path is strictly increasing in y, throwing on failure.
704
+ *
705
+ * @since 2.0.0
706
+ */
707
+ const asIncreasingY = asIncreasingY$1;
708
+ /**
709
+ * Asserts that the path is strictly decreasing in y, throwing on failure.
710
+ *
711
+ * @since 2.0.0
712
+ */
713
+ const asDecreasingY = asDecreasingY$1;
714
+ /**
715
+ * Asserts that the path is monotonic in y, throwing on failure.
716
+ *
717
+ * @since 2.0.0
718
+ */
719
+ const asMonotonicY = asMonotonicY$1;
720
+ const solveAtX = solveAtX$1;
721
+ const solveAtY = solveAtY$1;
722
+ /**
314
723
  * Computes the axis-aligned bounding box of the path — the smallest closed
315
724
  * `Box2d` enclosing every segment.
316
725
  *