curvy 1.0.1 → 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 +1 -1
- package/dist/curve/cubic2d.d.ts +1 -1
- package/dist/curve/cubic2d.mjs +4 -4
- package/dist/curve/linear2d.d.mts +1 -1
- package/dist/curve/linear2d.d.ts +1 -1
- package/dist/curve/linear2d.mjs +3 -3
- package/dist/curve/quadratic2d.d.mts +1 -1
- package/dist/curve/quadratic2d.d.ts +1 -1
- package/dist/curve/quadratic2d.mjs +4 -4
- 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 +1 -1
- package/dist/path/cubic2d.d.ts +1 -1
- package/dist/path/cubic2d.mjs +5 -4
- package/dist/path/linear2d.d.mts +1 -1
- package/dist/path/linear2d.d.ts +1 -1
- package/dist/path/linear2d.mjs +3 -3
- package/dist/path/quadratic2d.d.mts +1 -1
- package/dist/path/quadratic2d.d.ts +1 -1
- package/dist/path/quadratic2d.mjs +4 -4
- package/dist/polynomial/cubic.d.mts +1 -1
- package/dist/polynomial/cubic.d.ts +1 -1
- package/dist/polynomial/cubic.mjs +3 -3
- package/dist/polynomial/linear.d.mts +1 -1
- package/dist/polynomial/linear.d.ts +1 -1
- package/dist/polynomial/linear.mjs +2 -2
- package/dist/polynomial/quadratic.d.mts +1 -1
- package/dist/polynomial/quadratic.d.ts +1 -1
- package/dist/polynomial/quadratic.mjs +3 -3
- package/dist/shared/{curvy.Cty3LrOR.mjs → curvy.B1zfBfvf.mjs} +6 -2
- package/dist/shared/{curvy.DOSsf40r.mjs → curvy.BPOevbwG.mjs} +7 -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.DM6AiKbn.mjs → curvy.BrrC9QVB.mjs} +2 -2
- package/dist/shared/{curvy.ChkqgKuv.mjs → curvy.DLOeble8.mjs} +9 -1
- package/dist/shared/curvy.DN9ptodP.mjs +55 -0
- package/dist/shared/{curvy.bvP77ZZm.mjs → curvy.DTco5vku.mjs} +3 -3
- package/dist/shared/{curvy.D7bhnwZy.mjs → curvy.DV4S13Cq.mjs} +3 -2
- package/dist/shared/{curvy.DB7nQmVs.mjs → curvy.O57gIOmy.mjs} +1 -1
- package/dist/shared/{curvy.D7MEXd5g.mjs → curvy.ZjG-q57I.mjs} +2 -2
- 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 +1 -1
- package/dist/splines/bezier2d.d.ts +1 -1
- package/dist/splines/bezier2d.mjs +15 -49
- 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 +6 -2
- package/dist/vector/vector2.d.ts +6 -2
- package/dist/vector/vector2.mjs +4 -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,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, c as solveInverse$1, m as monotonicity$1, r as range$1, l as length$1, s as solve$1 } from './curvy.
|
|
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"
|
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
|
|
|
2
2
|
import { CubicPath2d } from '../path/cubic2d.mjs';
|
|
3
3
|
import { Vector2 } from '../vector/vector2.mjs';
|
|
4
4
|
import '../curve/cubic2d.mjs';
|
|
5
|
-
import '../shared/curvy.
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.mjs';
|
|
6
6
|
import '../interval.mjs';
|
|
7
7
|
import '../shared/curvy.DwHW5Fqt.mjs';
|
|
8
8
|
import '../vector/vector3.mjs';
|
|
@@ -2,7 +2,7 @@ import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
|
|
|
2
2
|
import { CubicPath2d } from '../path/cubic2d.js';
|
|
3
3
|
import { Vector2 } from '../vector/vector2.js';
|
|
4
4
|
import '../curve/cubic2d.js';
|
|
5
|
-
import '../shared/curvy.
|
|
5
|
+
import '../shared/curvy.Bf5TIk31.js';
|
|
6
6
|
import '../interval.js';
|
|
7
7
|
import '../shared/curvy.CkJRVnqj.js';
|
|
8
8
|
import '../vector/vector3.js';
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { make as make$2, vectorProductLeft } from '../matrix/matrix4x4.mjs';
|
|
1
|
+
import { d as dual, P as Pipeable, i as invariant } from '../shared/curvy.DLOeble8.mjs';
|
|
2
|
+
import { make as make$2 } from '../matrix/matrix4x4.mjs';
|
|
4
3
|
import { fromCurves } from '../path/cubic2d.mjs';
|
|
5
|
-
import { fromVector } from '../polynomial/cubic.mjs';
|
|
6
4
|
import { make as make$3 } from '../vector/vector2.mjs';
|
|
7
|
-
import {
|
|
5
|
+
import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
|
|
6
|
+
import '../shared/curvy.BrrC9QVB.mjs';
|
|
7
|
+
import '../shared/curvy.BPOevbwG.mjs';
|
|
8
|
+
import '../shared/curvy.B1zfBfvf.mjs';
|
|
9
|
+
import '../shared/curvy.DTco5vku.mjs';
|
|
10
|
+
import '../shared/curvy.DV4S13Cq.mjs';
|
|
11
|
+
import '../curve/cubic2d.mjs';
|
|
8
12
|
import '../interval.mjs';
|
|
9
13
|
import '../shared/curvy.DmVFTi0N.mjs';
|
|
14
|
+
import '../polynomial/cubic.mjs';
|
|
15
|
+
import '../shared/curvy.ZjG-q57I.mjs';
|
|
16
|
+
import '../shared/curvy.O57gIOmy.mjs';
|
|
10
17
|
import '../polynomial/quadratic.mjs';
|
|
11
|
-
import '../shared/curvy.D7MEXd5g.mjs';
|
|
12
|
-
import '../shared/curvy.DB7nQmVs.mjs';
|
|
13
18
|
import '../curve/linear2d.mjs';
|
|
14
19
|
import '../polynomial/linear.mjs';
|
|
15
20
|
import '../curve/quadratic2d.mjs';
|
|
16
|
-
import '../
|
|
17
|
-
import '../shared/curvy.DOSsf40r.mjs';
|
|
18
|
-
import '../shared/curvy.Cty3LrOR.mjs';
|
|
19
|
-
import '../shared/curvy.bvP77ZZm.mjs';
|
|
20
|
-
import '../shared/curvy.D7bhnwZy.mjs';
|
|
21
|
+
import '../vector/vector4.mjs';
|
|
21
22
|
|
|
22
23
|
const characteristic = make$2(
|
|
23
24
|
1,
|
|
@@ -37,7 +38,7 @@ const characteristic = make$2(
|
|
|
37
38
|
-3,
|
|
38
39
|
1
|
|
39
40
|
);
|
|
40
|
-
const Bezier2dTypeId = Symbol("curvy/splines/
|
|
41
|
+
const Bezier2dTypeId = Symbol("curvy/splines/bezier2d");
|
|
41
42
|
class Bezier2dImpl extends Pipeable {
|
|
42
43
|
[Bezier2dTypeId] = Bezier2dTypeId;
|
|
43
44
|
points;
|
|
@@ -98,42 +99,7 @@ const appendAccelerationAligned$1 = dual(2, (p, p6) => {
|
|
|
98
99
|
const p5 = make$3(p1.x + 4 * (p3.x - p2.x), p1.y + 4 * (p3.y - p2.y));
|
|
99
100
|
return append$1(p, p4, p5, p6);
|
|
100
101
|
});
|
|
101
|
-
|
|
102
|
-
let p0;
|
|
103
|
-
let p1;
|
|
104
|
-
let p2;
|
|
105
|
-
let p3;
|
|
106
|
-
for (const point of points) {
|
|
107
|
-
if (p0 === void 0) {
|
|
108
|
-
p0 = point;
|
|
109
|
-
} else if (p1 === void 0) {
|
|
110
|
-
p1 = point;
|
|
111
|
-
} else if (p2 === void 0) {
|
|
112
|
-
p2 = point;
|
|
113
|
-
} else if (p3 === void 0) {
|
|
114
|
-
p3 = point;
|
|
115
|
-
yield fromPolynomials(
|
|
116
|
-
fromVector(
|
|
117
|
-
vectorProductLeft(
|
|
118
|
-
characteristic,
|
|
119
|
-
make$4(p0.x, p1.x, p2.x, p3.x)
|
|
120
|
-
)
|
|
121
|
-
),
|
|
122
|
-
fromVector(
|
|
123
|
-
vectorProductLeft(
|
|
124
|
-
characteristic,
|
|
125
|
-
make$4(p0.y, p1.y, p2.y, p3.y)
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
);
|
|
129
|
-
p0 = p3;
|
|
130
|
-
p1 = void 0;
|
|
131
|
-
p2 = void 0;
|
|
132
|
-
p3 = void 0;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const toPath$1 = (p) => fromCurves(...toCurves(p));
|
|
102
|
+
const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic, 3));
|
|
137
103
|
|
|
138
104
|
const make = make$1;
|
|
139
105
|
const fromArray = fromArray$1;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 Cardinal2dTypeId: unique symbol;
|
|
15
|
+
type Cardinal2dTypeId = typeof Cardinal2dTypeId;
|
|
16
|
+
|
|
17
|
+
interface Cardinal2d extends Pipeable {
|
|
18
|
+
readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
|
|
19
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
20
|
+
}
|
|
21
|
+
declare const characteristic: (scale: number) => Matrix4x4;
|
|
22
|
+
declare const catRomCharacteristic: Matrix4x4;
|
|
23
|
+
declare const isCardinal2d: (p: unknown) => p is Cardinal2d;
|
|
24
|
+
declare const make: (p0: Vector2, p1: Vector2, ...points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
25
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
26
|
+
declare const append: {
|
|
27
|
+
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
28
|
+
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
29
|
+
};
|
|
30
|
+
declare const prepend: {
|
|
31
|
+
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
32
|
+
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
33
|
+
};
|
|
34
|
+
declare const withDuplicatedEndpoints: (c: Cardinal2d) => Cardinal2d;
|
|
35
|
+
declare const withReflectedEndpoints: {
|
|
36
|
+
(scale: number): (c: Cardinal2d) => Cardinal2d;
|
|
37
|
+
(c: Cardinal2d, scale?: number): Cardinal2d;
|
|
38
|
+
};
|
|
39
|
+
declare const toPath: {
|
|
40
|
+
(scale: number): (c: Cardinal2d) => CubicPath2d;
|
|
41
|
+
(c: Cardinal2d, scale?: number): CubicPath2d;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
|
|
@@ -0,0 +1,44 @@
|
|
|
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 Cardinal2dTypeId: unique symbol;
|
|
15
|
+
type Cardinal2dTypeId = typeof Cardinal2dTypeId;
|
|
16
|
+
|
|
17
|
+
interface Cardinal2d extends Pipeable {
|
|
18
|
+
readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
|
|
19
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
20
|
+
}
|
|
21
|
+
declare const characteristic: (scale: number) => Matrix4x4;
|
|
22
|
+
declare const catRomCharacteristic: Matrix4x4;
|
|
23
|
+
declare const isCardinal2d: (p: unknown) => p is Cardinal2d;
|
|
24
|
+
declare const make: (p0: Vector2, p1: Vector2, ...points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
25
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
26
|
+
declare const append: {
|
|
27
|
+
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
28
|
+
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
29
|
+
};
|
|
30
|
+
declare const prepend: {
|
|
31
|
+
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
32
|
+
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
33
|
+
};
|
|
34
|
+
declare const withDuplicatedEndpoints: (c: Cardinal2d) => Cardinal2d;
|
|
35
|
+
declare const withReflectedEndpoints: {
|
|
36
|
+
(scale: number): (c: Cardinal2d) => Cardinal2d;
|
|
37
|
+
(c: Cardinal2d, scale?: number): Cardinal2d;
|
|
38
|
+
};
|
|
39
|
+
declare const toPath: {
|
|
40
|
+
(scale: number): (c: Cardinal2d) => CubicPath2d;
|
|
41
|
+
(c: Cardinal2d, scale?: number): CubicPath2d;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { type Cardinal2d, append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { 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 { subtract, scale, add } from '../vector/vector2.mjs';
|
|
5
|
+
import { t as toCurves } from '../shared/curvy.DN9ptodP.mjs';
|
|
6
|
+
import '../shared/curvy.BrrC9QVB.mjs';
|
|
7
|
+
import '../shared/curvy.BPOevbwG.mjs';
|
|
8
|
+
import '../shared/curvy.B1zfBfvf.mjs';
|
|
9
|
+
import '../shared/curvy.DTco5vku.mjs';
|
|
10
|
+
import '../shared/curvy.DV4S13Cq.mjs';
|
|
11
|
+
import '../curve/cubic2d.mjs';
|
|
12
|
+
import '../interval.mjs';
|
|
13
|
+
import '../shared/curvy.DmVFTi0N.mjs';
|
|
14
|
+
import '../polynomial/cubic.mjs';
|
|
15
|
+
import '../shared/curvy.ZjG-q57I.mjs';
|
|
16
|
+
import '../shared/curvy.O57gIOmy.mjs';
|
|
17
|
+
import '../polynomial/quadratic.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 = (scale) => make$2(
|
|
24
|
+
0,
|
|
25
|
+
1,
|
|
26
|
+
0,
|
|
27
|
+
0,
|
|
28
|
+
-scale,
|
|
29
|
+
0,
|
|
30
|
+
scale,
|
|
31
|
+
0,
|
|
32
|
+
2 * scale,
|
|
33
|
+
scale - 3,
|
|
34
|
+
3 - 2 * scale,
|
|
35
|
+
-scale,
|
|
36
|
+
-scale,
|
|
37
|
+
2 - scale,
|
|
38
|
+
scale - 2,
|
|
39
|
+
scale
|
|
40
|
+
);
|
|
41
|
+
const catRomCharacteristic$1 = characteristic$1(0.5);
|
|
42
|
+
const Cardinal2dTypeId = Symbol.for(
|
|
43
|
+
"curvy/splines/cardinal2d"
|
|
44
|
+
);
|
|
45
|
+
class Cardinal2dImpl extends Pipeable {
|
|
46
|
+
[Cardinal2dTypeId] = Cardinal2dTypeId;
|
|
47
|
+
points;
|
|
48
|
+
constructor(points) {
|
|
49
|
+
invariant(points.length >= 2, "cardinal splines requires 2 or more points");
|
|
50
|
+
super();
|
|
51
|
+
this.points = points;
|
|
52
|
+
}
|
|
53
|
+
[Symbol.iterator]() {
|
|
54
|
+
return this.points[Symbol.iterator]();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const isCardinal2d$1 = (p) => typeof p === "object" && p !== null && Cardinal2dTypeId in p;
|
|
58
|
+
const make$1 = (...points) => new Cardinal2dImpl(points);
|
|
59
|
+
const fromArray$1 = (points) => new Cardinal2dImpl(points);
|
|
60
|
+
const append$1 = dual(
|
|
61
|
+
(args) => isCardinal2d$1(args[0]),
|
|
62
|
+
(p, ...points) => new Cardinal2dImpl([...p, ...points])
|
|
63
|
+
);
|
|
64
|
+
const prepend$1 = dual(
|
|
65
|
+
(args) => isCardinal2d$1(args[0]),
|
|
66
|
+
(p, ...points) => new Cardinal2dImpl([...points, ...p])
|
|
67
|
+
);
|
|
68
|
+
const withDuplicatedEndpoints$1 = (p) => {
|
|
69
|
+
const points = p instanceof Cardinal2dImpl ? p.points : [...p];
|
|
70
|
+
return new Cardinal2dImpl([
|
|
71
|
+
points[0],
|
|
72
|
+
...points,
|
|
73
|
+
points[points.length - 1]
|
|
74
|
+
]);
|
|
75
|
+
};
|
|
76
|
+
const withReflectedEndpoints$1 = dual(
|
|
77
|
+
(args) => isCardinal2d$1(args[0]),
|
|
78
|
+
(p, scale$1 = 1) => {
|
|
79
|
+
if (scale$1 === 0) {
|
|
80
|
+
return withDuplicatedEndpoints$1(p);
|
|
81
|
+
}
|
|
82
|
+
const points = p instanceof Cardinal2dImpl ? p.points : [...p];
|
|
83
|
+
const p0 = points[0];
|
|
84
|
+
const p1 = points[1];
|
|
85
|
+
const p2 = points[points.length - 2];
|
|
86
|
+
const p3 = points[points.length - 1];
|
|
87
|
+
return new Cardinal2dImpl([
|
|
88
|
+
subtract(p1, p0).pipe(scale(scale$1), add(p0)),
|
|
89
|
+
...points,
|
|
90
|
+
subtract(p2, p3).pipe(scale(scale$1), add(p3))
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
const toPath$1 = dual(
|
|
95
|
+
(args) => isCardinal2d$1(args[0]),
|
|
96
|
+
(p, scale = 0.5) => fromCurves(
|
|
97
|
+
...toCurves(
|
|
98
|
+
p,
|
|
99
|
+
scale === 0.5 ? catRomCharacteristic$1 : characteristic$1(scale),
|
|
100
|
+
1
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const characteristic = characteristic$1;
|
|
106
|
+
const catRomCharacteristic = catRomCharacteristic$1;
|
|
107
|
+
const isCardinal2d = isCardinal2d$1;
|
|
108
|
+
const make = make$1;
|
|
109
|
+
const fromArray = fromArray$1;
|
|
110
|
+
const append = append$1;
|
|
111
|
+
const prepend = prepend$1;
|
|
112
|
+
const withDuplicatedEndpoints = withDuplicatedEndpoints$1;
|
|
113
|
+
const withReflectedEndpoints = withReflectedEndpoints$1;
|
|
114
|
+
const toPath = toPath$1;
|
|
115
|
+
|
|
116
|
+
export { append, catRomCharacteristic, characteristic, fromArray, isCardinal2d, make, prepend, toPath, withDuplicatedEndpoints, withReflectedEndpoints };
|
|
@@ -0,0 +1,31 @@
|
|
|
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 Hermite2dTypeId: unique symbol;
|
|
15
|
+
type Hermite2dTypeId = typeof Hermite2dTypeId;
|
|
16
|
+
|
|
17
|
+
interface Hermite2d extends Pipeable {
|
|
18
|
+
readonly [Hermite2dTypeId]: Hermite2dTypeId;
|
|
19
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
20
|
+
}
|
|
21
|
+
declare const characteristic: Matrix4x4;
|
|
22
|
+
declare const make: (p0: Vector2, v0: Vector2, p1: Vector2, v1: Vector2) => Hermite2d;
|
|
23
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Hermite2d;
|
|
24
|
+
declare const isHermite2d: (p: unknown) => p is Hermite2d;
|
|
25
|
+
declare const append: {
|
|
26
|
+
(p1: Vector2, v1: Vector2): (p: Hermite2d) => Hermite2d;
|
|
27
|
+
(p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
|
|
28
|
+
};
|
|
29
|
+
declare const toPath: (p: Hermite2d) => CubicPath2d;
|
|
30
|
+
|
|
31
|
+
export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
|
|
@@ -0,0 +1,31 @@
|
|
|
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 Hermite2dTypeId: unique symbol;
|
|
15
|
+
type Hermite2dTypeId = typeof Hermite2dTypeId;
|
|
16
|
+
|
|
17
|
+
interface Hermite2d extends Pipeable {
|
|
18
|
+
readonly [Hermite2dTypeId]: Hermite2dTypeId;
|
|
19
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
20
|
+
}
|
|
21
|
+
declare const characteristic: Matrix4x4;
|
|
22
|
+
declare const make: (p0: Vector2, v0: Vector2, p1: Vector2, v1: Vector2) => Hermite2d;
|
|
23
|
+
declare const fromArray: (points: ReadonlyArray<Vector2>) => Hermite2d;
|
|
24
|
+
declare const isHermite2d: (p: unknown) => p is Hermite2d;
|
|
25
|
+
declare const append: {
|
|
26
|
+
(p1: Vector2, v1: Vector2): (p: Hermite2d) => Hermite2d;
|
|
27
|
+
(p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
|
|
28
|
+
};
|
|
29
|
+
declare const toPath: (p: Hermite2d) => CubicPath2d;
|
|
30
|
+
|
|
31
|
+
export { type Hermite2d, append, characteristic, fromArray, isHermite2d, make, toPath };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { 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,
|
|
25
|
+
0,
|
|
26
|
+
0,
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
1,
|
|
30
|
+
0,
|
|
31
|
+
0,
|
|
32
|
+
-3,
|
|
33
|
+
-2,
|
|
34
|
+
3,
|
|
35
|
+
-1,
|
|
36
|
+
2,
|
|
37
|
+
1,
|
|
38
|
+
-2,
|
|
39
|
+
1
|
|
40
|
+
);
|
|
41
|
+
const Hermite2dTypeId = Symbol("curvy/splines/hermite2d");
|
|
42
|
+
class Hermite2dImpl extends Pipeable {
|
|
43
|
+
[Hermite2dTypeId] = Hermite2dTypeId;
|
|
44
|
+
points;
|
|
45
|
+
constructor(points) {
|
|
46
|
+
invariant(points.length >= 4, "hermite splines requires 4 or more points");
|
|
47
|
+
invariant(
|
|
48
|
+
points.length % 2 === 0,
|
|
49
|
+
"hermite splines requires (n * 2) points"
|
|
50
|
+
);
|
|
51
|
+
super();
|
|
52
|
+
this.points = points;
|
|
53
|
+
}
|
|
54
|
+
[Symbol.iterator]() {
|
|
55
|
+
return this.points[Symbol.iterator]();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const isHermite2d$1 = (p) => typeof p === "object" && p !== null && Hermite2dTypeId in p;
|
|
59
|
+
const make$1 = (p0, v0, p1, v1) => new Hermite2dImpl([p0, v0, p1, v1]);
|
|
60
|
+
const fromArray$1 = (points) => new Hermite2dImpl(points);
|
|
61
|
+
const append$1 = dual(3, (p, p1, v1) => {
|
|
62
|
+
const points = p instanceof Hermite2dImpl ? p.points : Array.from(p);
|
|
63
|
+
return new Hermite2dImpl(points.concat(p1, v1));
|
|
64
|
+
});
|
|
65
|
+
const toPath$1 = (p) => fromCurves(...toCurves(p, characteristic$1, 2));
|
|
66
|
+
|
|
67
|
+
const characteristic = characteristic$1;
|
|
68
|
+
const make = make$1;
|
|
69
|
+
const fromArray = fromArray$1;
|
|
70
|
+
const isHermite2d = isHermite2d$1;
|
|
71
|
+
const append = append$1;
|
|
72
|
+
const toPath = toPath$1;
|
|
73
|
+
|
|
74
|
+
export { append, characteristic, fromArray, isHermite2d, make, toPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.mjs';
|
|
2
2
|
import { P as Pipeable } from '../shared/curvy.BN-oFBsc.mjs';
|
|
3
3
|
|
|
4
4
|
declare const Vector2TypeId: unique symbol;
|
|
@@ -37,5 +37,9 @@ declare const hadamard: {
|
|
|
37
37
|
(a: Vector2, b: Vector2): Vector2;
|
|
38
38
|
(b: Vector2): (a: Vector2) => Vector2;
|
|
39
39
|
};
|
|
40
|
+
declare const scale: {
|
|
41
|
+
(s: number): (v: Vector2) => Vector2;
|
|
42
|
+
(v: Vector2, s: number): Vector2;
|
|
43
|
+
};
|
|
40
44
|
|
|
41
|
-
export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
|
|
45
|
+
export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, scale, softmax, subtract, zero };
|
package/dist/vector/vector2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
|
|
2
2
|
import { P as Pipeable } from '../shared/curvy.BN-oFBsc.js';
|
|
3
3
|
|
|
4
4
|
declare const Vector2TypeId: unique symbol;
|
|
@@ -37,5 +37,9 @@ declare const hadamard: {
|
|
|
37
37
|
(a: Vector2, b: Vector2): Vector2;
|
|
38
38
|
(b: Vector2): (a: Vector2) => Vector2;
|
|
39
39
|
};
|
|
40
|
+
declare const scale: {
|
|
41
|
+
(s: number): (v: Vector2) => Vector2;
|
|
42
|
+
(v: Vector2, s: number): Vector2;
|
|
43
|
+
};
|
|
40
44
|
|
|
41
|
-
export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, softmax, subtract, zero };
|
|
45
|
+
export { type Vector2, add, components, cross, dot, hadamard, isVector2, magnitude, make, normalize, scale, softmax, subtract, zero };
|