curvy 1.0.0 → 1.0.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 (72) hide show
  1. package/dist/curve/cubic2d.d.mts +7 -3
  2. package/dist/curve/cubic2d.d.ts +7 -3
  3. package/dist/curve/cubic2d.mjs +22 -11
  4. package/dist/curve/linear2d.d.mts +4 -3
  5. package/dist/curve/linear2d.d.ts +4 -3
  6. package/dist/curve/linear2d.mjs +6 -4
  7. package/dist/curve/quadratic2d.d.mts +9 -3
  8. package/dist/curve/quadratic2d.d.ts +9 -3
  9. package/dist/curve/quadratic2d.mjs +24 -12
  10. package/dist/interval.mjs +1 -1
  11. package/dist/matrix/matrix2x2.d.mts +1 -1
  12. package/dist/matrix/matrix2x2.d.ts +1 -1
  13. package/dist/matrix/matrix2x2.mjs +3 -3
  14. package/dist/matrix/matrix3x3.d.mts +1 -1
  15. package/dist/matrix/matrix3x3.d.ts +1 -1
  16. package/dist/matrix/matrix3x3.mjs +5 -5
  17. package/dist/matrix/matrix4x4.d.mts +1 -1
  18. package/dist/matrix/matrix4x4.d.ts +1 -1
  19. package/dist/matrix/matrix4x4.mjs +6 -6
  20. package/dist/path/cubic2d.d.mts +2 -2
  21. package/dist/path/cubic2d.d.ts +2 -2
  22. package/dist/path/cubic2d.mjs +7 -6
  23. package/dist/path/linear2d.d.mts +2 -2
  24. package/dist/path/linear2d.d.ts +2 -2
  25. package/dist/path/linear2d.mjs +3 -3
  26. package/dist/path/quadratic2d.d.mts +3 -2
  27. package/dist/path/quadratic2d.d.ts +3 -2
  28. package/dist/path/quadratic2d.mjs +4 -4
  29. package/dist/polynomial/cubic.d.mts +2 -2
  30. package/dist/polynomial/cubic.d.ts +2 -2
  31. package/dist/polynomial/cubic.mjs +12 -4
  32. package/dist/polynomial/linear.d.mts +2 -2
  33. package/dist/polynomial/linear.d.ts +2 -2
  34. package/dist/polynomial/linear.mjs +6 -3
  35. package/dist/polynomial/quadratic.d.mts +2 -2
  36. package/dist/polynomial/quadratic.d.ts +2 -2
  37. package/dist/polynomial/quadratic.mjs +5 -4
  38. package/dist/shared/{curvy.Cty3LrOR.mjs → curvy.B1zfBfvf.mjs} +6 -2
  39. package/dist/shared/{curvy.DOLqYbKE.mjs → curvy.BPOevbwG.mjs} +8 -8
  40. package/dist/shared/{curvy.CT38g_II.d.mts → curvy.Bf5TIk31.d.mts} +1 -1
  41. package/dist/shared/{curvy.CT38g_II.d.ts → curvy.Bf5TIk31.d.ts} +1 -1
  42. package/dist/shared/{curvy.C-sUk7ux.mjs → curvy.BrrC9QVB.mjs} +2 -2
  43. package/dist/shared/{curvy.CO0Wclt0.d.ts → curvy.CkJRVnqj.d.ts} +14 -3
  44. package/dist/shared/{curvy.ChkqgKuv.mjs → curvy.DLOeble8.mjs} +9 -1
  45. package/dist/shared/curvy.DN9ptodP.mjs +55 -0
  46. package/dist/shared/{curvy.BAW_cKLu.mjs → curvy.DTco5vku.mjs} +3 -3
  47. package/dist/shared/{curvy.D7bhnwZy.mjs → curvy.DV4S13Cq.mjs} +3 -2
  48. package/dist/shared/{curvy.Bxxwly94.d.mts → curvy.DwHW5Fqt.d.mts} +14 -3
  49. package/dist/shared/{curvy.DgRsieUW.mjs → curvy.O57gIOmy.mjs} +5 -2
  50. package/dist/shared/{curvy.CLzGuqek.mjs → curvy.ZjG-q57I.mjs} +9 -3
  51. package/dist/splines/basis2d.d.mts +36 -0
  52. package/dist/splines/basis2d.d.ts +36 -0
  53. package/dist/splines/basis2d.mjs +86 -0
  54. package/dist/splines/bezier2d.d.mts +13 -5
  55. package/dist/splines/bezier2d.d.ts +13 -5
  56. package/dist/splines/bezier2d.mjs +50 -58
  57. package/dist/splines/cardinal2d.d.mts +44 -0
  58. package/dist/splines/cardinal2d.d.ts +44 -0
  59. package/dist/splines/cardinal2d.mjs +116 -0
  60. package/dist/splines/hermite2d.d.mts +31 -0
  61. package/dist/splines/hermite2d.d.ts +31 -0
  62. package/dist/splines/hermite2d.mjs +74 -0
  63. package/dist/vector/vector2.d.mts +10 -2
  64. package/dist/vector/vector2.d.ts +10 -2
  65. package/dist/vector/vector2.mjs +5 -3
  66. package/dist/vector/vector3.d.mts +6 -2
  67. package/dist/vector/vector3.d.ts +6 -2
  68. package/dist/vector/vector3.mjs +4 -3
  69. package/dist/vector/vector4.d.mts +6 -2
  70. package/dist/vector/vector4.d.ts +6 -2
  71. package/dist/vector/vector4.mjs +4 -3
  72. package/package.json +13 -1
@@ -2,9 +2,9 @@ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
2
  import { CubicPath2d } from '../path/cubic2d.mjs';
3
3
  import { Vector2 } from '../vector/vector2.mjs';
4
4
  import '../curve/cubic2d.mjs';
5
- import '../shared/curvy.CT38g_II.mjs';
5
+ import '../shared/curvy.Bf5TIk31.mjs';
6
6
  import '../interval.mjs';
7
- import '../shared/curvy.Bxxwly94.mjs';
7
+ import '../shared/curvy.DwHW5Fqt.mjs';
8
8
  import '../vector/vector3.mjs';
9
9
  import '../vector/vector4.mjs';
10
10
 
@@ -22,14 +22,22 @@ declare const append: {
22
22
  (p1: Vector2, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
23
23
  (p: Bezier2d, p1: Vector2, p2: Vector2, p3: Vector2): Bezier2d;
24
24
  };
25
- declare const appendAligned: {
25
+ declare const appendTangentAligned: {
26
26
  (ratio: number, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
27
27
  (p: Bezier2d, ratio: number, p2: Vector2, p3: Vector2): Bezier2d;
28
28
  };
29
- declare const appendMirrored: {
29
+ declare const appendCurvatureMirrored: {
30
+ (a: number, b: number, p6: Vector2): (p: Bezier2d) => Bezier2d;
31
+ (p: Bezier2d, a: number, b: number, p6: Vector2): Bezier2d;
32
+ };
33
+ declare const appendVelocityAligned: {
30
34
  (p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
31
35
  (p: Bezier2d, p2: Vector2, p3: Vector2): Bezier2d;
32
36
  };
37
+ declare const appendAccelerationAligned: {
38
+ (p3: Vector2): (p: Bezier2d) => Bezier2d;
39
+ (p: Bezier2d, p3: Vector2): Bezier2d;
40
+ };
33
41
  declare const toPath: (p: Bezier2d) => CubicPath2d;
34
42
 
35
- export { type Bezier2d, append, appendAligned, appendMirrored, fromArray, isCubicBezier2d, make, toPath };
43
+ export { type Bezier2d, append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };
@@ -2,9 +2,9 @@ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
2
  import { CubicPath2d } from '../path/cubic2d.js';
3
3
  import { Vector2 } from '../vector/vector2.js';
4
4
  import '../curve/cubic2d.js';
5
- import '../shared/curvy.CT38g_II.js';
5
+ import '../shared/curvy.Bf5TIk31.js';
6
6
  import '../interval.js';
7
- import '../shared/curvy.CO0Wclt0.js';
7
+ import '../shared/curvy.CkJRVnqj.js';
8
8
  import '../vector/vector3.js';
9
9
  import '../vector/vector4.js';
10
10
 
@@ -22,14 +22,22 @@ declare const append: {
22
22
  (p1: Vector2, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
23
23
  (p: Bezier2d, p1: Vector2, p2: Vector2, p3: Vector2): Bezier2d;
24
24
  };
25
- declare const appendAligned: {
25
+ declare const appendTangentAligned: {
26
26
  (ratio: number, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
27
27
  (p: Bezier2d, ratio: number, p2: Vector2, p3: Vector2): Bezier2d;
28
28
  };
29
- declare const appendMirrored: {
29
+ declare const appendCurvatureMirrored: {
30
+ (a: number, b: number, p6: Vector2): (p: Bezier2d) => Bezier2d;
31
+ (p: Bezier2d, a: number, b: number, p6: Vector2): Bezier2d;
32
+ };
33
+ declare const appendVelocityAligned: {
30
34
  (p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
31
35
  (p: Bezier2d, p2: Vector2, p3: Vector2): Bezier2d;
32
36
  };
37
+ declare const appendAccelerationAligned: {
38
+ (p3: Vector2): (p: Bezier2d) => Bezier2d;
39
+ (p: Bezier2d, p3: Vector2): Bezier2d;
40
+ };
33
41
  declare const toPath: (p: Bezier2d) => CubicPath2d;
34
42
 
35
- export { type Bezier2d, append, appendAligned, appendMirrored, fromArray, isCubicBezier2d, make, toPath };
43
+ export { type Bezier2d, append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };
@@ -1,23 +1,24 @@
1
- import { fromPolynomials } from '../curve/cubic2d.mjs';
2
- import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.ChkqgKuv.mjs';
3
- import { make as make$2, vectorProductLeft } from '../matrix/matrix4x4.mjs';
1
+ import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
2
+ import { make as make$2 } from '../matrix/matrix4x4.mjs';
4
3
  import { fromCurves } from '../path/cubic2d.mjs';
5
- import { fromVector } from '../polynomial/cubic.mjs';
6
4
  import { make as make$3 } from '../vector/vector2.mjs';
7
- import { make as make$4 } from '../vector/vector4.mjs';
5
+ import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
6
+ import '../shared/curvy.BrrC9QVB.mjs';
7
+ import '../shared/curvy.BPOevbwG.mjs';
8
+ import '../shared/curvy.B1zfBfvf.mjs';
9
+ import '../shared/curvy.DTco5vku.mjs';
10
+ import '../shared/curvy.DV4S13Cq.mjs';
11
+ import '../curve/cubic2d.mjs';
8
12
  import '../interval.mjs';
9
13
  import '../shared/curvy.DmVFTi0N.mjs';
14
+ import '../polynomial/cubic.mjs';
15
+ import '../shared/curvy.ZjG-q57I.mjs';
16
+ import '../shared/curvy.O57gIOmy.mjs';
10
17
  import '../polynomial/quadratic.mjs';
11
- import '../shared/curvy.CLzGuqek.mjs';
12
- import '../shared/curvy.DgRsieUW.mjs';
13
- import '../curve/quadratic2d.mjs';
14
- import '../polynomial/linear.mjs';
15
18
  import '../curve/linear2d.mjs';
16
- import '../shared/curvy.C-sUk7ux.mjs';
17
- import '../shared/curvy.DOLqYbKE.mjs';
18
- import '../shared/curvy.Cty3LrOR.mjs';
19
- import '../shared/curvy.BAW_cKLu.mjs';
20
- import '../shared/curvy.D7bhnwZy.mjs';
19
+ import '../polynomial/linear.mjs';
20
+ import '../curve/quadratic2d.mjs';
21
+ import '../vector/vector4.mjs';
21
22
 
22
23
  const characteristic = make$2(
23
24
  1,
@@ -37,7 +38,7 @@ const characteristic = make$2(
37
38
  -3,
38
39
  1
39
40
  );
40
- const Bezier2dTypeId = Symbol("curvy/splines/points");
41
+ const Bezier2dTypeId = Symbol("curvy/splines/bezier2d");
41
42
  class Bezier2dImpl extends Pipeable {
42
43
  [Bezier2dTypeId] = Bezier2dTypeId;
43
44
  points;
@@ -63,60 +64,51 @@ const append$1 = dual(
63
64
  (p instanceof Bezier2dImpl ? p.points : Array.from(p)).concat(p1, p2, p3)
64
65
  )
65
66
  );
66
- const appendAligned$1 = dual(4, (p, ratio, p5, p6) => {
67
+ const appendTangentAligned$1 = dual(4, (p, a, p5, p6) => {
67
68
  const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
68
69
  const p2 = points[points.length - 2];
69
70
  const p3 = points[points.length - 1];
70
- const p4 = make$3((1 + ratio) * p3.x - p2.x, (1 + ratio) * p3.y - p2.y);
71
+ const p4 = make$3(p3.x + (p3.x - p2.x) * a, p3.y + (p3.y - p2.y) * a);
71
72
  return append$1(p, p4, p5, p6);
72
73
  });
73
- const appendMirrored$1 = dual(
74
+ const appendCurvatureAligned = dual(
75
+ 4,
76
+ (p, a, b, p6) => {
77
+ const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
78
+ const p1 = points[points.length - 3];
79
+ const p2 = points[points.length - 2];
80
+ const p3 = points[points.length - 1];
81
+ const p4 = make$3(p3.x + (p3.x - p2.x) * a, p3.y + (p3.y - p2.y) * a);
82
+ const p5 = make$3(
83
+ p3.x + (p3.x - p2.x) * (2 * a + a ** 2 + b / 2) + (p1.x - p2.x) * a ** 2,
84
+ p3.y + (p3.y - p2.y) * (2 * a + a ** 2 + b / 2) + (p1.y - p2.y) * a ** 2
85
+ );
86
+ return append$1(p, p4, p5, p6);
87
+ }
88
+ );
89
+ const appendVelocityAligned$1 = dual(
74
90
  3,
75
- (p, p5, p6) => appendAligned$1(p, 1, p5, p6)
91
+ (p, p5, p6) => appendTangentAligned$1(p, 1, p5, p6)
76
92
  );
77
- function* toCurves(points) {
78
- let p0;
79
- let p1;
80
- let p2;
81
- let p3;
82
- for (const point of points) {
83
- if (p0 === void 0) {
84
- p0 = point;
85
- } else if (p1 === void 0) {
86
- p1 = point;
87
- } else if (p2 === void 0) {
88
- p2 = point;
89
- } else if (p3 === void 0) {
90
- p3 = point;
91
- yield fromPolynomials(
92
- fromVector(
93
- vectorProductLeft(
94
- characteristic,
95
- make$4(p0.x, p1.x, p2.x, p3.x)
96
- )
97
- ),
98
- fromVector(
99
- vectorProductLeft(
100
- characteristic,
101
- make$4(p0.y, p1.y, p2.y, p3.y)
102
- )
103
- )
104
- );
105
- p0 = p3;
106
- p1 = void 0;
107
- p2 = void 0;
108
- p3 = void 0;
109
- }
110
- }
111
- }
112
- const toPath$1 = (p) => fromCurves(...toCurves(p));
93
+ const appendAccelerationAligned$1 = dual(2, (p, p6) => {
94
+ const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
95
+ const p1 = points[points.length - 3];
96
+ const p2 = points[points.length - 2];
97
+ const p3 = points[points.length - 1];
98
+ const p4 = make$3(2 * p3.x - p2.x, 2 * p3.y - p2.y);
99
+ const p5 = make$3(p1.x + 4 * (p3.x - p2.x), p1.y + 4 * (p3.y - p2.y));
100
+ return append$1(p, p4, p5, p6);
101
+ });
102
+ const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic, 3));
113
103
 
114
104
  const make = make$1;
115
105
  const fromArray = fromArray$1;
116
106
  const isCubicBezier2d = isCubicBezier2d$1;
117
107
  const append = append$1;
118
- const appendAligned = appendAligned$1;
119
- const appendMirrored = appendMirrored$1;
108
+ const appendTangentAligned = appendTangentAligned$1;
109
+ const appendCurvatureMirrored = appendCurvatureAligned;
110
+ const appendVelocityAligned = appendVelocityAligned$1;
111
+ const appendAccelerationAligned = appendAccelerationAligned$1;
120
112
  const toPath = toPath$1;
121
113
 
122
- export { append, appendAligned, appendMirrored, fromArray, isCubicBezier2d, make, toPath };
114
+ export { append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };
@@ -0,0 +1,44 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { Matrix4x4 } from '../matrix/matrix4x4.mjs';
3
+ import { CubicPath2d } from '../path/cubic2d.mjs';
4
+ import { Vector2 } from '../vector/vector2.mjs';
5
+ import '../shared/curvy.Bf5TIk31.mjs';
6
+ import '../vector/vector4.mjs';
7
+ import '../matrix/matrix3x3.mjs';
8
+ import '../vector/vector3.mjs';
9
+ import '../matrix/matrix2x2.mjs';
10
+ import '../curve/cubic2d.mjs';
11
+ import '../interval.mjs';
12
+ import '../shared/curvy.DwHW5Fqt.mjs';
13
+
14
+ declare const Cardinal2dTypeId: unique symbol;
15
+ type Cardinal2dTypeId = typeof Cardinal2dTypeId;
16
+
17
+ interface Cardinal2d extends Pipeable {
18
+ readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
19
+ [Symbol.iterator](): IterableIterator<Vector2>;
20
+ }
21
+ declare const characteristic: (scale: number) => Matrix4x4;
22
+ declare const catRomCharacteristic: Matrix4x4;
23
+ declare const isCardinal2d: (p: unknown) => p is Cardinal2d;
24
+ declare const make: (p0: Vector2, p1: Vector2, ...points: ReadonlyArray<Vector2>) => Cardinal2d;
25
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Cardinal2d;
26
+ declare const append: {
27
+ (...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
28
+ (c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
29
+ };
30
+ declare const prepend: {
31
+ (...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
32
+ (c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
33
+ };
34
+ declare const withDuplicatedEndpoints: (c: Cardinal2d) => Cardinal2d;
35
+ declare const withReflectedEndpoints: {
36
+ (scale: number): (c: Cardinal2d) => Cardinal2d;
37
+ (c: Cardinal2d, scale?: number): Cardinal2d;
38
+ };
39
+ declare const toPath: {
40
+ (scale: number): (c: Cardinal2d) => CubicPath2d;
41
+ (c: Cardinal2d, scale?: number): CubicPath2d;
42
+ };
43
+
44
+ export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
@@ -0,0 +1,44 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { Matrix4x4 } from '../matrix/matrix4x4.js';
3
+ import { CubicPath2d } from '../path/cubic2d.js';
4
+ import { Vector2 } from '../vector/vector2.js';
5
+ import '../shared/curvy.Bf5TIk31.js';
6
+ import '../vector/vector4.js';
7
+ import '../matrix/matrix3x3.js';
8
+ import '../vector/vector3.js';
9
+ import '../matrix/matrix2x2.js';
10
+ import '../curve/cubic2d.js';
11
+ import '../interval.js';
12
+ import '../shared/curvy.CkJRVnqj.js';
13
+
14
+ declare const Cardinal2dTypeId: unique symbol;
15
+ type Cardinal2dTypeId = typeof Cardinal2dTypeId;
16
+
17
+ interface Cardinal2d extends Pipeable {
18
+ readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
19
+ [Symbol.iterator](): IterableIterator<Vector2>;
20
+ }
21
+ declare const characteristic: (scale: number) => Matrix4x4;
22
+ declare const catRomCharacteristic: Matrix4x4;
23
+ declare const isCardinal2d: (p: unknown) => p is Cardinal2d;
24
+ declare const make: (p0: Vector2, p1: Vector2, ...points: ReadonlyArray<Vector2>) => Cardinal2d;
25
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Cardinal2d;
26
+ declare const append: {
27
+ (...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
28
+ (c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
29
+ };
30
+ declare const prepend: {
31
+ (...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
32
+ (c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
33
+ };
34
+ declare const withDuplicatedEndpoints: (c: Cardinal2d) => Cardinal2d;
35
+ declare const withReflectedEndpoints: {
36
+ (scale: number): (c: Cardinal2d) => Cardinal2d;
37
+ (c: Cardinal2d, scale?: number): Cardinal2d;
38
+ };
39
+ declare const toPath: {
40
+ (scale: number): (c: Cardinal2d) => CubicPath2d;
41
+ (c: Cardinal2d, scale?: number): CubicPath2d;
42
+ };
43
+
44
+ export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
@@ -0,0 +1,116 @@
1
+ import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
2
+ import { make as make$2 } from '../matrix/matrix4x4.mjs';
3
+ import { fromCurves } from '../path/cubic2d.mjs';
4
+ import { subtract, scale, add } from '../vector/vector2.mjs';
5
+ import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
6
+ import '../shared/curvy.BrrC9QVB.mjs';
7
+ import '../shared/curvy.BPOevbwG.mjs';
8
+ import '../shared/curvy.B1zfBfvf.mjs';
9
+ import '../shared/curvy.DTco5vku.mjs';
10
+ import '../shared/curvy.DV4S13Cq.mjs';
11
+ import '../curve/cubic2d.mjs';
12
+ import '../interval.mjs';
13
+ import '../shared/curvy.DmVFTi0N.mjs';
14
+ import '../polynomial/cubic.mjs';
15
+ import '../shared/curvy.ZjG-q57I.mjs';
16
+ import '../shared/curvy.O57gIOmy.mjs';
17
+ import '../polynomial/quadratic.mjs';
18
+ import '../curve/linear2d.mjs';
19
+ import '../polynomial/linear.mjs';
20
+ import '../curve/quadratic2d.mjs';
21
+ import '../vector/vector4.mjs';
22
+
23
+ const characteristic$1 = (scale) => make$2(
24
+ 0,
25
+ 1,
26
+ 0,
27
+ 0,
28
+ -scale,
29
+ 0,
30
+ scale,
31
+ 0,
32
+ 2 * scale,
33
+ scale - 3,
34
+ 3 - 2 * scale,
35
+ -scale,
36
+ -scale,
37
+ 2 - scale,
38
+ scale - 2,
39
+ scale
40
+ );
41
+ const catRomCharacteristic$1 = characteristic$1(0.5);
42
+ const Cardinal2dTypeId = Symbol.for(
43
+ "curvy/splines/cardinal2d"
44
+ );
45
+ class Cardinal2dImpl extends Pipeable {
46
+ [Cardinal2dTypeId] = Cardinal2dTypeId;
47
+ points;
48
+ constructor(points) {
49
+ invariant(points.length >= 2, "cardinal splines requires 2 or more points");
50
+ super();
51
+ this.points = points;
52
+ }
53
+ [Symbol.iterator]() {
54
+ return this.points[Symbol.iterator]();
55
+ }
56
+ }
57
+ const isCardinal2d$1 = (p) => typeof p === "object" && p !== null && Cardinal2dTypeId in p;
58
+ const make$1 = (...points) => new Cardinal2dImpl(points);
59
+ const fromArray$1 = (points) => new Cardinal2dImpl(points);
60
+ const append$1 = dual(
61
+ (args) => isCardinal2d$1(args[0]),
62
+ (p, ...points) => new Cardinal2dImpl([...p, ...points])
63
+ );
64
+ const prepend$1 = dual(
65
+ (args) => isCardinal2d$1(args[0]),
66
+ (p, ...points) => new Cardinal2dImpl([...points, ...p])
67
+ );
68
+ const withDuplicatedEndpoints$1 = (p) => {
69
+ const points = p instanceof Cardinal2dImpl ? p.points : [...p];
70
+ return new Cardinal2dImpl([
71
+ points[0],
72
+ ...points,
73
+ points[points.length - 1]
74
+ ]);
75
+ };
76
+ const withReflectedEndpoints$1 = dual(
77
+ (args) => isCardinal2d$1(args[0]),
78
+ (p, scale$1 = 1) => {
79
+ if (scale$1 === 0) {
80
+ return withDuplicatedEndpoints$1(p);
81
+ }
82
+ const points = p instanceof Cardinal2dImpl ? p.points : [...p];
83
+ const p0 = points[0];
84
+ const p1 = points[1];
85
+ const p2 = points[points.length - 2];
86
+ const p3 = points[points.length - 1];
87
+ return new Cardinal2dImpl([
88
+ subtract(p1, p0).pipe(scale(scale$1), add(p0)),
89
+ ...points,
90
+ subtract(p2, p3).pipe(scale(scale$1), add(p3))
91
+ ]);
92
+ }
93
+ );
94
+ const toPath$1 = dual(
95
+ (args) => isCardinal2d$1(args[0]),
96
+ (p, scale = 0.5) => fromCurves(
97
+ ...toCurves(
98
+ p,
99
+ scale === 0.5 ? catRomCharacteristic$1 : characteristic$1(scale),
100
+ 1
101
+ )
102
+ )
103
+ );
104
+
105
+ const characteristic = characteristic$1;
106
+ const catRomCharacteristic = catRomCharacteristic$1;
107
+ const isCardinal2d = isCardinal2d$1;
108
+ const make = make$1;
109
+ const fromArray = fromArray$1;
110
+ const append = append$1;
111
+ const prepend = prepend$1;
112
+ const withDuplicatedEndpoints = withDuplicatedEndpoints$1;
113
+ const withReflectedEndpoints = withReflectedEndpoints$1;
114
+ const toPath = toPath$1;
115
+
116
+ export { append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
@@ -0,0 +1,31 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { Matrix4x4 } from '../matrix/matrix4x4.mjs';
3
+ import { CubicPath2d } from '../path/cubic2d.mjs';
4
+ import { Vector2 } from '../vector/vector2.mjs';
5
+ import '../shared/curvy.Bf5TIk31.mjs';
6
+ import '../vector/vector4.mjs';
7
+ import '../matrix/matrix3x3.mjs';
8
+ import '../vector/vector3.mjs';
9
+ import '../matrix/matrix2x2.mjs';
10
+ import '../curve/cubic2d.mjs';
11
+ import '../interval.mjs';
12
+ import '../shared/curvy.DwHW5Fqt.mjs';
13
+
14
+ declare const Hermite2dTypeId: unique symbol;
15
+ type Hermite2dTypeId = typeof Hermite2dTypeId;
16
+
17
+ interface Hermite2d extends Pipeable {
18
+ readonly [Hermite2dTypeId]: Hermite2dTypeId;
19
+ [Symbol.iterator](): IterableIterator<Vector2>;
20
+ }
21
+ declare const characteristic: Matrix4x4;
22
+ declare const make: (p0: Vector2, v0: Vector2, p1: Vector2, v1: Vector2) => Hermite2d;
23
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Hermite2d;
24
+ declare const isHermite2d: (p: unknown) => p is Hermite2d;
25
+ declare const append: {
26
+ (p1: Vector2, v1: Vector2): (p: Hermite2d) => Hermite2d;
27
+ (p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
28
+ };
29
+ declare const toPath: (p: Hermite2d) => CubicPath2d;
30
+
31
+ export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
@@ -0,0 +1,31 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { Matrix4x4 } from '../matrix/matrix4x4.js';
3
+ import { CubicPath2d } from '../path/cubic2d.js';
4
+ import { Vector2 } from '../vector/vector2.js';
5
+ import '../shared/curvy.Bf5TIk31.js';
6
+ import '../vector/vector4.js';
7
+ import '../matrix/matrix3x3.js';
8
+ import '../vector/vector3.js';
9
+ import '../matrix/matrix2x2.js';
10
+ import '../curve/cubic2d.js';
11
+ import '../interval.js';
12
+ import '../shared/curvy.CkJRVnqj.js';
13
+
14
+ declare const Hermite2dTypeId: unique symbol;
15
+ type Hermite2dTypeId = typeof Hermite2dTypeId;
16
+
17
+ interface Hermite2d extends Pipeable {
18
+ readonly [Hermite2dTypeId]: Hermite2dTypeId;
19
+ [Symbol.iterator](): IterableIterator<Vector2>;
20
+ }
21
+ declare const characteristic: Matrix4x4;
22
+ declare const make: (p0: Vector2, v0: Vector2, p1: Vector2, v1: Vector2) => Hermite2d;
23
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Hermite2d;
24
+ declare const isHermite2d: (p: unknown) => p is Hermite2d;
25
+ declare const append: {
26
+ (p1: Vector2, v1: Vector2): (p: Hermite2d) => Hermite2d;
27
+ (p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
28
+ };
29
+ declare const toPath: (p: Hermite2d) => CubicPath2d;
30
+
31
+ export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
@@ -0,0 +1,74 @@
1
+ import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
2
+ import { make as make$2 } from '../matrix/matrix4x4.mjs';
3
+ import { fromCurves } from '../path/cubic2d.mjs';
4
+ import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
5
+ import '../shared/curvy.BrrC9QVB.mjs';
6
+ import '../shared/curvy.BPOevbwG.mjs';
7
+ import '../shared/curvy.B1zfBfvf.mjs';
8
+ import '../shared/curvy.DTco5vku.mjs';
9
+ import '../shared/curvy.DV4S13Cq.mjs';
10
+ import '../curve/cubic2d.mjs';
11
+ import '../interval.mjs';
12
+ import '../shared/curvy.DmVFTi0N.mjs';
13
+ import '../polynomial/cubic.mjs';
14
+ import '../shared/curvy.ZjG-q57I.mjs';
15
+ import '../shared/curvy.O57gIOmy.mjs';
16
+ import '../polynomial/quadratic.mjs';
17
+ import '../vector/vector2.mjs';
18
+ import '../curve/linear2d.mjs';
19
+ import '../polynomial/linear.mjs';
20
+ import '../curve/quadratic2d.mjs';
21
+ import '../vector/vector4.mjs';
22
+
23
+ const characteristic$1 = make$2(
24
+ 1,
25
+ 0,
26
+ 0,
27
+ 0,
28
+ 0,
29
+ 1,
30
+ 0,
31
+ 0,
32
+ -3,
33
+ -2,
34
+ 3,
35
+ -1,
36
+ 2,
37
+ 1,
38
+ -2,
39
+ 1
40
+ );
41
+ const Hermite2dTypeId = Symbol("curvy/splines/hermite2d");
42
+ class Hermite2dImpl extends Pipeable {
43
+ [Hermite2dTypeId] = Hermite2dTypeId;
44
+ points;
45
+ constructor(points) {
46
+ invariant(points.length >= 4, "hermite splines requires 4 or more points");
47
+ invariant(
48
+ points.length % 2 === 0,
49
+ "hermite splines requires (n * 2) points"
50
+ );
51
+ super();
52
+ this.points = points;
53
+ }
54
+ [Symbol.iterator]() {
55
+ return this.points[Symbol.iterator]();
56
+ }
57
+ }
58
+ const isHermite2d$1 = (p) => typeof p === "object" && p !== null && Hermite2dTypeId in p;
59
+ const make$1 = (p0, v0, p1, v1) => new Hermite2dImpl([p0, v0, p1, v1]);
60
+ const fromArray$1 = (points) => new Hermite2dImpl(points);
61
+ const append$1 = dual(3, (p, p1, v1) => {
62
+ const points = p instanceof Hermite2dImpl ? p.points : Array.from(p);
63
+ return new Hermite2dImpl(points.concat(p1, v1));
64
+ });
65
+ const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic$1, 2));
66
+
67
+ const characteristic = characteristic$1;
68
+ const make = make$1;
69
+ const fromArray = fromArray$1;
70
+ const isHermite2d = isHermite2d$1;
71
+ const append = append$1;
72
+ const toPath = toPath$1;
73
+
74
+ export { append, characteristic, fromArray, isHermite2d, make, toPath };
@@ -1,4 +1,4 @@
1
- import { e as TwoDimensional } from '../shared/curvy.CT38g_II.mjs';
1
+ import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
2
  import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
3
3
 
4
4
  declare const Vector2TypeId: unique symbol;
@@ -18,6 +18,10 @@ declare const dot: {
18
18
  (a: Vector2, b: Vector2): number;
19
19
  (b: Vector2): (a: Vector2) => number;
20
20
  };
21
+ declare const cross: {
22
+ (a: Vector2, b: Vector2): number;
23
+ (b: Vector2): (a: Vector2) => number;
24
+ };
21
25
  declare const components: (v: Vector2) => [number, number];
22
26
  declare const softmax: (v: Vector2) => Vector2;
23
27
  declare const zero: Vector2;
@@ -33,5 +37,9 @@ declare const hadamard: {
33
37
  (a: Vector2, b: Vector2): Vector2;
34
38
  (b: Vector2): (a: Vector2) => Vector2;
35
39
  };
40
+ declare const scale: {
41
+ (s: number): (v: Vector2) => Vector2;
42
+ (v: Vector2, s: number): Vector2;
43
+ };
36
44
 
37
- export { type Vector2, add, components, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
45
+ export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, scale, softmax, subtract, zero };
@@ -1,4 +1,4 @@
1
- import { e as TwoDimensional } from '../shared/curvy.CT38g_II.js';
1
+ import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
2
2
  import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
3
3
 
4
4
  declare const Vector2TypeId: unique symbol;
@@ -18,6 +18,10 @@ declare const dot: {
18
18
  (a: Vector2, b: Vector2): number;
19
19
  (b: Vector2): (a: Vector2) => number;
20
20
  };
21
+ declare const cross: {
22
+ (a: Vector2, b: Vector2): number;
23
+ (b: Vector2): (a: Vector2) => number;
24
+ };
21
25
  declare const components: (v: Vector2) => [number, number];
22
26
  declare const softmax: (v: Vector2) => Vector2;
23
27
  declare const zero: Vector2;
@@ -33,5 +37,9 @@ declare const hadamard: {
33
37
  (a: Vector2, b: Vector2): Vector2;
34
38
  (b: Vector2): (a: Vector2) => Vector2;
35
39
  };
40
+ declare const scale: {
41
+ (s: number): (v: Vector2) => Vector2;
42
+ (v: Vector2, s: number): Vector2;
43
+ };
36
44
 
37
- export { type Vector2, add, components, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
45
+ export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, scale, softmax, subtract, zero };
@@ -1,16 +1,18 @@
1
- import { i as isVector2$1, m as make$1, a as magnitude$1, n as normalize$1, d as dot$1, c as components$1, s as softmax$1, b as add$1, e as subtract$1, h as hadamard$1 } from '../shared/curvy.DOLqYbKE.mjs';
2
- import '../shared/curvy.ChkqgKuv.mjs';
1
+ import { i as isVector2$1, m as make$1, a as magnitude$1, n as normalize$1, d as dot$1, c as cross$1, b as components$1, s as softmax$1, e as add$1, f as subtract$1, h as hadamard$1, g as scale$1 } from '../shared/curvy.BPOevbwG.mjs';
2
+ import '../shared/curvy.DLOeble8.mjs';
3
3
 
4
4
  const isVector2 = isVector2$1;
5
5
  const make = make$1;
6
6
  const magnitude = magnitude$1;
7
7
  const normalize = normalize$1;
8
8
  const dot = dot$1;
9
+ const cross = cross$1;
9
10
  const components = components$1;
10
11
  const softmax = softmax$1;
11
12
  const zero = make(0);
12
13
  const add = add$1;
13
14
  const subtract = subtract$1;
14
15
  const hadamard = hadamard$1;
16
+ const scale = scale$1;
15
17
 
16
- export { add, components, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
18
+ export { add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, scale, softmax, subtract, zero };
@@ -1,4 +1,4 @@
1
- import { g as ThreeDimensional } from '../shared/curvy.CT38g_II.mjs';
1
+ import { g as ThreeDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
2
  import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
3
3
 
4
4
  declare const Vector3TypeId: unique symbol;
@@ -34,5 +34,9 @@ declare const hadamard: {
34
34
  (a: Vector3, b: Vector3): Vector3;
35
35
  (b: Vector3): (a: Vector3) => Vector3;
36
36
  };
37
+ declare const scale: {
38
+ (s: number): (v: Vector3) => Vector3;
39
+ (v: Vector3, s: number): Vector3;
40
+ };
37
41
 
38
- export { type Vector3, add, components, dot, hadamard, isVector3, magnitude, make, normalize, softmax, subtract, zero };
42
+ export { type Vector3, add, components, dot, hadamard, isVector3, magnitude, make, normalize, scale, softmax, subtract, zero };