curvy 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/curve/cubic2d.d.mts +7 -3
- package/dist/curve/cubic2d.d.ts +7 -3
- package/dist/curve/cubic2d.mjs +22 -11
- package/dist/curve/linear2d.d.mts +4 -3
- package/dist/curve/linear2d.d.ts +4 -3
- package/dist/curve/linear2d.mjs +6 -4
- package/dist/curve/quadratic2d.d.mts +9 -3
- package/dist/curve/quadratic2d.d.ts +9 -3
- package/dist/curve/quadratic2d.mjs +24 -12
- package/dist/interval.mjs +1 -1
- package/dist/matrix/matrix2x2.d.mts +1 -1
- package/dist/matrix/matrix2x2.d.ts +1 -1
- package/dist/matrix/matrix2x2.mjs +3 -3
- package/dist/matrix/matrix3x3.d.mts +1 -1
- package/dist/matrix/matrix3x3.d.ts +1 -1
- package/dist/matrix/matrix3x3.mjs +5 -5
- package/dist/matrix/matrix4x4.d.mts +1 -1
- package/dist/matrix/matrix4x4.d.ts +1 -1
- package/dist/matrix/matrix4x4.mjs +6 -6
- package/dist/path/cubic2d.d.mts +2 -2
- package/dist/path/cubic2d.d.ts +2 -2
- package/dist/path/cubic2d.mjs +7 -6
- package/dist/path/linear2d.d.mts +2 -2
- package/dist/path/linear2d.d.ts +2 -2
- package/dist/path/linear2d.mjs +3 -3
- package/dist/path/quadratic2d.d.mts +3 -2
- package/dist/path/quadratic2d.d.ts +3 -2
- package/dist/path/quadratic2d.mjs +4 -4
- package/dist/polynomial/cubic.d.mts +2 -2
- package/dist/polynomial/cubic.d.ts +2 -2
- package/dist/polynomial/cubic.mjs +12 -4
- package/dist/polynomial/linear.d.mts +2 -2
- package/dist/polynomial/linear.d.ts +2 -2
- package/dist/polynomial/linear.mjs +6 -3
- package/dist/polynomial/quadratic.d.mts +2 -2
- package/dist/polynomial/quadratic.d.ts +2 -2
- package/dist/polynomial/quadratic.mjs +5 -4
- package/dist/shared/{curvy.Cty3LrOR.mjs → curvy.B1zfBfvf.mjs} +6 -2
- package/dist/shared/{curvy.DOLqYbKE.mjs → curvy.BPOevbwG.mjs} +8 -8
- package/dist/shared/{curvy.CT38g_II.d.mts → curvy.Bf5TIk31.d.mts} +1 -1
- package/dist/shared/{curvy.CT38g_II.d.ts → curvy.Bf5TIk31.d.ts} +1 -1
- package/dist/shared/{curvy.C-sUk7ux.mjs → curvy.BrrC9QVB.mjs} +2 -2
- package/dist/shared/{curvy.CO0Wclt0.d.ts → curvy.CkJRVnqj.d.ts} +14 -3
- package/dist/shared/{curvy.ChkqgKuv.mjs → curvy.DLOeble8.mjs} +9 -1
- package/dist/shared/curvy.DN9ptodP.mjs +55 -0
- package/dist/shared/{curvy.BAW_cKLu.mjs → curvy.DTco5vku.mjs} +3 -3
- package/dist/shared/{curvy.D7bhnwZy.mjs → curvy.DV4S13Cq.mjs} +3 -2
- package/dist/shared/{curvy.Bxxwly94.d.mts → curvy.DwHW5Fqt.d.mts} +14 -3
- package/dist/shared/{curvy.DgRsieUW.mjs → curvy.O57gIOmy.mjs} +5 -2
- package/dist/shared/{curvy.CLzGuqek.mjs → curvy.ZjG-q57I.mjs} +9 -3
- package/dist/splines/basis2d.d.mts +36 -0
- package/dist/splines/basis2d.d.ts +36 -0
- package/dist/splines/basis2d.mjs +86 -0
- package/dist/splines/bezier2d.d.mts +13 -5
- package/dist/splines/bezier2d.d.ts +13 -5
- package/dist/splines/bezier2d.mjs +50 -58
- package/dist/splines/cardinal2d.d.mts +44 -0
- package/dist/splines/cardinal2d.d.ts +44 -0
- package/dist/splines/cardinal2d.mjs +116 -0
- package/dist/splines/hermite2d.d.mts +31 -0
- package/dist/splines/hermite2d.d.ts +31 -0
- package/dist/splines/hermite2d.mjs +74 -0
- package/dist/vector/vector2.d.mts +10 -2
- package/dist/vector/vector2.d.ts +10 -2
- package/dist/vector/vector2.mjs +5 -3
- package/dist/vector/vector3.d.mts +6 -2
- package/dist/vector/vector3.d.ts +6 -2
- package/dist/vector/vector3.mjs +4 -3
- package/dist/vector/vector4.d.mts +6 -2
- package/dist/vector/vector4.d.ts +6 -2
- package/dist/vector/vector4.mjs +4 -3
- package/package.json +13 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../shared/curvy.BN-oFBsc.js';
|
|
2
2
|
import '../interval.js';
|
|
3
3
|
import '../vector/vector2.js';
|
|
4
|
-
export { L as LinearPolynomial,
|
|
5
|
-
import '../shared/curvy.
|
|
4
|
+
export { L as LinearPolynomial, U as antiderivative, T as derivative, V as domain, J as fromPointSlope, K as fromPoints, I as fromVector, G as isLinearPolynomial, X as length, H as make, S as monotonicity, W as range, R as root, M as solve, O as solveInverse, P as toInverseSolver, N as toSolver } from '../shared/curvy.CkJRVnqj.js';
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.js';
|
|
6
6
|
import '../vector/vector3.js';
|
|
7
7
|
import '../vector/vector4.js';
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { i as isLinearPolynomial$1, a as make$1, f as fromVector$1,
|
|
2
|
-
import '../shared/curvy.
|
|
1
|
+
import { i as isLinearPolynomial$1, a as make$1, f as fromVector$1, d as fromPointSlope$1, e as fromPoints$1, s as solve$1, t as toSolver$1, c as solveInverse$1, g as toInverseSolver$1, m as monotonicity$1, h as derivative$1, j as antiderivative$1, k as domain$1, r as range$1, l as length$1 } from '../shared/curvy.O57gIOmy.mjs';
|
|
2
|
+
import '../shared/curvy.DLOeble8.mjs';
|
|
3
3
|
import '../interval.mjs';
|
|
4
4
|
|
|
5
5
|
const isLinearPolynomial = isLinearPolynomial$1;
|
|
6
6
|
const make = make$1;
|
|
7
7
|
const fromVector = fromVector$1;
|
|
8
|
+
const fromPointSlope = fromPointSlope$1;
|
|
9
|
+
const fromPoints = fromPoints$1;
|
|
8
10
|
const solve = solve$1;
|
|
9
11
|
const toSolver = toSolver$1;
|
|
10
12
|
const solveInverse = solveInverse$1;
|
|
11
13
|
const toInverseSolver = toInverseSolver$1;
|
|
12
14
|
const root = (p) => solveInverse$1(p, 0);
|
|
13
15
|
const monotonicity = monotonicity$1;
|
|
16
|
+
const derivative = derivative$1;
|
|
14
17
|
const antiderivative = antiderivative$1;
|
|
15
18
|
const domain = domain$1;
|
|
16
19
|
const range = range$1;
|
|
17
20
|
const length = length$1;
|
|
18
21
|
|
|
19
|
-
export { antiderivative, domain, fromVector, isLinearPolynomial, length, make, monotonicity, range, root, solve, solveInverse, toInverseSolver, toSolver };
|
|
22
|
+
export { antiderivative, derivative, domain, fromPointSlope, fromPoints, fromVector, isLinearPolynomial, length, make, monotonicity, range, root, solve, solveInverse, toInverseSolver, toSolver };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../shared/curvy.BN-oFBsc.mjs';
|
|
2
2
|
import '../interval.mjs';
|
|
3
3
|
import '../vector/vector3.mjs';
|
|
4
|
-
export { Q as QuadraticPolynomial,
|
|
5
|
-
import '../shared/curvy.
|
|
4
|
+
export { Q as QuadraticPolynomial, A as antiderivative, F as curvature, w as derivative, B as domain, y as extreme, o as fromVector, k as isQuadraticPolynomial, E as length, n as make, z as monotonicity, D as range, x as roots, p as solve, u as solveInverse, v as toInverseSolver, q as toSolver } from '../shared/curvy.DwHW5Fqt.mjs';
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.mjs';
|
|
6
6
|
import '../vector/vector2.mjs';
|
|
7
7
|
import '../vector/vector4.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../shared/curvy.BN-oFBsc.js';
|
|
2
2
|
import '../interval.js';
|
|
3
3
|
import '../vector/vector3.js';
|
|
4
|
-
export { Q as QuadraticPolynomial,
|
|
5
|
-
import '../shared/curvy.
|
|
4
|
+
export { Q as QuadraticPolynomial, A as antiderivative, F as curvature, w as derivative, B as domain, y as extreme, o as fromVector, k as isQuadraticPolynomial, E as length, n as make, z as monotonicity, D as range, x as roots, p as solve, u as solveInverse, v as toInverseSolver, q as toSolver } from '../shared/curvy.CkJRVnqj.js';
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.js';
|
|
6
6
|
import '../vector/vector2.js';
|
|
7
7
|
import '../vector/vector4.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as isQuadraticPolynomial$1, m as make$1, f as fromVector$1, c as solve$1, t as toSolver$1, s as solveInverse$1,
|
|
2
|
-
import '../shared/curvy.
|
|
1
|
+
import { i as isQuadraticPolynomial$1, m as make$1, f as fromVector$1, c as solve$1, t as toSolver$1, s as solveInverse$1, e as toInverseSolver$1, d as derivative$1, r as roots$1, h as extreme$1, b as monotonicity$1, j as antiderivative$1, k as domain$1, n as range$1, l as length$1, o as curvature$1 } from '../shared/curvy.ZjG-q57I.mjs';
|
|
2
|
+
import '../shared/curvy.DLOeble8.mjs';
|
|
3
3
|
import '../interval.mjs';
|
|
4
|
-
import '../shared/curvy.
|
|
4
|
+
import '../shared/curvy.O57gIOmy.mjs';
|
|
5
5
|
|
|
6
6
|
const isQuadraticPolynomial = isQuadraticPolynomial$1;
|
|
7
7
|
const make = make$1;
|
|
@@ -18,5 +18,6 @@ const antiderivative = antiderivative$1;
|
|
|
18
18
|
const domain = domain$1;
|
|
19
19
|
const range = range$1;
|
|
20
20
|
const length = length$1;
|
|
21
|
+
const curvature = curvature$1;
|
|
21
22
|
|
|
22
|
-
export { antiderivative, derivative, domain, extreme, fromVector, isQuadraticPolynomial, length, make, monotonicity, range, roots, solve, solveInverse, toInverseSolver, toSolver };
|
|
23
|
+
export { antiderivative, curvature, derivative, domain, extreme, fromVector, isQuadraticPolynomial, length, make, monotonicity, range, roots, solve, solveInverse, toInverseSolver, toSolver };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as dual, r as round, P as Pipeable } from './curvy.
|
|
1
|
+
import { d as dual, r as round, P as Pipeable } from './curvy.DLOeble8.mjs';
|
|
2
2
|
|
|
3
3
|
const Vector4TypeId = Symbol.for("curvy/vector4");
|
|
4
4
|
class Vector4Impl extends Pipeable {
|
|
@@ -66,5 +66,9 @@ const hadamard = dual(
|
|
|
66
66
|
2,
|
|
67
67
|
(a, b) => make(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w)
|
|
68
68
|
);
|
|
69
|
+
const scale = dual(
|
|
70
|
+
2,
|
|
71
|
+
(v, s) => s === 1 ? v : make(v.x * s, v.y * s, v.z * s, v.w * s)
|
|
72
|
+
);
|
|
69
73
|
|
|
70
|
-
export { magnitude as a, add as b, components as c, dot as d, subtract as e, hadamard as h, isVector4 as i, make as m, normalize as n, softmax as s };
|
|
74
|
+
export { magnitude as a, add as b, components as c, dot as d, subtract as e, scale as f, hadamard as h, isVector4 as i, make as m, normalize as n, softmax as s };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { d as dual,
|
|
1
|
+
import { d as dual, r as round, P as Pipeable } from './curvy.DLOeble8.mjs';
|
|
2
2
|
|
|
3
3
|
const Vector2TypeId = Symbol.for("curvy/vector2");
|
|
4
4
|
class Vector2Impl extends Pipeable {
|
|
5
5
|
[Vector2TypeId] = Vector2TypeId;
|
|
6
6
|
x;
|
|
7
7
|
y;
|
|
8
|
-
|
|
9
|
-
constructor(v0 = 0, v1 = 0, precision = PRECISION) {
|
|
8
|
+
constructor(v0 = 0, v1 = 0) {
|
|
10
9
|
super();
|
|
11
|
-
this.x = round(v0
|
|
12
|
-
this.y = round(v1
|
|
13
|
-
this.precision = precision;
|
|
10
|
+
this.x = round(v0);
|
|
11
|
+
this.y = round(v1);
|
|
14
12
|
}
|
|
15
13
|
get [0]() {
|
|
16
14
|
return this.x;
|
|
@@ -26,7 +24,7 @@ class Vector2Impl extends Pipeable {
|
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
const isVector2 = (v) => typeof v === "object" && v !== null && Vector2TypeId in v;
|
|
29
|
-
const make = (v0, v1 = v0
|
|
27
|
+
const make = (v0, v1 = v0) => new Vector2Impl(v0, v1);
|
|
30
28
|
const components = (v) => [v.x, v.y];
|
|
31
29
|
const magnitude = (vector) => round(Math.hypot(vector.x, vector.y));
|
|
32
30
|
const normalize = (vector) => {
|
|
@@ -34,6 +32,7 @@ const normalize = (vector) => {
|
|
|
34
32
|
return make(vector.x / m, vector.y / m);
|
|
35
33
|
};
|
|
36
34
|
const dot = dual(2, (a, b) => round(a.x * b.x + a.y * b.y));
|
|
35
|
+
const cross = dual(2, (a, b) => round(a.x * b.y - a.y * b.x));
|
|
37
36
|
const softmax = (v) => {
|
|
38
37
|
const max = Math.max(v.x, v.y);
|
|
39
38
|
const v0 = Math.exp(v.x - max);
|
|
@@ -44,5 +43,6 @@ const softmax = (v) => {
|
|
|
44
43
|
const add = dual(2, (a, b) => make(a.x + b.x, a.y + b.y));
|
|
45
44
|
const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y));
|
|
46
45
|
const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y));
|
|
46
|
+
const scale = dual(2, (v, s) => s === 1 ? v : make(v.x * s, v.y * s));
|
|
47
47
|
|
|
48
|
-
export { magnitude as a,
|
|
48
|
+
export { magnitude as a, components as b, cross as c, dot as d, add as e, subtract as f, scale as g, hadamard as h, isVector2 as i, make as m, normalize as n, softmax as s };
|
|
@@ -19,4 +19,4 @@ interface FourDimensional<T> extends ThreeDimensional<T> {
|
|
|
19
19
|
readonly 3: T;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export type { FourDimensionalIndex as F,
|
|
22
|
+
export type { FourDimensionalIndex as F, TwoDimensional as T, FourDimensionalComponent as a, ThreeDimensionalIndex as b, ThreeDimensionalComponent as c, TwoDimensionalIndex as d, TwoDimensionalComponent as e, FourDimensional as f, ThreeDimensional as g };
|
|
@@ -19,4 +19,4 @@ interface FourDimensional<T> extends ThreeDimensional<T> {
|
|
|
19
19
|
readonly 3: T;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export type { FourDimensionalIndex as F,
|
|
22
|
+
export type { FourDimensionalIndex as F, TwoDimensional as T, FourDimensionalComponent as a, ThreeDimensionalIndex as b, ThreeDimensionalComponent as c, TwoDimensionalIndex as d, TwoDimensionalComponent as e, FourDimensional as f, ThreeDimensional as g };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as invariant, d as dual, r as round, P as Pipeable } from './curvy.
|
|
2
|
-
import { m as make$1, d as dot } from './curvy.
|
|
1
|
+
import { i as invariant, d as dual, r as round, P as Pipeable } from './curvy.DLOeble8.mjs';
|
|
2
|
+
import { m as make$1, d as dot } from './curvy.BPOevbwG.mjs';
|
|
3
3
|
|
|
4
4
|
function toIndex(input) {
|
|
5
5
|
if (typeof input === "number") {
|
|
@@ -35,7 +35,7 @@ declare const solveInverse$2: {
|
|
|
35
35
|
(y: number): (p: CubicPolynomial) => ZeroToThreeSolutions;
|
|
36
36
|
};
|
|
37
37
|
declare const toInverseSolver$2: (p: CubicPolynomial) => (y: number) => ZeroToThreeSolutions;
|
|
38
|
-
declare const derivative$
|
|
38
|
+
declare const derivative$2: (p: CubicPolynomial) => QuadraticPolynomial;
|
|
39
39
|
declare const roots$1: (p: CubicPolynomial) => ZeroToThreeSolutions;
|
|
40
40
|
declare const extrema: (p: CubicPolynomial) => ZeroToTwoSolutions;
|
|
41
41
|
declare const monotonicity$2: {
|
|
@@ -54,6 +54,10 @@ declare const length$2: {
|
|
|
54
54
|
(p: CubicPolynomial, domain: Interval): number;
|
|
55
55
|
(domain: Interval): (p: CubicPolynomial) => number;
|
|
56
56
|
};
|
|
57
|
+
declare const curvature$1: {
|
|
58
|
+
(p: CubicPolynomial, x: number): number;
|
|
59
|
+
(x: number): (p: CubicPolynomial) => number;
|
|
60
|
+
};
|
|
57
61
|
|
|
58
62
|
declare const QuadraticPolynomialTypeId: unique symbol;
|
|
59
63
|
type QuadraticPolynomialTypeId = typeof QuadraticPolynomialTypeId;
|
|
@@ -77,7 +81,7 @@ declare const solveInverse$1: {
|
|
|
77
81
|
(y: number): (p: QuadraticPolynomial) => ZeroToTwoSolutions;
|
|
78
82
|
};
|
|
79
83
|
declare const toInverseSolver$1: (p: QuadraticPolynomial) => (y: number) => ZeroToTwoSolutions;
|
|
80
|
-
declare const derivative: (p: QuadraticPolynomial) => LinearPolynomial;
|
|
84
|
+
declare const derivative$1: (p: QuadraticPolynomial) => LinearPolynomial;
|
|
81
85
|
declare const roots: (p: QuadraticPolynomial) => ZeroToTwoSolutions;
|
|
82
86
|
declare const extreme: (p: QuadraticPolynomial) => ZeroOrOneSolution;
|
|
83
87
|
declare const monotonicity$1: {
|
|
@@ -100,6 +104,10 @@ declare const length$1: {
|
|
|
100
104
|
(p: QuadraticPolynomial, i: Interval): number;
|
|
101
105
|
(i: Interval): (p: QuadraticPolynomial) => number;
|
|
102
106
|
};
|
|
107
|
+
declare const curvature: {
|
|
108
|
+
(p: QuadraticPolynomial, x: number): number;
|
|
109
|
+
(x: number): (p: QuadraticPolynomial) => number;
|
|
110
|
+
};
|
|
103
111
|
|
|
104
112
|
declare const LinearPolynomialTypeId: unique symbol;
|
|
105
113
|
type LinearPolynomialTypeId = typeof LinearPolynomialTypeId;
|
|
@@ -112,6 +120,8 @@ interface LinearPolynomial extends Pipeable {
|
|
|
112
120
|
declare const isLinearPolynomial: (v: unknown) => v is LinearPolynomial;
|
|
113
121
|
declare const make: (c0?: number, c1?: number) => LinearPolynomial;
|
|
114
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;
|
|
115
125
|
declare const solve: {
|
|
116
126
|
(p: LinearPolynomial, x: number): number;
|
|
117
127
|
(x: number): (p: LinearPolynomial) => number;
|
|
@@ -124,6 +134,7 @@ declare const solveInverse: {
|
|
|
124
134
|
declare const toInverseSolver: (p: LinearPolynomial) => (y: number) => ZeroOrOneSolution;
|
|
125
135
|
declare const root: (p: LinearPolynomial) => ZeroOrOneSolution;
|
|
126
136
|
declare const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity;
|
|
137
|
+
declare const derivative: (p: LinearPolynomial) => number;
|
|
127
138
|
declare const antiderivative: {
|
|
128
139
|
(p: LinearPolynomial, constant?: number): QuadraticPolynomial;
|
|
129
140
|
(constant: number): (p: LinearPolynomial) => QuadraticPolynomial;
|
|
@@ -141,4 +152,4 @@ declare const length: {
|
|
|
141
152
|
(domain: Interval): (p: LinearPolynomial) => number;
|
|
142
153
|
};
|
|
143
154
|
|
|
144
|
-
export {
|
|
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 };
|
|
@@ -98,6 +98,14 @@ function round(value, precision = PRECISION) {
|
|
|
98
98
|
}
|
|
99
99
|
return result;
|
|
100
100
|
}
|
|
101
|
+
function roundDown(value, precision = PRECISION) {
|
|
102
|
+
const scale = 10 ** precision;
|
|
103
|
+
const result = Math.floor(value * scale) / scale;
|
|
104
|
+
if (result === 0) {
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
101
109
|
dual(
|
|
102
110
|
5,
|
|
103
111
|
(x, x1, x2, y1, y2) => {
|
|
@@ -116,4 +124,4 @@ function invariant(condition, message) {
|
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
126
|
|
|
119
|
-
export { Pipeable as P,
|
|
127
|
+
export { Pipeable as P, roundDown as a, dual as d, invariant as i, round as r };
|
|
@@ -0,0 +1,55 @@
|
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as toThreeDimensionalIndex, d as determinant$1, m as make$1 } from './curvy.
|
|
2
|
-
import { d as dual, r as round, i as invariant, P as Pipeable } from './curvy.
|
|
3
|
-
import { c as components, m as make$2, d as dot } from './curvy.
|
|
1
|
+
import { o as toThreeDimensionalIndex, d as determinant$1, m as make$1 } from './curvy.BrrC9QVB.mjs';
|
|
2
|
+
import { d as dual, r as round, i as invariant, P as Pipeable } from './curvy.DLOeble8.mjs';
|
|
3
|
+
import { c as components, m as make$2, d as dot } from './curvy.DV4S13Cq.mjs';
|
|
4
4
|
|
|
5
5
|
const Matrix3x3TypeId = Symbol.for("curvy/matrix3x3");
|
|
6
6
|
class Matrix3x3Impl extends Pipeable {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as dual, r as round, P as Pipeable } from './curvy.
|
|
1
|
+
import { d as dual, r as round, P as Pipeable } from './curvy.DLOeble8.mjs';
|
|
2
2
|
|
|
3
3
|
const Vector3TypeId = Symbol.for("curvy/vector3");
|
|
4
4
|
class Vector3Impl extends Pipeable {
|
|
@@ -48,5 +48,6 @@ const make = (v0, v1 = v0, v2 = v1) => new Vector3Impl(v0, v1, v2);
|
|
|
48
48
|
const add = dual(2, (a, b) => make(a.x + b.x, a.y + b.y, a.z + b.z));
|
|
49
49
|
const subtract = dual(2, (a, b) => make(a.x - b.x, a.y - b.y, a.z - b.z));
|
|
50
50
|
const hadamard = dual(2, (a, b) => make(a.x * b.x, a.y * b.y, a.z * b.z));
|
|
51
|
+
const scale = dual(2, (v, s) => s === 1 ? v : make(v.x * s, v.y * s, v.z * s));
|
|
51
52
|
|
|
52
|
-
export { magnitude as a, add as b, components as c, dot as d, subtract as e, hadamard as h, isVector3 as i, make as m, normalize as n, softmax as s };
|
|
53
|
+
export { magnitude as a, add as b, components as c, dot as d, subtract as e, scale as f, hadamard as h, isVector3 as i, make as m, normalize as n, softmax as s };
|
|
@@ -35,7 +35,7 @@ declare const solveInverse$2: {
|
|
|
35
35
|
(y: number): (p: CubicPolynomial) => ZeroToThreeSolutions;
|
|
36
36
|
};
|
|
37
37
|
declare const toInverseSolver$2: (p: CubicPolynomial) => (y: number) => ZeroToThreeSolutions;
|
|
38
|
-
declare const derivative$
|
|
38
|
+
declare const derivative$2: (p: CubicPolynomial) => QuadraticPolynomial;
|
|
39
39
|
declare const roots$1: (p: CubicPolynomial) => ZeroToThreeSolutions;
|
|
40
40
|
declare const extrema: (p: CubicPolynomial) => ZeroToTwoSolutions;
|
|
41
41
|
declare const monotonicity$2: {
|
|
@@ -54,6 +54,10 @@ declare const length$2: {
|
|
|
54
54
|
(p: CubicPolynomial, domain: Interval): number;
|
|
55
55
|
(domain: Interval): (p: CubicPolynomial) => number;
|
|
56
56
|
};
|
|
57
|
+
declare const curvature$1: {
|
|
58
|
+
(p: CubicPolynomial, x: number): number;
|
|
59
|
+
(x: number): (p: CubicPolynomial) => number;
|
|
60
|
+
};
|
|
57
61
|
|
|
58
62
|
declare const QuadraticPolynomialTypeId: unique symbol;
|
|
59
63
|
type QuadraticPolynomialTypeId = typeof QuadraticPolynomialTypeId;
|
|
@@ -77,7 +81,7 @@ declare const solveInverse$1: {
|
|
|
77
81
|
(y: number): (p: QuadraticPolynomial) => ZeroToTwoSolutions;
|
|
78
82
|
};
|
|
79
83
|
declare const toInverseSolver$1: (p: QuadraticPolynomial) => (y: number) => ZeroToTwoSolutions;
|
|
80
|
-
declare const derivative: (p: QuadraticPolynomial) => LinearPolynomial;
|
|
84
|
+
declare const derivative$1: (p: QuadraticPolynomial) => LinearPolynomial;
|
|
81
85
|
declare const roots: (p: QuadraticPolynomial) => ZeroToTwoSolutions;
|
|
82
86
|
declare const extreme: (p: QuadraticPolynomial) => ZeroOrOneSolution;
|
|
83
87
|
declare const monotonicity$1: {
|
|
@@ -100,6 +104,10 @@ declare const length$1: {
|
|
|
100
104
|
(p: QuadraticPolynomial, i: Interval): number;
|
|
101
105
|
(i: Interval): (p: QuadraticPolynomial) => number;
|
|
102
106
|
};
|
|
107
|
+
declare const curvature: {
|
|
108
|
+
(p: QuadraticPolynomial, x: number): number;
|
|
109
|
+
(x: number): (p: QuadraticPolynomial) => number;
|
|
110
|
+
};
|
|
103
111
|
|
|
104
112
|
declare const LinearPolynomialTypeId: unique symbol;
|
|
105
113
|
type LinearPolynomialTypeId = typeof LinearPolynomialTypeId;
|
|
@@ -112,6 +120,8 @@ interface LinearPolynomial extends Pipeable {
|
|
|
112
120
|
declare const isLinearPolynomial: (v: unknown) => v is LinearPolynomial;
|
|
113
121
|
declare const make: (c0?: number, c1?: number) => LinearPolynomial;
|
|
114
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;
|
|
115
125
|
declare const solve: {
|
|
116
126
|
(p: LinearPolynomial, x: number): number;
|
|
117
127
|
(x: number): (p: LinearPolynomial) => number;
|
|
@@ -124,6 +134,7 @@ declare const solveInverse: {
|
|
|
124
134
|
declare const toInverseSolver: (p: LinearPolynomial) => (y: number) => ZeroOrOneSolution;
|
|
125
135
|
declare const root: (p: LinearPolynomial) => ZeroOrOneSolution;
|
|
126
136
|
declare const monotonicity: (p: LinearPolynomial) => GuaranteedMonotonicity;
|
|
137
|
+
declare const derivative: (p: LinearPolynomial) => number;
|
|
127
138
|
declare const antiderivative: {
|
|
128
139
|
(p: LinearPolynomial, constant?: number): QuadraticPolynomial;
|
|
129
140
|
(constant: number): (p: LinearPolynomial) => QuadraticPolynomial;
|
|
@@ -141,4 +152,4 @@ declare const length: {
|
|
|
141
152
|
(domain: Interval): (p: LinearPolynomial) => number;
|
|
142
153
|
};
|
|
143
154
|
|
|
144
|
-
export {
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Pipeable, r as round, d as dual } from './curvy.
|
|
1
|
+
import { P as Pipeable, r as round, d as dual } from './curvy.DLOeble8.mjs';
|
|
2
2
|
import { make as make$1, size } from '../interval.mjs';
|
|
3
3
|
|
|
4
4
|
const QuadraticPolynomialTypeId = Symbol.for(
|
|
@@ -31,6 +31,8 @@ class LinearPolynomialImpl extends Pipeable {
|
|
|
31
31
|
const isLinearPolynomial = (v) => typeof v === "object" && v !== null && LinearPolynomialTypeId in v;
|
|
32
32
|
const make = (c0 = 0, c1 = 0) => new LinearPolynomialImpl(c0, c1);
|
|
33
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));
|
|
34
36
|
const solve = dual(2, (p, x) => round(p.c0 + x * p.c1));
|
|
35
37
|
const toSolver = (p) => (x) => solve(p, x);
|
|
36
38
|
const solveInverse = dual(2, (p, y) => {
|
|
@@ -41,6 +43,7 @@ const solveInverse = dual(2, (p, y) => {
|
|
|
41
43
|
});
|
|
42
44
|
const toInverseSolver = (p) => (y) => solveInverse(p, y);
|
|
43
45
|
const monotonicity = (p) => p.c1 === 0 ? "constant" : p.c1 > 0 ? "increasing" : "decreasing";
|
|
46
|
+
const derivative = (p) => p.c1;
|
|
44
47
|
const antiderivative = dual(
|
|
45
48
|
(args) => isLinearPolynomial(args[0]),
|
|
46
49
|
(p, integrationConstant = 0) => new QuadraticPolynomialImpl(integrationConstant, p.c0, p.c1 / 2)
|
|
@@ -73,4 +76,4 @@ const length = dual(2, (p, domain2) => {
|
|
|
73
76
|
return round(Math.sqrt(1 + p.c1 ** 2) * size(domain2));
|
|
74
77
|
});
|
|
75
78
|
|
|
76
|
-
export { QuadraticPolynomialImpl as Q, make as a, QuadraticPolynomialTypeId as b,
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Pipeable, r as round, d as dual } from './curvy.
|
|
1
|
+
import { P as Pipeable, r as round, d as dual } from './curvy.DLOeble8.mjs';
|
|
2
2
|
import { size, contains, fromMinMax } from '../interval.mjs';
|
|
3
|
-
import { Q as QuadraticPolynomialImpl, b as QuadraticPolynomialTypeId, a as make$1,
|
|
3
|
+
import { Q as QuadraticPolynomialImpl, b as QuadraticPolynomialTypeId, a as make$1, c as solveInverse$1, m as monotonicity$1, r as range$1, l as length$1, s as solve$1 } from './curvy.O57gIOmy.mjs';
|
|
4
4
|
|
|
5
5
|
const CubicPolynomialTypeId = Symbol.for(
|
|
6
6
|
"curvy/polynomial/cubic"
|
|
@@ -120,5 +120,11 @@ const length = dual(2, (p, domain2) => {
|
|
|
120
120
|
const evalEnd = (derivativeEnd * sqrtEnd + Math.log(Math.abs(derivativeEnd + sqrtEnd))) / (4 * p.c2);
|
|
121
121
|
return round(evalEnd - evalStart);
|
|
122
122
|
});
|
|
123
|
+
const curvature = dual(
|
|
124
|
+
2,
|
|
125
|
+
(p, x) => round(
|
|
126
|
+
Math.abs(2 * p.c2) / (1 + (solve$1(derivative(p), x) ** 2) ** 1.5)
|
|
127
|
+
)
|
|
128
|
+
);
|
|
123
129
|
|
|
124
|
-
export { CubicPolynomialImpl as C, CubicPolynomialTypeId as a, monotonicity as b, solve as c,
|
|
130
|
+
export { CubicPolynomialImpl as C, CubicPolynomialTypeId as a, monotonicity as b, solve as c, derivative as d, toInverseSolver as e, fromVector as f, guaranteedMonotonicityFromComparison as g, extreme as h, isQuadraticPolynomial as i, antiderivative as j, domain as k, length as l, make as m, range as n, curvature as o, roots as r, solveInverse as s, toSolver as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
|
|
2
|
+
import { Matrix4x4 } from '../matrix/matrix4x4.mjs';
|
|
3
|
+
import { CubicPath2d } from '../path/cubic2d.mjs';
|
|
4
|
+
import { Vector2 } from '../vector/vector2.mjs';
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.mjs';
|
|
6
|
+
import '../vector/vector4.mjs';
|
|
7
|
+
import '../matrix/matrix3x3.mjs';
|
|
8
|
+
import '../vector/vector3.mjs';
|
|
9
|
+
import '../matrix/matrix2x2.mjs';
|
|
10
|
+
import '../curve/cubic2d.mjs';
|
|
11
|
+
import '../interval.mjs';
|
|
12
|
+
import '../shared/curvy.DwHW5Fqt.mjs';
|
|
13
|
+
|
|
14
|
+
declare const Basis2dTypeId: unique symbol;
|
|
15
|
+
type Basis2dTypeId = typeof Basis2dTypeId;
|
|
16
|
+
|
|
17
|
+
declare const characteristic: Matrix4x4;
|
|
18
|
+
interface Basis2d extends Pipeable {
|
|
19
|
+
readonly [Basis2dTypeId]: Basis2dTypeId;
|
|
20
|
+
[Symbol.iterator](): Iterator<Vector2>;
|
|
21
|
+
}
|
|
22
|
+
declare const isBasis2d: (p: unknown) => p is Basis2d;
|
|
23
|
+
declare const make: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Basis2d;
|
|
24
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Basis2d;
|
|
25
|
+
declare const append: {
|
|
26
|
+
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
27
|
+
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
28
|
+
};
|
|
29
|
+
declare const prepend: {
|
|
30
|
+
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
31
|
+
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
32
|
+
};
|
|
33
|
+
declare const withTriplicatedEndpoints: (p: Basis2d) => Basis2d;
|
|
34
|
+
declare const toPath: (p: Basis2d) => CubicPath2d;
|
|
35
|
+
|
|
36
|
+
export { type Basis2d, append, characteristic, fromArray, isBasis2d, make, prepend, toPath, withTriplicatedEndpoints };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
|
|
2
|
+
import { Matrix4x4 } from '../matrix/matrix4x4.js';
|
|
3
|
+
import { CubicPath2d } from '../path/cubic2d.js';
|
|
4
|
+
import { Vector2 } from '../vector/vector2.js';
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.js';
|
|
6
|
+
import '../vector/vector4.js';
|
|
7
|
+
import '../matrix/matrix3x3.js';
|
|
8
|
+
import '../vector/vector3.js';
|
|
9
|
+
import '../matrix/matrix2x2.js';
|
|
10
|
+
import '../curve/cubic2d.js';
|
|
11
|
+
import '../interval.js';
|
|
12
|
+
import '../shared/curvy.CkJRVnqj.js';
|
|
13
|
+
|
|
14
|
+
declare const Basis2dTypeId: unique symbol;
|
|
15
|
+
type Basis2dTypeId = typeof Basis2dTypeId;
|
|
16
|
+
|
|
17
|
+
declare const characteristic: Matrix4x4;
|
|
18
|
+
interface Basis2d extends Pipeable {
|
|
19
|
+
readonly [Basis2dTypeId]: Basis2dTypeId;
|
|
20
|
+
[Symbol.iterator](): Iterator<Vector2>;
|
|
21
|
+
}
|
|
22
|
+
declare const isBasis2d: (p: unknown) => p is Basis2d;
|
|
23
|
+
declare const make: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Basis2d;
|
|
24
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Basis2d;
|
|
25
|
+
declare const append: {
|
|
26
|
+
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
27
|
+
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
28
|
+
};
|
|
29
|
+
declare const prepend: {
|
|
30
|
+
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
31
|
+
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
32
|
+
};
|
|
33
|
+
declare const withTriplicatedEndpoints: (p: Basis2d) => Basis2d;
|
|
34
|
+
declare const toPath: (p: Basis2d) => CubicPath2d;
|
|
35
|
+
|
|
36
|
+
export { type Basis2d, append, characteristic, fromArray, isBasis2d, make, prepend, toPath, withTriplicatedEndpoints };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { a as roundDown, d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
|
|
2
|
+
import { make as make$2 } from '../matrix/matrix4x4.mjs';
|
|
3
|
+
import { fromCurves } from '../path/cubic2d.mjs';
|
|
4
|
+
import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
|
|
5
|
+
import '../shared/curvy.BrrC9QVB.mjs';
|
|
6
|
+
import '../shared/curvy.BPOevbwG.mjs';
|
|
7
|
+
import '../shared/curvy.B1zfBfvf.mjs';
|
|
8
|
+
import '../shared/curvy.DTco5vku.mjs';
|
|
9
|
+
import '../shared/curvy.DV4S13Cq.mjs';
|
|
10
|
+
import '../curve/cubic2d.mjs';
|
|
11
|
+
import '../interval.mjs';
|
|
12
|
+
import '../shared/curvy.DmVFTi0N.mjs';
|
|
13
|
+
import '../polynomial/cubic.mjs';
|
|
14
|
+
import '../shared/curvy.ZjG-q57I.mjs';
|
|
15
|
+
import '../shared/curvy.O57gIOmy.mjs';
|
|
16
|
+
import '../polynomial/quadratic.mjs';
|
|
17
|
+
import '../vector/vector2.mjs';
|
|
18
|
+
import '../curve/linear2d.mjs';
|
|
19
|
+
import '../polynomial/linear.mjs';
|
|
20
|
+
import '../curve/quadratic2d.mjs';
|
|
21
|
+
import '../vector/vector4.mjs';
|
|
22
|
+
|
|
23
|
+
const characteristic$1 = make$2(
|
|
24
|
+
1 / 6,
|
|
25
|
+
4 / 6,
|
|
26
|
+
roundDown(1 / 6),
|
|
27
|
+
0,
|
|
28
|
+
-0.5,
|
|
29
|
+
0,
|
|
30
|
+
0.5,
|
|
31
|
+
0,
|
|
32
|
+
0.5,
|
|
33
|
+
-1,
|
|
34
|
+
0.5,
|
|
35
|
+
0,
|
|
36
|
+
-1 / 6,
|
|
37
|
+
0.5,
|
|
38
|
+
-0.5,
|
|
39
|
+
1 / 6
|
|
40
|
+
);
|
|
41
|
+
const Basis2dTypeId = Symbol("curvy/splines/basis2d");
|
|
42
|
+
class Basis2dImpl extends Pipeable {
|
|
43
|
+
[Basis2dTypeId] = Basis2dTypeId;
|
|
44
|
+
points;
|
|
45
|
+
constructor(points) {
|
|
46
|
+
invariant(points.length >= 4, "basis splines requires 4 or more points");
|
|
47
|
+
super();
|
|
48
|
+
this.points = points;
|
|
49
|
+
}
|
|
50
|
+
[Symbol.iterator]() {
|
|
51
|
+
return this.points[Symbol.iterator]();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const isBasis2d$1 = (p) => typeof p === "object" && p !== null && Basis2dTypeId in p;
|
|
55
|
+
const make$1 = (p0, p1, p2, p3) => new Basis2dImpl([p0, p1, p2, p3]);
|
|
56
|
+
const fromArray$1 = (points) => new Basis2dImpl(points);
|
|
57
|
+
const append$1 = dual(
|
|
58
|
+
(args) => isBasis2d$1(args[0]),
|
|
59
|
+
(p, ...points) => new Basis2dImpl([...p, ...points])
|
|
60
|
+
);
|
|
61
|
+
const prepend$1 = dual(
|
|
62
|
+
(args) => isBasis2d$1(args[0]),
|
|
63
|
+
(p, ...points) => new Basis2dImpl([...points, ...p])
|
|
64
|
+
);
|
|
65
|
+
const withTriplicatedEndpoints$1 = (p) => {
|
|
66
|
+
const points = p instanceof Basis2dImpl ? p.points : [...p];
|
|
67
|
+
return new Basis2dImpl([
|
|
68
|
+
points[0],
|
|
69
|
+
points[0],
|
|
70
|
+
...points,
|
|
71
|
+
points[points.length - 1],
|
|
72
|
+
points[points.length - 1]
|
|
73
|
+
]);
|
|
74
|
+
};
|
|
75
|
+
const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic$1, 1));
|
|
76
|
+
|
|
77
|
+
const characteristic = characteristic$1;
|
|
78
|
+
const isBasis2d = isBasis2d$1;
|
|
79
|
+
const make = make$1;
|
|
80
|
+
const fromArray = fromArray$1;
|
|
81
|
+
const append = append$1;
|
|
82
|
+
const prepend = prepend$1;
|
|
83
|
+
const withTriplicatedEndpoints = withTriplicatedEndpoints$1;
|
|
84
|
+
const toPath = toPath$1;
|
|
85
|
+
|
|
86
|
+
export { append, characteristic, fromArray, isBasis2d, make, prepend, toPath, withTriplicatedEndpoints };
|