curvy 1.0.2 → 1.0.4

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 (78) hide show
  1. package/dist/curve/cubic2d.d.mts +2 -2
  2. package/dist/curve/cubic2d.d.ts +2 -2
  3. package/dist/curve/cubic2d.mjs +5 -4
  4. package/dist/curve/linear2d.d.mts +2 -2
  5. package/dist/curve/linear2d.d.ts +2 -2
  6. package/dist/curve/linear2d.mjs +4 -3
  7. package/dist/curve/quadratic2d.d.mts +2 -2
  8. package/dist/curve/quadratic2d.d.ts +2 -2
  9. package/dist/curve/quadratic2d.mjs +5 -4
  10. package/dist/interval.d.mts +1 -1
  11. package/dist/interval.d.ts +1 -1
  12. package/dist/interval.mjs +2 -1
  13. package/dist/matrix/matrix2x2.d.mts +1 -1
  14. package/dist/matrix/matrix2x2.d.ts +1 -1
  15. package/dist/matrix/matrix2x2.mjs +4 -3
  16. package/dist/matrix/matrix3x3.d.mts +2 -2
  17. package/dist/matrix/matrix3x3.d.ts +2 -2
  18. package/dist/matrix/matrix3x3.mjs +6 -5
  19. package/dist/matrix/matrix4x4.d.mts +1 -1
  20. package/dist/matrix/matrix4x4.d.ts +1 -1
  21. package/dist/matrix/matrix4x4.mjs +7 -6
  22. package/dist/path/cubic2d.d.mts +2 -2
  23. package/dist/path/cubic2d.d.ts +2 -2
  24. package/dist/path/cubic2d.mjs +5 -4
  25. package/dist/path/linear2d.d.mts +2 -2
  26. package/dist/path/linear2d.d.ts +2 -2
  27. package/dist/path/linear2d.mjs +4 -3
  28. package/dist/path/quadratic2d.d.mts +2 -2
  29. package/dist/path/quadratic2d.d.ts +2 -2
  30. package/dist/path/quadratic2d.mjs +5 -4
  31. package/dist/{shared/curvy.BN-oFBsc.d.mts → pipe.d.mts} +33 -1
  32. package/dist/{shared/curvy.BN-oFBsc.d.ts → pipe.d.ts} +33 -1
  33. package/dist/{shared/curvy.DLOeble8.mjs → pipe.mjs} +1 -37
  34. package/dist/polynomial/cubic.d.mts +2 -2
  35. package/dist/polynomial/cubic.d.ts +2 -2
  36. package/dist/polynomial/cubic.mjs +4 -3
  37. package/dist/polynomial/linear.d.mts +2 -2
  38. package/dist/polynomial/linear.d.ts +2 -2
  39. package/dist/polynomial/linear.mjs +3 -2
  40. package/dist/polynomial/quadratic.d.mts +2 -2
  41. package/dist/polynomial/quadratic.d.ts +2 -2
  42. package/dist/polynomial/quadratic.mjs +4 -3
  43. package/dist/shared/{curvy.O57gIOmy.mjs → curvy.BDhiZ7He.mjs} +2 -1
  44. package/dist/shared/{curvy.BrrC9QVB.mjs → curvy.BYDuJMHv.mjs} +3 -2
  45. package/dist/shared/{curvy.CkJRVnqj.d.ts → curvy.BsHoYJNv.d.ts} +1 -1
  46. package/dist/shared/{curvy.DTco5vku.mjs → curvy.BvJuXVua.mjs} +4 -3
  47. package/dist/shared/{curvy.ZjG-q57I.mjs → curvy.BzVmUIKm.mjs} +3 -2
  48. package/dist/shared/{curvy.B1zfBfvf.mjs → curvy.C2XGH0R0.mjs} +2 -1
  49. package/dist/shared/curvy.CE4X6_Is.mjs +181 -0
  50. package/dist/shared/{curvy.DV4S13Cq.mjs → curvy.D7YvJAMV.mjs} +2 -1
  51. package/dist/shared/{curvy.BPOevbwG.mjs → curvy.DSxnsSFS.mjs} +2 -1
  52. package/dist/shared/{curvy.DwHW5Fqt.d.mts → curvy.NsmY7zcr.d.mts} +1 -1
  53. package/dist/splines/basis2d.d.mts +5 -3
  54. package/dist/splines/basis2d.d.ts +5 -3
  55. package/dist/splines/basis2d.mjs +13 -10
  56. package/dist/splines/bezier2d.d.mts +11 -6
  57. package/dist/splines/bezier2d.d.ts +11 -6
  58. package/dist/splines/bezier2d.mjs +13 -105
  59. package/dist/splines/cardinal2d.d.mts +8 -3
  60. package/dist/splines/cardinal2d.d.ts +8 -3
  61. package/dist/splines/cardinal2d.mjs +17 -10
  62. package/dist/splines/hermite2d.d.mts +5 -3
  63. package/dist/splines/hermite2d.d.ts +5 -3
  64. package/dist/splines/hermite2d.mjs +13 -10
  65. package/dist/utils.d.mts +27 -0
  66. package/dist/utils.d.ts +27 -0
  67. package/dist/utils.mjs +47 -0
  68. package/dist/vector/vector2.d.mts +1 -1
  69. package/dist/vector/vector2.d.ts +1 -1
  70. package/dist/vector/vector2.mjs +3 -2
  71. package/dist/vector/vector3.d.mts +1 -1
  72. package/dist/vector/vector3.d.ts +1 -1
  73. package/dist/vector/vector3.mjs +3 -2
  74. package/dist/vector/vector4.d.mts +1 -1
  75. package/dist/vector/vector4.d.ts +1 -1
  76. package/dist/vector/vector4.mjs +3 -2
  77. package/package.json +9 -1
  78. package/dist/shared/curvy.DN9ptodP.mjs +0 -55
@@ -1,7 +1,8 @@
1
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
1
  import { Matrix4x4 } from '../matrix/matrix4x4.js';
3
2
  import { CubicPath2d } from '../path/cubic2d.js';
3
+ import { Pipeable } from '../pipe.js';
4
4
  import { Vector2 } from '../vector/vector2.js';
5
+ import { Bezier2d } from './bezier2d.js';
5
6
  import '../shared/curvy.Bf5TIk31.js';
6
7
  import '../vector/vector4.js';
7
8
  import '../matrix/matrix3x3.js';
@@ -9,7 +10,7 @@ import '../vector/vector3.js';
9
10
  import '../matrix/matrix2x2.js';
10
11
  import '../curve/cubic2d.js';
11
12
  import '../interval.js';
12
- import '../shared/curvy.CkJRVnqj.js';
13
+ import '../shared/curvy.BsHoYJNv.js';
13
14
 
14
15
  declare const Cardinal2dTypeId: unique symbol;
15
16
  type Cardinal2dTypeId = typeof Cardinal2dTypeId;
@@ -40,5 +41,9 @@ declare const toPath: {
40
41
  (scale: number): (c: Cardinal2d) => CubicPath2d;
41
42
  (c: Cardinal2d, scale?: number): CubicPath2d;
42
43
  };
44
+ declare const toBezier: {
45
+ (p: Cardinal2d): Bezier2d;
46
+ (p: Cardinal2d, scale: number): Bezier2d;
47
+ };
43
48
 
44
- export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
49
+ export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toBezier, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
@@ -1,19 +1,20 @@
1
- import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
2
1
  import { make as make$2 } from '../matrix/matrix4x4.mjs';
3
2
  import { fromCurves } from '../path/cubic2d.mjs';
3
+ import { dual, Pipeable } from '../pipe.mjs';
4
+ import { invariant } from '../utils.mjs';
4
5
  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';
6
+ import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
7
+ import '../shared/curvy.BYDuJMHv.mjs';
8
+ import '../shared/curvy.DSxnsSFS.mjs';
9
+ import '../shared/curvy.C2XGH0R0.mjs';
10
+ import '../shared/curvy.BvJuXVua.mjs';
11
+ import '../shared/curvy.D7YvJAMV.mjs';
11
12
  import '../curve/cubic2d.mjs';
12
13
  import '../interval.mjs';
13
14
  import '../shared/curvy.DmVFTi0N.mjs';
14
15
  import '../polynomial/cubic.mjs';
15
- import '../shared/curvy.ZjG-q57I.mjs';
16
- import '../shared/curvy.O57gIOmy.mjs';
16
+ import '../shared/curvy.BzVmUIKm.mjs';
17
+ import '../shared/curvy.BDhiZ7He.mjs';
17
18
  import '../polynomial/quadratic.mjs';
18
19
  import '../curve/linear2d.mjs';
19
20
  import '../polynomial/linear.mjs';
@@ -101,6 +102,11 @@ const toPath$1 = dual(
101
102
  )
102
103
  )
103
104
  );
105
+ const toBezier$1 = (p, scale = 0.5) => fromSpline(
106
+ p,
107
+ scale === 0.5 ? catRomCharacteristic$1 : characteristic$1(scale),
108
+ 1
109
+ );
104
110
 
105
111
  const characteristic = characteristic$1;
106
112
  const catRomCharacteristic = catRomCharacteristic$1;
@@ -112,5 +118,6 @@ const prepend = prepend$1;
112
118
  const withDuplicatedEndpoints = withDuplicatedEndpoints$1;
113
119
  const withReflectedEndpoints = withReflectedEndpoints$1;
114
120
  const toPath = toPath$1;
121
+ const toBezier = toBezier$1;
115
122
 
116
- export { append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
123
+ export { append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toBezier, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
@@ -1,7 +1,8 @@
1
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
1
  import { Matrix4x4 } from '../matrix/matrix4x4.mjs';
3
2
  import { CubicPath2d } from '../path/cubic2d.mjs';
3
+ import { Pipeable } from '../pipe.mjs';
4
4
  import { Vector2 } from '../vector/vector2.mjs';
5
+ import { Bezier2d } from './bezier2d.mjs';
5
6
  import '../shared/curvy.Bf5TIk31.mjs';
6
7
  import '../vector/vector4.mjs';
7
8
  import '../matrix/matrix3x3.mjs';
@@ -9,7 +10,7 @@ import '../vector/vector3.mjs';
9
10
  import '../matrix/matrix2x2.mjs';
10
11
  import '../curve/cubic2d.mjs';
11
12
  import '../interval.mjs';
12
- import '../shared/curvy.DwHW5Fqt.mjs';
13
+ import '../shared/curvy.NsmY7zcr.mjs';
13
14
 
14
15
  declare const Hermite2dTypeId: unique symbol;
15
16
  type Hermite2dTypeId = typeof Hermite2dTypeId;
@@ -27,5 +28,6 @@ declare const append: {
27
28
  (p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
28
29
  };
29
30
  declare const toPath: (p: Hermite2d) => CubicPath2d;
31
+ declare const toBezier: (p: Hermite2d) => Bezier2d;
30
32
 
31
- export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
33
+ export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toBezier, toPath };
@@ -1,7 +1,8 @@
1
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
1
  import { Matrix4x4 } from '../matrix/matrix4x4.js';
3
2
  import { CubicPath2d } from '../path/cubic2d.js';
3
+ import { Pipeable } from '../pipe.js';
4
4
  import { Vector2 } from '../vector/vector2.js';
5
+ import { Bezier2d } from './bezier2d.js';
5
6
  import '../shared/curvy.Bf5TIk31.js';
6
7
  import '../vector/vector4.js';
7
8
  import '../matrix/matrix3x3.js';
@@ -9,7 +10,7 @@ import '../vector/vector3.js';
9
10
  import '../matrix/matrix2x2.js';
10
11
  import '../curve/cubic2d.js';
11
12
  import '../interval.js';
12
- import '../shared/curvy.CkJRVnqj.js';
13
+ import '../shared/curvy.BsHoYJNv.js';
13
14
 
14
15
  declare const Hermite2dTypeId: unique symbol;
15
16
  type Hermite2dTypeId = typeof Hermite2dTypeId;
@@ -27,5 +28,6 @@ declare const append: {
27
28
  (p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
28
29
  };
29
30
  declare const toPath: (p: Hermite2d) => CubicPath2d;
31
+ declare const toBezier: (p: Hermite2d) => Bezier2d;
30
32
 
31
- export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
33
+ export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toBezier, toPath };
@@ -1,18 +1,19 @@
1
- import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
2
1
  import { make as make$2 } from '../matrix/matrix4x4.mjs';
3
2
  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';
3
+ import { dual, Pipeable } from '../pipe.mjs';
4
+ import { invariant } from '../utils.mjs';
5
+ import { t as toCurves, f as fromSpline } from '../shared/curvy.CE4X6_Is.mjs';
6
+ import '../shared/curvy.BYDuJMHv.mjs';
7
+ import '../shared/curvy.DSxnsSFS.mjs';
8
+ import '../shared/curvy.C2XGH0R0.mjs';
9
+ import '../shared/curvy.BvJuXVua.mjs';
10
+ import '../shared/curvy.D7YvJAMV.mjs';
10
11
  import '../curve/cubic2d.mjs';
11
12
  import '../interval.mjs';
12
13
  import '../shared/curvy.DmVFTi0N.mjs';
13
14
  import '../polynomial/cubic.mjs';
14
- import '../shared/curvy.ZjG-q57I.mjs';
15
- import '../shared/curvy.O57gIOmy.mjs';
15
+ import '../shared/curvy.BzVmUIKm.mjs';
16
+ import '../shared/curvy.BDhiZ7He.mjs';
16
17
  import '../polynomial/quadratic.mjs';
17
18
  import '../vector/vector2.mjs';
18
19
  import '../curve/linear2d.mjs';
@@ -63,6 +64,7 @@ const append$1 = dual(3, (p, p1, v1) => {
63
64
  return new Hermite2dImpl(points.concat(p1, v1));
64
65
  });
65
66
  const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic$1, 2));
67
+ const toBezier$1 = (p) => fromSpline(p, characteristic$1, 2);
66
68
 
67
69
  const characteristic = characteristic$1;
68
70
  const make = make$1;
@@ -70,5 +72,6 @@ const fromArray = fromArray$1;
70
72
  const isHermite2d = isHermite2d$1;
71
73
  const append = append$1;
72
74
  const toPath = toPath$1;
75
+ const toBezier = toBezier$1;
73
76
 
74
- export { append, characteristic, fromArray, isHermite2d, make, toPath };
77
+ export { append, characteristic, fromArray, isHermite2d, make, toBezier, toPath };
@@ -0,0 +1,27 @@
1
+ declare const PRECISION = 8;
2
+ declare function round(value: number, precision?: number): number;
3
+ declare function roundDown(value: number, precision?: number): number;
4
+ declare const lerp: {
5
+ (t: number, a: number, b: number): number;
6
+ (a: number, b: number): (t: number) => number;
7
+ };
8
+ declare const normalize: {
9
+ (x: number, a: number, b: number): number;
10
+ (a: number, b: number): (x: number) => number;
11
+ };
12
+ declare const remap: {
13
+ (x: number, x1: number, x2: number, y1: number, y2: number): number;
14
+ (x1: number, x2: number, y1: number, y2: number): (x: number) => number;
15
+ };
16
+ declare const clamp: {
17
+ (value: number, min: number, max: number): number;
18
+ (min: number, max: number): (value: number) => number;
19
+ };
20
+ declare const clip: {
21
+ <T>(value: number, min: number, max: number, onClip: T): T | number;
22
+ <T>(min: number, max: number, onClip: T): (value: number) => T | number;
23
+ };
24
+ declare function minMax(a: number, b: number): [number, number];
25
+ declare function invariant(condition: boolean, message: string): asserts condition;
26
+
27
+ export { PRECISION, clamp, clip, invariant, lerp, minMax, normalize, remap, round, roundDown };
@@ -0,0 +1,27 @@
1
+ declare const PRECISION = 8;
2
+ declare function round(value: number, precision?: number): number;
3
+ declare function roundDown(value: number, precision?: number): number;
4
+ declare const lerp: {
5
+ (t: number, a: number, b: number): number;
6
+ (a: number, b: number): (t: number) => number;
7
+ };
8
+ declare const normalize: {
9
+ (x: number, a: number, b: number): number;
10
+ (a: number, b: number): (x: number) => number;
11
+ };
12
+ declare const remap: {
13
+ (x: number, x1: number, x2: number, y1: number, y2: number): number;
14
+ (x1: number, x2: number, y1: number, y2: number): (x: number) => number;
15
+ };
16
+ declare const clamp: {
17
+ (value: number, min: number, max: number): number;
18
+ (min: number, max: number): (value: number) => number;
19
+ };
20
+ declare const clip: {
21
+ <T>(value: number, min: number, max: number, onClip: T): T | number;
22
+ <T>(min: number, max: number, onClip: T): (value: number) => T | number;
23
+ };
24
+ declare function minMax(a: number, b: number): [number, number];
25
+ declare function invariant(condition: boolean, message: string): asserts condition;
26
+
27
+ export { PRECISION, clamp, clip, invariant, lerp, minMax, normalize, remap, round, roundDown };
package/dist/utils.mjs ADDED
@@ -0,0 +1,47 @@
1
+ import { dual } from './pipe.mjs';
2
+
3
+ const PRECISION = 8;
4
+ function round(value, precision = PRECISION) {
5
+ const scale = 10 ** precision;
6
+ const result = Math.round(value * scale) / scale;
7
+ if (result === 0) {
8
+ return 0;
9
+ }
10
+ return result;
11
+ }
12
+ function roundDown(value, precision = PRECISION) {
13
+ const scale = 10 ** precision;
14
+ const result = Math.floor(value * scale) / scale;
15
+ if (result === 0) {
16
+ return 0;
17
+ }
18
+ return result;
19
+ }
20
+ const lerp = dual(3, (t, a, b) => {
21
+ return b * t + a * (1 - t);
22
+ });
23
+ const normalize = dual(3, (x, a, b) => {
24
+ return (x - a) / (b - a);
25
+ });
26
+ const remap = dual(
27
+ 5,
28
+ (x, x1, x2, y1, y2) => {
29
+ return y1 + (x - x1) / (x2 - x1) * (y2 - y1);
30
+ }
31
+ );
32
+ const clamp = dual(3, (value, min, max) => {
33
+ return value < min ? min : value > max ? max : value;
34
+ });
35
+ const clip = dual(4, (value, min, max, onClip) => {
36
+ return value < min ? onClip : value > max ? onClip : value;
37
+ });
38
+ function minMax(a, b) {
39
+ return a < b ? [a, b] : [b, a];
40
+ }
41
+ function invariant(condition, message) {
42
+ if (!condition) {
43
+ throw new Error(message);
44
+ }
45
+ }
46
+
47
+ export { PRECISION, clamp, clip, invariant, lerp, minMax, normalize, remap, round, roundDown };
@@ -1,5 +1,5 @@
1
1
  import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { Pipeable } from '../pipe.mjs';
3
3
 
4
4
  declare const Vector2TypeId: unique symbol;
5
5
  type Vector2TypeId = typeof Vector2TypeId;
@@ -1,5 +1,5 @@
1
1
  import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { Pipeable } from '../pipe.js';
3
3
 
4
4
  declare const Vector2TypeId: unique symbol;
5
5
  type Vector2TypeId = typeof Vector2TypeId;
@@ -1,5 +1,6 @@
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';
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.DSxnsSFS.mjs';
2
+ import '../pipe.mjs';
3
+ import '../utils.mjs';
3
4
 
4
5
  const isVector2 = isVector2$1;
5
6
  const make = make$1;
@@ -1,5 +1,5 @@
1
1
  import { g as ThreeDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { Pipeable } from '../pipe.mjs';
3
3
 
4
4
  declare const Vector3TypeId: unique symbol;
5
5
  type Vector3TypeId = typeof Vector3TypeId;
@@ -1,5 +1,5 @@
1
1
  import { g as ThreeDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { Pipeable } from '../pipe.js';
3
3
 
4
4
  declare const Vector3TypeId: unique symbol;
5
5
  type Vector3TypeId = typeof Vector3TypeId;
@@ -1,5 +1,6 @@
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, f as scale$1 } from '../shared/curvy.DV4S13Cq.mjs';
2
- import '../shared/curvy.DLOeble8.mjs';
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, f as scale$1 } from '../shared/curvy.D7YvJAMV.mjs';
2
+ import '../pipe.mjs';
3
+ import '../utils.mjs';
3
4
 
4
5
  const isVector3 = isVector3$1;
5
6
  const make = make$1;
@@ -1,5 +1,5 @@
1
1
  import { f as FourDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { Pipeable } from '../pipe.mjs';
3
3
 
4
4
  declare const Vector4TypeId: unique symbol;
5
5
  type Vector4TypeId = typeof Vector4TypeId;
@@ -1,5 +1,5 @@
1
1
  import { f as FourDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { Pipeable } from '../pipe.js';
3
3
 
4
4
  declare const Vector4TypeId: unique symbol;
5
5
  type Vector4TypeId = typeof Vector4TypeId;
@@ -1,5 +1,6 @@
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, f as scale$1 } from '../shared/curvy.B1zfBfvf.mjs';
2
- import '../shared/curvy.DLOeble8.mjs';
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, f as scale$1 } from '../shared/curvy.C2XGH0R0.mjs';
2
+ import '../pipe.mjs';
3
+ import '../utils.mjs';
3
4
 
4
5
  const isVector4 = isVector4$1;
5
6
  const make = make$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curvy",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Spline and Curve utilities",
5
5
  "author": "Tim Morris <timthewebguy@gmail.com>",
6
6
  "homepage": "https://github.com/tkofh/curvy#readme",
@@ -87,6 +87,14 @@
87
87
  "./splines/basis2d": {
88
88
  "types": "./dist/splines/basis2d.d.ts",
89
89
  "import": "./dist/splines/basis2d.mjs"
90
+ },
91
+ "./pipe": {
92
+ "types": "./dist/pipe.d.ts",
93
+ "import": "./dist/pipe.mjs"
94
+ },
95
+ "./utils": {
96
+ "types": "./dist/utils.d.ts",
97
+ "import": "./dist/utils.mjs"
90
98
  }
91
99
  },
92
100
  "files": [
@@ -1,55 +0,0 @@
1
- import { fromPolynomials } from '../curve/cubic2d.mjs';
2
- import { vectorProductLeft } from '../matrix/matrix4x4.mjs';
3
- import { fromVector } from '../polynomial/cubic.mjs';
4
- import { make } from '../vector/vector4.mjs';
5
-
6
- function* toCurves(points, matrix, stride) {
7
- let p0;
8
- let p1;
9
- let p2;
10
- let p3;
11
- for (const point of points) {
12
- if (p0 === void 0) {
13
- p0 = point;
14
- continue;
15
- }
16
- if (p1 === void 0) {
17
- p1 = point;
18
- continue;
19
- }
20
- if (p2 === void 0) {
21
- p2 = point;
22
- continue;
23
- }
24
- p3 = point;
25
- yield fromPolynomials(
26
- fromVector(
27
- vectorProductLeft(
28
- matrix,
29
- make(p0.x, p1.x, p2.x, p3.x)
30
- )
31
- ),
32
- fromVector(
33
- vectorProductLeft(
34
- matrix,
35
- make(p0.y, p1.y, p2.y, p3.y)
36
- )
37
- )
38
- );
39
- if (stride === 1) {
40
- p0 = p1;
41
- p1 = p2;
42
- p2 = p3;
43
- } else if (stride === 2) {
44
- p0 = p2;
45
- p1 = p3;
46
- p2 = void 0;
47
- } else if (stride === 3) {
48
- p0 = p3;
49
- p1 = void 0;
50
- p2 = void 0;
51
- }
52
- }
53
- }
54
-
55
- export { toCurves as t };