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,79 @@
1
+ import { P as Pipeable, r as round, d as dual } from './curvy.ChkqgKuv.mjs';
2
+ import { make as make$1, size } from '../interval.mjs';
3
+
4
+ const QuadraticPolynomialTypeId = Symbol.for(
5
+ "curvy/polynomial/quadratic"
6
+ );
7
+ class QuadraticPolynomialImpl extends Pipeable {
8
+ [QuadraticPolynomialTypeId] = QuadraticPolynomialTypeId;
9
+ c0;
10
+ c1;
11
+ c2;
12
+ constructor(c0 = 0, c1 = 0, c2 = 0) {
13
+ super();
14
+ this.c0 = round(c0);
15
+ this.c1 = round(c1);
16
+ this.c2 = round(c2);
17
+ }
18
+ }
19
+
20
+ const LinearPolynomialTypeId = Symbol.for("curvy/linear");
21
+ class LinearPolynomialImpl extends Pipeable {
22
+ [LinearPolynomialTypeId] = LinearPolynomialTypeId;
23
+ c0;
24
+ c1;
25
+ constructor(c0 = 0, c1 = 0) {
26
+ super();
27
+ this.c0 = round(c0);
28
+ this.c1 = round(c1);
29
+ }
30
+ }
31
+ const isLinearPolynomial = (v) => typeof v === "object" && v !== null && LinearPolynomialTypeId in v;
32
+ const make = (c0 = 0, c1 = 0) => new LinearPolynomialImpl(c0, c1);
33
+ const fromVector = (v) => new LinearPolynomialImpl(v.x, v.y);
34
+ const fromPointSlope = (p, slope) => new LinearPolynomialImpl(p.y - slope * p.x, slope);
35
+ const fromPoints = (p1, p2) => fromPointSlope(p1, (p2.y - p1.y) / (p2.x - p1.x));
36
+ const solve = dual(2, (p, x) => round(p.c0 + x * p.c1));
37
+ const toSolver = (p) => (x) => solve(p, x);
38
+ const solveInverse = dual(2, (p, y) => {
39
+ if (p.c1 === 0) {
40
+ return null;
41
+ }
42
+ return round((y - p.c0) / p.c1);
43
+ });
44
+ const toInverseSolver = (p) => (y) => solveInverse(p, y);
45
+ const monotonicity = (p) => p.c1 === 0 ? "constant" : p.c1 > 0 ? "increasing" : "decreasing";
46
+ const derivative = (p) => p.c1;
47
+ const antiderivative = dual(
48
+ (args) => isLinearPolynomial(args[0]),
49
+ (p, integrationConstant = 0) => new QuadraticPolynomialImpl(integrationConstant, p.c0, p.c1 / 2)
50
+ );
51
+ const domain = dual(2, (p, range2) => {
52
+ if (p.c1 === 0) {
53
+ if (range2.start === p.c0 && range2.end === p.c0) {
54
+ return make$1(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY);
55
+ }
56
+ return null;
57
+ }
58
+ const start = solveInverse(p, range2.start);
59
+ const end = solveInverse(p, range2.end);
60
+ if (start === null || end === null) {
61
+ return null;
62
+ }
63
+ return make$1(start, end);
64
+ });
65
+ const range = dual(
66
+ 2,
67
+ (p, domain2) => make$1(solve(p, domain2.start), solve(p, domain2.end))
68
+ );
69
+ const length = dual(2, (p, domain2) => {
70
+ if (size(domain2) === 0) {
71
+ return 0;
72
+ }
73
+ if (p.c1 === 0) {
74
+ return round(size(domain2));
75
+ }
76
+ return round(Math.sqrt(1 + p.c1 ** 2) * size(domain2));
77
+ });
78
+
79
+ export { QuadraticPolynomialImpl as Q, make as a, QuadraticPolynomialTypeId as b, solveInverse as c, fromPointSlope as d, fromPoints as e, fromVector as f, toInverseSolver as g, derivative as h, isLinearPolynomial as i, antiderivative as j, domain as k, length as l, monotonicity as m, range as r, solve as s, toSolver as t };
@@ -0,0 +1,119 @@
1
+ import { i as invariant, d as dual, r as round, P as Pipeable } from './curvy.ChkqgKuv.mjs';
2
+ import { m as make$1, d as dot } from './curvy.DOSsf40r.mjs';
3
+
4
+ function toIndex(input) {
5
+ if (typeof input === "number") {
6
+ invariant(input >= 0 && input <= 3, "Index out of bounds");
7
+ return input;
8
+ }
9
+ if (input === "x") {
10
+ return 0;
11
+ }
12
+ if (input === "y") {
13
+ return 1;
14
+ }
15
+ if (input === "z") {
16
+ return 2;
17
+ }
18
+ if (input === "w") {
19
+ return 3;
20
+ }
21
+ invariant(false, "Invalid component");
22
+ }
23
+ const toTwoDimensionalIndex = toIndex;
24
+ const toThreeDimensionalIndex = toIndex;
25
+ const toFourDimensionalIndex = toIndex;
26
+
27
+ const Matrix2x2TypeId = Symbol.for("curvy/matrix2x2");
28
+ class Matrix2x2Impl extends Pipeable {
29
+ [Matrix2x2TypeId] = Matrix2x2TypeId;
30
+ m00;
31
+ m01;
32
+ m10;
33
+ m11;
34
+ constructor(m00 = 0, m01 = 0, m10 = 0, m11 = 0) {
35
+ super();
36
+ this.m00 = round(m00);
37
+ this.m01 = round(m01);
38
+ this.m10 = round(m10);
39
+ this.m11 = round(m11);
40
+ }
41
+ get [Symbol.toStringTag]() {
42
+ return `Matrix2x2(${this.m00}, ${this.m01}, ${this.m10}, ${this.m11})`;
43
+ }
44
+ get [Symbol.for("nodejs.util.inspect.custom")]() {
45
+ return `Matrix2x2(${this.m00}, ${this.m01}, ${this.m10}, ${this.m11})`;
46
+ }
47
+ [Symbol.hasInstance](m) {
48
+ return isMatrix2x2(m);
49
+ }
50
+ }
51
+ const isMatrix2x2 = (m) => typeof m === "object" && m !== null && Matrix2x2TypeId in m;
52
+ const make = (m00 = 0, m01 = m00, m10 = m01, m11 = m10) => new Matrix2x2Impl(m00, m01, m10, m11);
53
+ const fromRows = (v0, v1) => new Matrix2x2Impl(v0.x, v0.y, v1.x, v1.y);
54
+ const fromColumns = (v0, v1) => new Matrix2x2Impl(v0.x, v1.x, v0.y, v1.y);
55
+ const setRow = dual(
56
+ 3,
57
+ (m, row, v) => fromRows(
58
+ ...toRows(m).with(toTwoDimensionalIndex(row), v)
59
+ )
60
+ );
61
+ const setColumn = dual(
62
+ 3,
63
+ (m, column, v) => fromColumns(
64
+ ...toColumns(m).with(toTwoDimensionalIndex(column), v)
65
+ )
66
+ );
67
+ const determinant = (m) => round(m.m00 * m.m11 - m.m01 * m.m10);
68
+ const vectorProductLeft = dual(
69
+ 2,
70
+ (m, v) => make$1(
71
+ dot(rowVector(m, 0), v),
72
+ dot(rowVector(m, 1), v)
73
+ )
74
+ );
75
+ const vectorProductRight = dual(
76
+ 2,
77
+ (m, v) => make$1(
78
+ dot(columnVector(m, 0), v),
79
+ dot(columnVector(m, 1), v)
80
+ )
81
+ );
82
+ const solveSystem = dual(2, (m, v) => {
83
+ const inverseDeterminant = 1 / determinant(m);
84
+ invariant(
85
+ Number.isFinite(inverseDeterminant),
86
+ "cannot solve system when coefficient matrix determinant is zero"
87
+ );
88
+ return make$1(
89
+ determinant(setColumn(m, 0, v)) * inverseDeterminant,
90
+ determinant(setColumn(m, 1, v)) * inverseDeterminant
91
+ );
92
+ });
93
+ const toRows = (m) => [
94
+ make$1(m.m00, m.m01),
95
+ make$1(m.m10, m.m11)
96
+ ];
97
+ const toColumns = (m) => [
98
+ make$1(m.m00, m.m10),
99
+ make$1(m.m01, m.m11)
100
+ ];
101
+ const rowVector = dual(
102
+ 2,
103
+ (m, row) => toRows(m)[toTwoDimensionalIndex(row)]
104
+ );
105
+ const columnVector = dual(
106
+ 2,
107
+ (m, column) => toColumns(m)[toTwoDimensionalIndex(column)]
108
+ );
109
+ const transpose = (m) => fromColumns(...toRows(m));
110
+ const reverseRows = (m) => {
111
+ const [r0, r1] = toRows(m);
112
+ return fromRows(r1, r0);
113
+ };
114
+ const reverseColumns = (m) => {
115
+ const [c0, c1] = toColumns(m);
116
+ return fromColumns(c1, c0);
117
+ };
118
+
119
+ export { fromColumns as a, setColumn as b, vectorProductRight as c, determinant as d, solveSystem as e, fromRows as f, toColumns as g, columnVector as h, isMatrix2x2 as i, transpose as j, reverseRows as k, reverseColumns as l, make as m, toFourDimensionalIndex as n, toThreeDimensionalIndex as o, rowVector as r, setRow as s, toRows as t, vectorProductLeft as v };
@@ -0,0 +1,49 @@
1
+ import { d as dual, a as PRECISION, r as round, P as Pipeable } from './curvy.ChkqgKuv.mjs';
2
+
3
+ const Vector2TypeId = Symbol.for("curvy/vector2");
4
+ class Vector2Impl extends Pipeable {
5
+ [Vector2TypeId] = Vector2TypeId;
6
+ x;
7
+ y;
8
+ precision;
9
+ constructor(v0 = 0, v1 = 0, precision = PRECISION) {
10
+ super();
11
+ this.x = round(v0, precision);
12
+ this.y = round(v1, precision);
13
+ this.precision = precision;
14
+ }
15
+ get [0]() {
16
+ return this.x;
17
+ }
18
+ get [1]() {
19
+ return this.y;
20
+ }
21
+ get [Symbol.toStringTag]() {
22
+ return `Vector2(${this.x}, ${this.y})`;
23
+ }
24
+ get [Symbol.for("nodejs.util.inspect.custom")]() {
25
+ return this[Symbol.toStringTag];
26
+ }
27
+ }
28
+ const isVector2 = (v) => typeof v === "object" && v !== null && Vector2TypeId in v;
29
+ const make = (v0, v1 = v0, precision = PRECISION) => new Vector2Impl(v0, v1, precision);
30
+ const components = (v) => [v.x, v.y];
31
+ const magnitude = (vector) => round(Math.hypot(vector.x, vector.y));
32
+ const normalize = (vector) => {
33
+ const m = magnitude(vector);
34
+ return make(vector.x / m, vector.y / m);
35
+ };
36
+ const dot = dual(2, (a, b) => round(a.x * b.x + a.y * b.y));
37
+ const cross = dual(2, (a, b) => round(a.x * b.y - a.y * b.x));
38
+ const softmax = (v) => {
39
+ const max = Math.max(v.x, v.y);
40
+ const v0 = Math.exp(v.x - max);
41
+ const v1 = Math.exp(v.y - max);
42
+ const sum = v0 + v1;
43
+ return make(v0 / sum, v1 / sum);
44
+ };
45
+ const add = dual(2, (a, b) => make(a.x + b.x, a.y + b.y));
46
+ const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y));
47
+ const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y));
48
+
49
+ export { magnitude as a, components as b, cross as c, dot as d, add as e, subtract as f, hadamard as h, isVector2 as i, make as m, normalize as n, softmax as s };
@@ -0,0 +1,34 @@
1
+ const GL32_X0 = 0.9972638618494816;
2
+ const GL32_X1 = 0.9856115115452684;
3
+ const GL32_X2 = 0.9647622555875064;
4
+ const GL32_X3 = 0.9349060759377397;
5
+ const GL32_X4 = 0.8963211557660521;
6
+ const GL32_X5 = 0.84936761373257;
7
+ const GL32_X6 = 0.7944837959679424;
8
+ const GL32_X7 = 0.7321821187402897;
9
+ const GL32_X8 = 0.6630442669302152;
10
+ const GL32_X9 = 0.5877157572407623;
11
+ const GL32_X10 = 0.5068999089322294;
12
+ const GL32_X11 = 0.42135127613063533;
13
+ const GL32_X12 = 0.33186860228212767;
14
+ const GL32_X13 = 0.23928736225213706;
15
+ const GL32_X14 = 0.1444719615827965;
16
+ const GL32_X15 = 0.04830766568773831;
17
+ const GL32_W0 = 0.007018610009470136;
18
+ const GL32_W1 = 0.01627439473090571;
19
+ const GL32_W2 = 0.02539206530926214;
20
+ const GL32_W3 = 0.03427386291302141;
21
+ const GL32_W4 = 0.042835898022226704;
22
+ const GL32_W5 = 0.050998059262376154;
23
+ const GL32_W6 = 0.05868409347853558;
24
+ const GL32_W7 = 0.06582222277636195;
25
+ const GL32_W8 = 0.07234579410884862;
26
+ const GL32_W9 = 0.07819389578707044;
27
+ const GL32_W10 = 0.08331192422694672;
28
+ const GL32_W11 = 0.08765209300440374;
29
+ const GL32_W12 = 0.0911738786957639;
30
+ const GL32_W13 = 0.09384439908080454;
31
+ const GL32_W14 = 0.09563872007927485;
32
+ const GL32_W15 = 0.09654008851472785;
33
+
34
+ export { GL32_X13 as A, GL32_W14 as B, GL32_X14 as C, GL32_W15 as D, GL32_X15 as E, GL32_W0 as G, GL32_X0 as a, GL32_W1 as b, GL32_X1 as c, GL32_W2 as d, GL32_X2 as e, GL32_W3 as f, GL32_X3 as g, GL32_W4 as h, GL32_X4 as i, GL32_W5 as j, GL32_X5 as k, GL32_W6 as l, GL32_X6 as m, GL32_W7 as n, GL32_X7 as o, GL32_W8 as p, GL32_X8 as q, GL32_W9 as r, GL32_X9 as s, GL32_W10 as t, GL32_X10 as u, GL32_W11 as v, GL32_X11 as w, GL32_W12 as x, GL32_X12 as y, GL32_W13 as z };
@@ -0,0 +1,155 @@
1
+ import { P as Pipeable } from './curvy.BN-oFBsc.mjs';
2
+ import { Interval } from '../interval.mjs';
3
+ import { Vector2 } from '../vector/vector2.mjs';
4
+ import { Vector3 } from '../vector/vector3.mjs';
5
+ import { Vector4 } from '../vector/vector4.mjs';
6
+
7
+ declare const CubicPolynomialTypeId: unique symbol;
8
+ type CubicPolynomialTypeId = typeof CubicPolynomialTypeId;
9
+
10
+ type Monotonicity = 'none' | 'increasing' | 'decreasing' | 'constant';
11
+ type GuaranteedMonotonicity = 'increasing' | 'decreasing' | 'constant';
12
+
13
+ type ZeroOrOneSolution = number | null;
14
+ type ZeroOrOneInterval = Interval | null;
15
+ type ZeroToTwoSolutions = readonly [] | readonly [number] | readonly [number, number];
16
+ type ZeroToThreeSolutions = readonly [] | readonly [number] | readonly [number, number] | readonly [number, number, number];
17
+
18
+ interface CubicPolynomial extends Pipeable {
19
+ readonly [CubicPolynomialTypeId]: CubicPolynomialTypeId;
20
+ readonly c0: number;
21
+ readonly c1: number;
22
+ readonly c2: number;
23
+ readonly c3: number;
24
+ }
25
+ declare const isCubicPolynomial: (value: unknown) => value is CubicPolynomial;
26
+ declare const make$2: (c0: number, c1: number, c2: number, c3: number) => CubicPolynomial;
27
+ declare const fromVector$2: (v: Vector4) => CubicPolynomial;
28
+ declare const solve$2: {
29
+ (p: CubicPolynomial, x: number): number;
30
+ (x: number): (p: CubicPolynomial) => number;
31
+ };
32
+ declare const toSolver$2: (p: CubicPolynomial) => (x: number) => number;
33
+ declare const solveInverse$2: {
34
+ (p: CubicPolynomial, y: number): ZeroToThreeSolutions;
35
+ (y: number): (p: CubicPolynomial) => ZeroToThreeSolutions;
36
+ };
37
+ declare const toInverseSolver$2: (p: CubicPolynomial) => (y: number) => ZeroToThreeSolutions;
38
+ declare const derivative$2: (p: CubicPolynomial) => QuadraticPolynomial;
39
+ declare const roots$1: (p: CubicPolynomial) => ZeroToThreeSolutions;
40
+ declare const extrema: (p: CubicPolynomial) => ZeroToTwoSolutions;
41
+ declare const monotonicity$2: {
42
+ (p: CubicPolynomial, i?: Interval): Monotonicity;
43
+ (i: Interval): (p: CubicPolynomial) => Monotonicity;
44
+ };
45
+ declare const domain$2: {
46
+ (p: CubicPolynomial, range: Interval): Interval;
47
+ (range: Interval): (p: CubicPolynomial) => Interval;
48
+ };
49
+ declare const range$2: {
50
+ (p: CubicPolynomial, domain: Interval): Interval;
51
+ (domain: Interval): (p: CubicPolynomial) => Interval;
52
+ };
53
+ declare const length$2: {
54
+ (p: CubicPolynomial, domain: Interval): number;
55
+ (domain: Interval): (p: CubicPolynomial) => number;
56
+ };
57
+ declare const curvature$1: {
58
+ (p: CubicPolynomial, x: number): number;
59
+ (x: number): (p: CubicPolynomial) => number;
60
+ };
61
+
62
+ declare const QuadraticPolynomialTypeId: unique symbol;
63
+ type QuadraticPolynomialTypeId = typeof QuadraticPolynomialTypeId;
64
+
65
+ interface QuadraticPolynomial extends Pipeable {
66
+ readonly [QuadraticPolynomialTypeId]: QuadraticPolynomialTypeId;
67
+ readonly c0: number;
68
+ readonly c1: number;
69
+ readonly c2: number;
70
+ }
71
+ declare const isQuadraticPolynomial: (v: unknown) => v is QuadraticPolynomial;
72
+ declare const make$1: (c0?: number, c1?: number, c2?: number) => QuadraticPolynomial;
73
+ declare const fromVector$1: (v: Vector3) => QuadraticPolynomial;
74
+ declare const solve$1: {
75
+ (p: QuadraticPolynomial, x: number): number;
76
+ (x: number): (p: QuadraticPolynomial) => number;
77
+ };
78
+ declare const toSolver$1: (p: QuadraticPolynomial) => (x: number) => number;
79
+ declare const solveInverse$1: {
80
+ (p: QuadraticPolynomial, y: number): ZeroToTwoSolutions;
81
+ (y: number): (p: QuadraticPolynomial) => ZeroToTwoSolutions;
82
+ };
83
+ declare const toInverseSolver$1: (p: QuadraticPolynomial) => (y: number) => ZeroToTwoSolutions;
84
+ declare const derivative$1: (p: QuadraticPolynomial) => LinearPolynomial;
85
+ declare const roots: (p: QuadraticPolynomial) => ZeroToTwoSolutions;
86
+ declare const extreme: (p: QuadraticPolynomial) => ZeroOrOneSolution;
87
+ declare const monotonicity$1: {
88
+ (p: QuadraticPolynomial, i?: Interval): Monotonicity;
89
+ (i: Interval): (p: QuadraticPolynomial) => Monotonicity;
90
+ };
91
+ declare const antiderivative$1: {
92
+ (p: QuadraticPolynomial, constant?: number): CubicPolynomial;
93
+ (constant: number): (p: QuadraticPolynomial) => CubicPolynomial;
94
+ };
95
+ declare const domain$1: {
96
+ (p: QuadraticPolynomial, range: Interval): Interval | null;
97
+ (range: Interval): (p: QuadraticPolynomial) => Interval | null;
98
+ };
99
+ declare const range$1: {
100
+ (p: QuadraticPolynomial, domain: Interval): Interval;
101
+ (domain: Interval): (p: QuadraticPolynomial) => Interval;
102
+ };
103
+ declare const length$1: {
104
+ (p: QuadraticPolynomial, i: Interval): number;
105
+ (i: Interval): (p: QuadraticPolynomial) => number;
106
+ };
107
+ declare const curvature: {
108
+ (p: QuadraticPolynomial, x: number): number;
109
+ (x: number): (p: QuadraticPolynomial) => number;
110
+ };
111
+
112
+ declare const LinearPolynomialTypeId: unique symbol;
113
+ type LinearPolynomialTypeId = typeof LinearPolynomialTypeId;
114
+
115
+ interface LinearPolynomial extends Pipeable {
116
+ readonly [LinearPolynomialTypeId]: LinearPolynomialTypeId;
117
+ readonly c0: number;
118
+ readonly c1: number;
119
+ }
120
+ declare const isLinearPolynomial: (v: unknown) => v is LinearPolynomial;
121
+ declare const make: (c0?: number, c1?: number) => LinearPolynomial;
122
+ declare const fromVector: (v: Vector2) => LinearPolynomial;
123
+ declare const fromPointSlope: (p: Vector2, slope: number) => LinearPolynomial;
124
+ declare const fromPoints: (p1: Vector2, p2: Vector2) => LinearPolynomial;
125
+ declare const solve: {
126
+ (p: LinearPolynomial, x: number): number;
127
+ (x: number): (p: LinearPolynomial) => number;
128
+ };
129
+ declare const toSolver: (p: LinearPolynomial) => (x: number) => number;
130
+ declare const solveInverse: {
131
+ (p: LinearPolynomial, y: number): ZeroOrOneSolution;
132
+ (y: number): (p: LinearPolynomial) => ZeroOrOneSolution;
133
+ };
134
+ declare const toInverseSolver: (p: LinearPolynomial) => (y: number) => ZeroOrOneSolution;
135
+ declare const root: (p: LinearPolynomial) => ZeroOrOneSolution;
136
+ declare const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity;
137
+ declare const derivative: (p: LinearPolynomial) => number;
138
+ declare const antiderivative: {
139
+ (p: LinearPolynomial, constant?: number): QuadraticPolynomial;
140
+ (constant: number): (p: LinearPolynomial) => QuadraticPolynomial;
141
+ };
142
+ declare const domain: {
143
+ (p: LinearPolynomial, range: Interval): ZeroOrOneInterval;
144
+ (range: Interval): (p: LinearPolynomial) => ZeroOrOneInterval;
145
+ };
146
+ declare const range: {
147
+ (p: LinearPolynomial, domain: Interval): Interval;
148
+ (domain: Interval): (p: LinearPolynomial) => Interval;
149
+ };
150
+ declare const length: {
151
+ (p: LinearPolynomial, domain: Interval): number;
152
+ (domain: Interval): (p: LinearPolynomial) => number;
153
+ };
154
+
155
+ export { antiderivative$1 as A, domain$1 as B, type CubicPolynomial as C, range$1 as D, length$1 as E, curvature as F, isLinearPolynomial as G, make as H, fromVector as I, fromPointSlope as J, fromPoints as K, type LinearPolynomial as L, solve as M, toSolver as N, solveInverse as O, toInverseSolver as P, type QuadraticPolynomial as Q, root as R, monotonicity as S, derivative as T, antiderivative as U, domain as V, range as W, length as X, solveInverse$2 as a, toInverseSolver$2 as b, monotonicity$2 as c, derivative$2 as d, extrema as e, fromVector$2 as f, domain$2 as g, range$2 as h, isCubicPolynomial as i, curvature$1 as j, isQuadraticPolynomial as k, length$2 as l, make$2 as m, make$1 as n, fromVector$1 as o, solve$1 as p, toSolver$1 as q, roots$1 as r, solve$2 as s, toSolver$2 as t, solveInverse$1 as u, toInverseSolver$1 as v, derivative$1 as w, roots as x, extreme as y, monotonicity$1 as z };
@@ -0,0 +1,123 @@
1
+ import { o as toThreeDimensionalIndex, d as determinant$1, m as make$1 } from './curvy.DM6AiKbn.mjs';
2
+ import { d as dual, r as round, i as invariant, P as Pipeable } from './curvy.ChkqgKuv.mjs';
3
+ import { c as components, m as make$2, d as dot } from './curvy.D7bhnwZy.mjs';
4
+
5
+ const Matrix3x3TypeId = Symbol.for("curvy/matrix3x3");
6
+ class Matrix3x3Impl extends Pipeable {
7
+ [Matrix3x3TypeId] = Matrix3x3TypeId;
8
+ m00;
9
+ m01;
10
+ m02;
11
+ m10;
12
+ m11;
13
+ m12;
14
+ m20;
15
+ m21;
16
+ m22;
17
+ constructor(m00 = 0, m01 = 0, m02 = 0, m10 = 0, m11 = 0, m12 = 0, m20 = 0, m21 = 0, m22 = 0) {
18
+ super();
19
+ this.m00 = round(m00);
20
+ this.m01 = round(m01);
21
+ this.m02 = round(m02);
22
+ this.m10 = round(m10);
23
+ this.m11 = round(m11);
24
+ this.m12 = round(m12);
25
+ this.m20 = round(m20);
26
+ this.m21 = round(m21);
27
+ this.m22 = round(m22);
28
+ }
29
+ get [Symbol.toStringTag]() {
30
+ return `Matrix3x3(${this.m00}, ${this.m01}, ${this.m02}, ${this.m10}, ${this.m11}, ${this.m12}, ${this.m20}, ${this.m21}, ${this.m22})`;
31
+ }
32
+ get [Symbol.for("nodejs.util.inspect.custom")]() {
33
+ return `Matrix3x3(${this.m00}, ${this.m01}, ${this.m02}, ${this.m10}, ${this.m11}, ${this.m12}, ${this.m20}, ${this.m21}, ${this.m22})`;
34
+ }
35
+ [Symbol.hasInstance](m) {
36
+ return isMatrix3x3(m);
37
+ }
38
+ }
39
+ const isMatrix3x3 = (m) => typeof m === "object" && m !== null && Matrix3x3TypeId in m;
40
+ const make = (m00 = 0, m01 = m00, m02 = m01, m10 = m02, m11 = m10, m12 = m11, m20 = m12, m21 = m20, m22 = m21) => {
41
+ return new Matrix3x3Impl(m00, m01, m02, m10, m11, m12, m20, m21, m22);
42
+ };
43
+ const fromRows = (v0, v1, v2) => new Matrix3x3Impl(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z);
44
+ const fromColumns = (v0, v1, v2) => new Matrix3x3Impl(v0.x, v1.x, v2.x, v0.y, v1.y, v2.y, v0.z, v1.z, v2.z);
45
+ const setRow = dual(
46
+ 3,
47
+ (m, row, v) => fromRows(
48
+ ...toRows(m).with(toThreeDimensionalIndex(row), v)
49
+ )
50
+ );
51
+ const setColumn = dual(
52
+ 3,
53
+ (m, column, v) => fromColumns(
54
+ ...toColumns(m).with(toThreeDimensionalIndex(column), v)
55
+ )
56
+ );
57
+ const determinant = (m) => round(
58
+ m.m00 * determinant$1(minor(m, 0, 0)) - m.m01 * determinant$1(minor(m, 0, 1)) + m.m02 * determinant$1(minor(m, 0, 2))
59
+ );
60
+ const minor = dual(3, (m, row, column) => {
61
+ const [v0, v1] = toRows(m).toSpliced(toThreeDimensionalIndex(row), 1);
62
+ const columnIndex = toThreeDimensionalIndex(column);
63
+ const [m00, m01] = components(v0).toSpliced(columnIndex, 1);
64
+ const [m10, m11] = components(v1).toSpliced(columnIndex, 1);
65
+ return make$1(m00, m01, m10, m11);
66
+ });
67
+ const vectorProductLeft = dual(2, (m, v) => {
68
+ const [v0, v1, v2] = toRows(m);
69
+ return make$2(
70
+ dot(v0, v),
71
+ dot(v1, v),
72
+ dot(v2, v)
73
+ );
74
+ });
75
+ const vectorProductRight = dual(2, (m, v) => {
76
+ const [v0, v1, v2] = toColumns(m);
77
+ return make$2(
78
+ dot(v, v0),
79
+ dot(v, v1),
80
+ dot(v, v2)
81
+ );
82
+ });
83
+ const solveSystem = dual(2, (m, v) => {
84
+ const inverseDeterminant = 1 / determinant(m);
85
+ invariant(
86
+ Number.isFinite(inverseDeterminant),
87
+ "cannot solve system when coefficient matrix determinant is zero"
88
+ );
89
+ return make$2(
90
+ determinant(setColumn(m, 0, v)) * inverseDeterminant,
91
+ determinant(setColumn(m, 1, v)) * inverseDeterminant,
92
+ determinant(setColumn(m, 2, v)) * inverseDeterminant
93
+ );
94
+ });
95
+ const toRows = (m) => [
96
+ make$2(m.m00, m.m01, m.m02),
97
+ make$2(m.m10, m.m11, m.m12),
98
+ make$2(m.m20, m.m21, m.m22)
99
+ ];
100
+ const toColumns = (m) => [
101
+ make$2(m.m00, m.m10, m.m20),
102
+ make$2(m.m01, m.m11, m.m21),
103
+ make$2(m.m02, m.m12, m.m22)
104
+ ];
105
+ const rowVector = dual(
106
+ 2,
107
+ (m, row) => toRows(m)[toThreeDimensionalIndex(row)]
108
+ );
109
+ const columnVector = dual(
110
+ 2,
111
+ (m, column) => toColumns(m)[toThreeDimensionalIndex(column)]
112
+ );
113
+ const transpose = (m) => fromColumns(...toRows(m));
114
+ const reverseRows = (m) => {
115
+ const [v0, v1, v2] = toRows(m);
116
+ return fromRows(v2, v1, v0);
117
+ };
118
+ const reverseColumns = (m) => {
119
+ const [v0, v1, v2] = toColumns(m);
120
+ return fromColumns(v2, v1, v0);
121
+ };
122
+
123
+ export { fromColumns as a, setColumn as b, minor as c, determinant as d, vectorProductRight as e, fromRows as f, solveSystem as g, toColumns as h, isMatrix3x3 as i, columnVector as j, transpose as k, reverseRows as l, make as m, reverseColumns as n, rowVector as r, setRow as s, toRows as t, vectorProductLeft as v };
@@ -0,0 +1,43 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
2
+ import { CubicPath2d } from '../path/cubic2d.mjs';
3
+ import { Vector2 } from '../vector/vector2.mjs';
4
+ import '../curve/cubic2d.mjs';
5
+ import '../shared/curvy.CT38g_II.mjs';
6
+ import '../interval.mjs';
7
+ import '../shared/curvy.DwHW5Fqt.mjs';
8
+ import '../vector/vector3.mjs';
9
+ import '../vector/vector4.mjs';
10
+
11
+ declare const Bezier2dTypeId: unique symbol;
12
+ type Bezier2dTypeId = typeof Bezier2dTypeId;
13
+
14
+ interface Bezier2d extends Pipeable {
15
+ readonly [Bezier2dTypeId]: Bezier2dTypeId;
16
+ [Symbol.iterator](): IterableIterator<Vector2>;
17
+ }
18
+ declare const make: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Bezier2d;
19
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Bezier2d;
20
+ declare const isCubicBezier2d: (p: unknown) => p is Bezier2d;
21
+ declare const append: {
22
+ (p1: Vector2, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
23
+ (p: Bezier2d, p1: Vector2, p2: Vector2, p3: Vector2): Bezier2d;
24
+ };
25
+ declare const appendTangentAligned: {
26
+ (ratio: number, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
27
+ (p: Bezier2d, ratio: number, p2: Vector2, p3: Vector2): Bezier2d;
28
+ };
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: {
34
+ (p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
35
+ (p: Bezier2d, p2: Vector2, p3: Vector2): Bezier2d;
36
+ };
37
+ declare const appendAccelerationAligned: {
38
+ (p3: Vector2): (p: Bezier2d) => Bezier2d;
39
+ (p: Bezier2d, p3: Vector2): Bezier2d;
40
+ };
41
+ declare const toPath: (p: Bezier2d) => CubicPath2d;
42
+
43
+ export { type Bezier2d, append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };
@@ -0,0 +1,43 @@
1
+ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
2
+ import { CubicPath2d } from '../path/cubic2d.js';
3
+ import { Vector2 } from '../vector/vector2.js';
4
+ import '../curve/cubic2d.js';
5
+ import '../shared/curvy.CT38g_II.js';
6
+ import '../interval.js';
7
+ import '../shared/curvy.CkJRVnqj.js';
8
+ import '../vector/vector3.js';
9
+ import '../vector/vector4.js';
10
+
11
+ declare const Bezier2dTypeId: unique symbol;
12
+ type Bezier2dTypeId = typeof Bezier2dTypeId;
13
+
14
+ interface Bezier2d extends Pipeable {
15
+ readonly [Bezier2dTypeId]: Bezier2dTypeId;
16
+ [Symbol.iterator](): IterableIterator<Vector2>;
17
+ }
18
+ declare const make: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Bezier2d;
19
+ declare const fromArray: (points: ReadonlyArray<Vector2>) => Bezier2d;
20
+ declare const isCubicBezier2d: (p: unknown) => p is Bezier2d;
21
+ declare const append: {
22
+ (p1: Vector2, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
23
+ (p: Bezier2d, p1: Vector2, p2: Vector2, p3: Vector2): Bezier2d;
24
+ };
25
+ declare const appendTangentAligned: {
26
+ (ratio: number, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
27
+ (p: Bezier2d, ratio: number, p2: Vector2, p3: Vector2): Bezier2d;
28
+ };
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: {
34
+ (p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
35
+ (p: Bezier2d, p2: Vector2, p3: Vector2): Bezier2d;
36
+ };
37
+ declare const appendAccelerationAligned: {
38
+ (p3: Vector2): (p: Bezier2d) => Bezier2d;
39
+ (p: Bezier2d, p3: Vector2): Bezier2d;
40
+ };
41
+ declare const toPath: (p: Bezier2d) => CubicPath2d;
42
+
43
+ export { type Bezier2d, append, appendAccelerationAligned, appendCurvatureMirrored, appendTangentAligned, appendVelocityAligned, fromArray, isCubicBezier2d, make, toPath };