curvy 0.3.3 → 1.0.0

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 +27 -0
  3. package/dist/curve/cubic2d.d.ts +27 -0
  4. package/dist/curve/cubic2d.mjs +85 -0
  5. package/dist/curve/linear2d.d.mts +27 -0
  6. package/dist/curve/linear2d.d.ts +27 -0
  7. package/dist/curve/linear2d.mjs +46 -0
  8. package/dist/curve/quadratic2d.d.mts +27 -0
  9. package/dist/curve/quadratic2d.d.ts +27 -0
  10. package/dist/curve/quadratic2d.mjs +74 -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 +29 -0
  30. package/dist/path/quadratic2d.d.ts +29 -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 +139 -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 +19 -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 +22 -0
  41. package/dist/shared/curvy.BAW_cKLu.mjs +123 -0
  42. package/dist/shared/curvy.BN-oFBsc.d.mts +26 -0
  43. package/dist/shared/curvy.BN-oFBsc.d.ts +26 -0
  44. package/dist/shared/curvy.Bxxwly94.d.mts +144 -0
  45. package/dist/shared/curvy.C-sUk7ux.mjs +119 -0
  46. package/dist/shared/curvy.CLzGuqek.mjs +124 -0
  47. package/dist/shared/curvy.CO0Wclt0.d.ts +144 -0
  48. package/dist/shared/curvy.CT38g_II.d.mts +22 -0
  49. package/dist/shared/curvy.CT38g_II.d.ts +22 -0
  50. package/dist/shared/curvy.ChkqgKuv.mjs +119 -0
  51. package/dist/shared/curvy.Cty3LrOR.mjs +70 -0
  52. package/dist/shared/curvy.D7bhnwZy.mjs +52 -0
  53. package/dist/shared/curvy.DOLqYbKE.mjs +48 -0
  54. package/dist/shared/curvy.DgRsieUW.mjs +76 -0
  55. package/dist/shared/curvy.DmVFTi0N.mjs +34 -0
  56. package/dist/splines/bezier2d.d.mts +35 -0
  57. package/dist/splines/bezier2d.d.ts +35 -0
  58. package/dist/splines/bezier2d.mjs +122 -0
  59. package/dist/vector/vector2.d.mts +37 -0
  60. package/dist/vector/vector2.d.ts +37 -0
  61. package/dist/vector/vector2.mjs +16 -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,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.0",
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';
package/dist/convert.cjs DELETED
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- const invariant = require('tiny-invariant');
4
- const splines = require('./splines.cjs');
5
- const util = require('./shared/curvy.262f6070.cjs');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
-
9
- const invariant__default = /*#__PURE__*/_interopDefaultCompat(invariant);
10
-
11
- function determinant(matrix) {
12
- const size = matrix.length;
13
- invariant__default(
14
- matrix.every((row) => row.length === size),
15
- "matrix must be square"
16
- );
17
- let result = 0;
18
- if (size === 1) {
19
- result = matrix[0][0];
20
- } else if (size === 2) {
21
- result = matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
22
- } else {
23
- for (const [columnIndex, value] of matrix[0].entries()) {
24
- const subMatrix = [];
25
- for (const row of matrix.slice(1)) {
26
- const subMatrixRow = [];
27
- for (const [subColumnIndex, subColumnValue] of row.entries()) {
28
- if (subColumnIndex !== columnIndex) {
29
- subMatrixRow.push(subColumnValue);
30
- }
31
- }
32
- subMatrix.push(subMatrixRow);
33
- }
34
- result = result + (-1) ** (columnIndex + 2) * value * determinant(subMatrix);
35
- }
36
- }
37
- return result;
38
- }
39
- function solveLinearSystem(coefficients, solutions) {
40
- const coefficientDeterminant = determinant(coefficients);
41
- invariant__default(
42
- coefficientDeterminant !== 0,
43
- "Cannot solve system of equations when coefficient matrix determinant is zero"
44
- );
45
- const variables = [0, 0, 0, 0];
46
- for (let index = 0; index < solutions.length; index++) {
47
- const solutionMatrix = [];
48
- for (const [rowIndex, row] of coefficients.entries()) {
49
- const solutionMatrixRow = [];
50
- for (const [columnIndex, column] of row.entries()) {
51
- solutionMatrixRow.push(
52
- columnIndex === index ? solutions[rowIndex] : column
53
- );
54
- }
55
- solutionMatrix.push(solutionMatrixRow);
56
- }
57
- variables[index] = determinant(solutionMatrix) / coefficientDeterminant;
58
- }
59
- return variables;
60
- }
61
- function convertScalars(points, sourceSpline, targetSpline) {
62
- const solutions = solveLinearSystem(
63
- targetSpline,
64
- splines.pointsToCoefficients(sourceSpline, points)
65
- );
66
- return [
67
- util.round(solutions[0]),
68
- util.round(solutions[1]),
69
- util.round(solutions[2]),
70
- util.round(solutions[3])
71
- ];
72
- }
73
-
74
- exports.convertScalars = convertScalars;
@@ -1,6 +0,0 @@
1
- import { a as CubicCoefficients } from './shared/curvy.df73166c.cjs';
2
- import { Matrix4x4 } from './splines.cjs';
3
-
4
- declare function convertScalars(points: CubicCoefficients, sourceSpline: Matrix4x4, targetSpline: Matrix4x4): CubicCoefficients;
5
-
6
- export { convertScalars };
@@ -1,6 +0,0 @@
1
- import { a as CubicCoefficients } from './shared/curvy.df73166c.mjs';
2
- import { Matrix4x4 } from './splines.mjs';
3
-
4
- declare function convertScalars(points: CubicCoefficients, sourceSpline: Matrix4x4, targetSpline: Matrix4x4): CubicCoefficients;
5
-
6
- export { convertScalars };
package/dist/convert.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { a as CubicCoefficients } from './shared/curvy.df73166c.js';
2
- import { Matrix4x4 } from './splines.js';
3
-
4
- declare function convertScalars(points: CubicCoefficients, sourceSpline: Matrix4x4, targetSpline: Matrix4x4): CubicCoefficients;
5
-
6
- export { convertScalars };
package/dist/convert.mjs DELETED
@@ -1,68 +0,0 @@
1
- import invariant from 'tiny-invariant';
2
- import { pointsToCoefficients } from './splines.mjs';
3
- import { a as round } from './shared/curvy.9cd8b44c.mjs';
4
-
5
- function determinant(matrix) {
6
- const size = matrix.length;
7
- invariant(
8
- matrix.every((row) => row.length === size),
9
- "matrix must be square"
10
- );
11
- let result = 0;
12
- if (size === 1) {
13
- result = matrix[0][0];
14
- } else if (size === 2) {
15
- result = matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
16
- } else {
17
- for (const [columnIndex, value] of matrix[0].entries()) {
18
- const subMatrix = [];
19
- for (const row of matrix.slice(1)) {
20
- const subMatrixRow = [];
21
- for (const [subColumnIndex, subColumnValue] of row.entries()) {
22
- if (subColumnIndex !== columnIndex) {
23
- subMatrixRow.push(subColumnValue);
24
- }
25
- }
26
- subMatrix.push(subMatrixRow);
27
- }
28
- result = result + (-1) ** (columnIndex + 2) * value * determinant(subMatrix);
29
- }
30
- }
31
- return result;
32
- }
33
- function solveLinearSystem(coefficients, solutions) {
34
- const coefficientDeterminant = determinant(coefficients);
35
- invariant(
36
- coefficientDeterminant !== 0,
37
- "Cannot solve system of equations when coefficient matrix determinant is zero"
38
- );
39
- const variables = [0, 0, 0, 0];
40
- for (let index = 0; index < solutions.length; index++) {
41
- const solutionMatrix = [];
42
- for (const [rowIndex, row] of coefficients.entries()) {
43
- const solutionMatrixRow = [];
44
- for (const [columnIndex, column] of row.entries()) {
45
- solutionMatrixRow.push(
46
- columnIndex === index ? solutions[rowIndex] : column
47
- );
48
- }
49
- solutionMatrix.push(solutionMatrixRow);
50
- }
51
- variables[index] = determinant(solutionMatrix) / coefficientDeterminant;
52
- }
53
- return variables;
54
- }
55
- function convertScalars(points, sourceSpline, targetSpline) {
56
- const solutions = solveLinearSystem(
57
- targetSpline,
58
- pointsToCoefficients(sourceSpline, points)
59
- );
60
- return [
61
- round(solutions[0]),
62
- round(solutions[1]),
63
- round(solutions[2]),
64
- round(solutions[3])
65
- ];
66
- }
67
-
68
- export { convertScalars };