replicad-pantograph 0.11.1 → 0.11.3
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.
|
@@ -689,10 +689,10 @@ function Pn$1(r, s, t) {
|
|
|
689
689
|
ignoreChecks: !0
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
const Se = 1e-21, zt$
|
|
692
|
+
const Se = 1e-21, zt$1 = 1.618034;
|
|
693
693
|
function ke(r, s = 0, t = 1, e = 110, n = 1e3) {
|
|
694
694
|
let i, o, l, h, a, u, c, g, d, w, p, P, f;
|
|
695
|
-
for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + zt$
|
|
695
|
+
for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + zt$1 * (t - s), h = r(f), a = 3, c = 0; h < l; ) {
|
|
696
696
|
if (g = (t - s) * (l - h), d = (t - f) * (l - o), w = d - g, Math.abs(w) < Se ? i = 2 * Se : i = 2 * w, p = t - ((t - f) * d - (t - s) * g) / i, P = t + e * (f - t), c > n)
|
|
697
697
|
throw new Error("Too many iterations.");
|
|
698
698
|
if (c += 1, (p - f) * (t - p) > 0) {
|
|
@@ -700,9 +700,9 @@ function ke(r, s = 0, t = 1, e = 110, n = 1e3) {
|
|
|
700
700
|
return s = t, t = p, o = l, l = u, [s, t, f, o, l, h, a];
|
|
701
701
|
if (u > l)
|
|
702
702
|
return f = p, h = u, [s, t, f, o, l, h, a];
|
|
703
|
-
p = f + zt$
|
|
703
|
+
p = f + zt$1 * (f - t), u = r(p), a += 1;
|
|
704
704
|
} else
|
|
705
|
-
(p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + zt$
|
|
705
|
+
(p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + zt$1 * (f - t), l = h, h = u, u = r(p), a += 1)) : (p = f + zt$1 * (f - t), u = r(p), a += 1);
|
|
706
706
|
s = t, t = f, f = p, o = l, l = h, h = u;
|
|
707
707
|
}
|
|
708
708
|
return [s, t, f, o, l, h, a];
|
|
@@ -4026,7 +4026,7 @@ function de$1(r, s) {
|
|
|
4026
4026
|
return r.length === 2 ? [t] : [...de$1(t, s), t];
|
|
4027
4027
|
}
|
|
4028
4028
|
const Ae = Symbol.for("pantograph:CubicBezier");
|
|
4029
|
-
let Et$
|
|
4029
|
+
let Et$2 = class Et extends Ft$2 {
|
|
4030
4030
|
constructor(t, e, n, i) {
|
|
4031
4031
|
super(t, e);
|
|
4032
4032
|
q(this, "segmentType", "CUBIC_BEZIER");
|
|
@@ -4422,7 +4422,7 @@ let jt$1 = class jt extends Ft$2 {
|
|
|
4422
4422
|
this.center,
|
|
4423
4423
|
nt$2(tt$3(this.majorAxis), this.minorRadius)
|
|
4424
4424
|
) : e = this.reverseEllipseReferenceFrameTransform.transform(
|
|
4425
|
-
gn
|
|
4425
|
+
gn(
|
|
4426
4426
|
this.majorRadius,
|
|
4427
4427
|
this.minorRadius,
|
|
4428
4428
|
this.ellipseReferenceFrameTransform.transform(t)
|
|
@@ -4556,7 +4556,7 @@ function mn$1([r, s], [t, e], n, i, o, l, h) {
|
|
|
4556
4556
|
ry: i
|
|
4557
4557
|
};
|
|
4558
4558
|
}
|
|
4559
|
-
function gn
|
|
4559
|
+
function gn(r, s, t) {
|
|
4560
4560
|
const e = Math.abs(t[0]), n = Math.abs(t[1]);
|
|
4561
4561
|
let i = 0.707, o = 0.707;
|
|
4562
4562
|
const l = r, h = s;
|
|
@@ -5033,7 +5033,7 @@ function Bn$1(t) {
|
|
|
5033
5033
|
);
|
|
5034
5034
|
}
|
|
5035
5035
|
function kn$1(t) {
|
|
5036
|
-
if (Et$
|
|
5036
|
+
if (Et$2.isInstance(t))
|
|
5037
5037
|
return vn$1(t);
|
|
5038
5038
|
if (_t$1.isInstance(t))
|
|
5039
5039
|
return Bn$1(t);
|
|
@@ -5047,7 +5047,7 @@ function On$1(t) {
|
|
|
5047
5047
|
E(t.firstPoint, i),
|
|
5048
5048
|
E(t.lastPoint, i)
|
|
5049
5049
|
];
|
|
5050
|
-
return Et$
|
|
5050
|
+
return Et$2.isInstance(t) ? r.push(
|
|
5051
5051
|
E(t.firstControlPoint, i),
|
|
5052
5052
|
E(t.lastControlPoint, i)
|
|
5053
5053
|
) : _t$1.isInstance(t) && r.push(E(t.controlPoint, i)), new ct$2(
|
|
@@ -5087,7 +5087,7 @@ let Y$2 = class Y {
|
|
|
5087
5087
|
}
|
|
5088
5088
|
};
|
|
5089
5089
|
function _n$1(t, n) {
|
|
5090
|
-
if (Et$
|
|
5090
|
+
if (Et$2.isInstance(t))
|
|
5091
5091
|
return new Ln$1([
|
|
5092
5092
|
E(t.firstPoint, n),
|
|
5093
5093
|
E(t.firstControlPoint, n),
|
|
@@ -5371,11 +5371,11 @@ function Z$1(t, n, e) {
|
|
|
5371
5371
|
count: s.length
|
|
5372
5372
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5373
5373
|
}
|
|
5374
|
-
if (at$4.isInstance(t) && (Et$
|
|
5374
|
+
if (at$4.isInstance(t) && (Et$2.isInstance(n) || _t$1.isInstance(n))) {
|
|
5375
5375
|
const s = Pt$1(t, n);
|
|
5376
5376
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5377
5377
|
}
|
|
5378
|
-
if (at$4.isInstance(n) && (Et$
|
|
5378
|
+
if (at$4.isInstance(n) && (Et$2.isInstance(t) || _t$1.isInstance(t))) {
|
|
5379
5379
|
const s = Pt$1(n, t);
|
|
5380
5380
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5381
5381
|
}
|
|
@@ -5387,11 +5387,11 @@ function Z$1(t, n, e) {
|
|
|
5387
5387
|
const s = wt$1(n, t);
|
|
5388
5388
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5389
5389
|
}
|
|
5390
|
-
if ((ct$3.isInstance(t) || jt$1.isInstance(t)) && Et$
|
|
5390
|
+
if ((ct$3.isInstance(t) || jt$1.isInstance(t)) && Et$2.isInstance(n)) {
|
|
5391
5391
|
const s = It(t, n);
|
|
5392
5392
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5393
5393
|
}
|
|
5394
|
-
if ((ct$3.isInstance(n) || jt$1.isInstance(n)) && Et$
|
|
5394
|
+
if ((ct$3.isInstance(n) || jt$1.isInstance(n)) && Et$2.isInstance(t)) {
|
|
5395
5395
|
const s = It(n, t);
|
|
5396
5396
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5397
5397
|
}
|
|
@@ -5410,16 +5410,16 @@ function Z$1(t, n, e) {
|
|
|
5410
5410
|
count: s.length
|
|
5411
5411
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5412
5412
|
}
|
|
5413
|
-
if (_t$1.isInstance(t) && Et$
|
|
5413
|
+
if (_t$1.isInstance(t) && Et$2.isInstance(n) || _t$1.isInstance(n) && Et$2.isInstance(t)) {
|
|
5414
5414
|
const s = D(t, n);
|
|
5415
5415
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5416
5416
|
}
|
|
5417
|
-
if (Et$
|
|
5417
|
+
if (Et$2.isInstance(t) && Et$2.isInstance(n)) {
|
|
5418
5418
|
const s = zn$1(
|
|
5419
5419
|
t,
|
|
5420
5420
|
n
|
|
5421
5421
|
);
|
|
5422
|
-
return s.length ? Et$
|
|
5422
|
+
return s.length ? Et$2.isInstance(s[0]) ? {
|
|
5423
5423
|
intersections: [],
|
|
5424
5424
|
overlaps: s,
|
|
5425
5425
|
count: s.length
|
|
@@ -5431,7 +5431,7 @@ function Z$1(t, n, e) {
|
|
|
5431
5431
|
}
|
|
5432
5432
|
throw new Error("Not implemented");
|
|
5433
5433
|
}
|
|
5434
|
-
function $t(t) {
|
|
5434
|
+
function $t$1(t) {
|
|
5435
5435
|
const n = [];
|
|
5436
5436
|
for (let e = 0; e < t; e++)
|
|
5437
5437
|
for (let s = 0; s <= e; s++)
|
|
@@ -5439,7 +5439,7 @@ function $t(t) {
|
|
|
5439
5439
|
return n;
|
|
5440
5440
|
}
|
|
5441
5441
|
function* it$1(t) {
|
|
5442
|
-
for (const [n, e] of $t(t.length))
|
|
5442
|
+
for (const [n, e] of $t$1(t.length))
|
|
5443
5443
|
n !== e && (yield [t[n], t[e]]);
|
|
5444
5444
|
}
|
|
5445
5445
|
class Yt extends ns {
|
|
@@ -5493,7 +5493,7 @@ class Yt extends ns {
|
|
|
5493
5493
|
}
|
|
5494
5494
|
}
|
|
5495
5495
|
function Nn(t, n = "Stroke") {
|
|
5496
|
-
$t(t.length).forEach(
|
|
5496
|
+
$t$1(t.length).forEach(
|
|
5497
5497
|
([e, s]) => {
|
|
5498
5498
|
if (e === s) return;
|
|
5499
5499
|
const i = t[e], r = t[s], l = Z$1(i, r), o = Math.max(i.precision, r.precision);
|
|
@@ -5613,7 +5613,7 @@ let B$3 = class B extends Yt {
|
|
|
5613
5613
|
);
|
|
5614
5614
|
}
|
|
5615
5615
|
};
|
|
5616
|
-
const Vn = (t, n) => {
|
|
5616
|
+
const Vn$1 = (t, n) => {
|
|
5617
5617
|
const e = me$1(n, {
|
|
5618
5618
|
V: [1, 0],
|
|
5619
5619
|
firstPoint: t,
|
|
@@ -5676,12 +5676,12 @@ const jn$1 = (t, n) => {
|
|
|
5676
5676
|
};
|
|
5677
5677
|
function $n$1(t, n) {
|
|
5678
5678
|
if (at$4.isInstance(n))
|
|
5679
|
-
return Vn(t, n);
|
|
5679
|
+
return Vn$1(t, n);
|
|
5680
5680
|
if (ct$3.isInstance(n))
|
|
5681
5681
|
return jn$1(t, n);
|
|
5682
5682
|
if (jt$1.isInstance(n))
|
|
5683
5683
|
return Un$1(t, n);
|
|
5684
|
-
if (Et$
|
|
5684
|
+
if (Et$2.isInstance(n) || _t$1.isInstance(n))
|
|
5685
5685
|
return Hn(t, n);
|
|
5686
5686
|
throw new Error("Not implemented");
|
|
5687
5687
|
}
|
|
@@ -5734,15 +5734,15 @@ function Yn$1(t) {
|
|
|
5734
5734
|
if (Xt(t, "Loop"), !Y$3(t[0].firstPoint, t[t.length - 1].lastPoint))
|
|
5735
5735
|
throw new Error("Loop segment must be closed");
|
|
5736
5736
|
}
|
|
5737
|
-
const Xn
|
|
5737
|
+
const Xn = [
|
|
5738
5738
|
at$4,
|
|
5739
5739
|
ct$3,
|
|
5740
5740
|
jt$1,
|
|
5741
5741
|
_t$1,
|
|
5742
|
-
Et$
|
|
5742
|
+
Et$2
|
|
5743
5743
|
];
|
|
5744
5744
|
function Gn$1(t) {
|
|
5745
|
-
return Xn
|
|
5745
|
+
return Xn.some((n) => n.isInstance(t));
|
|
5746
5746
|
}
|
|
5747
5747
|
function Qt(t) {
|
|
5748
5748
|
if (at$4.isInstance(t))
|
|
@@ -5777,7 +5777,7 @@ function Qt(t) {
|
|
|
5777
5777
|
lastPoint: t.lastPoint,
|
|
5778
5778
|
controlPoint: t.controlPoint
|
|
5779
5779
|
};
|
|
5780
|
-
if (Et$
|
|
5780
|
+
if (Et$2.isInstance(t))
|
|
5781
5781
|
return {
|
|
5782
5782
|
type: t.segmentType,
|
|
5783
5783
|
firstPoint: t.firstPoint,
|
|
@@ -5806,7 +5806,7 @@ function Qn$1(t) {
|
|
|
5806
5806
|
figures: t.figures.map(Wt)
|
|
5807
5807
|
};
|
|
5808
5808
|
}
|
|
5809
|
-
function Et(t) {
|
|
5809
|
+
function Et$1(t) {
|
|
5810
5810
|
if (O$2.isInstance(t))
|
|
5811
5811
|
return Qn$1(t);
|
|
5812
5812
|
if (v$2.isInstance(t))
|
|
@@ -6136,7 +6136,7 @@ function Zn$1(t, n = []) {
|
|
|
6136
6136
|
throw new Error("Holes must be inside the contour");
|
|
6137
6137
|
for (const [e, s] of it$1(n))
|
|
6138
6138
|
if (e.contains(s.firstPoint))
|
|
6139
|
-
throw console.error(Et(e), Et(s)), new Error("Holes must not be inside other holes");
|
|
6139
|
+
throw console.error(Et$1(e), Et$1(s)), new Error("Holes must not be inside other holes");
|
|
6140
6140
|
}
|
|
6141
6141
|
const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, te$1 = (t, n) => {
|
|
6142
6142
|
const e = t.boundingBox, s = n.boundingBox;
|
|
@@ -6159,7 +6159,7 @@ const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, te$1 = (t, n) => {
|
|
|
6159
6159
|
return t.forEach((e) => {
|
|
6160
6160
|
n.some((s) => ne$1(e, s)) || n.push(e);
|
|
6161
6161
|
}), n;
|
|
6162
|
-
}, se = (t) => {
|
|
6162
|
+
}, se$1 = (t) => {
|
|
6163
6163
|
const n = t.map((i, r) => t.slice(r + 1).map((l, o) => [o + r + 1, l]).filter(([, l]) => i.boundingBox.overlaps(l.boundingBox)).map(([l]) => l)), e = [], s = Array(n.length);
|
|
6164
6164
|
return n.forEach((i, r) => {
|
|
6165
6165
|
let l = s[r];
|
|
@@ -6189,7 +6189,7 @@ const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, te$1 = (t, n) => {
|
|
|
6189
6189
|
};
|
|
6190
6190
|
function X$2(t) {
|
|
6191
6191
|
const n = ee$1(t);
|
|
6192
|
-
return se(n).map(Kt).flatMap(ht$2).map((s) => {
|
|
6192
|
+
return se$1(n).map(Kt).flatMap(ht$2).map((s) => {
|
|
6193
6193
|
if (s.length === 1) return new v$2(s[0].loop);
|
|
6194
6194
|
s.sort((l, o) => l.isIn.length - o.isIn.length);
|
|
6195
6195
|
const [i, ...r] = s.map(({ loop: l }) => l);
|
|
@@ -6407,7 +6407,11 @@ const he = (t, n, e) => {
|
|
|
6407
6407
|
return Array.isArray(s) ? s : s.identical ? [] : s.firstCurveInSecond ? [] : s.secondCurveInFirst ? [t, n] : [t];
|
|
6408
6408
|
}, dt$1 = (t, n, e) => {
|
|
6409
6409
|
const s = (e == null ? void 0 : e.firstBoundaryInside) ?? !1, i = (e == null ? void 0 : e.secondBoundaryInside) ?? !1, r = s || i, l = (u, a, f) => u.segments.every(
|
|
6410
|
-
(c) => a.contains(c.midPoint, {
|
|
6410
|
+
(c) => a.contains(c.midPoint, {
|
|
6411
|
+
strokeIsInside: f
|
|
6412
|
+
}) && a.contains(c.firstPoint, {
|
|
6413
|
+
strokeIsInside: f
|
|
6414
|
+
})
|
|
6411
6415
|
);
|
|
6412
6416
|
if (r) {
|
|
6413
6417
|
if (l(t, n, i))
|
|
@@ -6514,16 +6518,16 @@ function Q$1(t, n) {
|
|
|
6514
6518
|
function lt$2(t, n) {
|
|
6515
6519
|
return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? de(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$2([e], n)) : n.flatMap((e) => lt$2(t, [e]));
|
|
6516
6520
|
}
|
|
6517
|
-
const zt
|
|
6521
|
+
const zt = Symbol.for("pantograph:Diagram");
|
|
6518
6522
|
let O$2 = class O extends ns {
|
|
6519
6523
|
constructor(e = [], { ignoreChecks: s = !1 } = {}) {
|
|
6520
6524
|
super();
|
|
6521
6525
|
b(this, "figures");
|
|
6522
6526
|
b(this, "_boundingBox", null);
|
|
6523
|
-
Object.defineProperty(this, zt
|
|
6527
|
+
Object.defineProperty(this, zt, { value: !0 }), s || me(e), this.figures = e;
|
|
6524
6528
|
}
|
|
6525
6529
|
static isInstance(e) {
|
|
6526
|
-
return !!e && e[zt
|
|
6530
|
+
return !!e && e[zt] === !0;
|
|
6527
6531
|
}
|
|
6528
6532
|
get isEmpty() {
|
|
6529
6533
|
return this.figures.length === 0;
|
|
@@ -6600,7 +6604,7 @@ function _(e, t) {
|
|
|
6600
6604
|
return rt$2(e, t);
|
|
6601
6605
|
if (ct$3.isInstance(e))
|
|
6602
6606
|
return it(e, t);
|
|
6603
|
-
if (_t$1.isInstance(e) || Et$
|
|
6607
|
+
if (_t$1.isInstance(e) || Et$2.isInstance(e))
|
|
6604
6608
|
return st$1(e, t);
|
|
6605
6609
|
throw new Error("Not implemented");
|
|
6606
6610
|
}
|
|
@@ -6685,7 +6689,7 @@ function st$1(e, t) {
|
|
|
6685
6689
|
c,
|
|
6686
6690
|
e.precision
|
|
6687
6691
|
);
|
|
6688
|
-
return new Et$
|
|
6692
|
+
return new Et$2(
|
|
6689
6693
|
a,
|
|
6690
6694
|
c,
|
|
6691
6695
|
g,
|
|
@@ -6913,7 +6917,7 @@ let at$2 = class at {
|
|
|
6913
6917
|
}
|
|
6914
6918
|
cubicBezierCurveTo(t, n, r) {
|
|
6915
6919
|
return this.saveSegment(
|
|
6916
|
-
new Et$
|
|
6920
|
+
new Et$2(this.pointer, t, n, r)
|
|
6917
6921
|
), this.pointer = t, this;
|
|
6918
6922
|
}
|
|
6919
6923
|
quadraticBezierCurveTo(t, n) {
|
|
@@ -7384,7 +7388,7 @@ function r(t) {
|
|
|
7384
7388
|
o(t.controlPoint),
|
|
7385
7389
|
o(t.lastPoint)
|
|
7386
7390
|
].join(" ")}`;
|
|
7387
|
-
if (Et$
|
|
7391
|
+
if (Et$2.isInstance(t))
|
|
7388
7392
|
return `C ${[
|
|
7389
7393
|
o(t.firstControlPoint),
|
|
7390
7394
|
o(t.lastControlPoint),
|
|
@@ -7421,9 +7425,9 @@ function A(t, n, i = 1, s) {
|
|
|
7421
7425
|
</svg>`;
|
|
7422
7426
|
}
|
|
7423
7427
|
|
|
7424
|
-
var
|
|
7425
|
-
var
|
|
7426
|
-
var I = (t, n, e) =>
|
|
7428
|
+
var $t = Object.defineProperty;
|
|
7429
|
+
var Ut = (t, n, e) => n in t ? $t(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
7430
|
+
var I = (t, n, e) => Ut(t, typeof n != "symbol" ? n + "" : n, e);
|
|
7427
7431
|
function x(t) {
|
|
7428
7432
|
if (v$2.isInstance(t))
|
|
7429
7433
|
return [t];
|
|
@@ -7433,7 +7437,7 @@ function x(t) {
|
|
|
7433
7437
|
return t.figures;
|
|
7434
7438
|
throw new Error("Unknown shape");
|
|
7435
7439
|
}
|
|
7436
|
-
function
|
|
7440
|
+
function Et(t, n, e = 1e-9) {
|
|
7437
7441
|
let r = [];
|
|
7438
7442
|
const s = [], i = new Array(n.segments.length).fill(0).map(() => []);
|
|
7439
7443
|
n.segments.forEach((c, f) => {
|
|
@@ -7461,13 +7465,13 @@ function kt(t, n, e = 1e-9) {
|
|
|
7461
7465
|
);
|
|
7462
7466
|
}
|
|
7463
7467
|
function tt(t, n, e = !1) {
|
|
7464
|
-
return
|
|
7468
|
+
return Et(n, t).filter((s) => {
|
|
7465
7469
|
const i = s.segments[0].midPoint;
|
|
7466
7470
|
return n.onStroke(i) ? !e : !n.contains(i);
|
|
7467
7471
|
});
|
|
7468
7472
|
}
|
|
7469
7473
|
function nt(t, n, e = !1) {
|
|
7470
|
-
return
|
|
7474
|
+
return Et(n, t).filter((s) => {
|
|
7471
7475
|
const i = s.segments[0].midPoint;
|
|
7472
7476
|
return n.onStroke(i) ? !e : n.contains(i);
|
|
7473
7477
|
});
|
|
@@ -7494,28 +7498,28 @@ function at(t, n, e = !1) {
|
|
|
7494
7498
|
);
|
|
7495
7499
|
}), r;
|
|
7496
7500
|
}
|
|
7497
|
-
function
|
|
7501
|
+
function pn(t, n) {
|
|
7498
7502
|
return new O$2(
|
|
7499
7503
|
G$1(x(t), x(n))
|
|
7500
7504
|
);
|
|
7501
7505
|
}
|
|
7502
7506
|
function z(t) {
|
|
7503
7507
|
return t.reduce(
|
|
7504
|
-
(n, e) =>
|
|
7508
|
+
(n, e) => pn(n, e),
|
|
7505
7509
|
new O$2()
|
|
7506
7510
|
);
|
|
7507
7511
|
}
|
|
7508
|
-
function
|
|
7512
|
+
function kt(t, n) {
|
|
7509
7513
|
return new O$2(
|
|
7510
7514
|
Q$1(x(t), x(n))
|
|
7511
7515
|
);
|
|
7512
7516
|
}
|
|
7513
|
-
function
|
|
7517
|
+
function Jn(t, n) {
|
|
7514
7518
|
return new O$2(
|
|
7515
7519
|
lt$2(x(t), x(n))
|
|
7516
7520
|
);
|
|
7517
7521
|
}
|
|
7518
|
-
function
|
|
7522
|
+
function Qn(t, n, e = !0) {
|
|
7519
7523
|
if (_$1.isInstance(n))
|
|
7520
7524
|
return tt(t, n, e);
|
|
7521
7525
|
if (v$2.isInstance(n))
|
|
@@ -7525,7 +7529,7 @@ function Jn(t, n, e = !0) {
|
|
|
7525
7529
|
r = r.flatMap((i) => ct(i, s, e));
|
|
7526
7530
|
}), r;
|
|
7527
7531
|
}
|
|
7528
|
-
function
|
|
7532
|
+
function Yn(t, n, e = !1) {
|
|
7529
7533
|
if (_$1.isInstance(n))
|
|
7530
7534
|
return nt(t, n, e);
|
|
7531
7535
|
if (v$2.isInstance(n))
|
|
@@ -7545,7 +7549,7 @@ const ut = (t, n, e) => {
|
|
|
7545
7549
|
return t.distanceFrom(n.lastPoint);
|
|
7546
7550
|
throw new Error("Invalid position");
|
|
7547
7551
|
};
|
|
7548
|
-
function
|
|
7552
|
+
function dn(t, n) {
|
|
7549
7553
|
const e = me$1(t, n);
|
|
7550
7554
|
if (e === "parallel")
|
|
7551
7555
|
return Math.min(
|
|
@@ -7595,16 +7599,16 @@ function lt(t, n) {
|
|
|
7595
7599
|
t.distanceFrom(n.lastPoint)
|
|
7596
7600
|
);
|
|
7597
7601
|
}
|
|
7598
|
-
const
|
|
7602
|
+
const mn = (t, n) => {
|
|
7599
7603
|
const e = t.angleToParam(n.firstAngle);
|
|
7600
7604
|
if (t.isValidParameter(e)) return !0;
|
|
7601
7605
|
const r = t.angleToParam(n.lastAngle);
|
|
7602
7606
|
return !!t.isValidParameter(r);
|
|
7603
7607
|
};
|
|
7604
|
-
function
|
|
7608
|
+
function Pn(t, n) {
|
|
7605
7609
|
if (jt(t, n, !0).length > 0) return 0;
|
|
7606
7610
|
const e = J$3(t.center, n.center);
|
|
7607
|
-
if (e < t.precision &&
|
|
7611
|
+
if (e < t.precision && mn(t, n))
|
|
7608
7612
|
return Math.abs(t.radius - n.radius);
|
|
7609
7613
|
const r = H$1(Q$2(n.center, t.center)), s = e - Math.abs(t.radius - n.radius) < t.precision;
|
|
7610
7614
|
let i = Ke(r);
|
|
@@ -7617,7 +7621,7 @@ function mn(t, n) {
|
|
|
7617
7621
|
n.distanceFrom(t.lastPoint)
|
|
7618
7622
|
);
|
|
7619
7623
|
}
|
|
7620
|
-
function
|
|
7624
|
+
function wn(t, n, e) {
|
|
7621
7625
|
let r = 0, s = t.length - 1;
|
|
7622
7626
|
for (; r <= s; ) {
|
|
7623
7627
|
const i = Math.floor((r + s) / 2), o = e(t[i], n);
|
|
@@ -7630,18 +7634,18 @@ function Pn(t, n, e) {
|
|
|
7630
7634
|
}
|
|
7631
7635
|
return -(r + 1);
|
|
7632
7636
|
}
|
|
7633
|
-
function
|
|
7634
|
-
const r =
|
|
7637
|
+
function In(t, n, e) {
|
|
7638
|
+
const r = wn(t, n, e);
|
|
7635
7639
|
r < 0 ? t.splice(-(r + 1), 0, n) : t.splice(r, 0, n);
|
|
7636
7640
|
}
|
|
7637
|
-
class
|
|
7641
|
+
class Mn {
|
|
7638
7642
|
constructor() {
|
|
7639
7643
|
I(this, "buckets");
|
|
7640
7644
|
this.buckets = [];
|
|
7641
7645
|
}
|
|
7642
7646
|
addInterval(n) {
|
|
7643
7647
|
const e = this.buckets[n.rectangle.diagonalBucketIndex];
|
|
7644
|
-
e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] :
|
|
7648
|
+
e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] : In(e, n, (r, s) => r.value - s.value);
|
|
7645
7649
|
}
|
|
7646
7650
|
removeInterval(n) {
|
|
7647
7651
|
const e = this.buckets[n.rectangle.diagonalBucketIndex];
|
|
@@ -7675,7 +7679,7 @@ class In {
|
|
|
7675
7679
|
return n;
|
|
7676
7680
|
}
|
|
7677
7681
|
}
|
|
7678
|
-
class
|
|
7682
|
+
class Sn {
|
|
7679
7683
|
constructor(n, e) {
|
|
7680
7684
|
I(this, "diagonal");
|
|
7681
7685
|
I(this, "diagonalBucketIndex");
|
|
@@ -7687,14 +7691,14 @@ class Mn {
|
|
|
7687
7691
|
), this.diagonalBucketIndex = n + e, this.index = `${n},${e}`;
|
|
7688
7692
|
}
|
|
7689
7693
|
}
|
|
7690
|
-
class
|
|
7694
|
+
class An {
|
|
7691
7695
|
constructor(n, e = 1e-8, r = 1e3, s = 1e-6) {
|
|
7692
7696
|
I(this, "rectangles");
|
|
7693
7697
|
I(this, "buckets");
|
|
7694
7698
|
I(this, "fMin");
|
|
7695
7699
|
I(this, "argMin");
|
|
7696
7700
|
I(this, "tol");
|
|
7697
|
-
this.fcn = n, this.endTolerance = e, this.maxIterations = r, this.epsilon = s, this.fcn = n, this.epsilon = s, this.endTolerance = e, this.maxIterations = r, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new
|
|
7701
|
+
this.fcn = n, this.endTolerance = e, this.maxIterations = r, this.epsilon = s, this.fcn = n, this.epsilon = s, this.endTolerance = e, this.maxIterations = r, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new Mn();
|
|
7698
7702
|
const i = [0.5, 0.5], o = this.rect(0, 0), c = this.fcn(i);
|
|
7699
7703
|
this.buckets.addInterval(new O(i, c, o)), this.fMin = c, this.argMin = i, this.tol = o.diagonal;
|
|
7700
7704
|
}
|
|
@@ -7703,7 +7707,7 @@ class Sn {
|
|
|
7703
7707
|
}
|
|
7704
7708
|
rect(n, e) {
|
|
7705
7709
|
const r = `${n},${e}`;
|
|
7706
|
-
return this.rectangles.has(r) || this.rectangles.set(r, new
|
|
7710
|
+
return this.rectangles.has(r) || this.rectangles.set(r, new Sn(n, e)), this.rectangles.get(r);
|
|
7707
7711
|
}
|
|
7708
7712
|
splitInterval(n) {
|
|
7709
7713
|
let e, r, s;
|
|
@@ -7748,26 +7752,26 @@ class O {
|
|
|
7748
7752
|
this.center = n, this.value = e, this.rectangle = r;
|
|
7749
7753
|
}
|
|
7750
7754
|
}
|
|
7751
|
-
function
|
|
7752
|
-
return new
|
|
7755
|
+
function vn(t, n = 1e-8, e = 1e3, r = 1e-6) {
|
|
7756
|
+
return new An(
|
|
7753
7757
|
t,
|
|
7754
7758
|
n,
|
|
7755
7759
|
e,
|
|
7756
7760
|
r
|
|
7757
7761
|
).run();
|
|
7758
7762
|
}
|
|
7759
|
-
function
|
|
7760
|
-
const r =
|
|
7763
|
+
function bn(t, n, e = 1e-9) {
|
|
7764
|
+
const r = vn((s) => {
|
|
7761
7765
|
const i = t.paramPoint(s[0]), o = n.paramPoint(s[1]);
|
|
7762
7766
|
return Rt$1(i, o);
|
|
7763
7767
|
}, e);
|
|
7764
7768
|
return Math.sqrt(r.fMin);
|
|
7765
7769
|
}
|
|
7766
|
-
function
|
|
7767
|
-
return at$4.isInstance(t) && at$4.isInstance(n) ?
|
|
7770
|
+
function Ln(t, n) {
|
|
7771
|
+
return at$4.isInstance(t) && at$4.isInstance(n) ? dn(t, n) : at$4.isInstance(t) && ct$3.isInstance(n) ? lt(t, n) : ct$3.isInstance(t) && at$4.isInstance(n) ? lt(n, t) : ct$3.isInstance(t) && ct$3.isInstance(n) ? Pn(t, n) : bn(t, n);
|
|
7768
7772
|
}
|
|
7769
|
-
function
|
|
7770
|
-
if (Et$
|
|
7773
|
+
function Ft(t) {
|
|
7774
|
+
if (Et$2.isInstance(t)) {
|
|
7771
7775
|
const s = Q$2(t.lastPoint, t.firstPoint), i = Q$2(t.firstControlPoint, t.firstPoint), o = Q$2(t.lastControlPoint, t.firstPoint), c = dn$1(s, i), f = dn$1(s, o);
|
|
7772
7776
|
if (c > 0 && f < 0 || c < 0 && f > 0) return !1;
|
|
7773
7777
|
}
|
|
@@ -7776,7 +7780,7 @@ function xt(t) {
|
|
|
7776
7780
|
return Math.abs(Math.acos(r)) < Math.PI / 3;
|
|
7777
7781
|
}
|
|
7778
7782
|
function X(t) {
|
|
7779
|
-
if (
|
|
7783
|
+
if (Ft(t)) return [t];
|
|
7780
7784
|
const [n, e] = t.splitAtParameters([0.5]);
|
|
7781
7785
|
return [
|
|
7782
7786
|
...X(n),
|
|
@@ -7784,9 +7788,9 @@ function X(t) {
|
|
|
7784
7788
|
];
|
|
7785
7789
|
}
|
|
7786
7790
|
function ht(t) {
|
|
7787
|
-
return
|
|
7791
|
+
return Ft(t) ? [t] : t.splitAtParameters(t.getParametersOfExtrema()).flatMap(X);
|
|
7788
7792
|
}
|
|
7789
|
-
function
|
|
7793
|
+
function En(t) {
|
|
7790
7794
|
const n = t.deltaAngle, e = Math.ceil(Math.abs(n) / (Math.PI / 2)), r = n / e, s = 4 * Math.tan(r / 4) / 3, i = t.clockwise ? -1 : 1, o = Array.from(
|
|
7791
7795
|
{ length: e + 1 },
|
|
7792
7796
|
(f, a) => t.firstAngle + a * r * i
|
|
@@ -7795,19 +7799,19 @@ function Ln(t) {
|
|
|
7795
7799
|
const u = Math.cos(f), g = Math.sin(f), p = Math.cos(a), d = Math.sin(a), [l, M] = t.center, w = t.minorRadius, S = t.majorRadius, L = new et$3().rotate(
|
|
7796
7800
|
t.tiltAngle,
|
|
7797
7801
|
t.center
|
|
7798
|
-
), k = (
|
|
7802
|
+
), k = (_t) => L.transform(_t), D = k([l + S * u, M + w * g]), $ = k([
|
|
7799
7803
|
l + S * (u - s * g * i),
|
|
7800
7804
|
M + w * (g + s * u * i)
|
|
7801
|
-
]),
|
|
7805
|
+
]), zt = k([
|
|
7802
7806
|
l + S * (p + s * d * i),
|
|
7803
7807
|
M + w * (d - s * p * i)
|
|
7804
|
-
]),
|
|
7805
|
-
return new Et$
|
|
7808
|
+
]), Gt = k([l + S * p, M + w * d]);
|
|
7809
|
+
return new Et$2(D, Gt, $, zt);
|
|
7806
7810
|
});
|
|
7807
7811
|
}
|
|
7808
|
-
const et = 1e-8,
|
|
7812
|
+
const et = 1e-8, xt = (t) => t.flatMap((n) => at$4.isInstance(n) ? [n] : ct$3.isInstance(n) ? [n] : jt$1.isInstance(n) ? En(n).flatMap(
|
|
7809
7813
|
(e) => ht(e)
|
|
7810
|
-
) : _t$1.isInstance(n) || Et$
|
|
7814
|
+
) : _t$1.isInstance(n) || Et$2.isInstance(n) ? ht(n) : [new at$4(n.firstPoint, n.lastPoint)]);
|
|
7811
7815
|
function J(t, n, e = !0) {
|
|
7812
7816
|
const r = t.map((a) => ({
|
|
7813
7817
|
offset: _(a, n),
|
|
@@ -7873,7 +7877,7 @@ function J(t, n, e = !0) {
|
|
|
7873
7877
|
}
|
|
7874
7878
|
return o && c(o), s;
|
|
7875
7879
|
}
|
|
7876
|
-
function
|
|
7880
|
+
function yt(t) {
|
|
7877
7881
|
const n = /* @__PURE__ */ new Map(), e = (r, s) => {
|
|
7878
7882
|
const i = n.get(r) || [];
|
|
7879
7883
|
n.set(r, [...i, ...s]);
|
|
@@ -7891,34 +7895,34 @@ function Ct(t) {
|
|
|
7891
7895
|
});
|
|
7892
7896
|
}), n;
|
|
7893
7897
|
}
|
|
7894
|
-
function
|
|
7898
|
+
function Ct(t, n) {
|
|
7895
7899
|
return n.flatMap((e, r) => {
|
|
7896
7900
|
if (!t.has(r)) return e;
|
|
7897
7901
|
const s = t.get(r);
|
|
7898
7902
|
return s ? e.splitAt(s) : e;
|
|
7899
7903
|
});
|
|
7900
7904
|
}
|
|
7901
|
-
function
|
|
7902
|
-
return t.filter((r) => !n.segments.some((i) =>
|
|
7905
|
+
function Dt(t, n, e) {
|
|
7906
|
+
return t.filter((r) => !n.segments.some((i) => Ln(i, r) < Math.abs(e) - et));
|
|
7903
7907
|
}
|
|
7904
7908
|
function G(t, n) {
|
|
7905
|
-
const e = t.clockwise ? n : -n, r =
|
|
7909
|
+
const e = t.clockwise ? n : -n, r = xt(t.segments), s = J(r, e);
|
|
7906
7910
|
if (s.length < 2) return new O$2();
|
|
7907
|
-
const i =
|
|
7911
|
+
const i = yt(s);
|
|
7908
7912
|
if (!i.size) {
|
|
7909
7913
|
const u = new _$1(s);
|
|
7910
7914
|
return new O$2([new v$2(u)]);
|
|
7911
7915
|
}
|
|
7912
|
-
const o =
|
|
7916
|
+
const o = Ct(
|
|
7913
7917
|
i,
|
|
7914
7918
|
s
|
|
7915
|
-
), c =
|
|
7919
|
+
), c = Dt(o, t, n);
|
|
7916
7920
|
if (!c.length) return new O$2();
|
|
7917
7921
|
const a = Jt(c).filter((u) => u.length > 1).filter((u) => Y$3(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new _$1(u));
|
|
7918
7922
|
return a.length ? new O$2(a.map((u) => new v$2(u))) : new O$2();
|
|
7919
7923
|
}
|
|
7920
|
-
function
|
|
7921
|
-
const r = n / 2, s =
|
|
7924
|
+
function kn(t, n, e = "round") {
|
|
7925
|
+
const r = n / 2, s = xt(t.segments), i = J(s, r, !1), o = J(
|
|
7922
7926
|
s,
|
|
7923
7927
|
-r,
|
|
7924
7928
|
!1
|
|
@@ -7939,43 +7943,43 @@ function En(t, n, e = "round") {
|
|
|
7939
7943
|
o[o.length - 1],
|
|
7940
7944
|
i[0]
|
|
7941
7945
|
)
|
|
7942
|
-
], a =
|
|
7946
|
+
], a = yt(f);
|
|
7943
7947
|
if (!a.size) {
|
|
7944
7948
|
const l = new _$1(f);
|
|
7945
7949
|
return new O$2([new v$2(l)]);
|
|
7946
7950
|
}
|
|
7947
|
-
const u =
|
|
7951
|
+
const u = Ct(
|
|
7948
7952
|
a,
|
|
7949
7953
|
f
|
|
7950
|
-
), g =
|
|
7954
|
+
), g = Dt(u, t, r);
|
|
7951
7955
|
if (!g.length) return new O$2();
|
|
7952
7956
|
const d = Jt(g).filter((l) => l.length > 1).filter((l) => Y$3(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new _$1(l));
|
|
7953
7957
|
return d.length ? new O$2(d.map((l) => new v$2(l))) : new O$2();
|
|
7954
7958
|
}
|
|
7955
|
-
function
|
|
7959
|
+
function Fn(t, n) {
|
|
7956
7960
|
const e = t.map((r) => {
|
|
7957
7961
|
const s = z(
|
|
7958
7962
|
r.holes.map((i) => G(i, n))
|
|
7959
7963
|
);
|
|
7960
|
-
return
|
|
7964
|
+
return kt(G(r.contour, n), s);
|
|
7961
7965
|
});
|
|
7962
7966
|
return z(e);
|
|
7963
7967
|
}
|
|
7964
|
-
function
|
|
7968
|
+
function xn(t, n) {
|
|
7965
7969
|
const e = Math.abs(n / 2), r = t.map(
|
|
7966
7970
|
(s) => z(
|
|
7967
|
-
s.allLoops.map((i) =>
|
|
7971
|
+
s.allLoops.map((i) => kt(G(i, e), G(i, -e)))
|
|
7968
7972
|
)
|
|
7969
7973
|
);
|
|
7970
7974
|
return z(r);
|
|
7971
7975
|
}
|
|
7972
|
-
function
|
|
7973
|
-
return
|
|
7976
|
+
function Zn(t, n) {
|
|
7977
|
+
return Fn(x(t), n);
|
|
7974
7978
|
}
|
|
7975
|
-
function
|
|
7976
|
-
return B$3.isInstance(t) ?
|
|
7979
|
+
function Wn(t, n, { endCap: e = "round" } = {}) {
|
|
7980
|
+
return B$3.isInstance(t) ? kn(t, n, e) : xn(x(t), n);
|
|
7977
7981
|
}
|
|
7978
|
-
class
|
|
7982
|
+
class yn {
|
|
7979
7983
|
constructor() {
|
|
7980
7984
|
I(this, "filters");
|
|
7981
7985
|
this.filters = [];
|
|
@@ -8016,7 +8020,7 @@ const V = 2 * Math.PI, gt = (t) => {
|
|
|
8016
8020
|
const n = t % V, e = n < 0 ? n + V : n;
|
|
8017
8021
|
return e < Math.PI ? e : e === Math.PI ? 0 : Math.abs(e - V);
|
|
8018
8022
|
};
|
|
8019
|
-
class C extends
|
|
8023
|
+
class C extends yn {
|
|
8020
8024
|
clone() {
|
|
8021
8025
|
const n = new C();
|
|
8022
8026
|
return n.filters = [...this.filters], n;
|
|
@@ -8108,7 +8112,7 @@ class C extends xn {
|
|
|
8108
8112
|
return this.shouldKeep.bind(this);
|
|
8109
8113
|
}
|
|
8110
8114
|
}
|
|
8111
|
-
function
|
|
8115
|
+
function Ot(t, n, e, r = () => !0) {
|
|
8112
8116
|
const s = [n.segments[0]], i = (c, f) => {
|
|
8113
8117
|
r({ firstCurve: c, secondCurve: f, point: c.lastPoint }) ? s.push(...t(c, f, e)) : s.push(c, f);
|
|
8114
8118
|
};
|
|
@@ -8128,7 +8132,7 @@ function Bt(t, n, e, r = () => !0) {
|
|
|
8128
8132
|
function R(t, n, e) {
|
|
8129
8133
|
const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
|
|
8130
8134
|
if (_$1.isInstance(t) || B$3.isInstance(t))
|
|
8131
|
-
return
|
|
8135
|
+
return Ot(I$1, t, n, s);
|
|
8132
8136
|
if (v$2.isInstance(t)) {
|
|
8133
8137
|
const i = R(t.contour, n, r), o = t.holes.map((c) => R(c, n, r));
|
|
8134
8138
|
return new v$2(i, o, { ignoreChecks: !0 });
|
|
@@ -8142,7 +8146,7 @@ function R(t, n, e) {
|
|
|
8142
8146
|
function T(t, n, e) {
|
|
8143
8147
|
const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
|
|
8144
8148
|
if (_$1.isInstance(t) || B$3.isInstance(t))
|
|
8145
|
-
return
|
|
8149
|
+
return Ot(V$1, t, n, s);
|
|
8146
8150
|
if (v$2.isInstance(t)) {
|
|
8147
8151
|
const i = T(t.contour, n, r), o = t.holes.map((c) => T(c, n, r));
|
|
8148
8152
|
return new v$2(i, o, { ignoreChecks: !0 });
|
|
@@ -8153,7 +8157,7 @@ function T(t, n, e) {
|
|
|
8153
8157
|
}
|
|
8154
8158
|
throw new Error("invalid shape to chamfer");
|
|
8155
8159
|
}
|
|
8156
|
-
class
|
|
8160
|
+
class Cn extends C {
|
|
8157
8161
|
constructor(n) {
|
|
8158
8162
|
super(), this.shape = n;
|
|
8159
8163
|
}
|
|
@@ -8164,10 +8168,10 @@ class yn extends C {
|
|
|
8164
8168
|
return T(this.shape, n, this.clone());
|
|
8165
8169
|
}
|
|
8166
8170
|
}
|
|
8167
|
-
function
|
|
8168
|
-
return new
|
|
8171
|
+
function jn(t) {
|
|
8172
|
+
return new Cn(t);
|
|
8169
8173
|
}
|
|
8170
|
-
const
|
|
8174
|
+
const Dn = 1 * fe$1, On = 24;
|
|
8171
8175
|
function H(t, n, e, r) {
|
|
8172
8176
|
const s = t.gradientAt(n);
|
|
8173
8177
|
return pn$1(s) <= r ? e : H$1(s);
|
|
@@ -8184,17 +8188,17 @@ function Q(t, n, e, r, s, i) {
|
|
|
8184
8188
|
}
|
|
8185
8189
|
function rt(t, n = {}) {
|
|
8186
8190
|
const e = {
|
|
8187
|
-
maxAngle: n.maxAngle ??
|
|
8188
|
-
maxDepth: n.maxDepth ??
|
|
8191
|
+
maxAngle: n.maxAngle ?? Dn,
|
|
8192
|
+
maxDepth: n.maxDepth ?? On
|
|
8189
8193
|
}, r = Math.cos(e.maxAngle);
|
|
8190
8194
|
return Q(t, 0, 1, e, r, 0);
|
|
8191
8195
|
}
|
|
8192
|
-
function
|
|
8196
|
+
function Bn(t, n) {
|
|
8193
8197
|
return new O$2(
|
|
8194
|
-
t.figures.map((e) =>
|
|
8198
|
+
t.figures.map((e) => Bt(e, n))
|
|
8195
8199
|
);
|
|
8196
8200
|
}
|
|
8197
|
-
function
|
|
8201
|
+
function Bt(t, n) {
|
|
8198
8202
|
return new v$2(
|
|
8199
8203
|
Y(t.contour, n),
|
|
8200
8204
|
t.holes.map((e) => Y(e, n))
|
|
@@ -8203,34 +8207,34 @@ function Rt(t, n) {
|
|
|
8203
8207
|
function Y(t, n) {
|
|
8204
8208
|
return new _$1(st(t.segments, n));
|
|
8205
8209
|
}
|
|
8206
|
-
function
|
|
8210
|
+
function Rn(t, n) {
|
|
8207
8211
|
return new B$3(st(t.segments, n));
|
|
8208
8212
|
}
|
|
8209
8213
|
function st(t, n) {
|
|
8210
8214
|
return t.flatMap(n);
|
|
8211
8215
|
}
|
|
8212
|
-
function
|
|
8216
|
+
function Tn(t, n) {
|
|
8213
8217
|
if (O$2.isInstance(t))
|
|
8214
|
-
return
|
|
8218
|
+
return Bn(t, n);
|
|
8215
8219
|
if (v$2.isInstance(t))
|
|
8216
|
-
return
|
|
8220
|
+
return Bt(t, n);
|
|
8217
8221
|
if (_$1.isInstance(t))
|
|
8218
8222
|
return Y(t, n);
|
|
8219
8223
|
if (B$3.isInstance(t))
|
|
8220
|
-
return
|
|
8224
|
+
return Rn(t, n);
|
|
8221
8225
|
if (Gn$1(t))
|
|
8222
8226
|
return st([t], n);
|
|
8223
8227
|
throw new Error("Unsupported shape type");
|
|
8224
8228
|
}
|
|
8225
|
-
function
|
|
8229
|
+
function zn(t) {
|
|
8226
8230
|
if (t.length < 2) return [];
|
|
8227
8231
|
const n = [];
|
|
8228
8232
|
for (let e = 0; e < t.length - 1; e += 1)
|
|
8229
8233
|
n.push(new at$4(t[e], t[e + 1]));
|
|
8230
8234
|
return n;
|
|
8231
8235
|
}
|
|
8232
|
-
function
|
|
8233
|
-
return
|
|
8236
|
+
function Gn(t, n) {
|
|
8237
|
+
return zn(rt(t, n));
|
|
8234
8238
|
}
|
|
8235
8239
|
function B(t, n) {
|
|
8236
8240
|
const e = [];
|
|
@@ -8245,21 +8249,21 @@ function B(t, n) {
|
|
|
8245
8249
|
}
|
|
8246
8250
|
}), e.length > 1 && Y$3(e[0], e[e.length - 1]) && e.pop(), e;
|
|
8247
8251
|
}
|
|
8248
|
-
function
|
|
8252
|
+
function _n(t) {
|
|
8249
8253
|
return t.length < 3 ? !1 : t.map((e, r) => {
|
|
8250
8254
|
const s = t[(r + 1) % t.length];
|
|
8251
8255
|
return (s[0] - e[0]) * (s[1] + e[1]);
|
|
8252
8256
|
}).reduce((e, r) => e + r, 0) > 0;
|
|
8253
8257
|
}
|
|
8254
8258
|
function K(t, n) {
|
|
8255
|
-
return t.length < 3 ||
|
|
8259
|
+
return t.length < 3 || _n(t) === n ? t : [...t].reverse();
|
|
8256
8260
|
}
|
|
8257
|
-
function
|
|
8258
|
-
return
|
|
8261
|
+
function te(t, n = {}) {
|
|
8262
|
+
return Tn(t, (r) => Gn(r, n));
|
|
8259
8263
|
}
|
|
8260
|
-
function
|
|
8264
|
+
function $n(t, n = {}) {
|
|
8261
8265
|
if (O$2.isInstance(t))
|
|
8262
|
-
return t.figures.flatMap((e) =>
|
|
8266
|
+
return t.figures.flatMap((e) => $n(e, n));
|
|
8263
8267
|
if (v$2.isInstance(t)) {
|
|
8264
8268
|
const e = K(
|
|
8265
8269
|
B(t.contour.segments, n),
|
|
@@ -8291,7 +8295,7 @@ const dt = (t) => "shape" in t ? t.shape : t, mt = (t, n) => {
|
|
|
8291
8295
|
const { color: e } = t;
|
|
8292
8296
|
return e ? `<g stroke="${e}">${n}</g>` : n;
|
|
8293
8297
|
}, Pt = (t) => new mt$1(t.xMin, -t.yMax, t.xMax, -t.yMin);
|
|
8294
|
-
function
|
|
8298
|
+
function ne(t, {
|
|
8295
8299
|
margin: n = 1,
|
|
8296
8300
|
unit: e = null,
|
|
8297
8301
|
viewBox: r
|
|
@@ -8309,7 +8313,7 @@ function te(t, {
|
|
|
8309
8313
|
e
|
|
8310
8314
|
);
|
|
8311
8315
|
}
|
|
8312
|
-
const
|
|
8316
|
+
const Rt = (t) => {
|
|
8313
8317
|
if (t.type === "LINE")
|
|
8314
8318
|
return new at$4(t.firstPoint, t.lastPoint);
|
|
8315
8319
|
if (t.type === "ARC")
|
|
@@ -8337,7 +8341,7 @@ const Tt = (t) => {
|
|
|
8337
8341
|
t.controlPoint
|
|
8338
8342
|
);
|
|
8339
8343
|
if (t.type === "CUBIC_BEZIER")
|
|
8340
|
-
return new Et$
|
|
8344
|
+
return new Et$2(
|
|
8341
8345
|
t.firstPoint,
|
|
8342
8346
|
t.lastPoint,
|
|
8343
8347
|
t.firstControlPoint,
|
|
@@ -8345,33 +8349,33 @@ const Tt = (t) => {
|
|
|
8345
8349
|
);
|
|
8346
8350
|
throw new Error("Unknown segment type");
|
|
8347
8351
|
}, Z = (t) => {
|
|
8348
|
-
const n = t.segments.map(
|
|
8352
|
+
const n = t.segments.map(Rt);
|
|
8349
8353
|
return new _$1(n);
|
|
8350
|
-
},
|
|
8354
|
+
}, Tt = (t) => {
|
|
8351
8355
|
const n = Z(t.contour), e = t.holes.map(Z);
|
|
8352
8356
|
return new v$2(n, e);
|
|
8353
|
-
},
|
|
8354
|
-
const n = t.figures.map(
|
|
8357
|
+
}, Un = (t) => {
|
|
8358
|
+
const n = t.figures.map(Tt);
|
|
8355
8359
|
return new O$2(n);
|
|
8356
8360
|
};
|
|
8357
|
-
function
|
|
8361
|
+
function ee(t) {
|
|
8358
8362
|
if (t.type === "DIAGRAM")
|
|
8359
|
-
return
|
|
8363
|
+
return Un(t);
|
|
8360
8364
|
if (t.type === "FIGURE")
|
|
8361
|
-
return
|
|
8365
|
+
return Tt(t);
|
|
8362
8366
|
if (t.type === "LOOP")
|
|
8363
8367
|
return Z(t);
|
|
8364
8368
|
if (t.type === "LINE" || t.type === "ARC" || t.type === "ELLIPSE_ARC" || t.type === "CUBIC_BEZIER")
|
|
8365
|
-
return
|
|
8369
|
+
return Rt(t);
|
|
8366
8370
|
throw new Error("Unknown shape type");
|
|
8367
8371
|
}
|
|
8368
|
-
const wt = Math.PI / 180,
|
|
8369
|
-
function
|
|
8372
|
+
const wt = Math.PI / 180, Vn = 180 / Math.PI;
|
|
8373
|
+
function re(t, n) {
|
|
8370
8374
|
const e = Math.cos(n * wt) * t, r = Math.sin(n * wt) * t;
|
|
8371
8375
|
return [e, r];
|
|
8372
8376
|
}
|
|
8373
|
-
function
|
|
8374
|
-
const e = Math.sqrt(t * t + n * n), r = Math.atan2(n, t) *
|
|
8377
|
+
function se([t, n]) {
|
|
8378
|
+
const e = Math.sqrt(t * t + n * n), r = Math.atan2(n, t) * Vn;
|
|
8375
8379
|
return [e, r];
|
|
8376
8380
|
}
|
|
8377
8381
|
|
|
@@ -8379,27 +8383,27 @@ var pantograph = /*#__PURE__*/Object.freeze({
|
|
|
8379
8383
|
__proto__: null,
|
|
8380
8384
|
DEG2RAD: wt,
|
|
8381
8385
|
DrawingPen: at$2,
|
|
8382
|
-
RAD2DEG:
|
|
8383
|
-
cartesianToPolar:
|
|
8386
|
+
RAD2DEG: Vn,
|
|
8387
|
+
cartesianToPolar: se,
|
|
8384
8388
|
chamfer: T,
|
|
8385
|
-
confineStrand:
|
|
8386
|
-
cut:
|
|
8389
|
+
confineStrand: Yn,
|
|
8390
|
+
cut: kt,
|
|
8387
8391
|
draw: ut$1,
|
|
8388
|
-
eraseStrand:
|
|
8389
|
-
exportJSON: Et,
|
|
8390
|
-
exportSVG:
|
|
8392
|
+
eraseStrand: Qn,
|
|
8393
|
+
exportJSON: Et$1,
|
|
8394
|
+
exportSVG: ne,
|
|
8391
8395
|
fillet: R,
|
|
8392
|
-
fuse:
|
|
8396
|
+
fuse: pn,
|
|
8393
8397
|
fuseAll: z,
|
|
8394
|
-
importJSON:
|
|
8395
|
-
intersect:
|
|
8396
|
-
offset:
|
|
8397
|
-
outlineStroke:
|
|
8398
|
-
polarToCartesian:
|
|
8399
|
-
selectCorners:
|
|
8398
|
+
importJSON: ee,
|
|
8399
|
+
intersect: Jn,
|
|
8400
|
+
offset: Zn,
|
|
8401
|
+
outlineStroke: Wn,
|
|
8402
|
+
polarToCartesian: re,
|
|
8403
|
+
selectCorners: jn,
|
|
8400
8404
|
svgBody: pt,
|
|
8401
|
-
tesselate:
|
|
8402
|
-
tesselatePoints:
|
|
8405
|
+
tesselate: te,
|
|
8406
|
+
tesselatePoints: $n
|
|
8403
8407
|
});
|
|
8404
8408
|
|
|
8405
8409
|
function sketchSegment(segment, plane) {
|
|
@@ -8422,7 +8426,7 @@ function sketchSegment(segment, plane) {
|
|
|
8422
8426
|
plane.toWorldCoords(segment.lastPoint),
|
|
8423
8427
|
]);
|
|
8424
8428
|
}
|
|
8425
|
-
if (segment instanceof Et$
|
|
8429
|
+
if (segment instanceof Et$2) {
|
|
8426
8430
|
return makeBezierCurve([
|
|
8427
8431
|
plane.toWorldCoords(segment.firstPoint),
|
|
8428
8432
|
plane.toWorldCoords(segment.firstControlPoint),
|
|
@@ -8476,7 +8480,7 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
8476
8480
|
pantographObject instanceof ct$3 ||
|
|
8477
8481
|
pantographObject instanceof jt$1 ||
|
|
8478
8482
|
pantographObject instanceof _t$1 ||
|
|
8479
|
-
pantographObject instanceof Et$
|
|
8483
|
+
pantographObject instanceof Et$2) {
|
|
8480
8484
|
return sketchFromSegments([sketchSegment(pantographObject, plane)], plane);
|
|
8481
8485
|
}
|
|
8482
8486
|
throw new Error(`Unsupported object type "${pantographObject.constructor.name}"`);
|
|
@@ -8533,13 +8537,13 @@ class Drawing {
|
|
|
8533
8537
|
return new Drawing(this.diagram.clone());
|
|
8534
8538
|
}
|
|
8535
8539
|
serialize() {
|
|
8536
|
-
return JSON.stringify(Et(this.diagram));
|
|
8540
|
+
return JSON.stringify(Et$1(this.diagram));
|
|
8537
8541
|
}
|
|
8538
8542
|
get boundingBox() {
|
|
8539
8543
|
return this.diagram.boundingBox;
|
|
8540
8544
|
}
|
|
8541
8545
|
get repr() {
|
|
8542
|
-
return JSON.stringify(Et(this.diagram));
|
|
8546
|
+
return JSON.stringify(Et$1(this.diagram));
|
|
8543
8547
|
}
|
|
8544
8548
|
rotate(angle, center) {
|
|
8545
8549
|
return new Drawing(this.diagram.rotate(angle, center));
|
|
@@ -8565,17 +8569,17 @@ class Drawing {
|
|
|
8565
8569
|
cut(other) {
|
|
8566
8570
|
const base = this.diagram;
|
|
8567
8571
|
const tool = other.diagram;
|
|
8568
|
-
return new Drawing(
|
|
8572
|
+
return new Drawing(kt(base, tool));
|
|
8569
8573
|
}
|
|
8570
8574
|
fuse(other) {
|
|
8571
8575
|
const base = this.diagram;
|
|
8572
8576
|
const tool = other.diagram;
|
|
8573
|
-
return new Drawing(
|
|
8577
|
+
return new Drawing(pn(base, tool));
|
|
8574
8578
|
}
|
|
8575
8579
|
intersect(other) {
|
|
8576
8580
|
const base = this.diagram;
|
|
8577
8581
|
const tool = other.diagram;
|
|
8578
|
-
return new Drawing(
|
|
8582
|
+
return new Drawing(Jn(base, tool));
|
|
8579
8583
|
}
|
|
8580
8584
|
fillet(radius, filter) {
|
|
8581
8585
|
return new Drawing(R(this.diagram, radius, filter));
|
|
@@ -8590,7 +8594,7 @@ class Drawing {
|
|
|
8590
8594
|
return sketchOnPlane(this.diagram, inputPlane, origin);
|
|
8591
8595
|
}
|
|
8592
8596
|
toSVG(margin) {
|
|
8593
|
-
return
|
|
8597
|
+
return ne(this.diagram, { margin });
|
|
8594
8598
|
}
|
|
8595
8599
|
toSVGViewBox(margin = 1) {
|
|
8596
8600
|
return v(this.diagram.boundingBox, margin);
|
|
@@ -8599,7 +8603,7 @@ class Drawing {
|
|
|
8599
8603
|
return svgPathsForShape(this.diagram);
|
|
8600
8604
|
}
|
|
8601
8605
|
offset(distance) {
|
|
8602
|
-
return new Drawing(
|
|
8606
|
+
return new Drawing(Zn(this.diagram, distance));
|
|
8603
8607
|
}
|
|
8604
8608
|
}
|
|
8605
8609
|
class ReDrawingPen extends at$2 {
|