curvy 1.0.9 → 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 (169) 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 -205
  59. package/dist/utils.mjs +88 -52
  60. package/dist/utils.mjs.map +1 -1
  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 -109
  65. package/dist/curve/cubic2d.d.ts +0 -109
  66. package/dist/curve/cubic2d.mjs +0 -80
  67. package/dist/curve/cubic2d.mjs.map +0 -1
  68. package/dist/curve/linear2d.d.mts +0 -94
  69. package/dist/curve/linear2d.d.ts +0 -94
  70. package/dist/curve/linear2d.mjs +0 -46
  71. package/dist/curve/linear2d.mjs.map +0 -1
  72. package/dist/curve/quadratic2d.d.mts +0 -117
  73. package/dist/curve/quadratic2d.d.ts +0 -117
  74. package/dist/curve/quadratic2d.mjs +0 -82
  75. package/dist/curve/quadratic2d.mjs.map +0 -1
  76. package/dist/interval.d.mts +0 -251
  77. package/dist/interval.d.ts +0 -251
  78. package/dist/interval.mjs +0 -86
  79. package/dist/interval.mjs.map +0 -1
  80. package/dist/matrix/matrix2x2.d.mts +0 -320
  81. package/dist/matrix/matrix2x2.d.ts +0 -320
  82. package/dist/matrix/matrix2x2.mjs +0 -25
  83. package/dist/matrix/matrix2x2.mjs.map +0 -1
  84. package/dist/matrix/matrix3x3.d.mts +0 -370
  85. package/dist/matrix/matrix3x3.d.ts +0 -370
  86. package/dist/matrix/matrix3x3.mjs +0 -28
  87. package/dist/matrix/matrix3x3.mjs.map +0 -1
  88. package/dist/matrix/matrix4x4.d.mts +0 -381
  89. package/dist/matrix/matrix4x4.d.ts +0 -381
  90. package/dist/matrix/matrix4x4.mjs +0 -178
  91. package/dist/matrix/matrix4x4.mjs.map +0 -1
  92. package/dist/path/cubic2d.d.mts +0 -95
  93. package/dist/path/cubic2d.d.ts +0 -95
  94. package/dist/path/cubic2d.mjs +0 -60
  95. package/dist/path/cubic2d.mjs.map +0 -1
  96. package/dist/path/linear2d.d.mts +0 -95
  97. package/dist/path/linear2d.d.ts +0 -95
  98. package/dist/path/linear2d.mjs +0 -53
  99. package/dist/path/linear2d.mjs.map +0 -1
  100. package/dist/path/quadratic2d.d.mts +0 -95
  101. package/dist/path/quadratic2d.d.ts +0 -95
  102. package/dist/path/quadratic2d.mjs +0 -57
  103. package/dist/path/quadratic2d.mjs.map +0 -1
  104. package/dist/pipe.d.ts +0 -58
  105. package/dist/pipe.mjs +0 -92
  106. package/dist/pipe.mjs.map +0 -1
  107. package/dist/polynomial/cubic.d.mts +0 -7
  108. package/dist/polynomial/cubic.d.ts +0 -7
  109. package/dist/polynomial/cubic.mjs +0 -133
  110. package/dist/polynomial/cubic.mjs.map +0 -1
  111. package/dist/polynomial/linear.d.mts +0 -7
  112. package/dist/polynomial/linear.d.ts +0 -7
  113. package/dist/polynomial/linear.mjs +0 -24
  114. package/dist/polynomial/linear.mjs.map +0 -1
  115. package/dist/polynomial/quadratic.d.mts +0 -7
  116. package/dist/polynomial/quadratic.d.ts +0 -7
  117. package/dist/polynomial/quadratic.mjs +0 -27
  118. package/dist/polynomial/quadratic.mjs.map +0 -1
  119. package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
  120. package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
  121. package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
  122. package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
  123. package/dist/shared/curvy.BxdGW9he.mjs +0 -116
  124. package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
  125. package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
  126. package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
  127. package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
  128. package/dist/shared/curvy.DCt1gGII.mjs +0 -147
  129. package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
  130. package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
  131. package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
  132. package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
  133. package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
  134. package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
  135. package/dist/shared/curvy.lktriTpx.mjs +0 -101
  136. package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
  137. package/dist/shared/curvy.mLFprrGm.mjs +0 -85
  138. package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
  139. package/dist/shared/curvy.r6f1j287.mjs +0 -76
  140. package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
  141. package/dist/splines/basis2d.d.mts +0 -130
  142. package/dist/splines/basis2d.d.ts +0 -130
  143. package/dist/splines/basis2d.mjs +0 -90
  144. package/dist/splines/basis2d.mjs.map +0 -1
  145. package/dist/splines/bezier2d.d.mts +0 -182
  146. package/dist/splines/bezier2d.d.ts +0 -182
  147. package/dist/splines/bezier2d.mjs +0 -23
  148. package/dist/splines/bezier2d.mjs.map +0 -1
  149. package/dist/splines/cardinal2d.d.mts +0 -178
  150. package/dist/splines/cardinal2d.d.ts +0 -178
  151. package/dist/splines/cardinal2d.mjs +0 -114
  152. package/dist/splines/cardinal2d.mjs.map +0 -1
  153. package/dist/splines/hermite2d.d.mts +0 -124
  154. package/dist/splines/hermite2d.d.ts +0 -124
  155. package/dist/splines/hermite2d.mjs +0 -63
  156. package/dist/splines/hermite2d.mjs.map +0 -1
  157. package/dist/utils.d.ts +0 -205
  158. package/dist/vector/vector2.d.mts +0 -324
  159. package/dist/vector/vector2.d.ts +0 -324
  160. package/dist/vector/vector2.mjs +0 -30
  161. package/dist/vector/vector2.mjs.map +0 -1
  162. package/dist/vector/vector3.d.mts +0 -417
  163. package/dist/vector/vector3.d.ts +0 -417
  164. package/dist/vector/vector3.mjs +0 -38
  165. package/dist/vector/vector3.mjs.map +0 -1
  166. package/dist/vector/vector4.d.mts +0 -205
  167. package/dist/vector/vector4.d.ts +0 -205
  168. package/dist/vector/vector4.mjs +0 -20
  169. package/dist/vector/vector4.mjs.map +0 -1
@@ -1,94 +0,0 @@
1
- import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { Interval } from '../interval.js';
3
- import { Pipeable } from '../pipe.js';
4
- import { L as LinearPolynomial } from '../shared/curvy.Cg8lZVUz.js';
5
- import { Vector2 } from '../vector/vector2.js';
6
- import '../vector/vector3.js';
7
- import '../vector/vector4.js';
8
-
9
- declare const LinearCurve2dTypeId: unique symbol;
10
- type LinearCurve2dTypeId = typeof LinearCurve2dTypeId;
11
-
12
- /**
13
- * A linear curve in 2D space.
14
- *
15
- * All fields are readonly and immutable, and all operations create new instances.
16
- *
17
- * @since 1.0.0
18
- */
19
- interface LinearCurve2d extends Pipeable, TwoDimensional<LinearPolynomial> {
20
- readonly [LinearCurve2dTypeId]: LinearCurve2dTypeId;
21
- }
22
- /**
23
- * Creates a new `LinearCurve2d` instance from polynomial parameters.
24
- *
25
- * @param x - The x polynomial.
26
- * @param y - The y polynomial.
27
- * @returns A new `LinearCurve2d` instance.
28
- * @since 1.0.0
29
- */
30
- declare const fromPolynomials: (x: LinearPolynomial, y: LinearPolynomial) => LinearCurve2d;
31
- /**
32
- * Creates a new `LinearCurve2d` instance from pairs of coefficients.
33
- *
34
- * @param p0 - The x^0 coefficients for the x and y polynomials.
35
- * @param p1 - The x^1 coefficients for the x and y polynomials.
36
- */
37
- declare const fromPoints: (p0: Vector2, p1: Vector2) => LinearCurve2d;
38
- /**
39
- * Checks if a value is a `LinearCurve2d`.
40
- *
41
- * @param c - The value to check.
42
- * @returns `true` if the value is a `LinearCurve2d`, `false` otherwise.
43
- * @since 1.0.0
44
- */
45
- declare const isLinearCurve2d: (c: unknown) => c is LinearCurve2d;
46
- /**
47
- * Gets the derivative of a linear curve as a vector
48
- *
49
- * @param c - The linear curve to get the derivative of.
50
- * @returns The derivative of the linear curve as a vector.
51
- * @since 1.0.0
52
- */
53
- declare const derivative: (c: LinearCurve2d) => Vector2;
54
- declare const solve: {
55
- /**
56
- * Solves the linear curve for a given parameter t.
57
- *
58
- * @param t - The parameter value.
59
- * @returns A function that takes a linear curve and returns the point on the curve at parameter t.
60
- * @since 1.0.0
61
- */
62
- (t: number): (c: LinearCurve2d) => Vector2;
63
- /**
64
- * Solves the linear curve for a given parameter t.
65
- *
66
- * @param c - The linear curve to solve.
67
- * @param t - The parameter value.
68
- * @returns The point on the curve at parameter t.
69
- * @since 1.0.0
70
- */
71
- (c: LinearCurve2d, t: number): Vector2;
72
- };
73
- declare const length: {
74
- /**
75
- * Calculates (approximates) the length of a linear curve.
76
- *
77
- * @param c - The linear curve to calculate the length of.
78
- * @param i - The interval to calculate the length over.
79
- * @returns The length of the linear curve over the given interval.
80
- * @since 1.0.0
81
- */
82
- (c: LinearCurve2d, i: Interval): number;
83
- /**
84
- * Calculates (approximates) the length of a linear curve.
85
- *
86
- * @param i - The interval to calculate the length over.
87
- * @returns A function that takes a linear curve and returns the length of the linear curve over the given interval.
88
- * @since 1.0.0
89
- */
90
- (i: Interval): (c: LinearCurve2d) => number;
91
- };
92
-
93
- export { derivative, fromPoints, fromPolynomials, isLinearCurve2d, length, solve };
94
- export type { LinearCurve2d };
@@ -1,46 +0,0 @@
1
- import { dual, Pipeable } from '../pipe.mjs';
2
- import { make as make$1, solve as solve$2 } from '../polynomial/linear.mjs';
3
- import { round } from '../utils.mjs';
4
- import { make } from '../vector/vector2.mjs';
5
- import '../shared/curvy.r6f1j287.mjs';
6
- import '../interval.mjs';
7
- import '../shared/curvy.DJ4xO0al.mjs';
8
-
9
- var _a, _b;
10
- const LinearCurve2dTypeId = Symbol("curvy/curve/linear2d");
11
- class LinearCurve2dImpl extends (_b = Pipeable, _a = LinearCurve2dTypeId, _b) {
12
- constructor(c0, c1) {
13
- super();
14
- this[_a] = LinearCurve2dTypeId;
15
- this.x = c0;
16
- this.y = c1;
17
- }
18
- get [0]() {
19
- return this.x;
20
- }
21
- get [1]() {
22
- return this.y;
23
- }
24
- }
25
- const fromPolynomials$1 = (c0, c1) => new LinearCurve2dImpl(c0, c1);
26
- const fromPoints$1 = (p0, p1) => new LinearCurve2dImpl(make$1(p0.x, p1.x), make$1(p0.y, p1.y));
27
- const isLinearCurve2d$1 = (c) => typeof c === "object" && c !== null && LinearCurve2dTypeId in c;
28
- const derivative$1 = (c) => make(c.x.c1, c.y.c1);
29
- const solve$1 = dual(
30
- 2,
31
- (c, t) => make(solve$2(c.x, t), solve$2(c.y, t))
32
- );
33
- const length$1 = dual(
34
- 2,
35
- (c, i) => round(Math.sqrt(c.x.c1 ** 2 + c.y.c1 ** 2) * Math.abs(i.end - i.start))
36
- );
37
-
38
- const fromPolynomials = fromPolynomials$1;
39
- const fromPoints = fromPoints$1;
40
- const isLinearCurve2d = isLinearCurve2d$1;
41
- const derivative = derivative$1;
42
- const solve = solve$1;
43
- const length = length$1;
44
-
45
- export { derivative, fromPoints, fromPolynomials, isLinearCurve2d, length, solve };
46
- //# sourceMappingURL=linear2d.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linear2d.mjs","sources":["../../src/curve/linear2d.internal.ts","../../src/curve/linear2d.ts"],"sourcesContent":["import type { Interval } from '../interval'\nimport { Pipeable } from '../pipe'\nimport { dual } from '../pipe'\nimport * as LinearPolynomial from '../polynomial/linear'\nimport { round } from '../utils'\nimport * as Vector2 from '../vector/vector2'\nimport type { LinearCurve2d } from './linear2d'\n\nexport const LinearCurve2dTypeId: unique symbol = Symbol('curvy/curve/linear2d')\nexport type LinearCurve2dTypeId = typeof LinearCurve2dTypeId\n\nexport class LinearCurve2dImpl extends Pipeable implements LinearCurve2d {\n readonly [LinearCurve2dTypeId]: LinearCurve2dTypeId = LinearCurve2dTypeId\n\n readonly x: LinearPolynomial.LinearPolynomial\n readonly y: LinearPolynomial.LinearPolynomial\n\n constructor(c0: LinearPolynomial.LinearPolynomial, c1: LinearPolynomial.LinearPolynomial) {\n super()\n this.x = c0\n this.y = c1\n }\n\n get [0]() {\n return this.x\n }\n\n get [1]() {\n return this.y\n }\n}\n\nexport const fromPolynomials: (\n c0: LinearPolynomial.LinearPolynomial,\n c1: LinearPolynomial.LinearPolynomial,\n) => LinearCurve2d = (c0, c1) => new LinearCurve2dImpl(c0, c1)\n\nexport const fromPoints: (p0: Vector2.Vector2, p1: Vector2.Vector2) => LinearCurve2d = (p0, p1) =>\n new LinearCurve2dImpl(LinearPolynomial.make(p0.x, p1.x), LinearPolynomial.make(p0.y, p1.y))\n\nexport const isLinearCurve2d = (c: unknown): c is LinearCurve2d =>\n typeof c === 'object' && c !== null && LinearCurve2dTypeId in c\n\nexport const derivative = (c: LinearCurve2d) => Vector2.make(c.x.c1, c.y.c1)\n\nexport const solve = dual<\n (t: number) => (c: LinearCurve2d) => Vector2.Vector2,\n (c: LinearCurve2d, t: number) => Vector2.Vector2\n>(2, (c: LinearCurve2d, t: number) =>\n Vector2.make(LinearPolynomial.solve(c.x, t), LinearPolynomial.solve(c.y, t)),\n)\n\nexport const length = dual(2, (c: LinearCurve2d, i: Interval) =>\n round(Math.sqrt(c.x.c1 ** 2 + c.y.c1 ** 2) * Math.abs(i.end - i.start)),\n)\n","import type { TwoDimensional } from '../dimensions'\nimport type { Interval } from '../interval'\nimport type { Pipeable } from '../pipe'\nimport type { LinearPolynomial } from '../polynomial/linear'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearCurve2dTypeId } from './linear2d.internal'\nimport * as internal from './linear2d.internal'\n\n/**\n * A linear curve in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport interface LinearCurve2d extends Pipeable, TwoDimensional<LinearPolynomial> {\n readonly [LinearCurve2dTypeId]: LinearCurve2dTypeId\n}\n\n/**\n * Creates a new `LinearCurve2d` instance from polynomial parameters.\n *\n * @param x - The x polynomial.\n * @param y - The y polynomial.\n * @returns A new `LinearCurve2d` instance.\n * @since 1.0.0\n */\nexport const fromPolynomials: (x: LinearPolynomial, y: LinearPolynomial) => LinearCurve2d =\n internal.fromPolynomials\n\n/**\n * Creates a new `LinearCurve2d` instance from pairs of coefficients.\n *\n * @param p0 - The x^0 coefficients for the x and y polynomials.\n * @param p1 - The x^1 coefficients for the x and y polynomials.\n */\nexport const fromPoints: (p0: Vector2, p1: Vector2) => LinearCurve2d = internal.fromPoints\n\n/**\n * Checks if a value is a `LinearCurve2d`.\n *\n * @param c - The value to check.\n * @returns `true` if the value is a `LinearCurve2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearCurve2d: (c: unknown) => c is LinearCurve2d = internal.isLinearCurve2d\n\n/**\n * Gets the derivative of a linear curve as a vector\n *\n * @param c - The linear curve to get the derivative of.\n * @returns The derivative of the linear curve as a vector.\n * @since 1.0.0\n */\nexport const derivative: (c: LinearCurve2d) => Vector2 = internal.derivative\n\nexport const solve: {\n /**\n * Solves the linear curve for a given parameter t.\n *\n * @param t - The parameter value.\n * @returns A function that takes a linear curve and returns the point on the curve at parameter t.\n * @since 1.0.0\n */\n (t: number): (c: LinearCurve2d) => Vector2\n /**\n * Solves the linear curve for a given parameter t.\n *\n * @param c - The linear curve to solve.\n * @param t - The parameter value.\n * @returns The point on the curve at parameter t.\n * @since 1.0.0\n */\n (c: LinearCurve2d, t: number): Vector2\n} = internal.solve\n\nexport const length: {\n /**\n * Calculates (approximates) the length of a linear curve.\n *\n * @param c - The linear curve to calculate the length of.\n * @param i - The interval to calculate the length over.\n * @returns The length of the linear curve over the given interval.\n * @since 1.0.0\n */\n (c: LinearCurve2d, i: Interval): number\n /**\n * Calculates (approximates) the length of a linear curve.\n *\n * @param i - The interval to calculate the length over.\n * @returns A function that takes a linear curve and returns the length of the linear curve over the given interval.\n * @since 1.0.0\n */\n (i: Interval): (c: LinearCurve2d) => number\n} = internal.length\n"],"names":["fromPolynomials","fromPoints","LinearPolynomial.make","isLinearCurve2d","derivative","Vector2.make","solve","LinearPolynomial.solve","length","internal.fromPolynomials","internal.fromPoints","internal.isLinearCurve2d","internal.derivative","internal.solve","internal.length"],"mappings":";;;;;;;;AAAA,IAAA,EAAA,EAAA,EAAA;AAQa,MAAA,mBAAA,GAAqC,OAAO,sBAAsB,CAAA;AAGlE,MAAA,iBAAA,UAA0B,EAC3B,GAAA,QAAA,EAAA,EAAA,GAAA,mBAAA,EAD2B,EAAkC,EAAA;AAAA,EAMvE,WAAA,CAAY,IAAuC,EAAuC,EAAA;AACxF,IAAM,KAAA,EAAA;AANR,IAAA,IAAA,CAAU,EAA4C,CAAA,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A,GAAA,GAAM,CAAE,CAAA,KAAK,CAAC;AACxE,CAAA;;AC3BO,MAAM,kBACXC;AAQK,MAAM,aAA0DC;AAShE,MAAM,kBAAsDC;AAS5D,MAAM,aAA4CC;AAElD,MAAM,QAkBTC;AAEG,MAAM,SAkBTC;;;;"}
@@ -1,117 +0,0 @@
1
- import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
- import { Interval } from '../interval.mjs';
3
- import { Pipeable } from '../pipe.mjs';
4
- import { Q as QuadraticPolynomial } from '../shared/curvy.FDaj5rlj.mjs';
5
- import { Vector2 } from '../vector/vector2.mjs';
6
- import { LinearCurve2d } from './linear2d.mjs';
7
- import '../vector/vector3.mjs';
8
- import '../vector/vector4.mjs';
9
-
10
- declare const QuadraticCurve2dTypeId: unique symbol;
11
- type QuadraticCurve2dTypeId = typeof QuadraticCurve2dTypeId;
12
-
13
- /**
14
- * A quadratic curve in 2D space.
15
- *
16
- * All fields are readonly and immutable, and all operations create new instances.
17
- *
18
- * @since 1.0.0
19
- */
20
- interface QuadraticCurve2d extends Pipeable, TwoDimensional<QuadraticPolynomial> {
21
- readonly [QuadraticCurve2dTypeId]: QuadraticCurve2dTypeId;
22
- }
23
- /**
24
- * Creates a new `QuadraticCurve2d` instance from polynomial parameters.
25
- *
26
- * @param c0 - The x polynomial.
27
- * @param c1 - The y polynomial.
28
- * @returns A new `QuadraticCurve2d` instance.
29
- * @since 1.0.0
30
- */
31
- declare const fromPolynomials: (c0: QuadraticPolynomial, c1: QuadraticPolynomial) => QuadraticCurve2d;
32
- /**
33
- * Creates a new `QuadraticCurve2d` instance from pairs of coefficients.
34
- *
35
- * @param p0 - The x^0 coefficients for the x and y polynomials.
36
- * @param p1 - The x^1 coefficients for the x and y polynomials.
37
- * @param p2 - The x^2 coefficients for the x and y polynomials.
38
- * @returns A new `QuadraticCurve2d` instance.
39
- * @since 1.0.0
40
- */
41
- declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticCurve2d;
42
- /**
43
- * Checks if a value is a `QuadraticCurve2d`.
44
- *
45
- * @param c - The value to check.
46
- * @returns `true` if the value is a `QuadraticCurve2d`, `false` otherwise.
47
- * @since 1.0.0
48
- */
49
- declare const isQuadraticCurve2d: (c: unknown) => c is QuadraticCurve2d;
50
- declare const solve: {
51
- /**
52
- * Solves the quadratic curve for a given parameter t.
53
- *
54
- * @param t - The parameter value.
55
- * @returns A function that takes a quadratic curve and returns the point on the curve at parameter t.
56
- * @since 1.0.0
57
- */
58
- (t: number): (c: QuadraticCurve2d) => Vector2;
59
- /**
60
- * Solves the quadratic curve for a given parameter t.
61
- *
62
- * @param c - The quadratic curve to solve.
63
- * @param t - The parameter value.
64
- * @returns The point on the curve at parameter t.
65
- * @since 1.0.0
66
- */
67
- (c: QuadraticCurve2d, t: number): Vector2;
68
- };
69
- declare const length: {
70
- /**
71
- * Computes the length of the quadratic curve over a given interval.
72
- *
73
- * @param c - The quadratic curve to compute the length of.
74
- * @param i - The interval over which to compute the length.
75
- * @returns The length of the quadratic curve over the interval.
76
- * @since 1.0.0
77
- */
78
- (c: QuadraticCurve2d, i: Interval): number;
79
- /**
80
- * Computes the length of the quadratic curve over a given interval.
81
- *
82
- * @param i - The interval over which to compute the length.
83
- * @returns A function that takes a quadratic curve and returns the length of the curve over the interval.
84
- * @since 1.0.0
85
- */
86
- (i: Interval): (c: QuadraticCurve2d) => number;
87
- };
88
- /**
89
- * Computes the derivative of a quadratic curve.
90
- *
91
- * @param c - The quadratic curve to compute the derivative of.
92
- * @returns The derivative of the quadratic curve as a linear curve.
93
- * @since 1.0.0
94
- */
95
- declare const derivative: (c: QuadraticCurve2d) => LinearCurve2d;
96
- declare const curvature: {
97
- /**
98
- * Computes the curvature of the quadratic curve at a given parameter t.
99
- *
100
- * @param c - The quadratic curve to compute the curvature for.
101
- * @param t - The parameter value.
102
- * @returns The curvature of the quadratic curve at parameter t.
103
- * @since 1.0.0
104
- */
105
- (c: QuadraticCurve2d, t: number): number;
106
- /**
107
- * Computes the curvature of the quadratic curve at a given parameter t.
108
- *
109
- * @param t - The parameter value.
110
- * @returns A function that takes a quadratic curve and returns the curvature of the curve at parameter t.
111
- * @since 1.0.0
112
- */
113
- (t: number): (c: QuadraticCurve2d) => number;
114
- };
115
-
116
- export { curvature, derivative, fromPoints, fromPolynomials, isQuadraticCurve2d, length, solve };
117
- export type { QuadraticCurve2d };
@@ -1,117 +0,0 @@
1
- import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { Interval } from '../interval.js';
3
- import { Pipeable } from '../pipe.js';
4
- import { Q as QuadraticPolynomial } from '../shared/curvy.Cg8lZVUz.js';
5
- import { Vector2 } from '../vector/vector2.js';
6
- import { LinearCurve2d } from './linear2d.js';
7
- import '../vector/vector3.js';
8
- import '../vector/vector4.js';
9
-
10
- declare const QuadraticCurve2dTypeId: unique symbol;
11
- type QuadraticCurve2dTypeId = typeof QuadraticCurve2dTypeId;
12
-
13
- /**
14
- * A quadratic curve in 2D space.
15
- *
16
- * All fields are readonly and immutable, and all operations create new instances.
17
- *
18
- * @since 1.0.0
19
- */
20
- interface QuadraticCurve2d extends Pipeable, TwoDimensional<QuadraticPolynomial> {
21
- readonly [QuadraticCurve2dTypeId]: QuadraticCurve2dTypeId;
22
- }
23
- /**
24
- * Creates a new `QuadraticCurve2d` instance from polynomial parameters.
25
- *
26
- * @param c0 - The x polynomial.
27
- * @param c1 - The y polynomial.
28
- * @returns A new `QuadraticCurve2d` instance.
29
- * @since 1.0.0
30
- */
31
- declare const fromPolynomials: (c0: QuadraticPolynomial, c1: QuadraticPolynomial) => QuadraticCurve2d;
32
- /**
33
- * Creates a new `QuadraticCurve2d` instance from pairs of coefficients.
34
- *
35
- * @param p0 - The x^0 coefficients for the x and y polynomials.
36
- * @param p1 - The x^1 coefficients for the x and y polynomials.
37
- * @param p2 - The x^2 coefficients for the x and y polynomials.
38
- * @returns A new `QuadraticCurve2d` instance.
39
- * @since 1.0.0
40
- */
41
- declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticCurve2d;
42
- /**
43
- * Checks if a value is a `QuadraticCurve2d`.
44
- *
45
- * @param c - The value to check.
46
- * @returns `true` if the value is a `QuadraticCurve2d`, `false` otherwise.
47
- * @since 1.0.0
48
- */
49
- declare const isQuadraticCurve2d: (c: unknown) => c is QuadraticCurve2d;
50
- declare const solve: {
51
- /**
52
- * Solves the quadratic curve for a given parameter t.
53
- *
54
- * @param t - The parameter value.
55
- * @returns A function that takes a quadratic curve and returns the point on the curve at parameter t.
56
- * @since 1.0.0
57
- */
58
- (t: number): (c: QuadraticCurve2d) => Vector2;
59
- /**
60
- * Solves the quadratic curve for a given parameter t.
61
- *
62
- * @param c - The quadratic curve to solve.
63
- * @param t - The parameter value.
64
- * @returns The point on the curve at parameter t.
65
- * @since 1.0.0
66
- */
67
- (c: QuadraticCurve2d, t: number): Vector2;
68
- };
69
- declare const length: {
70
- /**
71
- * Computes the length of the quadratic curve over a given interval.
72
- *
73
- * @param c - The quadratic curve to compute the length of.
74
- * @param i - The interval over which to compute the length.
75
- * @returns The length of the quadratic curve over the interval.
76
- * @since 1.0.0
77
- */
78
- (c: QuadraticCurve2d, i: Interval): number;
79
- /**
80
- * Computes the length of the quadratic curve over a given interval.
81
- *
82
- * @param i - The interval over which to compute the length.
83
- * @returns A function that takes a quadratic curve and returns the length of the curve over the interval.
84
- * @since 1.0.0
85
- */
86
- (i: Interval): (c: QuadraticCurve2d) => number;
87
- };
88
- /**
89
- * Computes the derivative of a quadratic curve.
90
- *
91
- * @param c - The quadratic curve to compute the derivative of.
92
- * @returns The derivative of the quadratic curve as a linear curve.
93
- * @since 1.0.0
94
- */
95
- declare const derivative: (c: QuadraticCurve2d) => LinearCurve2d;
96
- declare const curvature: {
97
- /**
98
- * Computes the curvature of the quadratic curve at a given parameter t.
99
- *
100
- * @param c - The quadratic curve to compute the curvature for.
101
- * @param t - The parameter value.
102
- * @returns The curvature of the quadratic curve at parameter t.
103
- * @since 1.0.0
104
- */
105
- (c: QuadraticCurve2d, t: number): number;
106
- /**
107
- * Computes the curvature of the quadratic curve at a given parameter t.
108
- *
109
- * @param t - The parameter value.
110
- * @returns A function that takes a quadratic curve and returns the curvature of the curve at parameter t.
111
- * @since 1.0.0
112
- */
113
- (t: number): (c: QuadraticCurve2d) => number;
114
- };
115
-
116
- export { curvature, derivative, fromPoints, fromPolynomials, isQuadraticCurve2d, length, solve };
117
- export type { QuadraticCurve2d };
@@ -1,82 +0,0 @@
1
- import { size, scaleShift, biunit } from '../interval.mjs';
2
- import { G as GL32_W0, a as GL32_X0, b as GL32_W1, c as GL32_X1, d as GL32_W2, e as GL32_X2, f as GL32_W3, g as GL32_X3, h as GL32_W4, i as GL32_X4, j as GL32_W5, k as GL32_X5, l as GL32_W6, m as GL32_X6, n as GL32_W7, o as GL32_X7, p as GL32_W8, q as GL32_X8, r as GL32_W9, s as GL32_X9, t as GL32_W10, u as GL32_X10, v as GL32_W11, w as GL32_X11, x as GL32_W12, y as GL32_X12, z as GL32_W13, A as GL32_X13, B as GL32_W14, C as GL32_X14, D as GL32_W15, E as GL32_X15 } from '../shared/curvy.DmVFTi0N.mjs';
3
- import { dual, Pipeable } from '../pipe.mjs';
4
- import { make as make$2 } from '../polynomial/linear.mjs';
5
- import { make, solve as solve$2, derivative as derivative$2 } from '../polynomial/quadratic.mjs';
6
- import { round } from '../utils.mjs';
7
- import { make as make$1, magnitude, cross } from '../vector/vector2.mjs';
8
- import { fromPolynomials as fromPolynomials$2, length as length$2, solve as solve$3, derivative as derivative$3 } from './linear2d.mjs';
9
- import '../shared/curvy.r6f1j287.mjs';
10
- import '../shared/curvy.BxdGW9he.mjs';
11
- import '../shared/curvy.DJ4xO0al.mjs';
12
-
13
- var _a, _b;
14
- const QuadraticCurve2dTypeId = Symbol("curvy/curve/quadratic2d");
15
- class QuadraticCurve2dImpl extends (_b = Pipeable, _a = QuadraticCurve2dTypeId, _b) {
16
- constructor(c0, c1) {
17
- super();
18
- this[_a] = QuadraticCurve2dTypeId;
19
- this.x = c0;
20
- this.y = c1;
21
- }
22
- get [0]() {
23
- return this.x;
24
- }
25
- get [1]() {
26
- return this.y;
27
- }
28
- }
29
- const fromPolynomials$1 = (c0, c1) => new QuadraticCurve2dImpl(c0, c1);
30
- const fromPoints$1 = (p0, p1, p2) => new QuadraticCurve2dImpl(
31
- make(p0.x, p1.x, p2.x),
32
- make(p0.y, p1.y, p2.y)
33
- );
34
- const isQuadraticCurve2d$1 = (c) => typeof c === "object" && c !== null && QuadraticCurve2dTypeId in c;
35
- const solve$1 = dual(
36
- 2,
37
- (c, t) => make$1(solve$2(c.x, t), solve$2(c.y, t))
38
- );
39
- const derivative$1 = (c) => fromPolynomials$2(
40
- derivative$2(c.x),
41
- derivative$2(c.y)
42
- );
43
- const length$1 = dual(2, (c, i) => {
44
- if (size(i) === 0) {
45
- return 0;
46
- }
47
- if (c.x.c2 === 0 && c.y.c2 === 0) {
48
- return length$2(
49
- fromPolynomials$2(
50
- make$2(c.x.c0, c.x.c1),
51
- make$2(c.y.c0, c.y.c1)
52
- ),
53
- i
54
- );
55
- }
56
- const d = derivative$1(c);
57
- const { scale, shift } = scaleShift(biunit, i);
58
- return round(
59
- (GL32_W0 * magnitude(solve$3(d, shift + scale * -0.9972638618494816)) + GL32_W0 * magnitude(solve$3(d, shift + scale * GL32_X0)) + GL32_W1 * magnitude(solve$3(d, shift + scale * -0.9856115115452684)) + GL32_W1 * magnitude(solve$3(d, shift + scale * GL32_X1)) + GL32_W2 * magnitude(solve$3(d, shift + scale * -0.9647622555875064)) + GL32_W2 * magnitude(solve$3(d, shift + scale * GL32_X2)) + GL32_W3 * magnitude(solve$3(d, shift + scale * -0.9349060759377397)) + GL32_W3 * magnitude(solve$3(d, shift + scale * GL32_X3)) + GL32_W4 * magnitude(solve$3(d, shift + scale * -0.8963211557660521)) + GL32_W4 * magnitude(solve$3(d, shift + scale * GL32_X4)) + GL32_W5 * magnitude(solve$3(d, shift + scale * -0.84936761373257)) + GL32_W5 * magnitude(solve$3(d, shift + scale * GL32_X5)) + GL32_W6 * magnitude(solve$3(d, shift + scale * -0.7944837959679424)) + GL32_W6 * magnitude(solve$3(d, shift + scale * GL32_X6)) + GL32_W7 * magnitude(solve$3(d, shift + scale * -0.7321821187402897)) + GL32_W7 * magnitude(solve$3(d, shift + scale * GL32_X7)) + GL32_W8 * magnitude(solve$3(d, shift + scale * -0.6630442669302152)) + GL32_W8 * magnitude(solve$3(d, shift + scale * GL32_X8)) + GL32_W9 * magnitude(solve$3(d, shift + scale * -0.5877157572407623)) + GL32_W9 * magnitude(solve$3(d, shift + scale * GL32_X9)) + GL32_W10 * magnitude(solve$3(d, shift + scale * -0.5068999089322294)) + GL32_W10 * magnitude(solve$3(d, shift + scale * GL32_X10)) + GL32_W11 * magnitude(solve$3(d, shift + scale * -0.42135127613063533)) + GL32_W11 * magnitude(solve$3(d, shift + scale * GL32_X11)) + GL32_W12 * magnitude(solve$3(d, shift + scale * -0.33186860228212767)) + GL32_W12 * magnitude(solve$3(d, shift + scale * GL32_X12)) + GL32_W13 * magnitude(solve$3(d, shift + scale * -0.23928736225213706)) + GL32_W13 * magnitude(solve$3(d, shift + scale * GL32_X13)) + GL32_W14 * magnitude(solve$3(d, shift + scale * -0.1444719615827965)) + GL32_W14 * magnitude(solve$3(d, shift + scale * GL32_X14)) + GL32_W15 * magnitude(solve$3(d, shift + scale * -0.04830766568773831)) + GL32_W15 * magnitude(solve$3(d, shift + scale * GL32_X15))) * scale
60
- );
61
- });
62
- const curvature$1 = dual(2, (c, t) => {
63
- const d = derivative$1(c);
64
- const v = solve$3(d, t);
65
- const a = derivative$3(d);
66
- const vMag = magnitude(v);
67
- if (vMag === 0) {
68
- return 0;
69
- }
70
- return round(Math.abs(cross(v, a)) / vMag ** 3);
71
- });
72
-
73
- const fromPolynomials = fromPolynomials$1;
74
- const fromPoints = fromPoints$1;
75
- const isQuadraticCurve2d = isQuadraticCurve2d$1;
76
- const solve = solve$1;
77
- const length = length$1;
78
- const derivative = derivative$1;
79
- const curvature = curvature$1;
80
-
81
- export { curvature, derivative, fromPoints, fromPolynomials, isQuadraticCurve2d, length, solve };
82
- //# sourceMappingURL=quadratic2d.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quadratic2d.mjs","sources":["../../src/curve/quadratic2d.internal.ts","../../src/curve/quadratic2d.ts"],"sourcesContent":["import * as Interval from '../interval'\nimport {\n GL32_W0,\n GL32_W1,\n GL32_W2,\n GL32_W3,\n GL32_W4,\n GL32_W5,\n GL32_W6,\n GL32_W7,\n GL32_W8,\n GL32_W9,\n GL32_W10,\n GL32_W11,\n GL32_W12,\n GL32_W13,\n GL32_W14,\n GL32_W15,\n GL32_X0,\n GL32_X1,\n GL32_X2,\n GL32_X3,\n GL32_X4,\n GL32_X5,\n GL32_X6,\n GL32_X7,\n GL32_X8,\n GL32_X9,\n GL32_X10,\n GL32_X11,\n GL32_X12,\n GL32_X13,\n GL32_X14,\n GL32_X15,\n} from '../length'\nimport { Pipeable } from '../pipe'\nimport { dual } from '../pipe'\nimport * as LinearPolynomial from '../polynomial/linear'\nimport * as QuadraticPolynomial from '../polynomial/quadratic'\nimport { round } from '../utils'\nimport * as Vector2 from '../vector/vector2'\nimport * as LinearCurve2d from './linear2d'\nimport type { QuadraticCurve2d } from './quadratic2d'\n\nexport const QuadraticCurve2dTypeId: unique symbol = Symbol('curvy/curve/quadratic2d')\nexport type QuadraticCurve2dTypeId = typeof QuadraticCurve2dTypeId\n\nexport class QuadraticCurve2dImpl extends Pipeable implements QuadraticCurve2d {\n readonly [QuadraticCurve2dTypeId]: QuadraticCurve2dTypeId = QuadraticCurve2dTypeId\n\n readonly x: QuadraticPolynomial.QuadraticPolynomial\n readonly y: QuadraticPolynomial.QuadraticPolynomial\n\n constructor(\n c0: QuadraticPolynomial.QuadraticPolynomial,\n c1: QuadraticPolynomial.QuadraticPolynomial,\n ) {\n super()\n this.x = c0\n this.y = c1\n }\n\n get [0]() {\n return this.x\n }\n\n get [1]() {\n return this.y\n }\n}\n\nexport const fromPolynomials: (\n c0: QuadraticPolynomial.QuadraticPolynomial,\n c1: QuadraticPolynomial.QuadraticPolynomial,\n) => QuadraticCurve2d = (c0, c1) => new QuadraticCurve2dImpl(c0, c1)\n\nexport const fromPoints: (\n p0: Vector2.Vector2,\n p1: Vector2.Vector2,\n p2: Vector2.Vector2,\n) => QuadraticCurve2d = (p0, p1, p2) =>\n new QuadraticCurve2dImpl(\n QuadraticPolynomial.make(p0.x, p1.x, p2.x),\n QuadraticPolynomial.make(p0.y, p1.y, p2.y),\n )\n\nexport const isQuadraticCurve2d = (c: unknown): c is QuadraticCurve2d =>\n typeof c === 'object' && c !== null && QuadraticCurve2dTypeId in c\n\nexport const solve = dual<\n (t: number) => (c: QuadraticCurve2d) => Vector2.Vector2,\n (c: QuadraticCurve2d, t: number) => Vector2.Vector2\n>(2, (c: QuadraticCurve2d, t: number) =>\n Vector2.make(QuadraticPolynomial.solve(c.x, t), QuadraticPolynomial.solve(c.y, t)),\n)\n\nexport const derivative = (c: QuadraticCurve2d) =>\n LinearCurve2d.fromPolynomials(\n QuadraticPolynomial.derivative(c.x),\n QuadraticPolynomial.derivative(c.y),\n )\n\nexport const length = dual(2, (c: QuadraticCurve2d, i: Interval.Interval) => {\n if (Interval.size(i) === 0) {\n return 0\n }\n\n if (c.x.c2 === 0 && c.y.c2 === 0) {\n return LinearCurve2d.length(\n LinearCurve2d.fromPolynomials(\n LinearPolynomial.make(c.x.c0, c.x.c1),\n LinearPolynomial.make(c.y.c0, c.y.c1),\n ),\n i,\n )\n }\n\n const d = derivative(c)\n\n const { scale, shift } = Interval.scaleShift(Interval.biunit, i)\n\n return round(\n (GL32_W0 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X0)) +\n GL32_W0 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X0)) +\n GL32_W1 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X1)) +\n GL32_W1 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X1)) +\n GL32_W2 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X2)) +\n GL32_W2 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X2)) +\n GL32_W3 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X3)) +\n GL32_W3 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X3)) +\n GL32_W4 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X4)) +\n GL32_W4 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X4)) +\n GL32_W5 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X5)) +\n GL32_W5 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X5)) +\n GL32_W6 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X6)) +\n GL32_W6 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X6)) +\n GL32_W7 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X7)) +\n GL32_W7 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X7)) +\n GL32_W8 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X8)) +\n GL32_W8 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X8)) +\n GL32_W9 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X9)) +\n GL32_W9 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X9)) +\n GL32_W10 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X10)) +\n GL32_W10 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X10)) +\n GL32_W11 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X11)) +\n GL32_W11 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X11)) +\n GL32_W12 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X12)) +\n GL32_W12 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X12)) +\n GL32_W13 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X13)) +\n GL32_W13 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X13)) +\n GL32_W14 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X14)) +\n GL32_W14 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X14)) +\n GL32_W15 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * -GL32_X15)) +\n GL32_W15 * Vector2.magnitude(LinearCurve2d.solve(d, shift + scale * GL32_X15))) *\n scale,\n )\n})\n\nexport const curvature = dual(2, (c: QuadraticCurve2d, t: number) => {\n const d = derivative(c)\n const v = LinearCurve2d.solve(d, t)\n const a = LinearCurve2d.derivative(d)\n\n const vMag = Vector2.magnitude(v)\n\n if (vMag === 0) {\n return 0\n }\n\n return round(Math.abs(Vector2.cross(v, a)) / vMag ** 3)\n})\n","import type { TwoDimensional } from '../dimensions'\nimport type { Interval } from '../interval'\nimport type { Pipeable } from '../pipe'\nimport type { QuadraticPolynomial } from '../polynomial/quadratic'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearCurve2d } from './linear2d'\nimport type { QuadraticCurve2dTypeId } from './quadratic2d.internal'\nimport * as internal from './quadratic2d.internal'\n\n/**\n * A quadratic curve in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport interface QuadraticCurve2d extends Pipeable, TwoDimensional<QuadraticPolynomial> {\n readonly [QuadraticCurve2dTypeId]: QuadraticCurve2dTypeId\n}\n\n/**\n * Creates a new `QuadraticCurve2d` instance from polynomial parameters.\n *\n * @param c0 - The x polynomial.\n * @param c1 - The y polynomial.\n * @returns A new `QuadraticCurve2d` instance.\n * @since 1.0.0\n */\nexport const fromPolynomials: (\n c0: QuadraticPolynomial,\n c1: QuadraticPolynomial,\n) => QuadraticCurve2d = internal.fromPolynomials\n\n/**\n * Creates a new `QuadraticCurve2d` instance from pairs of coefficients.\n *\n * @param p0 - The x^0 coefficients for the x and y polynomials.\n * @param p1 - The x^1 coefficients for the x and y polynomials.\n * @param p2 - The x^2 coefficients for the x and y polynomials.\n * @returns A new `QuadraticCurve2d` instance.\n * @since 1.0.0\n */\nexport const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2) => QuadraticCurve2d =\n internal.fromPoints\n\n/**\n * Checks if a value is a `QuadraticCurve2d`.\n *\n * @param c - The value to check.\n * @returns `true` if the value is a `QuadraticCurve2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticCurve2d: (c: unknown) => c is QuadraticCurve2d = internal.isQuadraticCurve2d\n\nexport const solve: {\n /**\n * Solves the quadratic curve for a given parameter t.\n *\n * @param t - The parameter value.\n * @returns A function that takes a quadratic curve and returns the point on the curve at parameter t.\n * @since 1.0.0\n */\n (t: number): (c: QuadraticCurve2d) => Vector2\n /**\n * Solves the quadratic curve for a given parameter t.\n *\n * @param c - The quadratic curve to solve.\n * @param t - The parameter value.\n * @returns The point on the curve at parameter t.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d, t: number): Vector2\n} = internal.solve\n\nexport const length: {\n /**\n * Computes the length of the quadratic curve over a given interval.\n *\n * @param c - The quadratic curve to compute the length of.\n * @param i - The interval over which to compute the length.\n * @returns The length of the quadratic curve over the interval.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d, i: Interval): number\n /**\n * Computes the length of the quadratic curve over a given interval.\n *\n * @param i - The interval over which to compute the length.\n * @returns A function that takes a quadratic curve and returns the length of the curve over the interval.\n * @since 1.0.0\n */\n (i: Interval): (c: QuadraticCurve2d) => number\n} = internal.length\n\n/**\n * Computes the derivative of a quadratic curve.\n *\n * @param c - The quadratic curve to compute the derivative of.\n * @returns The derivative of the quadratic curve as a linear curve.\n * @since 1.0.0\n */\nexport const derivative: (c: QuadraticCurve2d) => LinearCurve2d = internal.derivative\n\nexport const curvature: {\n /**\n * Computes the curvature of the quadratic curve at a given parameter t.\n *\n * @param c - The quadratic curve to compute the curvature for.\n * @param t - The parameter value.\n * @returns The curvature of the quadratic curve at parameter t.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d, t: number): number\n /**\n * Computes the curvature of the quadratic curve at a given parameter t.\n *\n * @param t - The parameter value.\n * @returns A function that takes a quadratic curve and returns the curvature of the curve at parameter t.\n * @since 1.0.0\n */\n (t: number): (c: QuadraticCurve2d) => number\n} = internal.curvature\n"],"names":["fromPolynomials","fromPoints","QuadraticPolynomial.make","isQuadraticCurve2d","solve","Vector2.make","QuadraticPolynomial.solve","derivative","LinearCurve2d.fromPolynomials","QuadraticPolynomial.derivative","length","Interval.size","LinearCurve2d.length","LinearPolynomial.make","Interval.scaleShift","Interval.biunit","Vector2.magnitude","LinearCurve2d.solve","curvature","LinearCurve2d.derivative","Vector2.cross","internal.fromPolynomials","internal.fromPoints","internal.isQuadraticCurve2d","internal.solve","internal.length","internal.derivative","internal.curvature"],"mappings":";;;;;;;;;;;;AAAA,IAAA,EAAA,EAAA,EAAA;AA4Ca,MAAA,sBAAA,GAAwC,OAAO,yBAAyB,CAAA;AAGxE,MAAA,oBAAA,UAA6B,EAC9B,GAAA,QAAA,EAAA,EAAA,GAAA,sBAAA,EAD8B,EAAqC,EAAA;AAAA,EAM7E,WAAA,CACE,IACA,EACA,EAAA;AACA,IAAM,KAAA,EAAA;AATR,IAAA,IAAA,CAAU,EAAkD,CAAA,GAAA,sBAAA;AAU1D,IAAA,IAAA,CAAK,CAAI,GAAA,EAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,EAAA;AAAA;AACX,EAEA,KAAK,CAAC,CAAI,GAAA;AACR,IAAA,OAAO,IAAK,CAAA,CAAA;AAAA;AACd,EAEA,KAAK,CAAC,CAAI,GAAA;AACR,IAAA,OA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