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.
Files changed (139) hide show
  1. package/dist/characteristic/index.d.mts +88 -0
  2. package/dist/characteristic/index.mjs +2 -0
  3. package/dist/curve/index.d.mts +2 -0
  4. package/dist/curve/index.mjs +2 -0
  5. package/dist/interval/index.d.mts +2 -0
  6. package/dist/interval/index.mjs +2 -0
  7. package/dist/matrix/index.d.mts +2 -0
  8. package/dist/matrix/index.mjs +267 -0
  9. package/dist/matrix/index.mjs.map +1 -0
  10. package/dist/number.d.mts +280 -0
  11. package/dist/number.mjs +140 -0
  12. package/dist/number.mjs.map +1 -0
  13. package/dist/path/index.d.mts +241 -0
  14. package/dist/path/index.mjs +292 -0
  15. package/dist/path/index.mjs.map +1 -0
  16. package/dist/polynomial/index.d.mts +2 -0
  17. package/dist/polynomial/index.mjs +3 -0
  18. package/dist/shared/characteristic-BGRxcxUH.mjs +104 -0
  19. package/dist/shared/characteristic-BGRxcxUH.mjs.map +1 -0
  20. package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
  21. package/dist/shared/cubic-CYYEUHNm.mjs +479 -0
  22. package/dist/shared/cubic-CYYEUHNm.mjs.map +1 -0
  23. package/dist/shared/cubic-Dfn6DB02.d.mts +1099 -0
  24. package/dist/shared/interval-CCEqzPgA.mjs +376 -0
  25. package/dist/shared/interval-CCEqzPgA.mjs.map +1 -0
  26. package/dist/shared/interval-hQDiKqj0.d.mts +494 -0
  27. package/dist/shared/matrix4x4-Bt_DBlP0.d.mts +1182 -0
  28. package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
  29. package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
  30. package/dist/shared/quadratic-DEhuAKuE.mjs +330 -0
  31. package/dist/shared/quadratic-DEhuAKuE.mjs.map +1 -0
  32. package/dist/shared/rationalCubic2d-BPLohNuI.d.mts +787 -0
  33. package/dist/shared/rationalCubic2d-CP4oGpnk.mjs +658 -0
  34. package/dist/shared/rationalCubic2d-CP4oGpnk.mjs.map +1 -0
  35. package/dist/shared/rationalCubic2d-CXa7Yren.mjs +278 -0
  36. package/dist/shared/rationalCubic2d-CXa7Yren.mjs.map +1 -0
  37. package/dist/shared/rationalCubic2d-D_-XWxcm.d.mts +297 -0
  38. package/dist/shared/solution-BjoW7ov4.d.mts +251 -0
  39. package/dist/shared/solution-CbSWzXCn.mjs +306 -0
  40. package/dist/shared/solution-CbSWzXCn.mjs.map +1 -0
  41. package/dist/{pipe.d.mts → shared/utils-DqTGyXrP.d.mts} +44 -26
  42. package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
  43. package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
  44. package/dist/shared/vector2-TV0UnlxY.d.mts +1168 -0
  45. package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
  46. package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
  47. package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
  48. package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
  49. package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
  50. package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
  51. package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
  52. package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
  53. package/dist/solution/index.d.mts +2 -0
  54. package/dist/solution/index.mjs +2 -0
  55. package/dist/splines/index.d.mts +701 -0
  56. package/dist/splines/index.mjs +734 -0
  57. package/dist/splines/index.mjs.map +1 -0
  58. package/dist/utils.d.mts +2 -27
  59. package/dist/utils.mjs +88 -43
  60. package/dist/utils.mjs.map +1 -0
  61. package/dist/vector/index.d.mts +2 -0
  62. package/dist/vector/index.mjs +4 -0
  63. package/package.json +49 -92
  64. package/dist/curve/cubic2d.d.mts +0 -31
  65. package/dist/curve/cubic2d.d.ts +0 -31
  66. package/dist/curve/cubic2d.mjs +0 -97
  67. package/dist/curve/linear2d.d.mts +0 -28
  68. package/dist/curve/linear2d.d.ts +0 -28
  69. package/dist/curve/linear2d.mjs +0 -49
  70. package/dist/curve/quadratic2d.d.mts +0 -33
  71. package/dist/curve/quadratic2d.d.ts +0 -33
  72. package/dist/curve/quadratic2d.mjs +0 -87
  73. package/dist/interval.d.mts +0 -58
  74. package/dist/interval.d.ts +0 -58
  75. package/dist/interval.mjs +0 -89
  76. package/dist/matrix/matrix2x2.d.mts +0 -49
  77. package/dist/matrix/matrix2x2.d.ts +0 -49
  78. package/dist/matrix/matrix2x2.mjs +0 -24
  79. package/dist/matrix/matrix3x3.d.mts +0 -63
  80. package/dist/matrix/matrix3x3.d.ts +0 -63
  81. package/dist/matrix/matrix3x3.mjs +0 -27
  82. package/dist/matrix/matrix4x4.d.mts +0 -72
  83. package/dist/matrix/matrix4x4.d.ts +0 -72
  84. package/dist/matrix/matrix4x4.mjs +0 -215
  85. package/dist/path/cubic2d.d.mts +0 -29
  86. package/dist/path/cubic2d.d.ts +0 -29
  87. package/dist/path/cubic2d.mjs +0 -62
  88. package/dist/path/linear2d.d.mts +0 -29
  89. package/dist/path/linear2d.d.ts +0 -29
  90. package/dist/path/linear2d.mjs +0 -55
  91. package/dist/path/quadratic2d.d.mts +0 -30
  92. package/dist/path/quadratic2d.d.ts +0 -30
  93. package/dist/path/quadratic2d.mjs +0 -61
  94. package/dist/pipe.d.ts +0 -58
  95. package/dist/pipe.mjs +0 -91
  96. package/dist/polynomial/cubic.d.mts +0 -7
  97. package/dist/polynomial/cubic.d.ts +0 -7
  98. package/dist/polynomial/cubic.mjs +0 -148
  99. package/dist/polynomial/linear.d.mts +0 -7
  100. package/dist/polynomial/linear.d.ts +0 -7
  101. package/dist/polynomial/linear.mjs +0 -23
  102. package/dist/polynomial/quadratic.d.mts +0 -7
  103. package/dist/polynomial/quadratic.d.ts +0 -7
  104. package/dist/polynomial/quadratic.mjs +0 -24
  105. package/dist/shared/curvy.BDhiZ7He.mjs +0 -80
  106. package/dist/shared/curvy.BZ_mTkJe.mjs +0 -60
  107. package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
  108. package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
  109. package/dist/shared/curvy.BsHoYJNv.d.ts +0 -155
  110. package/dist/shared/curvy.BzVmUIKm.mjs +0 -131
  111. package/dist/shared/curvy.C2XGH0R0.mjs +0 -75
  112. package/dist/shared/curvy.CE4X6_Is.mjs +0 -181
  113. package/dist/shared/curvy.Cps2R_RU.mjs +0 -120
  114. package/dist/shared/curvy.Cv-wIzDr.mjs +0 -124
  115. package/dist/shared/curvy.DmVFTi0N.mjs +0 -34
  116. package/dist/shared/curvy.NsmY7zcr.d.mts +0 -155
  117. package/dist/shared/curvy.wYJQhFW-.mjs +0 -87
  118. package/dist/splines/basis2d.d.mts +0 -38
  119. package/dist/splines/basis2d.d.ts +0 -38
  120. package/dist/splines/basis2d.mjs +0 -89
  121. package/dist/splines/bezier2d.d.mts +0 -48
  122. package/dist/splines/bezier2d.d.ts +0 -48
  123. package/dist/splines/bezier2d.mjs +0 -22
  124. package/dist/splines/cardinal2d.d.mts +0 -49
  125. package/dist/splines/cardinal2d.d.ts +0 -49
  126. package/dist/splines/cardinal2d.mjs +0 -123
  127. package/dist/splines/hermite2d.d.mts +0 -33
  128. package/dist/splines/hermite2d.d.ts +0 -33
  129. package/dist/splines/hermite2d.mjs +0 -77
  130. package/dist/utils.d.ts +0 -27
  131. package/dist/vector/vector2.d.mts +0 -66
  132. package/dist/vector/vector2.d.ts +0 -66
  133. package/dist/vector/vector2.mjs +0 -28
  134. package/dist/vector/vector3.d.mts +0 -77
  135. package/dist/vector/vector3.d.ts +0 -77
  136. package/dist/vector/vector3.mjs +0 -32
  137. package/dist/vector/vector4.d.mts +0 -43
  138. package/dist/vector/vector4.d.ts +0 -43
  139. package/dist/vector/vector4.mjs +0 -18
@@ -0,0 +1,658 @@
1
+ import { t as __exportAll } from "./chunk-25Hzd3z8.mjs";
2
+ import { Pipeable, dual, invariant } from "../utils.mjs";
3
+ import { i as make, n as cross, r as magnitude } from "./vector2-CL1HDdPr.mjs";
4
+ import { n as transpose } from "./vector4-5KbjoHVj.mjs";
5
+ import { c as size, d as unitOpen, s as scaleShift, t as biunit, u as unit } from "./interval-CCEqzPgA.mjs";
6
+ import { a as match, i as map, o as none, s as one, t as clip } from "./solution-CbSWzXCn.mjs";
7
+ import { A as GL32_X10, B as GL32_X6, C as GL32_W5, D as GL32_W9, E as GL32_W8, F as GL32_X15, H as GL32_X8, I as GL32_X2, L as GL32_X3, M as GL32_X12, N as GL32_X13, O as GL32_X0, P as GL32_X14, R as GL32_X4, S as GL32_W4, T as GL32_W7, U as GL32_X9, V as GL32_X7, _ as GL32_W13, a as isIncreasing$6, b as GL32_W2, c as roots, d as subdivide, f as GL32_W0, g as GL32_W12, h as GL32_W11, i as isDecreasing$6, j as GL32_X11, k as GL32_X1, l as solve$8, m as GL32_W10, n as derivative$5, o as isMonotonic$6, p as GL32_W1, s as make$1, u as solveInverse, v as GL32_W14, w as GL32_W6, x as GL32_W3, y as GL32_W15, z as GL32_X5 } from "./cubic-CYYEUHNm.mjs";
8
+ import { a as make$3, c as solveInverse$2, d as isMonotonic$7, h as solveInverse$1, i as isMonotonic$8, l as isDecreasing$7, m as solve$9, n as isDecreasing$8, p as make$2, r as isIncreasing$8, s as solve$10, t as derivative$6, u as isIncreasing$7 } from "./quadratic-DEhuAKuE.mjs";
9
+ import { i as cubicBezier, t as apply } from "./characteristic-BGRxcxUH.mjs";
10
+ //#region src/curve/linear2d.internal.ts
11
+ const LinearCurve2dTypeId = Symbol("curvy/curve/linear2d");
12
+ var LinearCurve2dImpl = class extends Pipeable {
13
+ [LinearCurve2dTypeId] = LinearCurve2dTypeId;
14
+ x;
15
+ y;
16
+ constructor(c0, c1) {
17
+ super();
18
+ this.x = c0;
19
+ this.y = c1;
20
+ }
21
+ get [0]() {
22
+ return this.x;
23
+ }
24
+ get [1]() {
25
+ return this.y;
26
+ }
27
+ };
28
+ const fromPolynomials$7 = (c0, c1) => new LinearCurve2dImpl(c0, c1);
29
+ const fromCoefficients$5 = (c0, c1) => new LinearCurve2dImpl(make$2(c0.x, c1.x), make$2(c0.y, c1.y));
30
+ const fromBezierPoints$7 = (p0, p1) => new LinearCurve2dImpl(make$2(p0.x, p1.x - p0.x), make$2(p0.y, p1.y - p0.y));
31
+ const isLinearCurve2d$1 = (c) => typeof c === "object" && c !== null && LinearCurve2dTypeId in c;
32
+ const derivative$4 = (c) => make(c.x.c1, c.y.c1);
33
+ const solve$7 = dual(2, (c, t) => make(solve$9(c.x, t), solve$9(c.y, t)));
34
+ const solveAtX$7 = dual(2, (c, x) => match(solveInverse$1(c.x, x), {
35
+ onNone: () => none,
36
+ onSome: ({ value: t }) => t < 0 || t > 1 ? none : one(solve$9(c.y, t))
37
+ }));
38
+ const solveAtY$7 = dual(2, (c, y) => match(solveInverse$1(c.y, y), {
39
+ onNone: () => none,
40
+ onSome: ({ value: t }) => t < 0 || t > 1 ? none : one(solve$9(c.x, t))
41
+ }));
42
+ const length$5 = dual(2, (c, i) => Math.sqrt(c.x.c1 ** 2 + c.y.c1 ** 2) * Math.abs(i.end - i.start));
43
+ const isMonotonic$5 = (c) => isMonotonic$7(c.x) && isMonotonic$7(c.y);
44
+ const isIncreasing$5 = (c) => isIncreasing$7(c.x) && isIncreasing$7(c.y);
45
+ const isDecreasing$5 = (c) => isDecreasing$7(c.x) && isDecreasing$7(c.y);
46
+ const fail$2 = (m) => {
47
+ throw new Error(m);
48
+ };
49
+ const asMonotonic$5 = (c) => isMonotonic$5(c) ? c : fail$2("linear curve is not monotonic in both axes");
50
+ const asIncreasing$5 = (c) => isIncreasing$5(c) ? c : fail$2("linear curve is not increasing in both axes");
51
+ const asDecreasing$5 = (c) => isDecreasing$5(c) ? c : fail$2("linear curve is not decreasing in both axes");
52
+ //#endregion
53
+ //#region src/curve/linear2d.ts
54
+ var linear2d_exports = /* @__PURE__ */ __exportAll({
55
+ asDecreasing: () => asDecreasing$4,
56
+ asIncreasing: () => asIncreasing$4,
57
+ asMonotonic: () => asMonotonic$4,
58
+ derivative: () => derivative$3,
59
+ fromBezierPoints: () => fromBezierPoints$6,
60
+ fromCoefficients: () => fromCoefficients$4,
61
+ fromPolynomials: () => fromPolynomials$6,
62
+ isDecreasing: () => isDecreasing$4,
63
+ isIncreasing: () => isIncreasing$4,
64
+ isLinearCurve2d: () => isLinearCurve2d,
65
+ isMonotonic: () => isMonotonic$4,
66
+ length: () => length$4,
67
+ solve: () => solve$6,
68
+ solveAtX: () => solveAtX$6,
69
+ solveAtY: () => solveAtY$6
70
+ });
71
+ /**
72
+ * Creates a new `LinearCurve2d` instance from polynomial parameters.
73
+ *
74
+ * @param x - The x polynomial.
75
+ * @param y - The y polynomial.
76
+ * @returns A new `LinearCurve2d` instance.
77
+ * @since 1.0.0
78
+ */
79
+ const fromPolynomials$6 = fromPolynomials$7;
80
+ /**
81
+ * Creates a new `LinearCurve2d` instance from monomial coefficient vectors.
82
+ *
83
+ * Each argument bundles the per-axis coefficient at the given power: `c0`
84
+ * holds the x⁰ term, `c1` holds the x¹ term. The resulting curve evaluates to
85
+ * `c0 + c1·t` per axis.
86
+ *
87
+ * @param c0 - The x⁰ coefficients (x and y).
88
+ * @param c1 - The x¹ coefficients (x and y).
89
+ * @returns A new `LinearCurve2d` instance.
90
+ * @since 2.0.0
91
+ */
92
+ const fromCoefficients$4 = fromCoefficients$5;
93
+ /**
94
+ * Creates a new `LinearCurve2d` instance from a pair of endpoints.
95
+ *
96
+ * `p0` is the curve at `t = 0`, `p1` is the curve at `t = 1`. The
97
+ * implementation converts to the curve's internal monomial form (slope-form
98
+ * polynomial in `t`) in closed form.
99
+ *
100
+ * @param p0 - The curve's start point.
101
+ * @param p1 - The curve's end point.
102
+ * @returns A new `LinearCurve2d` instance whose curve matches the line from `p0` to `p1`.
103
+ * @since 2.0.0
104
+ */
105
+ const fromBezierPoints$6 = fromBezierPoints$7;
106
+ /**
107
+ * Checks if a value is a `LinearCurve2d`.
108
+ *
109
+ * @param c - The value to check.
110
+ * @returns `true` if the value is a `LinearCurve2d`, `false` otherwise.
111
+ * @since 1.0.0
112
+ */
113
+ const isLinearCurve2d = isLinearCurve2d$1;
114
+ /**
115
+ * Gets the derivative of a linear curve as a vector
116
+ *
117
+ * @param c - The linear curve to get the derivative of.
118
+ * @returns The derivative of the linear curve as a vector.
119
+ * @since 1.0.0
120
+ */
121
+ const derivative$3 = derivative$4;
122
+ const solve$6 = solve$7;
123
+ const length$4 = length$5;
124
+ const solveAtX$6 = solveAtX$7;
125
+ const solveAtY$6 = solveAtY$7;
126
+ /**
127
+ * Type-narrowing predicate: refines both axes' traits to include `Monotonic`
128
+ * when both the x and y polynomials are strictly monotonic. When both axes
129
+ * are monotonic, the curve is invertible in either direction.
130
+ *
131
+ * For checking only one axis, call the polynomial-level refiner directly:
132
+ * `LinearPolynomial.isMonotonic(curve.x)`.
133
+ *
134
+ * @since 2.0.0
135
+ */
136
+ const isMonotonic$4 = isMonotonic$5;
137
+ /**
138
+ * Type-narrowing predicate: refines both axes' traits to include `Increasing`.
139
+ *
140
+ * @since 2.0.0
141
+ */
142
+ const isIncreasing$4 = isIncreasing$5;
143
+ /**
144
+ * Type-narrowing predicate: refines both axes' traits to include `Decreasing`.
145
+ *
146
+ * @since 2.0.0
147
+ */
148
+ const isDecreasing$4 = isDecreasing$5;
149
+ /**
150
+ * Asserts monotonicity in both axes, throwing on failure.
151
+ *
152
+ * @since 2.0.0
153
+ */
154
+ const asMonotonic$4 = asMonotonic$5;
155
+ /**
156
+ * Asserts that both axes are strictly increasing, throwing on failure.
157
+ *
158
+ * @since 2.0.0
159
+ */
160
+ const asIncreasing$4 = asIncreasing$5;
161
+ /**
162
+ * Asserts that both axes are strictly decreasing, throwing on failure.
163
+ *
164
+ * @since 2.0.0
165
+ */
166
+ const asDecreasing$4 = asDecreasing$5;
167
+ //#endregion
168
+ //#region src/curve/quadratic2d.internal.ts
169
+ const QuadraticCurve2dTypeId = Symbol("curvy/curve/quadratic2d");
170
+ var QuadraticCurve2dImpl = class extends Pipeable {
171
+ [QuadraticCurve2dTypeId] = QuadraticCurve2dTypeId;
172
+ x;
173
+ y;
174
+ constructor(c0, c1) {
175
+ super();
176
+ this.x = c0;
177
+ this.y = c1;
178
+ }
179
+ get [0]() {
180
+ return this.x;
181
+ }
182
+ get [1]() {
183
+ return this.y;
184
+ }
185
+ };
186
+ const fromPolynomials$5 = (c0, c1) => new QuadraticCurve2dImpl(c0, c1);
187
+ const fromCoefficients$3 = (c0, c1, c2) => new QuadraticCurve2dImpl(make$3(c0.x, c1.x, c2.x), make$3(c0.y, c1.y, c2.y));
188
+ const fromBezierPoints$5 = (p0, p1, p2) => new QuadraticCurve2dImpl(make$3(p0.x, -2 * p0.x + 2 * p1.x, p0.x - 2 * p1.x + p2.x), make$3(p0.y, -2 * p0.y + 2 * p1.y, p0.y - 2 * p1.y + p2.y));
189
+ const isQuadraticCurve2d$1 = (c) => typeof c === "object" && c !== null && QuadraticCurve2dTypeId in c;
190
+ const solve$5 = dual(2, (c, t) => make(solve$10(c.x, t), solve$10(c.y, t)));
191
+ const solveAtX$5 = dual(2, (c, x) => {
192
+ return map(clip(solveInverse$2(c.x, x), unit), (t) => solve$10(c.y, t));
193
+ });
194
+ const solveAtY$5 = dual(2, (c, y) => {
195
+ return map(clip(solveInverse$2(c.y, y), unit), (t) => solve$10(c.x, t));
196
+ });
197
+ const derivative$2 = (c) => fromPolynomials$6(derivative$6(c.x), derivative$6(c.y));
198
+ const length$3 = dual(2, (c, i) => {
199
+ if (size(i) === 0) return 0;
200
+ if (c.x.c2 === 0 && c.y.c2 === 0) return length$4(fromPolynomials$6(make$2(c.x.c0, c.x.c1), make$2(c.y.c0, c.y.c1)), i);
201
+ const d = derivative$2(c);
202
+ const { scale, shift } = scaleShift(biunit, i);
203
+ return (GL32_W0 * magnitude(solve$6(d, shift + scale * -GL32_X0)) + GL32_W0 * magnitude(solve$6(d, shift + scale * GL32_X0)) + GL32_W1 * magnitude(solve$6(d, shift + scale * -GL32_X1)) + GL32_W1 * magnitude(solve$6(d, shift + scale * GL32_X1)) + GL32_W2 * magnitude(solve$6(d, shift + scale * -GL32_X2)) + GL32_W2 * magnitude(solve$6(d, shift + scale * GL32_X2)) + GL32_W3 * magnitude(solve$6(d, shift + scale * -GL32_X3)) + GL32_W3 * magnitude(solve$6(d, shift + scale * GL32_X3)) + GL32_W4 * magnitude(solve$6(d, shift + scale * -GL32_X4)) + GL32_W4 * magnitude(solve$6(d, shift + scale * GL32_X4)) + GL32_W5 * magnitude(solve$6(d, shift + scale * -GL32_X5)) + GL32_W5 * magnitude(solve$6(d, shift + scale * GL32_X5)) + GL32_W6 * magnitude(solve$6(d, shift + scale * -GL32_X6)) + GL32_W6 * magnitude(solve$6(d, shift + scale * GL32_X6)) + GL32_W7 * magnitude(solve$6(d, shift + scale * -GL32_X7)) + GL32_W7 * magnitude(solve$6(d, shift + scale * GL32_X7)) + GL32_W8 * magnitude(solve$6(d, shift + scale * -GL32_X8)) + GL32_W8 * magnitude(solve$6(d, shift + scale * GL32_X8)) + GL32_W9 * magnitude(solve$6(d, shift + scale * -GL32_X9)) + GL32_W9 * magnitude(solve$6(d, shift + scale * GL32_X9)) + GL32_W10 * magnitude(solve$6(d, shift + scale * -GL32_X10)) + GL32_W10 * magnitude(solve$6(d, shift + scale * GL32_X10)) + GL32_W11 * magnitude(solve$6(d, shift + scale * -GL32_X11)) + GL32_W11 * magnitude(solve$6(d, shift + scale * GL32_X11)) + GL32_W12 * magnitude(solve$6(d, shift + scale * -GL32_X12)) + GL32_W12 * magnitude(solve$6(d, shift + scale * GL32_X12)) + GL32_W13 * magnitude(solve$6(d, shift + scale * -GL32_X13)) + GL32_W13 * magnitude(solve$6(d, shift + scale * GL32_X13)) + GL32_W14 * magnitude(solve$6(d, shift + scale * -GL32_X14)) + GL32_W14 * magnitude(solve$6(d, shift + scale * GL32_X14)) + GL32_W15 * magnitude(solve$6(d, shift + scale * -GL32_X15)) + GL32_W15 * magnitude(solve$6(d, shift + scale * GL32_X15))) * scale;
204
+ });
205
+ const curvature$3 = dual(2, (c, t) => {
206
+ const d = derivative$2(c);
207
+ const v = solve$6(d, t);
208
+ const a = derivative$3(d);
209
+ const vMag = magnitude(v);
210
+ if (vMag === 0) return 0;
211
+ return Math.abs(cross(v, a)) / vMag ** 3;
212
+ });
213
+ const isMonotonic$3 = (c) => isMonotonic$8(c.x, unit) && isMonotonic$8(c.y, unit);
214
+ const isIncreasing$3 = (c) => isIncreasing$8(c.x, unit) && isIncreasing$8(c.y, unit);
215
+ const isDecreasing$3 = (c) => isDecreasing$8(c.x, unit) && isDecreasing$8(c.y, unit);
216
+ const fail$1 = (m) => {
217
+ throw new Error(m);
218
+ };
219
+ const asMonotonic$3 = (c) => isMonotonic$3(c) ? c : fail$1("quadratic curve is not monotonic in both axes");
220
+ const asIncreasing$3 = (c) => isIncreasing$3(c) ? c : fail$1("quadratic curve is not increasing in both axes");
221
+ const asDecreasing$3 = (c) => isDecreasing$3(c) ? c : fail$1("quadratic curve is not decreasing in both axes");
222
+ //#endregion
223
+ //#region src/curve/quadratic2d.ts
224
+ var quadratic2d_exports = /* @__PURE__ */ __exportAll({
225
+ asDecreasing: () => asDecreasing$2,
226
+ asIncreasing: () => asIncreasing$2,
227
+ asMonotonic: () => asMonotonic$2,
228
+ curvature: () => curvature$2,
229
+ derivative: () => derivative$1,
230
+ fromBezierPoints: () => fromBezierPoints$4,
231
+ fromCoefficients: () => fromCoefficients$2,
232
+ fromPolynomials: () => fromPolynomials$4,
233
+ isDecreasing: () => isDecreasing$2,
234
+ isIncreasing: () => isIncreasing$2,
235
+ isMonotonic: () => isMonotonic$2,
236
+ isQuadraticCurve2d: () => isQuadraticCurve2d,
237
+ length: () => length$2,
238
+ solve: () => solve$4,
239
+ solveAtX: () => solveAtX$4,
240
+ solveAtY: () => solveAtY$4
241
+ });
242
+ /**
243
+ * Creates a new `QuadraticCurve2d` instance from polynomial parameters.
244
+ *
245
+ * @param c0 - The x polynomial.
246
+ * @param c1 - The y polynomial.
247
+ * @returns A new `QuadraticCurve2d` instance.
248
+ * @since 1.0.0
249
+ */
250
+ const fromPolynomials$4 = fromPolynomials$5;
251
+ /**
252
+ * Creates a new `QuadraticCurve2d` instance from monomial coefficient vectors.
253
+ *
254
+ * Each argument bundles the per-axis coefficient at the given power: `c0`
255
+ * holds the x⁰ term, `c1` holds the x¹ term, and so on. The resulting curve
256
+ * evaluates to `c0 + c1·t + c2·t²` per axis.
257
+ *
258
+ * @param c0 - The x⁰ coefficients (x and y).
259
+ * @param c1 - The x¹ coefficients (x and y).
260
+ * @param c2 - The x² coefficients (x and y).
261
+ * @returns A new `QuadraticCurve2d` instance.
262
+ * @since 2.0.0
263
+ */
264
+ const fromCoefficients$2 = fromCoefficients$3;
265
+ /**
266
+ * Creates a new `QuadraticCurve2d` instance from quadratic Bézier control
267
+ * points.
268
+ *
269
+ * The three arguments are the Bernstein-basis control points: `p0` and `p2`
270
+ * are the curve's endpoints and `p1` is the off-curve control handle. The
271
+ * implementation converts to the curve's internal monomial form in closed
272
+ * form.
273
+ *
274
+ * @param p0 - The first control point (curve start).
275
+ * @param p1 - The second control point (control handle).
276
+ * @param p2 - The third control point (curve end).
277
+ * @returns A new `QuadraticCurve2d` instance whose curve matches the given Bézier.
278
+ * @since 2.0.0
279
+ */
280
+ const fromBezierPoints$4 = fromBezierPoints$5;
281
+ /**
282
+ * Checks if a value is a `QuadraticCurve2d`.
283
+ *
284
+ * @param c - The value to check.
285
+ * @returns `true` if the value is a `QuadraticCurve2d`, `false` otherwise.
286
+ * @since 1.0.0
287
+ */
288
+ const isQuadraticCurve2d = isQuadraticCurve2d$1;
289
+ const solve$4 = solve$5;
290
+ const length$2 = length$3;
291
+ const solveAtX$4 = solveAtX$5;
292
+ const solveAtY$4 = solveAtY$5;
293
+ /**
294
+ * Computes the derivative of a quadratic curve.
295
+ *
296
+ * @param c - The quadratic curve to compute the derivative of.
297
+ * @returns The derivative of the quadratic curve as a linear curve.
298
+ * @since 1.0.0
299
+ */
300
+ const derivative$1 = derivative$2;
301
+ const curvature$2 = curvature$3;
302
+ /**
303
+ * Type-narrowing predicate: refines both axes' traits to include `Monotonic`
304
+ * when both x and y polynomials are monotonic over the unit interval `[0, 1]`.
305
+ *
306
+ * For checking only one axis, call the polynomial-level refiner directly:
307
+ * `QuadraticPolynomial.isMonotonic(curve.x, Interval.unit)`.
308
+ *
309
+ * @since 2.0.0
310
+ */
311
+ const isMonotonic$2 = isMonotonic$3;
312
+ /** @since 2.0.0 */
313
+ const isIncreasing$2 = isIncreasing$3;
314
+ /** @since 2.0.0 */
315
+ const isDecreasing$2 = isDecreasing$3;
316
+ /** @since 2.0.0 */
317
+ const asMonotonic$2 = asMonotonic$3;
318
+ /** @since 2.0.0 */
319
+ const asIncreasing$2 = asIncreasing$3;
320
+ /** @since 2.0.0 */
321
+ const asDecreasing$2 = asDecreasing$3;
322
+ //#endregion
323
+ //#region src/curve/cubic2d.internal.ts
324
+ const CubicCurve2dTypeId = Symbol("curvy/curve/cubic2d");
325
+ var CubicCurve2dImpl = class extends Pipeable {
326
+ [CubicCurve2dTypeId] = CubicCurve2dTypeId;
327
+ x;
328
+ y;
329
+ constructor(c0, c1) {
330
+ super();
331
+ this.x = c0;
332
+ this.y = c1;
333
+ }
334
+ get [0]() {
335
+ return this.x;
336
+ }
337
+ get [1]() {
338
+ return this.y;
339
+ }
340
+ };
341
+ const fromPolynomials$3 = (c0, c1) => new CubicCurve2dImpl(c0, c1);
342
+ const fromCoefficients$1 = (c0, c1, c2, c3) => new CubicCurve2dImpl(make$1(c0.x, c1.x, c2.x, c3.x), make$1(c0.y, c1.y, c2.y, c3.y));
343
+ const fromBezierPoints$3 = (p0, p1, p2, p3) => {
344
+ return new CubicCurve2dImpl(...apply(cubicBezier, ...transpose([
345
+ p0,
346
+ p1,
347
+ p2,
348
+ p3
349
+ ], (p) => [p.x, p.y])));
350
+ };
351
+ const isCubicCurve2d$1 = (c) => typeof c === "object" && c !== null && CubicCurve2dTypeId in c;
352
+ const solve$3 = dual(2, (c, t) => make(solve$8(c.x, t), solve$8(c.y, t)));
353
+ const solveAtX$3 = dual(2, (c, x) => {
354
+ return map(clip(solveInverse(c.x, x), unit), (t) => solve$8(c.y, t));
355
+ });
356
+ const solveAtY$3 = dual(2, (c, y) => {
357
+ return map(clip(solveInverse(c.y, y), unit), (t) => solve$8(c.x, t));
358
+ });
359
+ const derivative = (c) => fromPolynomials$4(derivative$5(c.x), derivative$5(c.y));
360
+ const length$1 = dual(2, (c, i) => {
361
+ if (size(i) === 0) return 0;
362
+ if (c.x.c3 === 0 && c.y.c3 === 0) return length$2(fromPolynomials$4(make$3(c.x.c0, c.x.c1, c.x.c2), make$3(c.y.c0, c.y.c1, c.y.c2)), i);
363
+ const d = derivative(c);
364
+ const { scale, shift } = scaleShift(biunit, i);
365
+ return (GL32_W0 * magnitude(solve$4(d, shift + scale * -GL32_X0)) + GL32_W0 * magnitude(solve$4(d, shift + scale * GL32_X0)) + GL32_W1 * magnitude(solve$4(d, shift + scale * -GL32_X1)) + GL32_W1 * magnitude(solve$4(d, shift + scale * GL32_X1)) + GL32_W2 * magnitude(solve$4(d, shift + scale * -GL32_X2)) + GL32_W2 * magnitude(solve$4(d, shift + scale * GL32_X2)) + GL32_W3 * magnitude(solve$4(d, shift + scale * -GL32_X3)) + GL32_W3 * magnitude(solve$4(d, shift + scale * GL32_X3)) + GL32_W4 * magnitude(solve$4(d, shift + scale * -GL32_X4)) + GL32_W4 * magnitude(solve$4(d, shift + scale * GL32_X4)) + GL32_W5 * magnitude(solve$4(d, shift + scale * -GL32_X5)) + GL32_W5 * magnitude(solve$4(d, shift + scale * GL32_X5)) + GL32_W6 * magnitude(solve$4(d, shift + scale * -GL32_X6)) + GL32_W6 * magnitude(solve$4(d, shift + scale * GL32_X6)) + GL32_W7 * magnitude(solve$4(d, shift + scale * -GL32_X7)) + GL32_W7 * magnitude(solve$4(d, shift + scale * GL32_X7)) + GL32_W8 * magnitude(solve$4(d, shift + scale * -GL32_X8)) + GL32_W8 * magnitude(solve$4(d, shift + scale * GL32_X8)) + GL32_W9 * magnitude(solve$4(d, shift + scale * -GL32_X9)) + GL32_W9 * magnitude(solve$4(d, shift + scale * GL32_X9)) + GL32_W10 * magnitude(solve$4(d, shift + scale * -GL32_X10)) + GL32_W10 * magnitude(solve$4(d, shift + scale * GL32_X10)) + GL32_W11 * magnitude(solve$4(d, shift + scale * -GL32_X11)) + GL32_W11 * magnitude(solve$4(d, shift + scale * GL32_X11)) + GL32_W12 * magnitude(solve$4(d, shift + scale * -GL32_X12)) + GL32_W12 * magnitude(solve$4(d, shift + scale * GL32_X12)) + GL32_W13 * magnitude(solve$4(d, shift + scale * -GL32_X13)) + GL32_W13 * magnitude(solve$4(d, shift + scale * GL32_X13)) + GL32_W14 * magnitude(solve$4(d, shift + scale * -GL32_X14)) + GL32_W14 * magnitude(solve$4(d, shift + scale * GL32_X14)) + GL32_W15 * magnitude(solve$4(d, shift + scale * -GL32_X15)) + GL32_W15 * magnitude(solve$4(d, shift + scale * GL32_X15))) * scale;
366
+ });
367
+ const curvature$1 = dual(2, (c, t) => {
368
+ const d = derivative(c);
369
+ const v = solve$4(d, t);
370
+ const a = solve$6(derivative$1(d), t);
371
+ const vMag = magnitude(v);
372
+ if (vMag === 0) return 0;
373
+ return Math.abs(cross(v, a)) / vMag ** 3;
374
+ });
375
+ const isMonotonic$1 = (c) => isMonotonic$6(c.x, unit) && isMonotonic$6(c.y, unit);
376
+ const isIncreasing$1 = (c) => isIncreasing$6(c.x, unit) && isIncreasing$6(c.y, unit);
377
+ const isDecreasing$1 = (c) => isDecreasing$6(c.x, unit) && isDecreasing$6(c.y, unit);
378
+ const fail = (m) => {
379
+ throw new Error(m);
380
+ };
381
+ const asMonotonic$1 = (c) => isMonotonic$1(c) ? c : fail("cubic curve is not monotonic in both axes");
382
+ const asIncreasing$1 = (c) => isIncreasing$1(c) ? c : fail("cubic curve is not increasing in both axes");
383
+ const asDecreasing$1 = (c) => isDecreasing$1(c) ? c : fail("cubic curve is not decreasing in both axes");
384
+ //#endregion
385
+ //#region src/curve/cubic2d.ts
386
+ var cubic2d_exports = /* @__PURE__ */ __exportAll({
387
+ asDecreasing: () => asDecreasing,
388
+ asIncreasing: () => asIncreasing,
389
+ asMonotonic: () => asMonotonic,
390
+ curvature: () => curvature,
391
+ fromBezierPoints: () => fromBezierPoints$2,
392
+ fromCoefficients: () => fromCoefficients,
393
+ fromPolynomials: () => fromPolynomials$2,
394
+ isCubicCurve2d: () => isCubicCurve2d,
395
+ isDecreasing: () => isDecreasing,
396
+ isIncreasing: () => isIncreasing,
397
+ isMonotonic: () => isMonotonic,
398
+ length: () => length,
399
+ solve: () => solve$2,
400
+ solveAtX: () => solveAtX$2,
401
+ solveAtY: () => solveAtY$2
402
+ });
403
+ /**
404
+ * Creates a new `CubicCurve2d` instance from polynomial parameters.
405
+ *
406
+ * @param x - The x polynomial.
407
+ * @param y - The y polynomial.
408
+ * @returns A new `CubicCurve2d` instance.
409
+ * @since 1.0.0
410
+ */
411
+ const fromPolynomials$2 = fromPolynomials$3;
412
+ /**
413
+ * Creates a new `CubicCurve2d` instance from monomial coefficient vectors.
414
+ *
415
+ * Each argument bundles the per-axis coefficient at the given power: `c0`
416
+ * holds the x⁰ term, `c1` holds the x¹ term, and so on. The resulting curve
417
+ * evaluates to `c0 + c1·t + c2·t² + c3·t³` per axis.
418
+ *
419
+ * @param c0 - The x⁰ coefficients (x and y).
420
+ * @param c1 - The x¹ coefficients (x and y).
421
+ * @param c2 - The x² coefficients (x and y).
422
+ * @param c3 - The x³ coefficients (x and y).
423
+ * @returns A new `CubicCurve2d` instance.
424
+ * @since 2.0.0
425
+ */
426
+ const fromCoefficients = fromCoefficients$1;
427
+ /**
428
+ * Creates a new `CubicCurve2d` instance from cubic Bézier control points.
429
+ *
430
+ * The four arguments are the Bernstein-basis control points: `p0` and `p3` are
431
+ * the curve's endpoints and `p1` and `p2` are the off-curve control handles.
432
+ * The implementation converts to the curve's internal monomial form in closed
433
+ * form.
434
+ *
435
+ * @param p0 - The first control point (curve start).
436
+ * @param p1 - The second control point (start handle).
437
+ * @param p2 - The third control point (end handle).
438
+ * @param p3 - The fourth control point (curve end).
439
+ * @returns A new `CubicCurve2d` instance whose curve matches the given Bézier.
440
+ * @since 2.0.0
441
+ */
442
+ const fromBezierPoints$2 = fromBezierPoints$3;
443
+ /**
444
+ * Checks if a value is a `CubicCurve2d`.
445
+ *
446
+ * @param c - The value to check.
447
+ * @returns `true` if the value is a `CubicCurve2d`, `false` otherwise.
448
+ * @since 1.0.0
449
+ */
450
+ const isCubicCurve2d = isCubicCurve2d$1;
451
+ const solve$2 = solve$3;
452
+ const length = length$1;
453
+ const solveAtX$2 = solveAtX$3;
454
+ const solveAtY$2 = solveAtY$3;
455
+ const curvature = curvature$1;
456
+ /**
457
+ * Type-narrowing predicate: refines both axes' traits to include `Monotonic`
458
+ * when both x and y polynomials are monotonic over the unit interval `[0, 1]`.
459
+ *
460
+ * For checking only one axis, call the polynomial-level refiner directly:
461
+ * `CubicPolynomial.isMonotonic(curve.x, Interval.unit)`.
462
+ *
463
+ * @since 2.0.0
464
+ */
465
+ const isMonotonic = isMonotonic$1;
466
+ /** @since 2.0.0 */
467
+ const isIncreasing = isIncreasing$1;
468
+ /** @since 2.0.0 */
469
+ const isDecreasing = isDecreasing$1;
470
+ /** @since 2.0.0 */
471
+ const asMonotonic = asMonotonic$1;
472
+ /** @since 2.0.0 */
473
+ const asIncreasing = asIncreasing$1;
474
+ /** @since 2.0.0 */
475
+ const asDecreasing = asDecreasing$1;
476
+ //#endregion
477
+ //#region src/curve/rationalCubic2d.internal.ts
478
+ const RationalCubicCurve2dTypeId = Symbol("curvy/curve/rationalCubic2d");
479
+ const RationalCurveTraits = Symbol.for("curvy/curve/rationalCubic2d/traits");
480
+ var RationalCubicCurve2dImpl = class extends Pipeable {
481
+ [RationalCubicCurve2dTypeId] = RationalCubicCurve2dTypeId;
482
+ x;
483
+ y;
484
+ w;
485
+ constructor(x, y, w) {
486
+ super();
487
+ this.x = x;
488
+ this.y = y;
489
+ this.w = w;
490
+ }
491
+ };
492
+ const isRationalCubicCurve2d$1 = (c) => typeof c === "object" && c !== null && RationalCubicCurve2dTypeId in c;
493
+ const fromPolynomials$1 = (x, y, w) => new RationalCubicCurve2dImpl(x, y, w);
494
+ const fromBezierPoints$1 = (p0, p1, p2, p3) => new RationalCubicCurve2dImpl(...apply(cubicBezier, ...transpose([
495
+ p0,
496
+ p1,
497
+ p2,
498
+ p3
499
+ ], (p) => [
500
+ p.x * p.weight,
501
+ p.y * p.weight,
502
+ p.weight
503
+ ])));
504
+ const makeMonotonicEasing$1 = (startSlope, endSlope) => {
505
+ invariant(Number.isFinite(startSlope) && startSlope >= 0, "makeMonotonicEasing: startSlope must be finite and ≥ 0");
506
+ invariant(Number.isFinite(endSlope) && endSlope >= 0, "makeMonotonicEasing: endSlope must be finite and ≥ 0");
507
+ const m0 = startSlope;
508
+ const m1 = endSlope;
509
+ const alpha = m0 + 1;
510
+ const beta = m1 + 1;
511
+ const pC0 = 0;
512
+ const pC1 = m0 * alpha;
513
+ const pC2 = beta * (2 - m1) + alpha * (1 - 2 * m0);
514
+ const pC3 = beta * (m1 - 1) + alpha * (m0 - 1);
515
+ const qC0 = alpha;
516
+ const qC1 = beta - alpha;
517
+ const xPoly = make$1(0, alpha, beta - alpha, 0);
518
+ const yPoly = make$1(pC0, pC1, pC2, pC3);
519
+ const wPoly = make$1(qC0, qC1, 0, 0);
520
+ const monoQ = make$1(m0 * alpha * alpha, 2 * alpha * pC2, 3 * alpha * pC3 + pC2 * (beta - alpha), 2 * pC3 * (beta - alpha));
521
+ const interiorRoots = monoQ.pipe(roots, clip(unitOpen));
522
+ for (const t of interiorRoots) {
523
+ const epsilon = 1e-6;
524
+ const lo = Math.max(0, t - epsilon);
525
+ const hi = Math.min(1, t + epsilon);
526
+ invariant(Math.sign(solve$8(monoQ, lo)) * Math.sign(solve$8(monoQ, hi)) >= 0, `makeMonotonicEasing: slopes (${m0}, ${m1}) produce a non-monotonic curve with the default Gregory-Delbourgo construction. Try smaller slopes or use a different easing form.`);
527
+ }
528
+ return new RationalCubicCurve2dImpl(xPoly, yPoly, wPoly);
529
+ };
530
+ const solve$1 = dual(2, (c, t) => {
531
+ const w = solve$8(c.w, t);
532
+ return make(solve$8(c.x, t) / w, solve$8(c.y, t) / w);
533
+ });
534
+ const solveAtX$1 = dual(2, (c, x) => make$1(c.x.c0 - x * c.w.c0, c.x.c1 - x * c.w.c1, c.x.c2 - x * c.w.c2, c.x.c3 - x * c.w.c3).pipe(roots, clip(unit), map((t) => solve$8(c.y, t) / solve$8(c.w, t))));
535
+ const solveAtY$1 = dual(2, (c, y) => make$1(c.y.c0 - y * c.w.c0, c.y.c1 - y * c.w.c1, c.y.c2 - y * c.w.c2, c.y.c3 - y * c.w.c3).pipe(roots, clip(unit), map((t) => solve$8(c.x, t) / solve$8(c.w, t))));
536
+ const MAX_APPROX_DEPTH = 20;
537
+ const buildCubicCandidate = (c) => {
538
+ const x0 = c.x.c0;
539
+ const x1 = c.x.c0 + c.x.c1 / 3;
540
+ const x2 = c.x.c0 + 2 * c.x.c1 / 3 + c.x.c2 / 3;
541
+ const x3 = c.x.c0 + c.x.c1 + c.x.c2 + c.x.c3;
542
+ const y0 = c.y.c0;
543
+ const y1 = c.y.c0 + c.y.c1 / 3;
544
+ const y2 = c.y.c0 + 2 * c.y.c1 / 3 + c.y.c2 / 3;
545
+ const y3 = c.y.c0 + c.y.c1 + c.y.c2 + c.y.c3;
546
+ const w0 = c.w.c0;
547
+ const w1 = c.w.c0 + c.w.c1 / 3;
548
+ const w2 = c.w.c0 + 2 * c.w.c1 / 3 + c.w.c2 / 3;
549
+ const w3 = c.w.c0 + c.w.c1 + c.w.c2 + c.w.c3;
550
+ return fromBezierPoints$2(make(x0 / w0, y0 / w0), make(x1 / w1, y1 / w1), make(x2 / w2, y2 / w2), make(x3 / w3, y3 / w3));
551
+ };
552
+ const splitAtHalf = (c) => {
553
+ const [leftX, rightX] = subdivide(c.x, .5);
554
+ const [leftY, rightY] = subdivide(c.y, .5);
555
+ const [leftW, rightW] = subdivide(c.w, .5);
556
+ return [new RationalCubicCurve2dImpl(leftX, leftY, leftW), new RationalCubicCurve2dImpl(rightX, rightY, rightW)];
557
+ };
558
+ const midpointError = (c, candidate) => {
559
+ const w = solve$8(c.w, .5);
560
+ const trueX = solve$8(c.x, .5) / w;
561
+ const trueY = solve$8(c.y, .5) / w;
562
+ const candX = solve$8(candidate.x, .5);
563
+ const candY = solve$8(candidate.y, .5);
564
+ return Math.hypot(trueX - candX, trueY - candY);
565
+ };
566
+ const approximateAsCubicCurves$1 = dual(2, (c, tolerance) => {
567
+ invariant(Number.isFinite(tolerance) && tolerance > 0, "approximateAsCubicCurves: tolerance must be finite and > 0");
568
+ const out = [];
569
+ const recurse = (curr, depth) => {
570
+ const candidate = buildCubicCandidate(curr);
571
+ if (depth >= MAX_APPROX_DEPTH || midpointError(curr, candidate) <= tolerance) {
572
+ out.push(candidate);
573
+ return;
574
+ }
575
+ const [left, right] = splitAtHalf(curr);
576
+ recurse(left, depth + 1);
577
+ recurse(right, depth + 1);
578
+ };
579
+ recurse(c, 0);
580
+ return out;
581
+ });
582
+ //#endregion
583
+ //#region src/curve/rationalCubic2d.ts
584
+ var rationalCubic2d_exports = /* @__PURE__ */ __exportAll({
585
+ RationalCurveTraits: () => RationalCurveTraits,
586
+ approximateAsCubicCurves: () => approximateAsCubicCurves,
587
+ fromBezierPoints: () => fromBezierPoints,
588
+ fromPolynomials: () => fromPolynomials,
589
+ isRationalCubicCurve2d: () => isRationalCubicCurve2d,
590
+ makeMonotonicEasing: () => makeMonotonicEasing,
591
+ solve: () => solve,
592
+ solveAtX: () => solveAtX,
593
+ solveAtY: () => solveAtY
594
+ });
595
+ /**
596
+ * Checks if a value is a `RationalCubicCurve2d`.
597
+ *
598
+ * @param c - The value to check.
599
+ * @returns `true` if the value is a `RationalCubicCurve2d`, `false` otherwise.
600
+ * @since 2.1.0
601
+ */
602
+ const isRationalCubicCurve2d = isRationalCubicCurve2d$1;
603
+ /**
604
+ * Creates a new `RationalCubicCurve2d` from per-axis numerator polynomials
605
+ * and a shared denominator polynomial.
606
+ *
607
+ * @param x - The x numerator polynomial.
608
+ * @param y - The y numerator polynomial.
609
+ * @param w - The shared denominator polynomial (must be non-zero on `[0, 1]`).
610
+ * @returns A new `RationalCubicCurve2d` instance.
611
+ * @since 2.1.0
612
+ */
613
+ const fromPolynomials = fromPolynomials$1;
614
+ /**
615
+ * Creates a new `RationalCubicCurve2d` from four weighted cubic Bézier
616
+ * control points. The four control points are lifted to homogeneous form
617
+ * `(w·x, w·y, w)` and the cubic Bernstein basis is expanded into per-channel
618
+ * monomial coefficients, yielding the curve's `x`, `y`, and `w` polynomials.
619
+ *
620
+ * @param p0 - The first weighted control point (curve start).
621
+ * @param p1 - The second weighted control point (start handle).
622
+ * @param p2 - The third weighted control point (end handle).
623
+ * @param p3 - The fourth weighted control point (curve end).
624
+ * @returns A new `RationalCubicCurve2d` instance.
625
+ * @since 2.1.0
626
+ */
627
+ const fromBezierPoints = fromBezierPoints$1;
628
+ /**
629
+ * Creates a guaranteed-monotonic rational cubic easing curve via Gregory-
630
+ * Delbourgo style construction. The result interpolates `(0, 0)` and
631
+ * `(1, 1)` with the given endpoint slopes, with `x(t) = t` pinned linearly
632
+ * and a rational cubic numerator for `y(t)`. Monotonicity of `y(t)` is
633
+ * verified rigorously at construction (degree-3 polynomial sign analysis);
634
+ * the returned curve is branded `<Increasing, Increasing>` so that
635
+ * {@link solveAtX} returns `Solution.AtMostOne<number>` without further
636
+ * trait refinement.
637
+ *
638
+ * For input slope combinations that the default Gregory-Delbourgo
639
+ * construction cannot accommodate (typically when one slope is large while
640
+ * the other is small), construction throws. Useful operating range is
641
+ * roughly `m₀, m₁ ∈ [0, 2]` with `m₀ + m₁ ≲ 3`; smoothstep (`0, 0`) and
642
+ * linear (`1, 1`) fall out as special cases.
643
+ *
644
+ * @param startSlope - The easing function's slope at the start (`dy/dx` at `x = 0`); must be finite and non-negative.
645
+ * @param endSlope - The easing function's slope at the end (`dy/dx` at `x = 1`); must be finite and non-negative.
646
+ * @returns A monotone-by-construction rational cubic easing curve.
647
+ * @throws When slopes are negative, non-finite, or produce a non-monotonic curve under the default construction.
648
+ * @since 2.1.0
649
+ */
650
+ const makeMonotonicEasing = makeMonotonicEasing$1;
651
+ const solve = solve$1;
652
+ const solveAtX = solveAtX$1;
653
+ const solveAtY = solveAtY$1;
654
+ const approximateAsCubicCurves = approximateAsCubicCurves$1;
655
+ //#endregion
656
+ export { cubic2d_exports as a, solve$2 as c, quadratic2d_exports as d, solve$4 as f, solve$6 as h, solve as i, derivative as l, linear2d_exports as m, fromBezierPoints as n, fromPolynomials$2 as o, length$4 as p, rationalCubic2d_exports as r, length as s, approximateAsCubicCurves as t, length$2 as u };
657
+
658
+ //# sourceMappingURL=rationalCubic2d-CP4oGpnk.mjs.map