curvy 1.0.8 → 1.0.9

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 (109) hide show
  1. package/dist/curve/cubic2d.d.mts +80 -2
  2. package/dist/curve/cubic2d.d.ts +80 -2
  3. package/dist/curve/cubic2d.mjs +9 -26
  4. package/dist/curve/cubic2d.mjs.map +1 -0
  5. package/dist/curve/linear2d.d.mts +68 -2
  6. package/dist/curve/linear2d.d.ts +68 -2
  7. package/dist/curve/linear2d.mjs +11 -14
  8. package/dist/curve/linear2d.mjs.map +1 -0
  9. package/dist/curve/quadratic2d.d.mts +86 -2
  10. package/dist/curve/quadratic2d.d.ts +86 -2
  11. package/dist/curve/quadratic2d.mjs +10 -15
  12. package/dist/curve/quadratic2d.mjs.map +1 -0
  13. package/dist/interval.d.mts +195 -2
  14. package/dist/interval.d.ts +195 -2
  15. package/dist/interval.mjs +9 -12
  16. package/dist/interval.mjs.map +1 -0
  17. package/dist/matrix/matrix2x2.d.mts +273 -2
  18. package/dist/matrix/matrix2x2.d.ts +273 -2
  19. package/dist/matrix/matrix2x2.mjs +5 -4
  20. package/dist/matrix/matrix2x2.mjs.map +1 -0
  21. package/dist/matrix/matrix3x3.d.mts +308 -1
  22. package/dist/matrix/matrix3x3.d.ts +308 -1
  23. package/dist/matrix/matrix3x3.mjs +5 -4
  24. package/dist/matrix/matrix3x3.mjs.map +1 -0
  25. package/dist/matrix/matrix4x4.d.mts +310 -1
  26. package/dist/matrix/matrix4x4.d.ts +310 -1
  27. package/dist/matrix/matrix4x4.mjs +24 -61
  28. package/dist/matrix/matrix4x4.mjs.map +1 -0
  29. package/dist/path/cubic2d.d.mts +68 -2
  30. package/dist/path/cubic2d.d.ts +68 -2
  31. package/dist/path/cubic2d.mjs +10 -12
  32. package/dist/path/cubic2d.mjs.map +1 -0
  33. package/dist/path/linear2d.d.mts +68 -2
  34. package/dist/path/linear2d.d.ts +68 -2
  35. package/dist/path/linear2d.mjs +7 -9
  36. package/dist/path/linear2d.mjs.map +1 -0
  37. package/dist/path/quadratic2d.d.mts +67 -2
  38. package/dist/path/quadratic2d.d.ts +67 -2
  39. package/dist/path/quadratic2d.mjs +9 -13
  40. package/dist/path/quadratic2d.mjs.map +1 -0
  41. package/dist/pipe.mjs +1 -0
  42. package/dist/pipe.mjs.map +1 -0
  43. package/dist/polynomial/cubic.d.mts +1 -1
  44. package/dist/polynomial/cubic.d.ts +1 -1
  45. package/dist/polynomial/cubic.mjs +13 -28
  46. package/dist/polynomial/cubic.mjs.map +1 -0
  47. package/dist/polynomial/linear.d.mts +1 -1
  48. package/dist/polynomial/linear.d.ts +1 -1
  49. package/dist/polynomial/linear.mjs +2 -1
  50. package/dist/polynomial/linear.mjs.map +1 -0
  51. package/dist/polynomial/quadratic.d.mts +2 -2
  52. package/dist/polynomial/quadratic.d.ts +2 -2
  53. package/dist/polynomial/quadratic.mjs +5 -2
  54. package/dist/polynomial/quadratic.mjs.map +1 -0
  55. package/dist/shared/{curvy.Cps2R_RU.mjs → curvy.BkkW8Tx9.mjs} +11 -29
  56. package/dist/shared/curvy.BkkW8Tx9.mjs.map +1 -0
  57. package/dist/shared/{curvy.BzVmUIKm.mjs → curvy.BxdGW9he.mjs} +17 -32
  58. package/dist/shared/curvy.BxdGW9he.mjs.map +1 -0
  59. package/dist/shared/{curvy.C2XGH0R0.mjs → curvy.C_sCeg9J.mjs} +15 -24
  60. package/dist/shared/curvy.C_sCeg9J.mjs.map +1 -0
  61. package/dist/shared/curvy.Cg8lZVUz.d.ts +688 -0
  62. package/dist/shared/{curvy.CE4X6_Is.mjs → curvy.DCt1gGII.mjs} +11 -45
  63. package/dist/shared/curvy.DCt1gGII.mjs.map +1 -0
  64. package/dist/shared/{curvy.BZ_mTkJe.mjs → curvy.DJ4xO0al.mjs} +9 -6
  65. package/dist/shared/curvy.DJ4xO0al.mjs.map +1 -0
  66. package/dist/shared/curvy.DmVFTi0N.mjs +1 -0
  67. package/dist/shared/curvy.DmVFTi0N.mjs.map +1 -0
  68. package/dist/shared/curvy.FDaj5rlj.d.mts +688 -0
  69. package/dist/shared/{curvy.Cv-wIzDr.mjs → curvy.lktriTpx.mjs} +19 -42
  70. package/dist/shared/curvy.lktriTpx.mjs.map +1 -0
  71. package/dist/shared/{curvy.wYJQhFW-.mjs → curvy.mLFprrGm.mjs} +14 -16
  72. package/dist/shared/curvy.mLFprrGm.mjs.map +1 -0
  73. package/dist/shared/{curvy.BDhiZ7He.mjs → curvy.r6f1j287.mjs} +8 -12
  74. package/dist/shared/curvy.r6f1j287.mjs.map +1 -0
  75. package/dist/splines/basis2d.d.mts +94 -2
  76. package/dist/splines/basis2d.d.ts +94 -2
  77. package/dist/splines/basis2d.mjs +13 -12
  78. package/dist/splines/basis2d.mjs.map +1 -0
  79. package/dist/splines/bezier2d.d.mts +136 -2
  80. package/dist/splines/bezier2d.d.ts +136 -2
  81. package/dist/splines/bezier2d.mjs +10 -9
  82. package/dist/splines/bezier2d.mjs.map +1 -0
  83. package/dist/splines/cardinal2d.d.mts +131 -2
  84. package/dist/splines/cardinal2d.d.ts +131 -2
  85. package/dist/splines/cardinal2d.mjs +15 -24
  86. package/dist/splines/cardinal2d.mjs.map +1 -0
  87. package/dist/splines/hermite2d.d.mts +94 -3
  88. package/dist/splines/hermite2d.d.ts +94 -3
  89. package/dist/splines/hermite2d.mjs +22 -36
  90. package/dist/splines/hermite2d.mjs.map +1 -0
  91. package/dist/utils.d.mts +179 -1
  92. package/dist/utils.d.ts +179 -1
  93. package/dist/utils.mjs +16 -7
  94. package/dist/utils.mjs.map +1 -0
  95. package/dist/vector/vector2.d.mts +259 -1
  96. package/dist/vector/vector2.d.ts +259 -1
  97. package/dist/vector/vector2.mjs +4 -2
  98. package/dist/vector/vector2.mjs.map +1 -0
  99. package/dist/vector/vector3.d.mts +341 -1
  100. package/dist/vector/vector3.d.ts +341 -1
  101. package/dist/vector/vector3.mjs +8 -2
  102. package/dist/vector/vector3.mjs.map +1 -0
  103. package/dist/vector/vector4.d.mts +163 -1
  104. package/dist/vector/vector4.d.ts +163 -1
  105. package/dist/vector/vector4.mjs +4 -2
  106. package/dist/vector/vector4.mjs.map +1 -0
  107. package/package.json +4 -4
  108. package/dist/shared/curvy.BsHoYJNv.d.ts +0 -155
  109. package/dist/shared/curvy.NsmY7zcr.d.mts +0 -155
@@ -3,27 +3,93 @@ import { Pipeable } from '../pipe.mjs';
3
3
  import { Vector2 } from '../vector/vector2.mjs';
4
4
  import '../shared/curvy.Bf5TIk31.mjs';
5
5
  import '../interval.mjs';
6
- import '../shared/curvy.NsmY7zcr.mjs';
6
+ import '../shared/curvy.FDaj5rlj.mjs';
7
7
  import '../vector/vector3.mjs';
8
8
  import '../vector/vector4.mjs';
9
9
 
10
10
  declare const CubicPath2dTypeId: unique symbol;
11
11
  type CubicPath2dTypeId = typeof CubicPath2dTypeId;
12
12
 
13
+ /**
14
+ * A cubic path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * @since 1.0.0
19
+ */
13
20
  interface CubicPath2d extends Pipeable, Iterable<CubicCurve2d> {
14
21
  readonly [CubicPath2dTypeId]: CubicPath2dTypeId;
15
22
  }
23
+ /**
24
+ * Creates a new `CubicPath2d` instance from curve parameters.
25
+ *
26
+ * @param curves - The curves to create the path from.
27
+ * @returns A new `CubicPath2d` instance.
28
+ * @since 1.0.0
29
+ */
16
30
  declare const fromCurves: (...curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
31
+ /**
32
+ * Creates a new `CubicPath2d` instance from an array of curves.
33
+ *
34
+ * @param curves - The curves to create the path from.
35
+ * @returns A new `CubicPath2d` instance.
36
+ * @since 1.0.0
37
+ */
17
38
  declare const fromCurveArray: (curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
39
+ /**
40
+ * Checks if a value is a `CubicPath2d`.
41
+ *
42
+ * @param p - The value to check.
43
+ * @returns `true` if the value is a `CubicPath2d`, `false` otherwise.
44
+ * @since 1.0.0
45
+ */
18
46
  declare const isCubicPath2d: (p: unknown) => p is CubicPath2d;
19
47
  declare const append: {
48
+ /**
49
+ * Appends a cubic curve to a cubic path.
50
+ *
51
+ * @param c - The cubic curve to append.
52
+ * @returns A function that takes a cubic path and returns a new cubic path.
53
+ * @since 1.0.0
54
+ */
20
55
  (c: CubicCurve2d): (p: CubicPath2d) => CubicPath2d;
56
+ /**
57
+ * Appends a cubic curve to a cubic path.
58
+ *
59
+ * @param p - The cubic path to append to.
60
+ * @param c - The cubic curve to append.
61
+ * @returns A new cubic path.
62
+ * @since 1.0.0
63
+ */
21
64
  (p: CubicPath2d, c: CubicCurve2d): CubicPath2d;
22
65
  };
66
+ /**
67
+ * Calculates the length of a cubic path.
68
+ *
69
+ * @param p - The cubic path to calculate the length of.
70
+ * @returns The length of the cubic path.
71
+ * @since 1.0.0
72
+ */
23
73
  declare const length: (p: CubicPath2d) => number;
24
74
  declare const solve: {
75
+ /**
76
+ * Solves a cubic path for a given parameter.
77
+ *
78
+ * @param u - The parameter to solve for.
79
+ * @returns A function that takes a cubic path and returns the solved vector.
80
+ * @since 1.0.0
81
+ */
25
82
  (u: number): (p: CubicPath2d) => Vector2;
83
+ /**
84
+ * Solves a cubic path for a given parameter.
85
+ *
86
+ * @param p - The cubic path to solve.
87
+ * @param u - The parameter to solve for.
88
+ * @returns The solved vector.
89
+ * @since 1.0.0
90
+ */
26
91
  (p: CubicPath2d, u: number): Vector2;
27
92
  };
28
93
 
29
- export { type CubicPath2d, append, fromCurveArray, fromCurves, isCubicPath2d, length, solve };
94
+ export { append, fromCurveArray, fromCurves, isCubicPath2d, length, solve };
95
+ export type { CubicPath2d };
@@ -3,27 +3,93 @@ import { Pipeable } from '../pipe.js';
3
3
  import { Vector2 } from '../vector/vector2.js';
4
4
  import '../shared/curvy.Bf5TIk31.js';
5
5
  import '../interval.js';
6
- import '../shared/curvy.BsHoYJNv.js';
6
+ import '../shared/curvy.Cg8lZVUz.js';
7
7
  import '../vector/vector3.js';
8
8
  import '../vector/vector4.js';
9
9
 
10
10
  declare const CubicPath2dTypeId: unique symbol;
11
11
  type CubicPath2dTypeId = typeof CubicPath2dTypeId;
12
12
 
13
+ /**
14
+ * A cubic path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * @since 1.0.0
19
+ */
13
20
  interface CubicPath2d extends Pipeable, Iterable<CubicCurve2d> {
14
21
  readonly [CubicPath2dTypeId]: CubicPath2dTypeId;
15
22
  }
23
+ /**
24
+ * Creates a new `CubicPath2d` instance from curve parameters.
25
+ *
26
+ * @param curves - The curves to create the path from.
27
+ * @returns A new `CubicPath2d` instance.
28
+ * @since 1.0.0
29
+ */
16
30
  declare const fromCurves: (...curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
31
+ /**
32
+ * Creates a new `CubicPath2d` instance from an array of curves.
33
+ *
34
+ * @param curves - The curves to create the path from.
35
+ * @returns A new `CubicPath2d` instance.
36
+ * @since 1.0.0
37
+ */
17
38
  declare const fromCurveArray: (curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
39
+ /**
40
+ * Checks if a value is a `CubicPath2d`.
41
+ *
42
+ * @param p - The value to check.
43
+ * @returns `true` if the value is a `CubicPath2d`, `false` otherwise.
44
+ * @since 1.0.0
45
+ */
18
46
  declare const isCubicPath2d: (p: unknown) => p is CubicPath2d;
19
47
  declare const append: {
48
+ /**
49
+ * Appends a cubic curve to a cubic path.
50
+ *
51
+ * @param c - The cubic curve to append.
52
+ * @returns A function that takes a cubic path and returns a new cubic path.
53
+ * @since 1.0.0
54
+ */
20
55
  (c: CubicCurve2d): (p: CubicPath2d) => CubicPath2d;
56
+ /**
57
+ * Appends a cubic curve to a cubic path.
58
+ *
59
+ * @param p - The cubic path to append to.
60
+ * @param c - The cubic curve to append.
61
+ * @returns A new cubic path.
62
+ * @since 1.0.0
63
+ */
21
64
  (p: CubicPath2d, c: CubicCurve2d): CubicPath2d;
22
65
  };
66
+ /**
67
+ * Calculates the length of a cubic path.
68
+ *
69
+ * @param p - The cubic path to calculate the length of.
70
+ * @returns The length of the cubic path.
71
+ * @since 1.0.0
72
+ */
23
73
  declare const length: (p: CubicPath2d) => number;
24
74
  declare const solve: {
75
+ /**
76
+ * Solves a cubic path for a given parameter.
77
+ *
78
+ * @param u - The parameter to solve for.
79
+ * @returns A function that takes a cubic path and returns the solved vector.
80
+ * @since 1.0.0
81
+ */
25
82
  (u: number): (p: CubicPath2d) => Vector2;
83
+ /**
84
+ * Solves a cubic path for a given parameter.
85
+ *
86
+ * @param p - The cubic path to solve.
87
+ * @param u - The parameter to solve for.
88
+ * @returns The solved vector.
89
+ * @since 1.0.0
90
+ */
26
91
  (p: CubicPath2d, u: number): Vector2;
27
92
  };
28
93
 
29
- export { type CubicPath2d, append, fromCurveArray, fromCurves, isCubicPath2d, length, solve };
94
+ export { append, fromCurveArray, fromCurves, isCubicPath2d, length, solve };
95
+ export type { CubicPath2d };
@@ -1,38 +1,35 @@
1
1
  import { length as length$2, solve as solve$2 } from '../curve/cubic2d.mjs';
2
2
  import { unit } from '../interval.mjs';
3
3
  import { dual, Pipeable } from '../pipe.mjs';
4
- import { round, invariant } from '../utils.mjs';
4
+ import { invariant, round } from '../utils.mjs';
5
5
  import '../shared/curvy.DmVFTi0N.mjs';
6
6
  import '../polynomial/cubic.mjs';
7
- import '../shared/curvy.BzVmUIKm.mjs';
8
- import '../shared/curvy.BDhiZ7He.mjs';
9
- import '../polynomial/quadratic.mjs';
7
+ import '../shared/curvy.BxdGW9he.mjs';
10
8
  import '../vector/vector2.mjs';
11
- import '../shared/curvy.BZ_mTkJe.mjs';
9
+ import '../shared/curvy.DJ4xO0al.mjs';
10
+ import '../shared/curvy.r6f1j287.mjs';
11
+ import '../polynomial/quadratic.mjs';
12
12
  import '../curve/linear2d.mjs';
13
13
  import '../polynomial/linear.mjs';
14
14
  import '../curve/quadratic2d.mjs';
15
15
 
16
+ var _a;
16
17
  const CubicPath2dTypeId = Symbol("curvy/path/cubic2d");
17
18
  class CubicPath2dImpl extends Pipeable {
18
- [CubicPath2dTypeId] = CubicPath2dTypeId;
19
- curves;
20
19
  constructor(curves) {
21
20
  invariant(curves.length > 0, "cubic path requires at least one curve");
22
21
  super();
22
+ this[_a] = CubicPath2dTypeId;
23
23
  this.curves = curves;
24
24
  }
25
- [Symbol.iterator]() {
25
+ [(_a = CubicPath2dTypeId, Symbol.iterator)]() {
26
26
  return this.curves[Symbol.iterator]();
27
27
  }
28
28
  }
29
29
  const isCubicPath2d$1 = (p) => typeof p === "object" && p !== null && CubicPath2dTypeId in p;
30
30
  const fromCurves$1 = (...curves) => new CubicPath2dImpl(curves);
31
31
  const fromCurveArray$1 = (curves) => new CubicPath2dImpl(curves);
32
- const append$1 = dual(
33
- 2,
34
- (p, c) => fromCurveArray$1([...p, c])
35
- );
32
+ const append$1 = dual(2, (p, c) => fromCurveArray$1([...p, c]));
36
33
  const length$1 = (p) => {
37
34
  let length2 = 0;
38
35
  for (const curve of p) {
@@ -60,3 +57,4 @@ const length = length$1;
60
57
  const solve = solve$1;
61
58
 
62
59
  export { append, fromCurveArray, fromCurves, isCubicPath2d, length, solve };
60
+ //# sourceMappingURL=cubic2d.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cubic2d.mjs","sources":["../../src/path/cubic2d.internal.ts","../../src/path/cubic2d.ts"],"sourcesContent":["import * as CubicCurve2d from '../curve/cubic2d'\nimport * as Interval from '../interval'\nimport { Pipeable } from '../pipe'\nimport { dual } from '../pipe'\nimport { invariant, round } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { CubicPath2d } from './cubic2d'\n\nexport const CubicPath2dTypeId: unique symbol = Symbol('curvy/path/cubic2d')\nexport type CubicPath2dTypeId = typeof CubicPath2dTypeId\n\nexport class CubicPath2dImpl extends Pipeable implements CubicPath2d {\n readonly [CubicPath2dTypeId]: CubicPath2dTypeId = CubicPath2dTypeId\n\n readonly curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>\n\n constructor(curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>) {\n invariant(curves.length > 0, 'cubic path requires at least one curve')\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<CubicCurve2d.CubicCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isCubicPath2d = (p: unknown): p is CubicPath2d =>\n typeof p === 'object' && p !== null && CubicPath2dTypeId in p\n\nexport const fromCurves = (...curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>): CubicPath2d =>\n new CubicPath2dImpl(curves)\n\nexport const fromCurveArray = (curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>): CubicPath2d =>\n new CubicPath2dImpl(curves)\n\nexport const append = dual<\n (c: CubicCurve2d.CubicCurve2d) => (p: CubicPath2d) => CubicPath2d,\n (p: CubicPath2d, c: CubicCurve2d.CubicCurve2d) => CubicPath2d\n>(2, (p: CubicPath2d, c: CubicCurve2d.CubicCurve2d) => fromCurveArray([...p, c]))\n\nexport const length = (p: CubicPath2d) => {\n let length = 0\n for (const curve of p) {\n length += CubicCurve2d.length(curve, Interval.unit)\n }\n\n return round(length)\n}\n\nexport const solve = dual<\n (u: number) => (p: CubicPath2d) => Vector2,\n (p: CubicPath2d, u: number) => Vector2\n>(2, (p: CubicPath2d, u: number) => {\n const curves = p instanceof CubicPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as CubicCurve2d.CubicCurve2d\n return CubicCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as CubicCurve2d.CubicCurve2d\n return CubicCurve2d.solve(curve, t - i)\n})\n","import type { CubicCurve2d } from '../curve/cubic2d'\nimport type { Pipeable } from '../pipe'\nimport type { Vector2 } from '../vector/vector2'\nimport type { CubicPath2dTypeId } from './cubic2d.internal'\nimport * as internal from './cubic2d.internal'\n\n/**\n * A cubic path 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 CubicPath2d extends Pipeable, Iterable<CubicCurve2d> {\n readonly [CubicPath2dTypeId]: CubicPath2dTypeId\n}\n\n/**\n * Creates a new `CubicPath2d` instance from curve parameters.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `CubicPath2d` instance.\n * @since 1.0.0\n */\nexport const fromCurves: (...curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d =\n internal.fromCurves\n\n/**\n * Creates a new `CubicPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `CubicPath2d` instance.\n * @since 1.0.0\n */\nexport const fromCurveArray: (curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d =\n internal.fromCurveArray\n\n/**\n * Checks if a value is a `CubicPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `CubicPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isCubicPath2d: (p: unknown) => p is CubicPath2d = internal.isCubicPath2d\n\nexport const append: {\n /**\n * Appends a cubic curve to a cubic path.\n *\n * @param c - The cubic curve to append.\n * @returns A function that takes a cubic path and returns a new cubic path.\n * @since 1.0.0\n */\n (c: CubicCurve2d): (p: CubicPath2d) => CubicPath2d\n /**\n * Appends a cubic curve to a cubic path.\n *\n * @param p - The cubic path to append to.\n * @param c - The cubic curve to append.\n * @returns A new cubic path.\n * @since 1.0.0\n */\n (p: CubicPath2d, c: CubicCurve2d): CubicPath2d\n} = internal.append\n\n/**\n * Calculates the length of a cubic path.\n *\n * @param p - The cubic path to calculate the length of.\n * @returns The length of the cubic path.\n * @since 1.0.0\n */\nexport const length: (p: CubicPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a cubic path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a cubic path and returns the solved vector.\n * @since 1.0.0\n */\n (u: number): (p: CubicPath2d) => Vector2\n /**\n * Solves a cubic path for a given parameter.\n *\n * @param p - The cubic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved vector.\n * @since 1.0.0\n */\n (p: CubicPath2d, u: number): Vector2\n} = internal.solve\n"],"names":["isCubicPath2d","fromCurves","fromCurveArray","append","length","CubicCurve2d.length","Interval.unit","solve","CubicCurve2d.solve","internal.fromCurves","internal.fromCurveArray","internal.isCubicPath2d","internal.append","internal.length","internal.solve"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAA,EAAA;AAQa,MAAA,iBAAA,GAAmC,OAAO,oBAAoB,CAAA;AAGpE,MAAM,wBAAwB,QAAgC,CAAA;AAAA,EAKnE,YAAY,MAAkD,EAAA;AAC5D,IAAU,SAAA,CAAA,MAAA,CAAO,MAAS,GAAA,CAAA,EAAG,wCAAwC,CAAA;AACrE,IAAM,KAAA,EAAA;AANR,IAAA,IAAA,CAAU,EAAwC,CAAA,GAAA,iBAAA;AAOhD,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AAAA;AAChB,EAEA,EAVU,EAAA,GAAA,iBAAA,EAUT,MAAO,CAAA,QAAA,EAAiD,GAAA;AACvD,IAAA,OAAO,IAAK,CAAA,MAAA,CAAO,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAExC;AAEa,MAAAA,eAAA,GAAgB,CAAC,CAC5B,KAAA,OAAO,MAAM,QAAY,IAAA,CAAA,KAAM,QAAQ,iBAAqB,IAAA,CAAA;AAEvD,MAAMC,YAAa,GAAA,CAAA,GAAI,MAC5B,KAAA,IAAI,gBAAgB,MAAM,CAAA;AAErB,MAAMC,gBAAiB,GAAA,CAAC,MAC7B,KAAA,IAAI,gBAAgB,MAAM,CAAA;AAErB,MAAMC,QAAS,GAAA,IAAA,CAGpB,CAAG,EAAA,CAAC,CAAgB,EAAA,CAAA,KAAiCD,gBAAe,CAAA,CAAC,GAAG,CAAA,EAAG,CAAC,CAAC,CAAC,CAAA;AAEnE,MAAAE,QAAA,GAAS,CAAC,CAAmB,KAAA;AACxC,EAAA,IAAIA,OAAS,GAAA,CAAA;AACb,EAAA,KAAA,MAAW,SAAS,CAAG,EAAA;AACrB,IAAAA,OAAU,IAAAC,QAAoB,CAAA,KAAA,EAAOC,IAAa,CAAA;AAAA;AAGpD,EAAA,OAAO,MAAMF,OAAM,CAAA;AACrB,CAAA;AAEO,MAAMG,OAAQ,GAAA,IAAA,CAGnB,CAAG,EAAA,CAAC,GAAgB,CAAc,KAAA;AAClC,EAAA,MAAM,SAAS,CAAa,YAAA,eAAA,GAAkB,EAAE,MAAS,GAAA,CAAC,GAAG,CAAC,CAAA;AAE9D,EAAA,IAAI,MAAM,CAAG,EAAA;AACX,IAAM,MAAA,IAAA,GAAO,MAAO,CAAA,EAAA,CAAG,EAAE,CAAA;AACzB,IAAO,OAAAC,OAAmB,CAAA,IAAA,EAAM,CAAC,CAAA;AAAA;AAGnC,EAAM,MAAA,CAAA,GAAI,IAAI,MAAO,CAAA,MAAA;AACrB,EAAM,MAAA,CAAA,GAAI,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA;AACtB,EAAM,MAAA,KAAA,GAAQ,OAAO,CAAC,CAAA;AACtB,EAAA,OAAOA,OAAa,CAAM,KAAO,EAAA,CAAA,GAAI,CAAC,CAAA;AACxC,CAAC,CAAA;;ACzCM,MAAM,aACXC;AASK,MAAM,iBACXC;AASK,MAAM,gBAAkDC;AAExD,MAAM,SAkBTC;AASG,MAAM,SAAqCC;AAE3C,MAAM,QAkBTC;;;;"}
@@ -3,27 +3,93 @@ import { Pipeable } from '../pipe.mjs';
3
3
  import { Vector2 } from '../vector/vector2.mjs';
4
4
  import '../shared/curvy.Bf5TIk31.mjs';
5
5
  import '../interval.mjs';
6
- import '../shared/curvy.NsmY7zcr.mjs';
6
+ import '../shared/curvy.FDaj5rlj.mjs';
7
7
  import '../vector/vector3.mjs';
8
8
  import '../vector/vector4.mjs';
9
9
 
10
10
  declare const LinearPath2dTypeId: unique symbol;
11
11
  type LinearPath2dTypeId = typeof LinearPath2dTypeId;
12
12
 
13
+ /**
14
+ * A linear path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * @since 1.0.0
19
+ */
13
20
  interface LinearPath2d extends Pipeable, Iterable<LinearCurve2d> {
14
21
  readonly [LinearPath2dTypeId]: LinearPath2dTypeId;
15
22
  }
23
+ /**
24
+ * Creates a new `LinearPath2d` instance from curve parameters.
25
+ *
26
+ * @param curves - The curves to create the path from.
27
+ * @returns A new `LinearPath2d` instance.
28
+ * @since 1.0.0
29
+ */
16
30
  declare const fromCurves: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
31
+ /**
32
+ * Creates a new `LinearPath2d` instance from an array of curves.
33
+ *
34
+ * @param curves - The curves to create the path from.
35
+ * @returns A new `LinearPath2d` instance.
36
+ * @since 1.0.0
37
+ */
17
38
  declare const fromCurveArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
39
+ /**
40
+ * Checks if a value is a `LinearPath2d`.
41
+ *
42
+ * @param p - The value to check.
43
+ * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.
44
+ * @since 1.0.0
45
+ */
18
46
  declare const isLinearPath2d: (p: unknown) => p is LinearPath2d;
19
47
  declare const append: {
48
+ /**
49
+ * Appends a linear curve to a linear path.
50
+ *
51
+ * @param c - The linear curve to append.
52
+ * @returns A function that takes a linear path and returns a new linear path.
53
+ * @since 1.0.0
54
+ */
20
55
  (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d;
56
+ /**
57
+ * Appends a linear curve to a linear path.
58
+ *
59
+ * @param p - The linear path to append to.
60
+ * @param c - The linear curve to append.
61
+ * @returns A new `LinearPath2d` instance with the appended curve.
62
+ * @since 1.0.0
63
+ */
21
64
  (p: LinearPath2d, c: LinearCurve2d): LinearPath2d;
22
65
  };
66
+ /**
67
+ * Calculates the length of a linear path.
68
+ *
69
+ * @param p - The linear path to calculate the length of.
70
+ * @returns The length of the linear path.
71
+ * @since 1.0.0
72
+ */
23
73
  declare const length: (p: LinearPath2d) => number;
24
74
  declare const solve: {
75
+ /**
76
+ * Solves a linear path for a given parameter.
77
+ *
78
+ * @param u - The parameter to solve for.
79
+ * @returns A function that takes a linear path and returns the solved point.
80
+ * @since 1.0.0
81
+ */
25
82
  (u: number): (p: LinearPath2d) => Vector2;
83
+ /**
84
+ * Solves a linear path for a given parameter.
85
+ *
86
+ * @param p - The linear path to solve.
87
+ * @param u - The parameter to solve for.
88
+ * @returns The solved point on the linear path.
89
+ * @since 1.0.0
90
+ */
26
91
  (p: LinearPath2d, u: number): Vector2;
27
92
  };
28
93
 
29
- export { type LinearPath2d, append, fromCurveArray, fromCurves, isLinearPath2d, length, solve };
94
+ export { append, fromCurveArray, fromCurves, isLinearPath2d, length, solve };
95
+ export type { LinearPath2d };
@@ -3,27 +3,93 @@ import { Pipeable } from '../pipe.js';
3
3
  import { Vector2 } from '../vector/vector2.js';
4
4
  import '../shared/curvy.Bf5TIk31.js';
5
5
  import '../interval.js';
6
- import '../shared/curvy.BsHoYJNv.js';
6
+ import '../shared/curvy.Cg8lZVUz.js';
7
7
  import '../vector/vector3.js';
8
8
  import '../vector/vector4.js';
9
9
 
10
10
  declare const LinearPath2dTypeId: unique symbol;
11
11
  type LinearPath2dTypeId = typeof LinearPath2dTypeId;
12
12
 
13
+ /**
14
+ * A linear path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * @since 1.0.0
19
+ */
13
20
  interface LinearPath2d extends Pipeable, Iterable<LinearCurve2d> {
14
21
  readonly [LinearPath2dTypeId]: LinearPath2dTypeId;
15
22
  }
23
+ /**
24
+ * Creates a new `LinearPath2d` instance from curve parameters.
25
+ *
26
+ * @param curves - The curves to create the path from.
27
+ * @returns A new `LinearPath2d` instance.
28
+ * @since 1.0.0
29
+ */
16
30
  declare const fromCurves: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
31
+ /**
32
+ * Creates a new `LinearPath2d` instance from an array of curves.
33
+ *
34
+ * @param curves - The curves to create the path from.
35
+ * @returns A new `LinearPath2d` instance.
36
+ * @since 1.0.0
37
+ */
17
38
  declare const fromCurveArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
39
+ /**
40
+ * Checks if a value is a `LinearPath2d`.
41
+ *
42
+ * @param p - The value to check.
43
+ * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.
44
+ * @since 1.0.0
45
+ */
18
46
  declare const isLinearPath2d: (p: unknown) => p is LinearPath2d;
19
47
  declare const append: {
48
+ /**
49
+ * Appends a linear curve to a linear path.
50
+ *
51
+ * @param c - The linear curve to append.
52
+ * @returns A function that takes a linear path and returns a new linear path.
53
+ * @since 1.0.0
54
+ */
20
55
  (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d;
56
+ /**
57
+ * Appends a linear curve to a linear path.
58
+ *
59
+ * @param p - The linear path to append to.
60
+ * @param c - The linear curve to append.
61
+ * @returns A new `LinearPath2d` instance with the appended curve.
62
+ * @since 1.0.0
63
+ */
21
64
  (p: LinearPath2d, c: LinearCurve2d): LinearPath2d;
22
65
  };
66
+ /**
67
+ * Calculates the length of a linear path.
68
+ *
69
+ * @param p - The linear path to calculate the length of.
70
+ * @returns The length of the linear path.
71
+ * @since 1.0.0
72
+ */
23
73
  declare const length: (p: LinearPath2d) => number;
24
74
  declare const solve: {
75
+ /**
76
+ * Solves a linear path for a given parameter.
77
+ *
78
+ * @param u - The parameter to solve for.
79
+ * @returns A function that takes a linear path and returns the solved point.
80
+ * @since 1.0.0
81
+ */
25
82
  (u: number): (p: LinearPath2d) => Vector2;
83
+ /**
84
+ * Solves a linear path for a given parameter.
85
+ *
86
+ * @param p - The linear path to solve.
87
+ * @param u - The parameter to solve for.
88
+ * @returns The solved point on the linear path.
89
+ * @since 1.0.0
90
+ */
26
91
  (p: LinearPath2d, u: number): Vector2;
27
92
  };
28
93
 
29
- export { type LinearPath2d, append, fromCurveArray, fromCurves, isLinearPath2d, length, solve };
94
+ export { append, fromCurveArray, fromCurves, isLinearPath2d, length, solve };
95
+ export type { LinearPath2d };
@@ -3,29 +3,26 @@ import { unit } from '../interval.mjs';
3
3
  import { dual, Pipeable } from '../pipe.mjs';
4
4
  import { round } from '../utils.mjs';
5
5
  import '../polynomial/linear.mjs';
6
- import '../shared/curvy.BDhiZ7He.mjs';
6
+ import '../shared/curvy.r6f1j287.mjs';
7
7
  import '../vector/vector2.mjs';
8
- import '../shared/curvy.BZ_mTkJe.mjs';
8
+ import '../shared/curvy.DJ4xO0al.mjs';
9
9
 
10
+ var _a;
10
11
  const LinearPath2dTypeId = Symbol("curvy/path/linear2d");
11
12
  class LinearPath2dImpl extends Pipeable {
12
- [LinearPath2dTypeId] = LinearPath2dTypeId;
13
- curves;
14
13
  constructor(curves) {
15
14
  super();
15
+ this[_a] = LinearPath2dTypeId;
16
16
  this.curves = curves;
17
17
  }
18
- [Symbol.iterator]() {
18
+ [(_a = LinearPath2dTypeId, Symbol.iterator)]() {
19
19
  return this.curves[Symbol.iterator]();
20
20
  }
21
21
  }
22
22
  const isLinearPath2d$1 = (p) => typeof p === "object" && p !== null && LinearPath2dTypeId in p;
23
23
  const fromCurves$1 = (...curves) => new LinearPath2dImpl(curves);
24
24
  const fromCurveArray$1 = (curves) => new LinearPath2dImpl(curves);
25
- const append$1 = dual(
26
- 2,
27
- (p, c) => fromCurveArray$1([...p, c])
28
- );
25
+ const append$1 = dual(2, (p, c) => fromCurveArray$1([...p, c]));
29
26
  const length$1 = (p) => {
30
27
  let length2 = 0;
31
28
  for (const curve of p) {
@@ -53,3 +50,4 @@ const length = length$1;
53
50
  const solve = solve$1;
54
51
 
55
52
  export { append, fromCurveArray, fromCurves, isLinearPath2d, length, solve };
53
+ //# sourceMappingURL=linear2d.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear2d.mjs","sources":["../../src/path/linear2d.internal.ts","../../src/path/linear2d.ts"],"sourcesContent":["import * as LinearCurve2d from '../curve/linear2d'\nimport * as Interval from '../interval'\nimport { Pipeable } from '../pipe'\nimport { dual } from '../pipe'\nimport { round } from '../utils'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2d } from './linear2d'\n\nexport const LinearPath2dTypeId: unique symbol = Symbol('curvy/path/linear2d')\nexport type LinearPath2dTypeId = typeof LinearPath2dTypeId\n\nexport class LinearPath2dImpl extends Pipeable implements LinearPath2d {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId = LinearPath2dTypeId\n\n readonly curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>\n\n constructor(curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) {\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<LinearCurve2d.LinearCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\nexport const isLinearPath2d = (p: unknown): p is LinearPath2d =>\n typeof p === 'object' && p !== null && LinearPath2dTypeId in p\n\nexport const fromCurves = (...curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>): LinearPath2d =>\n new LinearPath2dImpl(curves)\n\nexport const fromCurveArray = (curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>) =>\n new LinearPath2dImpl(curves)\n\nexport const append = dual<\n (c: LinearCurve2d.LinearCurve2d) => (p: LinearPath2d) => LinearPath2d,\n (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => LinearPath2d\n>(2, (p: LinearPath2d, c: LinearCurve2d.LinearCurve2d) => fromCurveArray([...p, c]))\n\nexport const length = (p: LinearPath2d) => {\n let length = 0\n for (const curve of p) {\n length += LinearCurve2d.length(curve, Interval.unit)\n }\n\n return round(length)\n}\n\nexport const solve = dual<\n (u: number) => (p: LinearPath2d) => Vector2,\n (p: LinearPath2d, u: number) => Vector2\n>(2, (p: LinearPath2d, u: number) => {\n const curves = p instanceof LinearPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as LinearCurve2d.LinearCurve2d\n return LinearCurve2d.solve(curve, t - i)\n})\n","import type { LinearCurve2d } from '../curve/linear2d'\nimport type { Pipeable } from '../pipe'\nimport type { Vector2 } from '../vector/vector2'\nimport type { LinearPath2dTypeId } from './linear2d.internal'\nimport * as internal from './linear2d.internal'\n\n/**\n * A linear path 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 LinearPath2d extends Pipeable, Iterable<LinearCurve2d> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId\n}\n\n/**\n * Creates a new `LinearPath2d` instance from curve parameters.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 1.0.0\n */\nexport const fromCurves: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d =\n internal.fromCurves\n\n/**\n * Creates a new `LinearPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 1.0.0\n */\nexport const fromCurveArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d =\n internal.fromCurveArray\n\n/**\n * Checks if a value is a `LinearPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPath2d: (p: unknown) => p is LinearPath2d = internal.isLinearPath2d\n\nexport const append: {\n /**\n * Appends a linear curve to a linear path.\n *\n * @param c - The linear curve to append.\n * @returns A function that takes a linear path and returns a new linear path.\n * @since 1.0.0\n */\n (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d\n /**\n * Appends a linear curve to a linear path.\n *\n * @param p - The linear path to append to.\n * @param c - The linear curve to append.\n * @returns A new `LinearPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: LinearPath2d, c: LinearCurve2d): LinearPath2d\n} = internal.append\n\n/**\n * Calculates the length of a linear path.\n *\n * @param p - The linear path to calculate the length of.\n * @returns The length of the linear path.\n * @since 1.0.0\n */\nexport const length: (p: LinearPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a linear path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a linear path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: LinearPath2d) => Vector2\n /**\n * Solves a linear path for a given parameter.\n *\n * @param p - The linear path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point on the linear path.\n * @since 1.0.0\n */\n (p: LinearPath2d, u: number): Vector2\n} = internal.solve\n"],"names":["isLinearPath2d","fromCurves","fromCurveArray","append","length","LinearCurve2d.length","Interval.unit","solve","LinearCurve2d.solve","internal.fromCurves","internal.fromCurveArray","internal.isLinearPath2d","internal.append","internal.length","internal.solve"],"mappings":";;;;;;;;;AAAA,IAAA,EAAA;AAQa,MAAA,kBAAA,GAAoC,OAAO,qBAAqB,CAAA;AAGtE,MAAM,yBAAyB,QAAiC,CAAA;AAAA,EAKrE,YAAY,MAAoD,EAAA;AAC9D,IAAM,KAAA,EAAA;AALR,IAAA,IAAA,CAAU,EAA0C,CAAA,GAAA,kBAAA;AAMlD,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AAAA;AAChB,EAEA,EATU,EAAA,GAAA,kBAAA,EAST,MAAO,CAAA,QAAA,EAAmD,GAAA;AACzD,IAAA,OAAO,IAAK,CAAA,MAAA,CAAO,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAExC;AAEa,MAAAA,gBAAA,GAAiB,CAAC,CAC7B,KAAA,OAAO,MAAM,QAAY,IAAA,CAAA,KAAM,QAAQ,kBAAsB,IAAA,CAAA;AAExD,MAAMC,YAAa,GAAA,CAAA,GAAI,MAC5B,KAAA,IAAI,iBAAiB,MAAM,CAAA;AAEtB,MAAMC,gBAAiB,GAAA,CAAC,MAC7B,KAAA,IAAI,iBAAiB,MAAM,CAAA;AAEtB,MAAMC,QAAS,GAAA,IAAA,CAGpB,CAAG,EAAA,CAAC,CAAiB,EAAA,CAAA,KAAmCD,gBAAe,CAAA,CAAC,GAAG,CAAA,EAAG,CAAC,CAAC,CAAC,CAAA;AAEtE,MAAAE,QAAA,GAAS,CAAC,CAAoB,KAAA;AACzC,EAAA,IAAIA,OAAS,GAAA,CAAA;AACb,EAAA,KAAA,MAAW,SAAS,CAAG,EAAA;AACrB,IAAAA,OAAU,IAAAC,QAAqB,CAAA,KAAA,EAAOC,IAAa,CAAA;AAAA;AAGrD,EAAA,OAAO,MAAMF,OAAM,CAAA;AACrB,CAAA;AAEO,MAAMG,OAAQ,GAAA,IAAA,CAGnB,CAAG,EAAA,CAAC,GAAiB,CAAc,KAAA;AACnC,EAAA,MAAM,SAAS,CAAa,YAAA,gBAAA,GAAmB,EAAE,MAAS,GAAA,CAAC,GAAG,CAAC,CAAA;AAE/D,EAAA,IAAI,MAAM,CAAG,EAAA;AACX,IAAM,MAAA,IAAA,GAAO,MAAO,CAAA,EAAA,CAAG,EAAE,CAAA;AACzB,IAAO,OAAAC,OAAoB,CAAA,IAAA,EAAM,CAAC,CAAA;AAAA;AAGpC,EAAM,MAAA,CAAA,GAAI,IAAI,MAAO,CAAA,MAAA;AACrB,EAAM,MAAA,CAAA,GAAI,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA;AACtB,EAAM,MAAA,KAAA,GAAQ,OAAO,CAAC,CAAA;AACtB,EAAA,OAAOA,OAAc,CAAM,KAAO,EAAA,CAAA,GAAI,CAAC,CAAA;AACzC,CAAC,CAAA;;ACxCM,MAAM,aACXC;AASK,MAAM,iBACXC;AASK,MAAM,iBAAoDC;AAE1D,MAAM,SAkBTC;AASG,MAAM,SAAsCC;AAE5C,MAAM,QAkBTC;;;;"}
@@ -3,7 +3,7 @@ import { Pipeable } from '../pipe.mjs';
3
3
  import { Vector2 } from '../vector/vector2.mjs';
4
4
  import '../shared/curvy.Bf5TIk31.mjs';
5
5
  import '../interval.mjs';
6
- import '../shared/curvy.NsmY7zcr.mjs';
6
+ import '../shared/curvy.FDaj5rlj.mjs';
7
7
  import '../vector/vector3.mjs';
8
8
  import '../vector/vector4.mjs';
9
9
  import '../curve/linear2d.mjs';
@@ -11,20 +11,85 @@ import '../curve/linear2d.mjs';
11
11
  declare const QuadraticPath2dTypeId: unique symbol;
12
12
  type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId;
13
13
 
14
+ /**
15
+ * A quadratic path in 2D space.
16
+ *
17
+ * All fields are readonly and immutable, and all operations create new instances.
18
+ *
19
+ * @since 1.0.0
20
+ */
14
21
  interface QuadraticPath2d extends Pipeable, Iterable<QuadraticCurve2d> {
15
22
  readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId;
16
23
  }
24
+ /**
25
+ * Creates a new `QuadraticPath2d` instance from curve parameters.
26
+ *
27
+ * @param curves - The curves to create the path from.
28
+ * @returns A new `QuadraticPath2d` instance.
29
+ * @since 1.0.0
30
+ */
17
31
  declare const fromCurves: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d;
32
+ /**
33
+ * Creates a new `QuadraticPath2d` instance from an array of curves.
34
+ *
35
+ * @param curves - The curves to create the path from.
36
+ * @returns A new `QuadraticPath2d` instance.
37
+ * @since 1.0.0
38
+ */
18
39
  declare const fromCurveArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d;
40
+ /**
41
+ * Checks if a value is a `QuadraticPath2d`.
42
+ *
43
+ * @param p - The value to check.
44
+ * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.
45
+ * @since 1.0.0
46
+ */
19
47
  declare const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d;
20
48
  declare const append: {
49
+ /**
50
+ * Appends a quadratic curve to a quadratic path.
51
+ *
52
+ * @param c - The quadratic curve to append.
53
+ * @returns A function that takes a quadratic path and returns a new quadratic path.
54
+ * @since 1.0.0
55
+ */
21
56
  (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d;
57
+ /**
58
+ * Appends a quadratic curve to a quadratic path.
59
+ *
60
+ * @param p - The quadratic path to append to.
61
+ * @param c - The quadratic curve to append.
62
+ * @returns A new `QuadraticPath2d` instance with the appended curve.
63
+ * @since 1.0.0
64
+ */
22
65
  (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d;
23
66
  };
67
+ /**
68
+ * Calculates the length of a quadratic path.
69
+ *
70
+ * @param p - The quadratic path to calculate the length of.
71
+ * @returns The length of the path.
72
+ */
24
73
  declare const length: (p: QuadraticPath2d) => number;
25
74
  declare const solve: {
75
+ /**
76
+ * Solves a quadratic path at a given parameter.
77
+ *
78
+ * @param u - The parameter to solve for.
79
+ * @returns A function that takes a quadratic path and returns the solved point.
80
+ * @since 1.0.0
81
+ */
26
82
  (u: number): (p: QuadraticPath2d) => Vector2;
83
+ /**
84
+ * Solves a quadratic path at a given parameter.
85
+ *
86
+ * @param p - The quadratic path to solve.
87
+ * @param u - The parameter to solve for.
88
+ * @returns The solved point.
89
+ * @since 1.0.0
90
+ */
27
91
  (p: QuadraticPath2d, u: number): Vector2;
28
92
  };
29
93
 
30
- export { type QuadraticPath2d, append, fromCurveArray, fromCurves, isQuadraticPath2d, length, solve };
94
+ export { append, fromCurveArray, fromCurves, isQuadraticPath2d, length, solve };
95
+ export type { QuadraticPath2d };