curvy 1.0.9 → 2.0.0-alpha.2

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 (173) 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 +3 -0
  6. package/dist/interval/index.mjs +3 -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 +261 -0
  14. package/dist/path/index.mjs +325 -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-B9nCh_cx.mjs +104 -0
  19. package/dist/shared/characteristic-B9nCh_cx.mjs.map +1 -0
  20. package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
  21. package/dist/shared/cubic-BajUY0JT.d.mts +1100 -0
  22. package/dist/shared/cubic-CpHAx8cC.mjs +479 -0
  23. package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
  24. package/dist/shared/interval-05CR6eBf.mjs +421 -0
  25. package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
  26. package/dist/shared/interval-Dy-RMEE3.d.mts +533 -0
  27. package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
  28. package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
  29. package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
  30. package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
  31. package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
  32. package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +1183 -0
  33. package/dist/shared/quadratic-CamozcFc.mjs +330 -0
  34. package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
  35. package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +308 -0
  36. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs +295 -0
  37. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
  38. package/dist/shared/rationalCubic2d-Bys2Uory.mjs +695 -0
  39. package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
  40. package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +818 -0
  41. package/dist/shared/solution-CrtLfqEq.mjs +306 -0
  42. package/dist/shared/solution-CrtLfqEq.mjs.map +1 -0
  43. package/dist/shared/solution-sNQ-ZVhN.d.mts +251 -0
  44. package/dist/{pipe.d.mts → shared/utils-MCckigYk.d.mts} +44 -26
  45. package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
  46. package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
  47. package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
  48. package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
  49. package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
  50. package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
  51. package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
  52. package/dist/shared/vector3-DqeOZtOB.d.mts +703 -0
  53. package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
  54. package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
  55. package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
  56. package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
  57. package/dist/solution/index.d.mts +2 -0
  58. package/dist/solution/index.mjs +2 -0
  59. package/dist/splines/index.d.mts +701 -0
  60. package/dist/splines/index.mjs +734 -0
  61. package/dist/splines/index.mjs.map +1 -0
  62. package/dist/utils.d.mts +2 -205
  63. package/dist/utils.mjs +88 -52
  64. package/dist/utils.mjs.map +1 -1
  65. package/dist/vector/index.d.mts +3 -0
  66. package/dist/vector/index.mjs +4 -0
  67. package/package.json +49 -92
  68. package/dist/curve/cubic2d.d.mts +0 -109
  69. package/dist/curve/cubic2d.d.ts +0 -109
  70. package/dist/curve/cubic2d.mjs +0 -80
  71. package/dist/curve/cubic2d.mjs.map +0 -1
  72. package/dist/curve/linear2d.d.mts +0 -94
  73. package/dist/curve/linear2d.d.ts +0 -94
  74. package/dist/curve/linear2d.mjs +0 -46
  75. package/dist/curve/linear2d.mjs.map +0 -1
  76. package/dist/curve/quadratic2d.d.mts +0 -117
  77. package/dist/curve/quadratic2d.d.ts +0 -117
  78. package/dist/curve/quadratic2d.mjs +0 -82
  79. package/dist/curve/quadratic2d.mjs.map +0 -1
  80. package/dist/interval.d.mts +0 -251
  81. package/dist/interval.d.ts +0 -251
  82. package/dist/interval.mjs +0 -86
  83. package/dist/interval.mjs.map +0 -1
  84. package/dist/matrix/matrix2x2.d.mts +0 -320
  85. package/dist/matrix/matrix2x2.d.ts +0 -320
  86. package/dist/matrix/matrix2x2.mjs +0 -25
  87. package/dist/matrix/matrix2x2.mjs.map +0 -1
  88. package/dist/matrix/matrix3x3.d.mts +0 -370
  89. package/dist/matrix/matrix3x3.d.ts +0 -370
  90. package/dist/matrix/matrix3x3.mjs +0 -28
  91. package/dist/matrix/matrix3x3.mjs.map +0 -1
  92. package/dist/matrix/matrix4x4.d.mts +0 -381
  93. package/dist/matrix/matrix4x4.d.ts +0 -381
  94. package/dist/matrix/matrix4x4.mjs +0 -178
  95. package/dist/matrix/matrix4x4.mjs.map +0 -1
  96. package/dist/path/cubic2d.d.mts +0 -95
  97. package/dist/path/cubic2d.d.ts +0 -95
  98. package/dist/path/cubic2d.mjs +0 -60
  99. package/dist/path/cubic2d.mjs.map +0 -1
  100. package/dist/path/linear2d.d.mts +0 -95
  101. package/dist/path/linear2d.d.ts +0 -95
  102. package/dist/path/linear2d.mjs +0 -53
  103. package/dist/path/linear2d.mjs.map +0 -1
  104. package/dist/path/quadratic2d.d.mts +0 -95
  105. package/dist/path/quadratic2d.d.ts +0 -95
  106. package/dist/path/quadratic2d.mjs +0 -57
  107. package/dist/path/quadratic2d.mjs.map +0 -1
  108. package/dist/pipe.d.ts +0 -58
  109. package/dist/pipe.mjs +0 -92
  110. package/dist/pipe.mjs.map +0 -1
  111. package/dist/polynomial/cubic.d.mts +0 -7
  112. package/dist/polynomial/cubic.d.ts +0 -7
  113. package/dist/polynomial/cubic.mjs +0 -133
  114. package/dist/polynomial/cubic.mjs.map +0 -1
  115. package/dist/polynomial/linear.d.mts +0 -7
  116. package/dist/polynomial/linear.d.ts +0 -7
  117. package/dist/polynomial/linear.mjs +0 -24
  118. package/dist/polynomial/linear.mjs.map +0 -1
  119. package/dist/polynomial/quadratic.d.mts +0 -7
  120. package/dist/polynomial/quadratic.d.ts +0 -7
  121. package/dist/polynomial/quadratic.mjs +0 -27
  122. package/dist/polynomial/quadratic.mjs.map +0 -1
  123. package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
  124. package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
  125. package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
  126. package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
  127. package/dist/shared/curvy.BxdGW9he.mjs +0 -116
  128. package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
  129. package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
  130. package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
  131. package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
  132. package/dist/shared/curvy.DCt1gGII.mjs +0 -147
  133. package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
  134. package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
  135. package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
  136. package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
  137. package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
  138. package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
  139. package/dist/shared/curvy.lktriTpx.mjs +0 -101
  140. package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
  141. package/dist/shared/curvy.mLFprrGm.mjs +0 -85
  142. package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
  143. package/dist/shared/curvy.r6f1j287.mjs +0 -76
  144. package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
  145. package/dist/splines/basis2d.d.mts +0 -130
  146. package/dist/splines/basis2d.d.ts +0 -130
  147. package/dist/splines/basis2d.mjs +0 -90
  148. package/dist/splines/basis2d.mjs.map +0 -1
  149. package/dist/splines/bezier2d.d.mts +0 -182
  150. package/dist/splines/bezier2d.d.ts +0 -182
  151. package/dist/splines/bezier2d.mjs +0 -23
  152. package/dist/splines/bezier2d.mjs.map +0 -1
  153. package/dist/splines/cardinal2d.d.mts +0 -178
  154. package/dist/splines/cardinal2d.d.ts +0 -178
  155. package/dist/splines/cardinal2d.mjs +0 -114
  156. package/dist/splines/cardinal2d.mjs.map +0 -1
  157. package/dist/splines/hermite2d.d.mts +0 -124
  158. package/dist/splines/hermite2d.d.ts +0 -124
  159. package/dist/splines/hermite2d.mjs +0 -63
  160. package/dist/splines/hermite2d.mjs.map +0 -1
  161. package/dist/utils.d.ts +0 -205
  162. package/dist/vector/vector2.d.mts +0 -324
  163. package/dist/vector/vector2.d.ts +0 -324
  164. package/dist/vector/vector2.mjs +0 -30
  165. package/dist/vector/vector2.mjs.map +0 -1
  166. package/dist/vector/vector3.d.mts +0 -417
  167. package/dist/vector/vector3.d.ts +0 -417
  168. package/dist/vector/vector3.mjs +0 -38
  169. package/dist/vector/vector3.mjs.map +0 -1
  170. package/dist/vector/vector4.d.mts +0 -205
  171. package/dist/vector/vector4.d.ts +0 -205
  172. package/dist/vector/vector4.mjs +0 -20
  173. package/dist/vector/vector4.mjs.map +0 -1
package/package.json CHANGED
@@ -1,125 +1,82 @@
1
1
  {
2
2
  "name": "curvy",
3
- "version": "1.0.9",
3
+ "version": "2.0.0-alpha.2",
4
4
  "description": "Spline and Curve utilities",
5
- "author": "Tim Morris <timthewebguy@gmail.com>",
6
5
  "homepage": "https://github.com/tkofh/curvy#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/tkofh/curvy/issues"
8
+ },
7
9
  "license": "MIT",
8
- "sideEffects": false,
10
+ "author": "Tim Morris <timthewebguy@gmail.com>",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/tkofh/curvy.git"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
9
18
  "type": "module",
19
+ "sideEffects": false,
10
20
  "exports": {
11
- "./vector2": {
12
- "types": "./dist/vector/vector2.d.ts",
13
- "import": "./dist/vector/vector2.mjs"
14
- },
15
- "./vector3": {
16
- "types": "./dist/vector/vector3.d.ts",
17
- "import": "./dist/vector/vector3.mjs"
18
- },
19
- "./vector4": {
20
- "types": "./dist/vector/vector4.d.ts",
21
- "import": "./dist/vector/vector4.mjs"
22
- },
23
- "./matrix2x2": {
24
- "types": "./dist/matrix/matrix2x2.d.ts",
25
- "import": "./dist/matrix/matrix2x2.mjs"
26
- },
27
- "./matrix3x3": {
28
- "types": "./dist/matrix/matrix3x3.d.ts",
29
- "import": "./dist/matrix/matrix3x3.mjs"
21
+ "./vector": {
22
+ "types": "./dist/vector/index.d.mts",
23
+ "import": "./dist/vector/index.mjs"
30
24
  },
31
- "./matrix4x4": {
32
- "types": "./dist/matrix/matrix4x4.d.ts",
33
- "import": "./dist/matrix/matrix4x4.mjs"
25
+ "./matrix": {
26
+ "types": "./dist/matrix/index.d.mts",
27
+ "import": "./dist/matrix/index.mjs"
34
28
  },
35
- "./curve/linear2d": {
36
- "types": "./dist/curve/linear2d.d.ts",
37
- "import": "./dist/curve/linear2d.mjs"
29
+ "./polynomial": {
30
+ "types": "./dist/polynomial/index.d.mts",
31
+ "import": "./dist/polynomial/index.mjs"
38
32
  },
39
- "./curve/quadratic2d": {
40
- "types": "./dist/curve/quadratic2d.d.ts",
41
- "import": "./dist/curve/quadratic2d.mjs"
33
+ "./curve": {
34
+ "types": "./dist/curve/index.d.mts",
35
+ "import": "./dist/curve/index.mjs"
42
36
  },
43
- "./curve/cubic2d": {
44
- "types": "./dist/curve/cubic2d.d.ts",
45
- "import": "./dist/curve/cubic2d.mjs"
37
+ "./path": {
38
+ "types": "./dist/path/index.d.mts",
39
+ "import": "./dist/path/index.mjs"
46
40
  },
47
- "./polynomial/linear": {
48
- "types": "./dist/polynomial/linear.d.ts",
49
- "import": "./dist/polynomial/linear.mjs"
50
- },
51
- "./polynomial/quadratic": {
52
- "types": "./dist/polynomial/quadratic.d.ts",
53
- "import": "./dist/polynomial/quadratic.mjs"
54
- },
55
- "./polynomial/cubic": {
56
- "types": "./dist/polynomial/cubic.d.ts",
57
- "import": "./dist/polynomial/cubic.mjs"
41
+ "./splines": {
42
+ "types": "./dist/splines/index.d.mts",
43
+ "import": "./dist/splines/index.mjs"
58
44
  },
59
45
  "./interval": {
60
- "types": "./dist/interval.d.ts",
61
- "import": "./dist/interval.mjs"
62
- },
63
- "./path/linear2d": {
64
- "types": "./dist/path/linear2d.d.ts",
65
- "import": "./dist/path/linear2d.mjs"
66
- },
67
- "./path/quadratic2d": {
68
- "types": "./dist/path/quadratic2d.d.ts",
69
- "import": "./dist/path/quadratic2d.mjs"
70
- },
71
- "./path/cubic2d": {
72
- "types": "./dist/path/cubic2d.d.ts",
73
- "import": "./dist/path/cubic2d.mjs"
46
+ "types": "./dist/interval/index.d.mts",
47
+ "import": "./dist/interval/index.mjs"
74
48
  },
75
- "./splines/bezier2d": {
76
- "types": "./dist/splines/bezier2d.d.ts",
77
- "import": "./dist/splines/bezier2d.mjs"
49
+ "./solution": {
50
+ "types": "./dist/solution/index.d.mts",
51
+ "import": "./dist/solution/index.mjs"
78
52
  },
79
- "./splines/hermite2d": {
80
- "types": "./dist/splines/hermite2d.d.ts",
81
- "import": "./dist/splines/hermite2d.mjs"
53
+ "./characteristic": {
54
+ "types": "./dist/characteristic/index.d.mts",
55
+ "import": "./dist/characteristic/index.mjs"
82
56
  },
83
- "./splines/cardinal2d": {
84
- "types": "./dist/splines/cardinal2d.d.ts",
85
- "import": "./dist/splines/cardinal2d.mjs"
86
- },
87
- "./splines/basis2d": {
88
- "types": "./dist/splines/basis2d.d.ts",
89
- "import": "./dist/splines/basis2d.mjs"
90
- },
91
- "./pipe": {
92
- "types": "./dist/pipe.d.ts",
93
- "import": "./dist/pipe.mjs"
57
+ "./number": {
58
+ "types": "./dist/number.d.mts",
59
+ "import": "./dist/number.mjs"
94
60
  },
95
61
  "./utils": {
96
- "types": "./dist/utils.d.ts",
62
+ "types": "./dist/utils.d.mts",
97
63
  "import": "./dist/utils.mjs"
98
64
  }
99
65
  },
100
- "files": [
101
- "dist"
102
- ],
103
66
  "publishConfig": {
104
67
  "access": "public"
105
68
  },
106
- "repository": {
107
- "type": "git",
108
- "url": "git+https://github.com/tkofh/curvy.git"
109
- },
110
- "bugs": {
111
- "url": "https://github.com/tkofh/curvy/issues"
112
- },
113
69
  "devDependencies": {
114
- "typescript": "^5.8.3",
115
- "unbuild": "3.5.0",
116
- "vitest": "^3.1.1",
117
- "@repo/tsconfig": "1.0.0"
70
+ "tsdown": "^0.22.0",
71
+ "typescript": "^6.0.3",
72
+ "vitest": "^4.1.5"
118
73
  },
119
74
  "scripts": {
120
- "build": "unbuild",
75
+ "build": "tsdown",
76
+ "build:watch": "tsdown --watch",
121
77
  "test": "vitest run",
122
78
  "test:watch": "vitest",
79
+ "bench": "vitest bench --run",
123
80
  "typecheck": "tsc --noEmit"
124
81
  }
125
82
  }
@@ -1,109 +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 { C as CubicPolynomial } from '../shared/curvy.FDaj5rlj.mjs';
5
- import { Vector2 } from '../vector/vector2.mjs';
6
- import '../vector/vector3.mjs';
7
- import '../vector/vector4.mjs';
8
-
9
- declare const CubicCurve2dTypeId: unique symbol;
10
- type CubicCurve2dTypeId = typeof CubicCurve2dTypeId;
11
-
12
- /**
13
- * A cubic 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 CubicCurve2d extends Pipeable, TwoDimensional<CubicPolynomial> {
20
- readonly [CubicCurve2dTypeId]: CubicCurve2dTypeId;
21
- }
22
- /**
23
- * Creates a new `CubicCurve2d` instance from polynomial parameters.
24
- *
25
- * @param x - The x polynomial.
26
- * @param y - The y polynomial.
27
- * @returns A new `CubicCurve2d` instance.
28
- * @since 1.0.0
29
- */
30
- declare const fromPolynomials: (x: CubicPolynomial, y: CubicPolynomial) => CubicCurve2d;
31
- /**
32
- * Creates a new `CubicCurve2d` 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
- * @param p2 - The x^2 coefficients for the x and y polynomials.
37
- * @param p3 - The x^3 coefficients for the x and y polynomials.
38
- * @returns A new `CubicCurve2d` instance.
39
- * @since 1.0.0
40
- */
41
- declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => CubicCurve2d;
42
- /**
43
- * Checks if a value is a `CubicCurve2d`.
44
- *
45
- * @param c - The value to check.
46
- * @returns `true` if the value is a `CubicCurve2d`, `false` otherwise.
47
- * @since 1.0.0
48
- */
49
- declare const isCubicCurve2d: (c: unknown) => c is CubicCurve2d;
50
- declare const solve: {
51
- /**
52
- * Solves the cubic curve for a given parameter t.
53
- *
54
- * @param t - The parameter value.
55
- * @returns A function that takes a cubic curve and returns the point on the curve at parameter t.
56
- * @since 1.0.0
57
- */
58
- (t: number): (c: CubicCurve2d) => Vector2;
59
- /**
60
- * Solves the cubic curve for a given parameter t.
61
- *
62
- * @param c - The cubic 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: CubicCurve2d, t: number): Vector2;
68
- };
69
- declare const length: {
70
- /**
71
- * Calculates (approximates) the length of a cubic curve.
72
- *
73
- * @param c - The cubic curve to calculate the length of.
74
- * @param i - The interval over which to calculate the length.
75
- * @returns The length of the cubic curve.
76
- * @since 1.0.0
77
- */
78
- (c: CubicCurve2d, i: Interval): number;
79
- /**
80
- * Calculates (approximates) the length of a cubic curve.
81
- *
82
- * @param i - The interval over which to calculate the length.
83
- * @returns A function that takes a cubic curve and returns the length of the cubic curve.
84
- * @since 1.0.0
85
- */
86
- (i: Interval): (c: CubicCurve2d) => number;
87
- };
88
- declare const curvature: {
89
- /**
90
- * Calculates the curvature of a cubic curve at a given parameter.
91
- *
92
- * @param c - The cubic curve to calculate the curvature for.
93
- * @param t - The parameter value.
94
- * @returns The curvature of the cubic curve at parameter t.
95
- * @since 1.0.0
96
- */
97
- (c: CubicCurve2d, t: number): number;
98
- /**
99
- * Calculates the curvature of a cubic curve at a given parameter.
100
- *
101
- * @param t - The parameter value.
102
- * @returns A function that takes a cubic curve and returns the curvature of the cubic curve at parameter t.
103
- * @since 1.0.0
104
- */
105
- (t: number): (c: CubicCurve2d) => number;
106
- };
107
-
108
- export { curvature, fromPoints, fromPolynomials, isCubicCurve2d, length, solve };
109
- export type { CubicCurve2d };
@@ -1,109 +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 { C as CubicPolynomial } 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 CubicCurve2dTypeId: unique symbol;
10
- type CubicCurve2dTypeId = typeof CubicCurve2dTypeId;
11
-
12
- /**
13
- * A cubic 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 CubicCurve2d extends Pipeable, TwoDimensional<CubicPolynomial> {
20
- readonly [CubicCurve2dTypeId]: CubicCurve2dTypeId;
21
- }
22
- /**
23
- * Creates a new `CubicCurve2d` instance from polynomial parameters.
24
- *
25
- * @param x - The x polynomial.
26
- * @param y - The y polynomial.
27
- * @returns A new `CubicCurve2d` instance.
28
- * @since 1.0.0
29
- */
30
- declare const fromPolynomials: (x: CubicPolynomial, y: CubicPolynomial) => CubicCurve2d;
31
- /**
32
- * Creates a new `CubicCurve2d` 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
- * @param p2 - The x^2 coefficients for the x and y polynomials.
37
- * @param p3 - The x^3 coefficients for the x and y polynomials.
38
- * @returns A new `CubicCurve2d` instance.
39
- * @since 1.0.0
40
- */
41
- declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => CubicCurve2d;
42
- /**
43
- * Checks if a value is a `CubicCurve2d`.
44
- *
45
- * @param c - The value to check.
46
- * @returns `true` if the value is a `CubicCurve2d`, `false` otherwise.
47
- * @since 1.0.0
48
- */
49
- declare const isCubicCurve2d: (c: unknown) => c is CubicCurve2d;
50
- declare const solve: {
51
- /**
52
- * Solves the cubic curve for a given parameter t.
53
- *
54
- * @param t - The parameter value.
55
- * @returns A function that takes a cubic curve and returns the point on the curve at parameter t.
56
- * @since 1.0.0
57
- */
58
- (t: number): (c: CubicCurve2d) => Vector2;
59
- /**
60
- * Solves the cubic curve for a given parameter t.
61
- *
62
- * @param c - The cubic 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: CubicCurve2d, t: number): Vector2;
68
- };
69
- declare const length: {
70
- /**
71
- * Calculates (approximates) the length of a cubic curve.
72
- *
73
- * @param c - The cubic curve to calculate the length of.
74
- * @param i - The interval over which to calculate the length.
75
- * @returns The length of the cubic curve.
76
- * @since 1.0.0
77
- */
78
- (c: CubicCurve2d, i: Interval): number;
79
- /**
80
- * Calculates (approximates) the length of a cubic curve.
81
- *
82
- * @param i - The interval over which to calculate the length.
83
- * @returns A function that takes a cubic curve and returns the length of the cubic curve.
84
- * @since 1.0.0
85
- */
86
- (i: Interval): (c: CubicCurve2d) => number;
87
- };
88
- declare const curvature: {
89
- /**
90
- * Calculates the curvature of a cubic curve at a given parameter.
91
- *
92
- * @param c - The cubic curve to calculate the curvature for.
93
- * @param t - The parameter value.
94
- * @returns The curvature of the cubic curve at parameter t.
95
- * @since 1.0.0
96
- */
97
- (c: CubicCurve2d, t: number): number;
98
- /**
99
- * Calculates the curvature of a cubic curve at a given parameter.
100
- *
101
- * @param t - The parameter value.
102
- * @returns A function that takes a cubic curve and returns the curvature of the cubic curve at parameter t.
103
- * @since 1.0.0
104
- */
105
- (t: number): (c: CubicCurve2d) => number;
106
- };
107
-
108
- export { curvature, fromPoints, fromPolynomials, isCubicCurve2d, length, solve };
109
- export type { CubicCurve2d };
@@ -1,80 +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, solve as solve$2, derivative as derivative$2 } from '../polynomial/cubic.mjs';
5
- import { make as make$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 { solve as solve$4 } from './linear2d.mjs';
9
- import { length as length$2, fromPolynomials as fromPolynomials$2, solve as solve$3, derivative as derivative$1 } from './quadratic2d.mjs';
10
- import '../shared/curvy.BxdGW9he.mjs';
11
- import '../shared/curvy.r6f1j287.mjs';
12
- import '../shared/curvy.DJ4xO0al.mjs';
13
- import '../polynomial/linear.mjs';
14
-
15
- var _a, _b;
16
- const CubicCurve2dTypeId = Symbol("curvy/curve/cubic2d");
17
- class CubicCurve2dImpl extends (_b = Pipeable, _a = CubicCurve2dTypeId, _b) {
18
- constructor(c0, c1) {
19
- super();
20
- this[_a] = CubicCurve2dTypeId;
21
- this.x = c0;
22
- this.y = c1;
23
- }
24
- get [0]() {
25
- return this.x;
26
- }
27
- get [1]() {
28
- return this.y;
29
- }
30
- }
31
- const fromPolynomials$1 = (c0, c1) => new CubicCurve2dImpl(c0, c1);
32
- const fromPoints$1 = (p0, p1, p2, p3) => new CubicCurve2dImpl(
33
- make(p0.x, p1.x, p2.x, p3.x),
34
- make(p0.y, p1.y, p2.y, p3.y)
35
- );
36
- const isCubicCurve2d$1 = (c) => typeof c === "object" && c !== null && CubicCurve2dTypeId in c;
37
- const solve$1 = dual(
38
- 2,
39
- (c, t) => make$1(solve$2(c.x, t), solve$2(c.y, t))
40
- );
41
- const derivative = (c) => fromPolynomials$2(derivative$2(c.x), derivative$2(c.y));
42
- const length$1 = dual(2, (c, i) => {
43
- if (size(i) === 0) {
44
- return 0;
45
- }
46
- if (c.x.c3 === 0 && c.y.c3 === 0) {
47
- return length$2(
48
- fromPolynomials$2(
49
- make$2(c.x.c0, c.x.c1, c.x.c2),
50
- make$2(c.y.c0, c.y.c1, c.y.c2)
51
- ),
52
- i
53
- );
54
- }
55
- const d = derivative(c);
56
- const { scale, shift } = scaleShift(biunit, i);
57
- return round(
58
- (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
59
- );
60
- });
61
- const curvature$1 = dual(2, (c, t) => {
62
- const d = derivative(c);
63
- const v = solve$3(d, t);
64
- const a = solve$4(derivative$1(d), t);
65
- const vMag = magnitude(v);
66
- if (vMag === 0) {
67
- return 0;
68
- }
69
- return round(Math.abs(cross(v, a)) / vMag ** 3);
70
- });
71
-
72
- const fromPolynomials = fromPolynomials$1;
73
- const fromPoints = fromPoints$1;
74
- const isCubicCurve2d = isCubicCurve2d$1;
75
- const solve = solve$1;
76
- const length = length$1;
77
- const curvature = curvature$1;
78
-
79
- export { curvature, fromPoints, fromPolynomials, isCubicCurve2d, length, solve };
80
- //# sourceMappingURL=cubic2d.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cubic2d.mjs","sources":["../../src/curve/cubic2d.internal.ts","../../src/curve/cubic2d.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 CubicPolynomial from '../polynomial/cubic'\nimport * as QuadraticPolynomial from '../polynomial/quadratic'\nimport { round } from '../utils'\nimport * as Vector2 from '../vector/vector2'\nimport type { CubicCurve2d } from './cubic2d'\nimport * as LinearCurve2d from './linear2d'\nimport * as QuadraticCurve2d from './quadratic2d'\n\nexport const CubicCurve2dTypeId: unique symbol = Symbol('curvy/curve/cubic2d')\nexport type CubicCurve2dTypeId = typeof CubicCurve2dTypeId\n\nexport class CubicCurve2dImpl extends Pipeable implements CubicCurve2d {\n readonly [CubicCurve2dTypeId]: CubicCurve2dTypeId = CubicCurve2dTypeId\n\n readonly x: CubicPolynomial.CubicPolynomial\n readonly y: CubicPolynomial.CubicPolynomial\n\n constructor(c0: CubicPolynomial.CubicPolynomial, c1: CubicPolynomial.CubicPolynomial) {\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: CubicPolynomial.CubicPolynomial,\n c1: CubicPolynomial.CubicPolynomial,\n) => CubicCurve2d = (c0, c1) => new CubicCurve2dImpl(c0, c1)\n\nexport const fromPoints: (\n p0: Vector2.Vector2,\n p1: Vector2.Vector2,\n p2: Vector2.Vector2,\n p3: Vector2.Vector2,\n) => CubicCurve2d = (p0, p1, p2, p3) =>\n new CubicCurve2dImpl(\n CubicPolynomial.make(p0.x, p1.x, p2.x, p3.x),\n CubicPolynomial.make(p0.y, p1.y, p2.y, p3.y),\n )\n\nexport const isCubicCurve2d = (c: unknown): c is CubicCurve2d =>\n typeof c === 'object' && c !== null && CubicCurve2dTypeId in c\n\nexport const solve = dual<\n (t: number) => (c: CubicCurve2d) => Vector2.Vector2,\n (c: CubicCurve2d, t: number) => Vector2.Vector2\n>(2, (c: CubicCurve2d, t: number) =>\n Vector2.make(CubicPolynomial.solve(c.x, t), CubicPolynomial.solve(c.y, t)),\n)\n\nexport const derivative = (c: CubicCurve2d) =>\n QuadraticCurve2d.fromPolynomials(CubicPolynomial.derivative(c.x), CubicPolynomial.derivative(c.y))\n\nexport const length = dual(2, (c: CubicCurve2d, i: Interval.Interval) => {\n if (Interval.size(i) === 0) {\n return 0\n }\n\n if (c.x.c3 === 0 && c.y.c3 === 0) {\n return QuadraticCurve2d.length(\n QuadraticCurve2d.fromPolynomials(\n QuadraticPolynomial.make(c.x.c0, c.x.c1, c.x.c2),\n QuadraticPolynomial.make(c.y.c0, c.y.c1, c.y.c2),\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(QuadraticCurve2d.solve(d, shift + scale * -GL32_X0)) +\n GL32_W0 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X0)) +\n GL32_W1 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X1)) +\n GL32_W1 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X1)) +\n GL32_W2 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X2)) +\n GL32_W2 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X2)) +\n GL32_W3 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X3)) +\n GL32_W3 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X3)) +\n GL32_W4 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X4)) +\n GL32_W4 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X4)) +\n GL32_W5 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X5)) +\n GL32_W5 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X5)) +\n GL32_W6 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X6)) +\n GL32_W6 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X6)) +\n GL32_W7 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X7)) +\n GL32_W7 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X7)) +\n GL32_W8 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X8)) +\n GL32_W8 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X8)) +\n GL32_W9 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X9)) +\n GL32_W9 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X9)) +\n GL32_W10 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X10)) +\n GL32_W10 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X10)) +\n GL32_W11 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X11)) +\n GL32_W11 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X11)) +\n GL32_W12 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X12)) +\n GL32_W12 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X12)) +\n GL32_W13 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X13)) +\n GL32_W13 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X13)) +\n GL32_W14 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X14)) +\n GL32_W14 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X14)) +\n GL32_W15 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * -GL32_X15)) +\n GL32_W15 * Vector2.magnitude(QuadraticCurve2d.solve(d, shift + scale * GL32_X15))) *\n scale,\n )\n})\n\nexport const curvature = dual(2, (c: CubicCurve2d, t: number) => {\n const d = derivative(c)\n\n const v = QuadraticCurve2d.solve(d, t)\n const a = LinearCurve2d.solve(QuadraticCurve2d.derivative(d), t)\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 { CubicPolynomial } from '../polynomial/cubic'\nimport type { Vector2 } from '../vector/vector2'\nimport type { CubicCurve2dTypeId } from './cubic2d.internal'\nimport * as internal from './cubic2d.internal'\n\n/**\n * A cubic 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 CubicCurve2d extends Pipeable, TwoDimensional<CubicPolynomial> {\n readonly [CubicCurve2dTypeId]: CubicCurve2dTypeId\n}\n\n/**\n * Creates a new `CubicCurve2d` instance from polynomial parameters.\n *\n * @param x - The x polynomial.\n * @param y - The y polynomial.\n * @returns A new `CubicCurve2d` instance.\n * @since 1.0.0\n */\nexport const fromPolynomials: (x: CubicPolynomial, y: CubicPolynomial) => CubicCurve2d =\n internal.fromPolynomials\n\n/**\n * Creates a new `CubicCurve2d` 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 * @param p3 - The x^3 coefficients for the x and y polynomials.\n * @returns A new `CubicCurve2d` instance.\n * @since 1.0.0\n */\nexport const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => CubicCurve2d =\n internal.fromPoints\n\n/**\n * Checks if a value is a `CubicCurve2d`.\n *\n * @param c - The value to check.\n * @returns `true` if the value is a `CubicCurve2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isCubicCurve2d: (c: unknown) => c is CubicCurve2d = internal.isCubicCurve2d\n\nexport const solve: {\n /**\n * Solves the cubic curve for a given parameter t.\n *\n * @param t - The parameter value.\n * @returns A function that takes a cubic curve and returns the point on the curve at parameter t.\n * @since 1.0.0\n */\n (t: number): (c: CubicCurve2d) => Vector2\n /**\n * Solves the cubic curve for a given parameter t.\n *\n * @param c - The cubic 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: CubicCurve2d, t: number): Vector2\n} = internal.solve\n\nexport const length: {\n /**\n * Calculates (approximates) the length of a cubic curve.\n *\n * @param c - The cubic curve to calculate the length of.\n * @param i - The interval over which to calculate the length.\n * @returns The length of the cubic curve.\n * @since 1.0.0\n */\n (c: CubicCurve2d, i: Interval): number\n /**\n * Calculates (approximates) the length of a cubic curve.\n *\n * @param i - The interval over which to calculate the length.\n * @returns A function that takes a cubic curve and returns the length of the cubic curve.\n * @since 1.0.0\n */\n (i: Interval): (c: CubicCurve2d) => number\n} = internal.length\n\nexport const curvature: {\n /**\n * Calculates the curvature of a cubic curve at a given parameter.\n *\n * @param c - The cubic curve to calculate the curvature for.\n * @param t - The parameter value.\n * @returns The curvature of the cubic curve at parameter t.\n * @since 1.0.0\n */\n (c: CubicCurve2d, t: number): number\n /**\n * Calculates the curvature of a cubic curve at a given parameter.\n *\n * @param t - The parameter value.\n * @returns A function that takes a cubic curve and returns the curvature of the cubic curve at parameter t.\n * @since 1.0.0\n */\n (t: number): (c: CubicCurve2d) => number\n} = internal.curvature\n"],"names":["fromPolynomials","fromPoints","CubicPolynomial.make","isCubicCurve2d","solve","Vector2.make","CubicPolynomial.solve","QuadraticCurve2d.fromPolynomials","CubicPolynomial.derivative","length","Interval.size","QuadraticCurve2d.length","QuadraticPolynomial.make","Interval.scaleShift","Interval.biunit","Vector2.magnitude","QuadraticCurve2d.solve","curvature","LinearCurve2d.solve","QuadraticCurve2d.derivative","Vector2.cross","internal.fromPolynomials","internal.fromPoints","internal.isCubicCurve2d","internal.solve","internal.length","internal.curvature"],"mappings":";;;;;;;;;;;;;;AAAA,IAAA,EAAA,EAAA,EAAA;AA6Ca,MAAA,kBAAA,GAAoC,OAAO,qBAAqB,CAAA;AAGhE,MAAA,gBAAA,UAAyB,EAC1B,GAAA,QAAA,EAAA,EAAA,GAAA,kBAAA,EAD0B,EAAiC,EAAA;AAAA,EAMrE,WAAA,CAAY,IAAqC,EAAqC,EAAA;AACpF,IAAM,KAAA,EAAA;AANR,IAAA,IAAA,CAAU,EAA0C,CAAA,GAAA,kBAAA;AAOlD,IAAA,IAAA,CAAK,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Ac,KAAA;AAC/D,EAAM,MAAA,CAAA,GAAI,WAAW,CAAC,CAAA;AAEtB,EAAA,MAAM,CAAI,GAAAD,OAAuB,CAAA,CAAA,EAAG,CAAC,CAAA;AACrC,EAAA,MAAM,IAAIE,OAAc,CAAMC,YAA4B,CAAA,CAAC,GAAG,CAAC,CAAA;AAE/D,EAAM,MAAA,IAAA,GAAOJ,SAAQ,CAAU,CAAC,CAAA;AAEhC,EAAA,IAAI,SAAS,CAAG,EAAA;AACd,IAAO,OAAA,CAAA;AAAA;AAGT,EAAO,OAAA,KAAA,CAAM,IAAK,CAAA,GAAA,CAAIK,KAAQ,CAAM,GAAG,CAAC,CAAC,CAAI,GAAA,IAAA,IAAQ,CAAC,CAAA;AACxD,CAAC,CAAA;;AC5IM,MAAM,kBACXC;AAYK,MAAM,aACXC;AASK,MAAM,iBAAoDC;AAE1D,MAAM,QAkBTC;AAEG,MAAM,SAkBTC;AAEG,MAAM,YAkBTC;;;;"}
@@ -1,94 +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 { L as LinearPolynomial } from '../shared/curvy.FDaj5rlj.mjs';
5
- import { Vector2 } from '../vector/vector2.mjs';
6
- import '../vector/vector3.mjs';
7
- import '../vector/vector4.mjs';
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 };