curvy 0.3.3 → 1.0.1

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 (95) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/curve/cubic2d.d.mts +31 -0
  3. package/dist/curve/cubic2d.d.ts +31 -0
  4. package/dist/curve/cubic2d.mjs +96 -0
  5. package/dist/curve/linear2d.d.mts +28 -0
  6. package/dist/curve/linear2d.d.ts +28 -0
  7. package/dist/curve/linear2d.mjs +48 -0
  8. package/dist/curve/quadratic2d.d.mts +33 -0
  9. package/dist/curve/quadratic2d.d.ts +33 -0
  10. package/dist/curve/quadratic2d.mjs +86 -0
  11. package/dist/interval.d.mts +58 -0
  12. package/dist/interval.d.ts +58 -0
  13. package/dist/interval.mjs +88 -0
  14. package/dist/matrix/matrix2x2.d.mts +49 -0
  15. package/dist/matrix/matrix2x2.d.ts +49 -0
  16. package/dist/matrix/matrix2x2.mjs +23 -0
  17. package/dist/matrix/matrix3x3.d.mts +63 -0
  18. package/dist/matrix/matrix3x3.d.ts +63 -0
  19. package/dist/matrix/matrix3x3.mjs +26 -0
  20. package/dist/matrix/matrix4x4.d.mts +72 -0
  21. package/dist/matrix/matrix4x4.d.ts +72 -0
  22. package/dist/matrix/matrix4x4.mjs +214 -0
  23. package/dist/path/cubic2d.d.mts +29 -0
  24. package/dist/path/cubic2d.d.ts +29 -0
  25. package/dist/path/cubic2d.mjs +60 -0
  26. package/dist/path/linear2d.d.mts +29 -0
  27. package/dist/path/linear2d.d.ts +29 -0
  28. package/dist/path/linear2d.mjs +54 -0
  29. package/dist/path/quadratic2d.d.mts +30 -0
  30. package/dist/path/quadratic2d.d.ts +30 -0
  31. package/dist/path/quadratic2d.mjs +60 -0
  32. package/dist/polynomial/cubic.d.mts +7 -0
  33. package/dist/polynomial/cubic.d.ts +7 -0
  34. package/dist/polynomial/cubic.mjs +147 -0
  35. package/dist/polynomial/linear.d.mts +7 -0
  36. package/dist/polynomial/linear.d.ts +7 -0
  37. package/dist/polynomial/linear.mjs +22 -0
  38. package/dist/polynomial/quadratic.d.mts +7 -0
  39. package/dist/polynomial/quadratic.d.ts +7 -0
  40. package/dist/polynomial/quadratic.mjs +23 -0
  41. package/dist/shared/curvy.BN-oFBsc.d.mts +26 -0
  42. package/dist/shared/curvy.BN-oFBsc.d.ts +26 -0
  43. package/dist/shared/curvy.CT38g_II.d.mts +22 -0
  44. package/dist/shared/curvy.CT38g_II.d.ts +22 -0
  45. package/dist/shared/curvy.ChkqgKuv.mjs +119 -0
  46. package/dist/shared/curvy.CkJRVnqj.d.ts +155 -0
  47. package/dist/shared/curvy.Cty3LrOR.mjs +70 -0
  48. package/dist/shared/curvy.D7MEXd5g.mjs +130 -0
  49. package/dist/shared/curvy.D7bhnwZy.mjs +52 -0
  50. package/dist/shared/curvy.DB7nQmVs.mjs +79 -0
  51. package/dist/shared/curvy.DM6AiKbn.mjs +119 -0
  52. package/dist/shared/curvy.DOSsf40r.mjs +49 -0
  53. package/dist/shared/curvy.DmVFTi0N.mjs +34 -0
  54. package/dist/shared/curvy.DwHW5Fqt.d.mts +155 -0
  55. package/dist/shared/curvy.bvP77ZZm.mjs +123 -0
  56. package/dist/splines/bezier2d.d.mts +43 -0
  57. package/dist/splines/bezier2d.d.ts +43 -0
  58. package/dist/splines/bezier2d.mjs +148 -0
  59. package/dist/vector/vector2.d.mts +41 -0
  60. package/dist/vector/vector2.d.ts +41 -0
  61. package/dist/vector/vector2.mjs +17 -0
  62. package/dist/vector/vector3.d.mts +38 -0
  63. package/dist/vector/vector3.d.ts +38 -0
  64. package/dist/vector/vector3.mjs +16 -0
  65. package/dist/vector/vector4.d.mts +39 -0
  66. package/dist/vector/vector4.d.ts +39 -0
  67. package/dist/vector/vector4.mjs +16 -0
  68. package/package.json +78 -37
  69. package/dist/axis.cjs +0 -14
  70. package/dist/axis.d.cts +0 -20
  71. package/dist/axis.d.mts +0 -20
  72. package/dist/axis.d.ts +0 -20
  73. package/dist/axis.mjs +0 -3
  74. package/dist/convert.cjs +0 -74
  75. package/dist/convert.d.cts +0 -6
  76. package/dist/convert.d.mts +0 -6
  77. package/dist/convert.d.ts +0 -6
  78. package/dist/convert.mjs +0 -68
  79. package/dist/curve.cjs +0 -365
  80. package/dist/curve.d.cts +0 -20
  81. package/dist/curve.d.mts +0 -20
  82. package/dist/curve.d.ts +0 -20
  83. package/dist/curve.mjs +0 -354
  84. package/dist/shared/curvy.262f6070.cjs +0 -16
  85. package/dist/shared/curvy.7876e09e.mjs +0 -323
  86. package/dist/shared/curvy.9cd8b44c.mjs +0 -13
  87. package/dist/shared/curvy.db103082.cjs +0 -335
  88. package/dist/shared/curvy.df73166c.d.cts +0 -38
  89. package/dist/shared/curvy.df73166c.d.mts +0 -38
  90. package/dist/shared/curvy.df73166c.d.ts +0 -38
  91. package/dist/splines.cjs +0 -150
  92. package/dist/splines.d.cts +0 -27
  93. package/dist/splines.d.mts +0 -27
  94. package/dist/splines.d.ts +0 -27
  95. package/dist/splines.mjs +0 -138
@@ -0,0 +1,148 @@
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';
4
+ import { fromCurves } from '../path/cubic2d.mjs';
5
+ import { fromVector } from '../polynomial/cubic.mjs';
6
+ import { make as make$3 } from '../vector/vector2.mjs';
7
+ import { make as make$4 } from '../vector/vector4.mjs';
8
+ import '../interval.mjs';
9
+ import '../shared/curvy.DmVFTi0N.mjs';
10
+ import '../polynomial/quadratic.mjs';
11
+ import '../shared/curvy.D7MEXd5g.mjs';
12
+ import '../shared/curvy.DB7nQmVs.mjs';
13
+ import '../curve/linear2d.mjs';
14
+ import '../polynomial/linear.mjs';
15
+ import '../curve/quadratic2d.mjs';
16
+ import '../shared/curvy.DM6AiKbn.mjs';
17
+ import '../shared/curvy.DOSsf40r.mjs';
18
+ import '../shared/curvy.Cty3LrOR.mjs';
19
+ import '../shared/curvy.bvP77ZZm.mjs';
20
+ import '../shared/curvy.D7bhnwZy.mjs';
21
+
22
+ const characteristic = make$2(
23
+ 1,
24
+ 0,
25
+ 0,
26
+ 0,
27
+ -3,
28
+ 3,
29
+ 0,
30
+ 0,
31
+ 3,
32
+ -6,
33
+ 3,
34
+ 0,
35
+ -1,
36
+ 3,
37
+ -3,
38
+ 1
39
+ );
40
+ const Bezier2dTypeId = Symbol("curvy/splines/points");
41
+ class Bezier2dImpl extends Pipeable {
42
+ [Bezier2dTypeId] = Bezier2dTypeId;
43
+ points;
44
+ constructor(points) {
45
+ invariant(points.length >= 4, "cubic splines requires 4 or more points");
46
+ invariant(
47
+ points.length % 3 === 1,
48
+ "cubic splines requires (n * 3) + 1 points"
49
+ );
50
+ super();
51
+ this.points = points;
52
+ }
53
+ [Symbol.iterator]() {
54
+ return this.points[Symbol.iterator]();
55
+ }
56
+ }
57
+ const isCubicBezier2d$1 = (p) => typeof p === "object" && p !== null && Bezier2dTypeId in p;
58
+ const make$1 = (p0, p1, p2, p3) => new Bezier2dImpl([p0, p1, p2, p3]);
59
+ const fromArray$1 = (points) => new Bezier2dImpl(points);
60
+ const append$1 = dual(
61
+ 4,
62
+ (p, p1, p2, p3) => new Bezier2dImpl(
63
+ (p instanceof Bezier2dImpl ? p.points : Array.from(p)).concat(p1, p2, p3)
64
+ )
65
+ );
66
+ const appendTangentAligned$1 = dual(4, (p, a, p5, p6) => {
67
+ const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
68
+ const p2 = points[points.length - 2];
69
+ const p3 = points[points.length - 1];
70
+ const p4 = make$3(p3.x + (p3.x - p2.x) * a, p3.y + (p3.y - p2.y) * a);
71
+ return append$1(p, p4, p5, p6);
72
+ });
73
+ const appendCurvatureAligned = dual(
74
+ 4,
75
+ (p, a, b, p6) => {
76
+ const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
77
+ const p1 = points[points.length - 3];
78
+ const p2 = points[points.length - 2];
79
+ const p3 = points[points.length - 1];
80
+ const p4 = make$3(p3.x + (p3.x - p2.x) * a, p3.y + (p3.y - p2.y) * a);
81
+ const p5 = make$3(
82
+ p3.x + (p3.x - p2.x) * (2 * a + a ** 2 + b / 2) + (p1.x - p2.x) * a ** 2,
83
+ p3.y + (p3.y - p2.y) * (2 * a + a ** 2 + b / 2) + (p1.y - p2.y) * a ** 2
84
+ );
85
+ return append$1(p, p4, p5, p6);
86
+ }
87
+ );
88
+ const appendVelocityAligned$1 = dual(
89
+ 3,
90
+ (p, p5, p6) => appendTangentAligned$1(p, 1, p5, p6)
91
+ );
92
+ const appendAccelerationAligned$1 = dual(2, (p, p6) => {
93
+ const points = p instanceof Bezier2dImpl ? p.points : Array.from(p);
94
+ const p1 = points[points.length - 3];
95
+ const p2 = points[points.length - 2];
96
+ const p3 = points[points.length - 1];
97
+ const p4 = make$3(2 * p3.x - p2.x, 2 * p3.y - p2.y);
98
+ const p5 = make$3(p1.x + 4 * (p3.x - p2.x), p1.y + 4 * (p3.y - p2.y));
99
+ return append$1(p, p4, p5, p6);
100
+ });
101
+ function* toCurves(points) {
102
+ let p0;
103
+ let p1;
104
+ let p2;
105
+ let p3;
106
+ for (const point of points) {
107
+ if (p0 === void 0) {
108
+ p0 = point;
109
+ } else if (p1 === void 0) {
110
+ p1 = point;
111
+ } else if (p2 === void 0) {
112
+ p2 = point;
113
+ } else if (p3 === void 0) {
114
+ p3 = point;
115
+ yield fromPolynomials(
116
+ fromVector(
117
+ vectorProductLeft(
118
+ characteristic,
119
+ make$4(p0.x, p1.x, p2.x, p3.x)
120
+ )
121
+ ),
122
+ fromVector(
123
+ vectorProductLeft(
124
+ characteristic,
125
+ make$4(p0.y, p1.y, p2.y, p3.y)
126
+ )
127
+ )
128
+ );
129
+ p0 = p3;
130
+ p1 = void 0;
131
+ p2 = void 0;
132
+ p3 = void 0;
133
+ }
134
+ }
135
+ }
136
+ const toPath$1 = (p) => fromCurves(...toCurves(p));
137
+
138
+ const make = make$1;
139
+ const fromArray = fromArray$1;
140
+ const isCubicBezier2d = isCubicBezier2d$1;
141
+ const append = append$1;
142
+ const appendTangentAligned = appendTangentAligned$1;
143
+ const appendCurvatureMirrored = appendCurvatureAligned;
144
+ const appendVelocityAligned = appendVelocityAligned$1;
145
+ const appendAccelerationAligned = appendAccelerationAligned$1;
146
+ const toPath = toPath$1;
147
+
148
+ export { append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };
@@ -0,0 +1,41 @@
1
+ import { e as TwoDimensional } from '../shared/curvy.CT38g_II.mjs';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
3
+
4
+ declare const Vector2TypeId: unique symbol;
5
+ type Vector2TypeId = typeof Vector2TypeId;
6
+
7
+ interface Vector2 extends Pipeable, TwoDimensional<number> {
8
+ readonly [Vector2TypeId]: Vector2TypeId;
9
+ }
10
+ declare const isVector2: (v: unknown) => v is Vector2;
11
+ declare const make: {
12
+ (xy: number): Vector2;
13
+ (x: number, y: number): Vector2;
14
+ };
15
+ declare const magnitude: (vector: Vector2) => number;
16
+ declare const normalize: (vector: Vector2) => Vector2;
17
+ declare const dot: {
18
+ (a: Vector2, b: Vector2): number;
19
+ (b: Vector2): (a: Vector2) => number;
20
+ };
21
+ declare const cross: {
22
+ (a: Vector2, b: Vector2): number;
23
+ (b: Vector2): (a: Vector2) => number;
24
+ };
25
+ declare const components: (v: Vector2) => [number, number];
26
+ declare const softmax: (v: Vector2) => Vector2;
27
+ declare const zero: Vector2;
28
+ declare const add: {
29
+ (a: Vector2, b: Vector2): Vector2;
30
+ (b: Vector2): (a: Vector2) => Vector2;
31
+ };
32
+ declare const subtract: {
33
+ (a: Vector2, b: Vector2): Vector2;
34
+ (b: Vector2): (a: Vector2) => Vector2;
35
+ };
36
+ declare const hadamard: {
37
+ (a: Vector2, b: Vector2): Vector2;
38
+ (b: Vector2): (a: Vector2) => Vector2;
39
+ };
40
+
41
+ export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,41 @@
1
+ import { e as TwoDimensional } from '../shared/curvy.CT38g_II.js';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
3
+
4
+ declare const Vector2TypeId: unique symbol;
5
+ type Vector2TypeId = typeof Vector2TypeId;
6
+
7
+ interface Vector2 extends Pipeable, TwoDimensional<number> {
8
+ readonly [Vector2TypeId]: Vector2TypeId;
9
+ }
10
+ declare const isVector2: (v: unknown) => v is Vector2;
11
+ declare const make: {
12
+ (xy: number): Vector2;
13
+ (x: number, y: number): Vector2;
14
+ };
15
+ declare const magnitude: (vector: Vector2) => number;
16
+ declare const normalize: (vector: Vector2) => Vector2;
17
+ declare const dot: {
18
+ (a: Vector2, b: Vector2): number;
19
+ (b: Vector2): (a: Vector2) => number;
20
+ };
21
+ declare const cross: {
22
+ (a: Vector2, b: Vector2): number;
23
+ (b: Vector2): (a: Vector2) => number;
24
+ };
25
+ declare const components: (v: Vector2) => [number, number];
26
+ declare const softmax: (v: Vector2) => Vector2;
27
+ declare const zero: Vector2;
28
+ declare const add: {
29
+ (a: Vector2, b: Vector2): Vector2;
30
+ (b: Vector2): (a: Vector2) => Vector2;
31
+ };
32
+ declare const subtract: {
33
+ (a: Vector2, b: Vector2): Vector2;
34
+ (b: Vector2): (a: Vector2) => Vector2;
35
+ };
36
+ declare const hadamard: {
37
+ (a: Vector2, b: Vector2): Vector2;
38
+ (b: Vector2): (a: Vector2) => Vector2;
39
+ };
40
+
41
+ export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,17 @@
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 } from '../shared/curvy.DOSsf40r.mjs';
2
+ import '../shared/curvy.ChkqgKuv.mjs';
3
+
4
+ const isVector2 = isVector2$1;
5
+ const make = make$1;
6
+ const magnitude = magnitude$1;
7
+ const normalize = normalize$1;
8
+ const dot = dot$1;
9
+ const cross = cross$1;
10
+ const components = components$1;
11
+ const softmax = softmax$1;
12
+ const zero = make(0);
13
+ const add = add$1;
14
+ const subtract = subtract$1;
15
+ const hadamard = hadamard$1;
16
+
17
+ export { add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,38 @@
1
+ import { g as ThreeDimensional } from '../shared/curvy.CT38g_II.mjs';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
3
+
4
+ declare const Vector3TypeId: unique symbol;
5
+ type Vector3TypeId = typeof Vector3TypeId;
6
+
7
+ interface Vector3 extends Pipeable, ThreeDimensional<number> {
8
+ readonly [Vector3TypeId]: Vector3TypeId;
9
+ }
10
+ declare const isVector3: (v: unknown) => v is Vector3;
11
+ declare const make: {
12
+ (xyz: number): Vector3;
13
+ (x: number, yz: number): Vector3;
14
+ (x: number, y: number, z: number): Vector3;
15
+ };
16
+ declare const magnitude: (vector: Vector3) => number;
17
+ declare const normalize: (vector: Vector3) => Vector3;
18
+ declare const dot: {
19
+ (a: Vector3, b: Vector3): number;
20
+ (b: Vector3): (a: Vector3) => number;
21
+ };
22
+ declare const components: (v: Vector3) => [number, number, number];
23
+ declare const softmax: (v: Vector3) => Vector3;
24
+ declare const zero: Vector3;
25
+ declare const add: {
26
+ (a: Vector3, b: Vector3): Vector3;
27
+ (b: Vector3): (a: Vector3) => Vector3;
28
+ };
29
+ declare const subtract: {
30
+ (a: Vector3, b: Vector3): Vector3;
31
+ (b: Vector3): (a: Vector3) => Vector3;
32
+ };
33
+ declare const hadamard: {
34
+ (a: Vector3, b: Vector3): Vector3;
35
+ (b: Vector3): (a: Vector3) => Vector3;
36
+ };
37
+
38
+ export { type Vector3, add, components, dot, hadamard, isVector3, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,38 @@
1
+ import { g as ThreeDimensional } from '../shared/curvy.CT38g_II.js';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
3
+
4
+ declare const Vector3TypeId: unique symbol;
5
+ type Vector3TypeId = typeof Vector3TypeId;
6
+
7
+ interface Vector3 extends Pipeable, ThreeDimensional<number> {
8
+ readonly [Vector3TypeId]: Vector3TypeId;
9
+ }
10
+ declare const isVector3: (v: unknown) => v is Vector3;
11
+ declare const make: {
12
+ (xyz: number): Vector3;
13
+ (x: number, yz: number): Vector3;
14
+ (x: number, y: number, z: number): Vector3;
15
+ };
16
+ declare const magnitude: (vector: Vector3) => number;
17
+ declare const normalize: (vector: Vector3) => Vector3;
18
+ declare const dot: {
19
+ (a: Vector3, b: Vector3): number;
20
+ (b: Vector3): (a: Vector3) => number;
21
+ };
22
+ declare const components: (v: Vector3) => [number, number, number];
23
+ declare const softmax: (v: Vector3) => Vector3;
24
+ declare const zero: Vector3;
25
+ declare const add: {
26
+ (a: Vector3, b: Vector3): Vector3;
27
+ (b: Vector3): (a: Vector3) => Vector3;
28
+ };
29
+ declare const subtract: {
30
+ (a: Vector3, b: Vector3): Vector3;
31
+ (b: Vector3): (a: Vector3) => Vector3;
32
+ };
33
+ declare const hadamard: {
34
+ (a: Vector3, b: Vector3): Vector3;
35
+ (b: Vector3): (a: Vector3) => Vector3;
36
+ };
37
+
38
+ export { type Vector3, add, components, dot, hadamard, isVector3, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,16 @@
1
+ import { i as isVector3$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.D7bhnwZy.mjs';
2
+ import '../shared/curvy.ChkqgKuv.mjs';
3
+
4
+ const isVector3 = isVector3$1;
5
+ const make = make$1;
6
+ const magnitude = magnitude$1;
7
+ const normalize = normalize$1;
8
+ const dot = dot$1;
9
+ const components = components$1;
10
+ const softmax = softmax$1;
11
+ const zero = make(0);
12
+ const add = add$1;
13
+ const subtract = subtract$1;
14
+ const hadamard = hadamard$1;
15
+
16
+ export { add, components, dot, hadamard, isVector3, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,39 @@
1
+ import { f as FourDimensional } from '../shared/curvy.CT38g_II.mjs';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
3
+
4
+ declare const Vector4TypeId: unique symbol;
5
+ type Vector4TypeId = typeof Vector4TypeId;
6
+
7
+ interface Vector4 extends Pipeable, FourDimensional<number> {
8
+ readonly [Vector4TypeId]: Vector4TypeId;
9
+ }
10
+ declare const isVector4: (v: unknown) => v is Vector4;
11
+ declare const make: {
12
+ (xyzw: number): Vector4;
13
+ (x: number, yzw: number): Vector4;
14
+ (x: number, y: number, zw: number): Vector4;
15
+ (x: number, y: number, z: number, w: number): Vector4;
16
+ };
17
+ declare const magnitude: (vector: Vector4) => number;
18
+ declare const normalize: (vector: Vector4) => Vector4;
19
+ declare const dot: {
20
+ (a: Vector4, b: Vector4): number;
21
+ (b: Vector4): (a: Vector4) => number;
22
+ };
23
+ declare const components: (v: Vector4) => [number, number, number, number];
24
+ declare const softmax: (v: Vector4) => Vector4;
25
+ declare const zero: Vector4;
26
+ declare const add: {
27
+ (a: Vector4, b: Vector4): Vector4;
28
+ (b: Vector4): (a: Vector4) => Vector4;
29
+ };
30
+ declare const subtract: {
31
+ (a: Vector4, b: Vector4): Vector4;
32
+ (b: Vector4): (a: Vector4) => Vector4;
33
+ };
34
+ declare const hadamard: {
35
+ (a: Vector4, b: Vector4): Vector4;
36
+ (b: Vector4): (a: Vector4) => Vector4;
37
+ };
38
+
39
+ export { type Vector4, add, components, dot, hadamard, isVector4, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,39 @@
1
+ import { f as FourDimensional } from '../shared/curvy.CT38g_II.js';
2
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
3
+
4
+ declare const Vector4TypeId: unique symbol;
5
+ type Vector4TypeId = typeof Vector4TypeId;
6
+
7
+ interface Vector4 extends Pipeable, FourDimensional<number> {
8
+ readonly [Vector4TypeId]: Vector4TypeId;
9
+ }
10
+ declare const isVector4: (v: unknown) => v is Vector4;
11
+ declare const make: {
12
+ (xyzw: number): Vector4;
13
+ (x: number, yzw: number): Vector4;
14
+ (x: number, y: number, zw: number): Vector4;
15
+ (x: number, y: number, z: number, w: number): Vector4;
16
+ };
17
+ declare const magnitude: (vector: Vector4) => number;
18
+ declare const normalize: (vector: Vector4) => Vector4;
19
+ declare const dot: {
20
+ (a: Vector4, b: Vector4): number;
21
+ (b: Vector4): (a: Vector4) => number;
22
+ };
23
+ declare const components: (v: Vector4) => [number, number, number, number];
24
+ declare const softmax: (v: Vector4) => Vector4;
25
+ declare const zero: Vector4;
26
+ declare const add: {
27
+ (a: Vector4, b: Vector4): Vector4;
28
+ (b: Vector4): (a: Vector4) => Vector4;
29
+ };
30
+ declare const subtract: {
31
+ (a: Vector4, b: Vector4): Vector4;
32
+ (b: Vector4): (a: Vector4) => Vector4;
33
+ };
34
+ declare const hadamard: {
35
+ (a: Vector4, b: Vector4): Vector4;
36
+ (b: Vector4): (a: Vector4) => Vector4;
37
+ };
38
+
39
+ export { type Vector4, add, components, dot, hadamard, isVector4, magnitude, make, normalize, softmax, subtract, zero };
@@ -0,0 +1,16 @@
1
+ import { i as isVector4$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.Cty3LrOR.mjs';
2
+ import '../shared/curvy.ChkqgKuv.mjs';
3
+
4
+ const isVector4 = isVector4$1;
5
+ const make = make$1;
6
+ const magnitude = magnitude$1;
7
+ const normalize = normalize$1;
8
+ const dot = dot$1;
9
+ const components = components$1;
10
+ const softmax = softmax$1;
11
+ const zero = make(0);
12
+ const add = add$1;
13
+ const subtract = subtract$1;
14
+ const hadamard = hadamard$1;
15
+
16
+ export { add, components, dot, hadamard, isVector4, magnitude, make, normalize, softmax, subtract, zero };
package/package.json CHANGED
@@ -1,35 +1,80 @@
1
1
  {
2
2
  "name": "curvy",
3
- "version": "0.3.3",
3
+ "version": "1.0.1",
4
4
  "description": "Spline and Curve utilities",
5
5
  "author": "Tim Morris <timthewebguy@gmail.com>",
6
6
  "homepage": "https://github.com/tkofh/curvy#readme",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
9
9
  "type": "module",
10
- "main": "./dist/curve.cjs",
11
- "module": "./dist/curve.mjs",
12
- "types": "./dist/curve.d.ts",
13
10
  "exports": {
14
- ".": {
15
- "require": "./dist/curve.cjs",
16
- "import": "./dist/curve.mjs",
17
- "types": "./dist/curve.d.ts"
18
- },
19
- "./axis": {
20
- "require": "./dist/axis.cjs",
21
- "import": "./dist/axis.mjs",
22
- "types": "./dist/axis.d.ts"
23
- },
24
- "./convert": {
25
- "require": "./dist/convert.cjs",
26
- "import": "./dist/convert.mjs",
27
- "types": "./dist/convert.d.ts"
28
- },
29
- "./splines": {
30
- "require": "./dist/splines.cjs",
31
- "import": "./dist/splines.mjs",
32
- "types": "./dist/splines.d.ts"
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"
30
+ },
31
+ "./matrix4x4": {
32
+ "types": "./dist/matrix/matrix4x4.d.ts",
33
+ "import": "./dist/matrix/matrix4x4.mjs"
34
+ },
35
+ "./curve/linear2d": {
36
+ "types": "./dist/curve/linear2d.d.ts",
37
+ "import": "./dist/curve/linear2d.mjs"
38
+ },
39
+ "./curve/quadratic2d": {
40
+ "types": "./dist/curve/quadratic2d.d.ts",
41
+ "import": "./dist/curve/quadratic2d.mjs"
42
+ },
43
+ "./curve/cubic2d": {
44
+ "types": "./dist/curve/cubic2d.d.ts",
45
+ "import": "./dist/curve/cubic2d.mjs"
46
+ },
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"
58
+ },
59
+ "./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"
74
+ },
75
+ "./splines/bezier2d": {
76
+ "types": "./dist/splines/bezier2d.d.ts",
77
+ "import": "./dist/splines/bezier2d.mjs"
33
78
  }
34
79
  },
35
80
  "files": [
@@ -42,23 +87,19 @@
42
87
  "type": "git",
43
88
  "url": "git+https://github.com/tkofh/curvy.git"
44
89
  },
45
- "scripts": {
46
- "build": "unbuild",
47
- "test": "vitest",
48
- "test:run": "vitest run",
49
- "test:ui": "vitest --ui --coverage",
50
- "prepublish": "pnpm test:run && pnpm build"
51
- },
52
90
  "bugs": {
53
91
  "url": "https://github.com/tkofh/curvy/issues"
54
92
  },
55
93
  "devDependencies": {
56
- "@vitest/coverage-v8": "^1.3.1",
57
- "@vitest/ui": "^1.3.1",
58
- "unbuild": "^2.0.0",
59
- "vitest": "^1.3.1"
94
+ "typescript": "^5.7.2",
95
+ "unbuild": "3.0.0-rc.8",
96
+ "vitest": "^2.1.6",
97
+ "@repo/tsconfig": "1.0.0"
60
98
  },
61
- "dependencies": {
62
- "tiny-invariant": "^1.3.3"
99
+ "scripts": {
100
+ "build": "unbuild",
101
+ "test": "vitest run",
102
+ "test:watch": "vitest",
103
+ "typecheck": "tsc --noEmit"
63
104
  }
64
- }
105
+ }
package/dist/axis.cjs DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- require('tiny-invariant');
4
- const axis = require('./shared/curvy.db103082.cjs');
5
- require('./splines.cjs');
6
-
7
-
8
-
9
- exports.createBasisAxis = axis.createBasisAxis;
10
- exports.createBezierAxis = axis.createBezierAxis;
11
- exports.createCardinalAxis = axis.createCardinalAxis;
12
- exports.createCatmullRomAxis = axis.createCatmullRomAxis;
13
- exports.createCurveAxis = axis.createCurveAxis;
14
- exports.createHermiteAxis = axis.createHermiteAxis;
package/dist/axis.d.cts DELETED
@@ -1,20 +0,0 @@
1
- import { I as Interval, M as Monotonicity, C as CubicPolynomial, a as CubicCoefficients } from './shared/curvy.df73166c.cjs';
2
-
3
- type CurveAxis = {
4
- readonly domain: Interval;
5
- readonly range: Interval;
6
- readonly monotonicity: Monotonicity;
7
- readonly extrema: ReadonlyArray<number>;
8
- readonly segments: ReadonlyArray<CubicPolynomial>;
9
- readonly solvePosition: (t: number) => number;
10
- readonly solveVelocity: (t: number) => number;
11
- readonly solveT: (position: number, domain: Interval) => ReadonlyArray<number>;
12
- };
13
- declare function createCurveAxis(coefficients: ReadonlyArray<CubicCoefficients>): CurveAxis;
14
- declare function createBasisAxis(parameters: ReadonlyArray<number>, triplicateEndpoints?: boolean): CurveAxis;
15
- declare function createBezierAxis(parameters: ReadonlyArray<number>): CurveAxis;
16
- declare function createCardinalAxis(parameters: ReadonlyArray<number>, a?: number, duplicateEndpoints?: boolean): CurveAxis;
17
- declare function createCatmullRomAxis(parameters: ReadonlyArray<number>, duplicateEndpoints?: boolean): CurveAxis;
18
- declare function createHermiteAxis(parameters: ReadonlyArray<number>): CurveAxis;
19
-
20
- export { type CurveAxis, createBasisAxis, createBezierAxis, createCardinalAxis, createCatmullRomAxis, createCurveAxis, createHermiteAxis };
package/dist/axis.d.mts DELETED
@@ -1,20 +0,0 @@
1
- import { I as Interval, M as Monotonicity, C as CubicPolynomial, a as CubicCoefficients } from './shared/curvy.df73166c.mjs';
2
-
3
- type CurveAxis = {
4
- readonly domain: Interval;
5
- readonly range: Interval;
6
- readonly monotonicity: Monotonicity;
7
- readonly extrema: ReadonlyArray<number>;
8
- readonly segments: ReadonlyArray<CubicPolynomial>;
9
- readonly solvePosition: (t: number) => number;
10
- readonly solveVelocity: (t: number) => number;
11
- readonly solveT: (position: number, domain: Interval) => ReadonlyArray<number>;
12
- };
13
- declare function createCurveAxis(coefficients: ReadonlyArray<CubicCoefficients>): CurveAxis;
14
- declare function createBasisAxis(parameters: ReadonlyArray<number>, triplicateEndpoints?: boolean): CurveAxis;
15
- declare function createBezierAxis(parameters: ReadonlyArray<number>): CurveAxis;
16
- declare function createCardinalAxis(parameters: ReadonlyArray<number>, a?: number, duplicateEndpoints?: boolean): CurveAxis;
17
- declare function createCatmullRomAxis(parameters: ReadonlyArray<number>, duplicateEndpoints?: boolean): CurveAxis;
18
- declare function createHermiteAxis(parameters: ReadonlyArray<number>): CurveAxis;
19
-
20
- export { type CurveAxis, createBasisAxis, createBezierAxis, createCardinalAxis, createCatmullRomAxis, createCurveAxis, createHermiteAxis };
package/dist/axis.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { I as Interval, M as Monotonicity, C as CubicPolynomial, a as CubicCoefficients } from './shared/curvy.df73166c.js';
2
-
3
- type CurveAxis = {
4
- readonly domain: Interval;
5
- readonly range: Interval;
6
- readonly monotonicity: Monotonicity;
7
- readonly extrema: ReadonlyArray<number>;
8
- readonly segments: ReadonlyArray<CubicPolynomial>;
9
- readonly solvePosition: (t: number) => number;
10
- readonly solveVelocity: (t: number) => number;
11
- readonly solveT: (position: number, domain: Interval) => ReadonlyArray<number>;
12
- };
13
- declare function createCurveAxis(coefficients: ReadonlyArray<CubicCoefficients>): CurveAxis;
14
- declare function createBasisAxis(parameters: ReadonlyArray<number>, triplicateEndpoints?: boolean): CurveAxis;
15
- declare function createBezierAxis(parameters: ReadonlyArray<number>): CurveAxis;
16
- declare function createCardinalAxis(parameters: ReadonlyArray<number>, a?: number, duplicateEndpoints?: boolean): CurveAxis;
17
- declare function createCatmullRomAxis(parameters: ReadonlyArray<number>, duplicateEndpoints?: boolean): CurveAxis;
18
- declare function createHermiteAxis(parameters: ReadonlyArray<number>): CurveAxis;
19
-
20
- export { type CurveAxis, createBasisAxis, createBezierAxis, createCardinalAxis, createCatmullRomAxis, createCurveAxis, createHermiteAxis };
package/dist/axis.mjs DELETED
@@ -1,3 +0,0 @@
1
- import 'tiny-invariant';
2
- export { b as createBasisAxis, d as createBezierAxis, e as createCardinalAxis, f as createCatmullRomAxis, a as createCurveAxis, g as createHermiteAxis } from './shared/curvy.7876e09e.mjs';
3
- import './splines.mjs';