replicad-pantograph 0.11.1 → 0.11.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.
|
@@ -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);
|
|
@@ -6514,16 +6514,16 @@ function Q$1(t, n) {
|
|
|
6514
6514
|
function lt$2(t, n) {
|
|
6515
6515
|
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
6516
|
}
|
|
6517
|
-
const zt
|
|
6517
|
+
const zt = Symbol.for("pantograph:Diagram");
|
|
6518
6518
|
let O$2 = class O extends ns {
|
|
6519
6519
|
constructor(e = [], { ignoreChecks: s = !1 } = {}) {
|
|
6520
6520
|
super();
|
|
6521
6521
|
b(this, "figures");
|
|
6522
6522
|
b(this, "_boundingBox", null);
|
|
6523
|
-
Object.defineProperty(this, zt
|
|
6523
|
+
Object.defineProperty(this, zt, { value: !0 }), s || me(e), this.figures = e;
|
|
6524
6524
|
}
|
|
6525
6525
|
static isInstance(e) {
|
|
6526
|
-
return !!e && e[zt
|
|
6526
|
+
return !!e && e[zt] === !0;
|
|
6527
6527
|
}
|
|
6528
6528
|
get isEmpty() {
|
|
6529
6529
|
return this.figures.length === 0;
|
|
@@ -6600,7 +6600,7 @@ function _(e, t) {
|
|
|
6600
6600
|
return rt$2(e, t);
|
|
6601
6601
|
if (ct$3.isInstance(e))
|
|
6602
6602
|
return it(e, t);
|
|
6603
|
-
if (_t$1.isInstance(e) || Et$
|
|
6603
|
+
if (_t$1.isInstance(e) || Et$2.isInstance(e))
|
|
6604
6604
|
return st$1(e, t);
|
|
6605
6605
|
throw new Error("Not implemented");
|
|
6606
6606
|
}
|
|
@@ -6685,7 +6685,7 @@ function st$1(e, t) {
|
|
|
6685
6685
|
c,
|
|
6686
6686
|
e.precision
|
|
6687
6687
|
);
|
|
6688
|
-
return new Et$
|
|
6688
|
+
return new Et$2(
|
|
6689
6689
|
a,
|
|
6690
6690
|
c,
|
|
6691
6691
|
g,
|
|
@@ -6913,7 +6913,7 @@ let at$2 = class at {
|
|
|
6913
6913
|
}
|
|
6914
6914
|
cubicBezierCurveTo(t, n, r) {
|
|
6915
6915
|
return this.saveSegment(
|
|
6916
|
-
new Et$
|
|
6916
|
+
new Et$2(this.pointer, t, n, r)
|
|
6917
6917
|
), this.pointer = t, this;
|
|
6918
6918
|
}
|
|
6919
6919
|
quadraticBezierCurveTo(t, n) {
|
|
@@ -7384,7 +7384,7 @@ function r(t) {
|
|
|
7384
7384
|
o(t.controlPoint),
|
|
7385
7385
|
o(t.lastPoint)
|
|
7386
7386
|
].join(" ")}`;
|
|
7387
|
-
if (Et$
|
|
7387
|
+
if (Et$2.isInstance(t))
|
|
7388
7388
|
return `C ${[
|
|
7389
7389
|
o(t.firstControlPoint),
|
|
7390
7390
|
o(t.lastControlPoint),
|
|
@@ -7421,9 +7421,9 @@ function A(t, n, i = 1, s) {
|
|
|
7421
7421
|
</svg>`;
|
|
7422
7422
|
}
|
|
7423
7423
|
|
|
7424
|
-
var
|
|
7425
|
-
var
|
|
7426
|
-
var I = (t, n, e) =>
|
|
7424
|
+
var $t = Object.defineProperty;
|
|
7425
|
+
var Ut = (t, n, e) => n in t ? $t(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
7426
|
+
var I = (t, n, e) => Ut(t, typeof n != "symbol" ? n + "" : n, e);
|
|
7427
7427
|
function x(t) {
|
|
7428
7428
|
if (v$2.isInstance(t))
|
|
7429
7429
|
return [t];
|
|
@@ -7433,7 +7433,7 @@ function x(t) {
|
|
|
7433
7433
|
return t.figures;
|
|
7434
7434
|
throw new Error("Unknown shape");
|
|
7435
7435
|
}
|
|
7436
|
-
function
|
|
7436
|
+
function Et(t, n, e = 1e-9) {
|
|
7437
7437
|
let r = [];
|
|
7438
7438
|
const s = [], i = new Array(n.segments.length).fill(0).map(() => []);
|
|
7439
7439
|
n.segments.forEach((c, f) => {
|
|
@@ -7461,13 +7461,13 @@ function kt(t, n, e = 1e-9) {
|
|
|
7461
7461
|
);
|
|
7462
7462
|
}
|
|
7463
7463
|
function tt(t, n, e = !1) {
|
|
7464
|
-
return
|
|
7464
|
+
return Et(n, t).filter((s) => {
|
|
7465
7465
|
const i = s.segments[0].midPoint;
|
|
7466
7466
|
return n.onStroke(i) ? !e : !n.contains(i);
|
|
7467
7467
|
});
|
|
7468
7468
|
}
|
|
7469
7469
|
function nt(t, n, e = !1) {
|
|
7470
|
-
return
|
|
7470
|
+
return Et(n, t).filter((s) => {
|
|
7471
7471
|
const i = s.segments[0].midPoint;
|
|
7472
7472
|
return n.onStroke(i) ? !e : n.contains(i);
|
|
7473
7473
|
});
|
|
@@ -7494,28 +7494,28 @@ function at(t, n, e = !1) {
|
|
|
7494
7494
|
);
|
|
7495
7495
|
}), r;
|
|
7496
7496
|
}
|
|
7497
|
-
function
|
|
7497
|
+
function pn(t, n) {
|
|
7498
7498
|
return new O$2(
|
|
7499
7499
|
G$1(x(t), x(n))
|
|
7500
7500
|
);
|
|
7501
7501
|
}
|
|
7502
7502
|
function z(t) {
|
|
7503
7503
|
return t.reduce(
|
|
7504
|
-
(n, e) =>
|
|
7504
|
+
(n, e) => pn(n, e),
|
|
7505
7505
|
new O$2()
|
|
7506
7506
|
);
|
|
7507
7507
|
}
|
|
7508
|
-
function
|
|
7508
|
+
function kt(t, n) {
|
|
7509
7509
|
return new O$2(
|
|
7510
7510
|
Q$1(x(t), x(n))
|
|
7511
7511
|
);
|
|
7512
7512
|
}
|
|
7513
|
-
function
|
|
7513
|
+
function Jn(t, n) {
|
|
7514
7514
|
return new O$2(
|
|
7515
7515
|
lt$2(x(t), x(n))
|
|
7516
7516
|
);
|
|
7517
7517
|
}
|
|
7518
|
-
function
|
|
7518
|
+
function Qn(t, n, e = !0) {
|
|
7519
7519
|
if (_$1.isInstance(n))
|
|
7520
7520
|
return tt(t, n, e);
|
|
7521
7521
|
if (v$2.isInstance(n))
|
|
@@ -7525,7 +7525,7 @@ function Jn(t, n, e = !0) {
|
|
|
7525
7525
|
r = r.flatMap((i) => ct(i, s, e));
|
|
7526
7526
|
}), r;
|
|
7527
7527
|
}
|
|
7528
|
-
function
|
|
7528
|
+
function Yn(t, n, e = !1) {
|
|
7529
7529
|
if (_$1.isInstance(n))
|
|
7530
7530
|
return nt(t, n, e);
|
|
7531
7531
|
if (v$2.isInstance(n))
|
|
@@ -7545,7 +7545,7 @@ const ut = (t, n, e) => {
|
|
|
7545
7545
|
return t.distanceFrom(n.lastPoint);
|
|
7546
7546
|
throw new Error("Invalid position");
|
|
7547
7547
|
};
|
|
7548
|
-
function
|
|
7548
|
+
function dn(t, n) {
|
|
7549
7549
|
const e = me$1(t, n);
|
|
7550
7550
|
if (e === "parallel")
|
|
7551
7551
|
return Math.min(
|
|
@@ -7595,16 +7595,16 @@ function lt(t, n) {
|
|
|
7595
7595
|
t.distanceFrom(n.lastPoint)
|
|
7596
7596
|
);
|
|
7597
7597
|
}
|
|
7598
|
-
const
|
|
7598
|
+
const mn = (t, n) => {
|
|
7599
7599
|
const e = t.angleToParam(n.firstAngle);
|
|
7600
7600
|
if (t.isValidParameter(e)) return !0;
|
|
7601
7601
|
const r = t.angleToParam(n.lastAngle);
|
|
7602
7602
|
return !!t.isValidParameter(r);
|
|
7603
7603
|
};
|
|
7604
|
-
function
|
|
7604
|
+
function Pn(t, n) {
|
|
7605
7605
|
if (jt(t, n, !0).length > 0) return 0;
|
|
7606
7606
|
const e = J$3(t.center, n.center);
|
|
7607
|
-
if (e < t.precision &&
|
|
7607
|
+
if (e < t.precision && mn(t, n))
|
|
7608
7608
|
return Math.abs(t.radius - n.radius);
|
|
7609
7609
|
const r = H$1(Q$2(n.center, t.center)), s = e - Math.abs(t.radius - n.radius) < t.precision;
|
|
7610
7610
|
let i = Ke(r);
|
|
@@ -7617,7 +7617,7 @@ function mn(t, n) {
|
|
|
7617
7617
|
n.distanceFrom(t.lastPoint)
|
|
7618
7618
|
);
|
|
7619
7619
|
}
|
|
7620
|
-
function
|
|
7620
|
+
function wn(t, n, e) {
|
|
7621
7621
|
let r = 0, s = t.length - 1;
|
|
7622
7622
|
for (; r <= s; ) {
|
|
7623
7623
|
const i = Math.floor((r + s) / 2), o = e(t[i], n);
|
|
@@ -7630,18 +7630,18 @@ function Pn(t, n, e) {
|
|
|
7630
7630
|
}
|
|
7631
7631
|
return -(r + 1);
|
|
7632
7632
|
}
|
|
7633
|
-
function
|
|
7634
|
-
const r =
|
|
7633
|
+
function In(t, n, e) {
|
|
7634
|
+
const r = wn(t, n, e);
|
|
7635
7635
|
r < 0 ? t.splice(-(r + 1), 0, n) : t.splice(r, 0, n);
|
|
7636
7636
|
}
|
|
7637
|
-
class
|
|
7637
|
+
class Mn {
|
|
7638
7638
|
constructor() {
|
|
7639
7639
|
I(this, "buckets");
|
|
7640
7640
|
this.buckets = [];
|
|
7641
7641
|
}
|
|
7642
7642
|
addInterval(n) {
|
|
7643
7643
|
const e = this.buckets[n.rectangle.diagonalBucketIndex];
|
|
7644
|
-
e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] :
|
|
7644
|
+
e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] : In(e, n, (r, s) => r.value - s.value);
|
|
7645
7645
|
}
|
|
7646
7646
|
removeInterval(n) {
|
|
7647
7647
|
const e = this.buckets[n.rectangle.diagonalBucketIndex];
|
|
@@ -7675,7 +7675,7 @@ class In {
|
|
|
7675
7675
|
return n;
|
|
7676
7676
|
}
|
|
7677
7677
|
}
|
|
7678
|
-
class
|
|
7678
|
+
class Sn {
|
|
7679
7679
|
constructor(n, e) {
|
|
7680
7680
|
I(this, "diagonal");
|
|
7681
7681
|
I(this, "diagonalBucketIndex");
|
|
@@ -7687,14 +7687,14 @@ class Mn {
|
|
|
7687
7687
|
), this.diagonalBucketIndex = n + e, this.index = `${n},${e}`;
|
|
7688
7688
|
}
|
|
7689
7689
|
}
|
|
7690
|
-
class
|
|
7690
|
+
class An {
|
|
7691
7691
|
constructor(n, e = 1e-8, r = 1e3, s = 1e-6) {
|
|
7692
7692
|
I(this, "rectangles");
|
|
7693
7693
|
I(this, "buckets");
|
|
7694
7694
|
I(this, "fMin");
|
|
7695
7695
|
I(this, "argMin");
|
|
7696
7696
|
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
|
|
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 Mn();
|
|
7698
7698
|
const i = [0.5, 0.5], o = this.rect(0, 0), c = this.fcn(i);
|
|
7699
7699
|
this.buckets.addInterval(new O(i, c, o)), this.fMin = c, this.argMin = i, this.tol = o.diagonal;
|
|
7700
7700
|
}
|
|
@@ -7703,7 +7703,7 @@ class Sn {
|
|
|
7703
7703
|
}
|
|
7704
7704
|
rect(n, e) {
|
|
7705
7705
|
const r = `${n},${e}`;
|
|
7706
|
-
return this.rectangles.has(r) || this.rectangles.set(r, new
|
|
7706
|
+
return this.rectangles.has(r) || this.rectangles.set(r, new Sn(n, e)), this.rectangles.get(r);
|
|
7707
7707
|
}
|
|
7708
7708
|
splitInterval(n) {
|
|
7709
7709
|
let e, r, s;
|
|
@@ -7748,26 +7748,26 @@ class O {
|
|
|
7748
7748
|
this.center = n, this.value = e, this.rectangle = r;
|
|
7749
7749
|
}
|
|
7750
7750
|
}
|
|
7751
|
-
function
|
|
7752
|
-
return new
|
|
7751
|
+
function vn(t, n = 1e-8, e = 1e3, r = 1e-6) {
|
|
7752
|
+
return new An(
|
|
7753
7753
|
t,
|
|
7754
7754
|
n,
|
|
7755
7755
|
e,
|
|
7756
7756
|
r
|
|
7757
7757
|
).run();
|
|
7758
7758
|
}
|
|
7759
|
-
function
|
|
7760
|
-
const r =
|
|
7759
|
+
function bn(t, n, e = 1e-9) {
|
|
7760
|
+
const r = vn((s) => {
|
|
7761
7761
|
const i = t.paramPoint(s[0]), o = n.paramPoint(s[1]);
|
|
7762
7762
|
return Rt$1(i, o);
|
|
7763
7763
|
}, e);
|
|
7764
7764
|
return Math.sqrt(r.fMin);
|
|
7765
7765
|
}
|
|
7766
|
-
function
|
|
7767
|
-
return at$4.isInstance(t) && at$4.isInstance(n) ?
|
|
7766
|
+
function Ln(t, n) {
|
|
7767
|
+
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
7768
|
}
|
|
7769
|
-
function
|
|
7770
|
-
if (Et$
|
|
7769
|
+
function Ft(t) {
|
|
7770
|
+
if (Et$2.isInstance(t)) {
|
|
7771
7771
|
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
7772
|
if (c > 0 && f < 0 || c < 0 && f > 0) return !1;
|
|
7773
7773
|
}
|
|
@@ -7776,7 +7776,7 @@ function xt(t) {
|
|
|
7776
7776
|
return Math.abs(Math.acos(r)) < Math.PI / 3;
|
|
7777
7777
|
}
|
|
7778
7778
|
function X(t) {
|
|
7779
|
-
if (
|
|
7779
|
+
if (Ft(t)) return [t];
|
|
7780
7780
|
const [n, e] = t.splitAtParameters([0.5]);
|
|
7781
7781
|
return [
|
|
7782
7782
|
...X(n),
|
|
@@ -7784,9 +7784,9 @@ function X(t) {
|
|
|
7784
7784
|
];
|
|
7785
7785
|
}
|
|
7786
7786
|
function ht(t) {
|
|
7787
|
-
return
|
|
7787
|
+
return Ft(t) ? [t] : t.splitAtParameters(t.getParametersOfExtrema()).flatMap(X);
|
|
7788
7788
|
}
|
|
7789
|
-
function
|
|
7789
|
+
function En(t) {
|
|
7790
7790
|
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
7791
|
{ length: e + 1 },
|
|
7792
7792
|
(f, a) => t.firstAngle + a * r * i
|
|
@@ -7795,19 +7795,19 @@ function Ln(t) {
|
|
|
7795
7795
|
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
7796
|
t.tiltAngle,
|
|
7797
7797
|
t.center
|
|
7798
|
-
), k = (
|
|
7798
|
+
), k = (_t) => L.transform(_t), D = k([l + S * u, M + w * g]), $ = k([
|
|
7799
7799
|
l + S * (u - s * g * i),
|
|
7800
7800
|
M + w * (g + s * u * i)
|
|
7801
|
-
]),
|
|
7801
|
+
]), zt = k([
|
|
7802
7802
|
l + S * (p + s * d * i),
|
|
7803
7803
|
M + w * (d - s * p * i)
|
|
7804
|
-
]),
|
|
7805
|
-
return new Et$
|
|
7804
|
+
]), Gt = k([l + S * p, M + w * d]);
|
|
7805
|
+
return new Et$2(D, Gt, $, zt);
|
|
7806
7806
|
});
|
|
7807
7807
|
}
|
|
7808
|
-
const et = 1e-8,
|
|
7808
|
+
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
7809
|
(e) => ht(e)
|
|
7810
|
-
) : _t$1.isInstance(n) || Et$
|
|
7810
|
+
) : _t$1.isInstance(n) || Et$2.isInstance(n) ? ht(n) : [new at$4(n.firstPoint, n.lastPoint)]);
|
|
7811
7811
|
function J(t, n, e = !0) {
|
|
7812
7812
|
const r = t.map((a) => ({
|
|
7813
7813
|
offset: _(a, n),
|
|
@@ -7873,7 +7873,7 @@ function J(t, n, e = !0) {
|
|
|
7873
7873
|
}
|
|
7874
7874
|
return o && c(o), s;
|
|
7875
7875
|
}
|
|
7876
|
-
function
|
|
7876
|
+
function yt(t) {
|
|
7877
7877
|
const n = /* @__PURE__ */ new Map(), e = (r, s) => {
|
|
7878
7878
|
const i = n.get(r) || [];
|
|
7879
7879
|
n.set(r, [...i, ...s]);
|
|
@@ -7891,34 +7891,34 @@ function Ct(t) {
|
|
|
7891
7891
|
});
|
|
7892
7892
|
}), n;
|
|
7893
7893
|
}
|
|
7894
|
-
function
|
|
7894
|
+
function Ct(t, n) {
|
|
7895
7895
|
return n.flatMap((e, r) => {
|
|
7896
7896
|
if (!t.has(r)) return e;
|
|
7897
7897
|
const s = t.get(r);
|
|
7898
7898
|
return s ? e.splitAt(s) : e;
|
|
7899
7899
|
});
|
|
7900
7900
|
}
|
|
7901
|
-
function
|
|
7902
|
-
return t.filter((r) => !n.segments.some((i) =>
|
|
7901
|
+
function Dt(t, n, e) {
|
|
7902
|
+
return t.filter((r) => !n.segments.some((i) => Ln(i, r) < Math.abs(e) - et));
|
|
7903
7903
|
}
|
|
7904
7904
|
function G(t, n) {
|
|
7905
|
-
const e = t.clockwise ? n : -n, r =
|
|
7905
|
+
const e = t.clockwise ? n : -n, r = xt(t.segments), s = J(r, e);
|
|
7906
7906
|
if (s.length < 2) return new O$2();
|
|
7907
|
-
const i =
|
|
7907
|
+
const i = yt(s);
|
|
7908
7908
|
if (!i.size) {
|
|
7909
7909
|
const u = new _$1(s);
|
|
7910
7910
|
return new O$2([new v$2(u)]);
|
|
7911
7911
|
}
|
|
7912
|
-
const o =
|
|
7912
|
+
const o = Ct(
|
|
7913
7913
|
i,
|
|
7914
7914
|
s
|
|
7915
|
-
), c =
|
|
7915
|
+
), c = Dt(o, t, n);
|
|
7916
7916
|
if (!c.length) return new O$2();
|
|
7917
7917
|
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
7918
|
return a.length ? new O$2(a.map((u) => new v$2(u))) : new O$2();
|
|
7919
7919
|
}
|
|
7920
|
-
function
|
|
7921
|
-
const r = n / 2, s =
|
|
7920
|
+
function kn(t, n, e = "round") {
|
|
7921
|
+
const r = n / 2, s = xt(t.segments), i = J(s, r, !1), o = J(
|
|
7922
7922
|
s,
|
|
7923
7923
|
-r,
|
|
7924
7924
|
!1
|
|
@@ -7939,43 +7939,43 @@ function En(t, n, e = "round") {
|
|
|
7939
7939
|
o[o.length - 1],
|
|
7940
7940
|
i[0]
|
|
7941
7941
|
)
|
|
7942
|
-
], a =
|
|
7942
|
+
], a = yt(f);
|
|
7943
7943
|
if (!a.size) {
|
|
7944
7944
|
const l = new _$1(f);
|
|
7945
7945
|
return new O$2([new v$2(l)]);
|
|
7946
7946
|
}
|
|
7947
|
-
const u =
|
|
7947
|
+
const u = Ct(
|
|
7948
7948
|
a,
|
|
7949
7949
|
f
|
|
7950
|
-
), g =
|
|
7950
|
+
), g = Dt(u, t, r);
|
|
7951
7951
|
if (!g.length) return new O$2();
|
|
7952
7952
|
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
7953
|
return d.length ? new O$2(d.map((l) => new v$2(l))) : new O$2();
|
|
7954
7954
|
}
|
|
7955
|
-
function
|
|
7955
|
+
function Fn(t, n) {
|
|
7956
7956
|
const e = t.map((r) => {
|
|
7957
7957
|
const s = z(
|
|
7958
7958
|
r.holes.map((i) => G(i, n))
|
|
7959
7959
|
);
|
|
7960
|
-
return
|
|
7960
|
+
return kt(G(r.contour, n), s);
|
|
7961
7961
|
});
|
|
7962
7962
|
return z(e);
|
|
7963
7963
|
}
|
|
7964
|
-
function
|
|
7964
|
+
function xn(t, n) {
|
|
7965
7965
|
const e = Math.abs(n / 2), r = t.map(
|
|
7966
7966
|
(s) => z(
|
|
7967
|
-
s.allLoops.map((i) =>
|
|
7967
|
+
s.allLoops.map((i) => kt(G(i, e), G(i, -e)))
|
|
7968
7968
|
)
|
|
7969
7969
|
);
|
|
7970
7970
|
return z(r);
|
|
7971
7971
|
}
|
|
7972
|
-
function
|
|
7973
|
-
return
|
|
7972
|
+
function Zn(t, n) {
|
|
7973
|
+
return Fn(x(t), n);
|
|
7974
7974
|
}
|
|
7975
|
-
function
|
|
7976
|
-
return B$3.isInstance(t) ?
|
|
7975
|
+
function Wn(t, n, { endCap: e = "round" } = {}) {
|
|
7976
|
+
return B$3.isInstance(t) ? kn(t, n, e) : xn(x(t), n);
|
|
7977
7977
|
}
|
|
7978
|
-
class
|
|
7978
|
+
class yn {
|
|
7979
7979
|
constructor() {
|
|
7980
7980
|
I(this, "filters");
|
|
7981
7981
|
this.filters = [];
|
|
@@ -8016,7 +8016,7 @@ const V = 2 * Math.PI, gt = (t) => {
|
|
|
8016
8016
|
const n = t % V, e = n < 0 ? n + V : n;
|
|
8017
8017
|
return e < Math.PI ? e : e === Math.PI ? 0 : Math.abs(e - V);
|
|
8018
8018
|
};
|
|
8019
|
-
class C extends
|
|
8019
|
+
class C extends yn {
|
|
8020
8020
|
clone() {
|
|
8021
8021
|
const n = new C();
|
|
8022
8022
|
return n.filters = [...this.filters], n;
|
|
@@ -8108,7 +8108,7 @@ class C extends xn {
|
|
|
8108
8108
|
return this.shouldKeep.bind(this);
|
|
8109
8109
|
}
|
|
8110
8110
|
}
|
|
8111
|
-
function
|
|
8111
|
+
function Ot(t, n, e, r = () => !0) {
|
|
8112
8112
|
const s = [n.segments[0]], i = (c, f) => {
|
|
8113
8113
|
r({ firstCurve: c, secondCurve: f, point: c.lastPoint }) ? s.push(...t(c, f, e)) : s.push(c, f);
|
|
8114
8114
|
};
|
|
@@ -8128,7 +8128,7 @@ function Bt(t, n, e, r = () => !0) {
|
|
|
8128
8128
|
function R(t, n, e) {
|
|
8129
8129
|
const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
|
|
8130
8130
|
if (_$1.isInstance(t) || B$3.isInstance(t))
|
|
8131
|
-
return
|
|
8131
|
+
return Ot(I$1, t, n, s);
|
|
8132
8132
|
if (v$2.isInstance(t)) {
|
|
8133
8133
|
const i = R(t.contour, n, r), o = t.holes.map((c) => R(c, n, r));
|
|
8134
8134
|
return new v$2(i, o, { ignoreChecks: !0 });
|
|
@@ -8142,7 +8142,7 @@ function R(t, n, e) {
|
|
|
8142
8142
|
function T(t, n, e) {
|
|
8143
8143
|
const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
|
|
8144
8144
|
if (_$1.isInstance(t) || B$3.isInstance(t))
|
|
8145
|
-
return
|
|
8145
|
+
return Ot(V$1, t, n, s);
|
|
8146
8146
|
if (v$2.isInstance(t)) {
|
|
8147
8147
|
const i = T(t.contour, n, r), o = t.holes.map((c) => T(c, n, r));
|
|
8148
8148
|
return new v$2(i, o, { ignoreChecks: !0 });
|
|
@@ -8153,7 +8153,7 @@ function T(t, n, e) {
|
|
|
8153
8153
|
}
|
|
8154
8154
|
throw new Error("invalid shape to chamfer");
|
|
8155
8155
|
}
|
|
8156
|
-
class
|
|
8156
|
+
class Cn extends C {
|
|
8157
8157
|
constructor(n) {
|
|
8158
8158
|
super(), this.shape = n;
|
|
8159
8159
|
}
|
|
@@ -8164,10 +8164,10 @@ class yn extends C {
|
|
|
8164
8164
|
return T(this.shape, n, this.clone());
|
|
8165
8165
|
}
|
|
8166
8166
|
}
|
|
8167
|
-
function
|
|
8168
|
-
return new
|
|
8167
|
+
function jn(t) {
|
|
8168
|
+
return new Cn(t);
|
|
8169
8169
|
}
|
|
8170
|
-
const
|
|
8170
|
+
const Dn = 1 * fe$1, On = 24;
|
|
8171
8171
|
function H(t, n, e, r) {
|
|
8172
8172
|
const s = t.gradientAt(n);
|
|
8173
8173
|
return pn$1(s) <= r ? e : H$1(s);
|
|
@@ -8184,17 +8184,17 @@ function Q(t, n, e, r, s, i) {
|
|
|
8184
8184
|
}
|
|
8185
8185
|
function rt(t, n = {}) {
|
|
8186
8186
|
const e = {
|
|
8187
|
-
maxAngle: n.maxAngle ??
|
|
8188
|
-
maxDepth: n.maxDepth ??
|
|
8187
|
+
maxAngle: n.maxAngle ?? Dn,
|
|
8188
|
+
maxDepth: n.maxDepth ?? On
|
|
8189
8189
|
}, r = Math.cos(e.maxAngle);
|
|
8190
8190
|
return Q(t, 0, 1, e, r, 0);
|
|
8191
8191
|
}
|
|
8192
|
-
function
|
|
8192
|
+
function Bn(t, n) {
|
|
8193
8193
|
return new O$2(
|
|
8194
|
-
t.figures.map((e) =>
|
|
8194
|
+
t.figures.map((e) => Bt(e, n))
|
|
8195
8195
|
);
|
|
8196
8196
|
}
|
|
8197
|
-
function
|
|
8197
|
+
function Bt(t, n) {
|
|
8198
8198
|
return new v$2(
|
|
8199
8199
|
Y(t.contour, n),
|
|
8200
8200
|
t.holes.map((e) => Y(e, n))
|
|
@@ -8203,34 +8203,34 @@ function Rt(t, n) {
|
|
|
8203
8203
|
function Y(t, n) {
|
|
8204
8204
|
return new _$1(st(t.segments, n));
|
|
8205
8205
|
}
|
|
8206
|
-
function
|
|
8206
|
+
function Rn(t, n) {
|
|
8207
8207
|
return new B$3(st(t.segments, n));
|
|
8208
8208
|
}
|
|
8209
8209
|
function st(t, n) {
|
|
8210
8210
|
return t.flatMap(n);
|
|
8211
8211
|
}
|
|
8212
|
-
function
|
|
8212
|
+
function Tn(t, n) {
|
|
8213
8213
|
if (O$2.isInstance(t))
|
|
8214
|
-
return
|
|
8214
|
+
return Bn(t, n);
|
|
8215
8215
|
if (v$2.isInstance(t))
|
|
8216
|
-
return
|
|
8216
|
+
return Bt(t, n);
|
|
8217
8217
|
if (_$1.isInstance(t))
|
|
8218
8218
|
return Y(t, n);
|
|
8219
8219
|
if (B$3.isInstance(t))
|
|
8220
|
-
return
|
|
8220
|
+
return Rn(t, n);
|
|
8221
8221
|
if (Gn$1(t))
|
|
8222
8222
|
return st([t], n);
|
|
8223
8223
|
throw new Error("Unsupported shape type");
|
|
8224
8224
|
}
|
|
8225
|
-
function
|
|
8225
|
+
function zn(t) {
|
|
8226
8226
|
if (t.length < 2) return [];
|
|
8227
8227
|
const n = [];
|
|
8228
8228
|
for (let e = 0; e < t.length - 1; e += 1)
|
|
8229
8229
|
n.push(new at$4(t[e], t[e + 1]));
|
|
8230
8230
|
return n;
|
|
8231
8231
|
}
|
|
8232
|
-
function
|
|
8233
|
-
return
|
|
8232
|
+
function Gn(t, n) {
|
|
8233
|
+
return zn(rt(t, n));
|
|
8234
8234
|
}
|
|
8235
8235
|
function B(t, n) {
|
|
8236
8236
|
const e = [];
|
|
@@ -8245,21 +8245,21 @@ function B(t, n) {
|
|
|
8245
8245
|
}
|
|
8246
8246
|
}), e.length > 1 && Y$3(e[0], e[e.length - 1]) && e.pop(), e;
|
|
8247
8247
|
}
|
|
8248
|
-
function
|
|
8248
|
+
function _n(t) {
|
|
8249
8249
|
return t.length < 3 ? !1 : t.map((e, r) => {
|
|
8250
8250
|
const s = t[(r + 1) % t.length];
|
|
8251
8251
|
return (s[0] - e[0]) * (s[1] + e[1]);
|
|
8252
8252
|
}).reduce((e, r) => e + r, 0) > 0;
|
|
8253
8253
|
}
|
|
8254
8254
|
function K(t, n) {
|
|
8255
|
-
return t.length < 3 ||
|
|
8255
|
+
return t.length < 3 || _n(t) === n ? t : [...t].reverse();
|
|
8256
8256
|
}
|
|
8257
|
-
function
|
|
8258
|
-
return
|
|
8257
|
+
function te(t, n = {}) {
|
|
8258
|
+
return Tn(t, (r) => Gn(r, n));
|
|
8259
8259
|
}
|
|
8260
|
-
function
|
|
8260
|
+
function $n(t, n = {}) {
|
|
8261
8261
|
if (O$2.isInstance(t))
|
|
8262
|
-
return t.figures.flatMap((e) =>
|
|
8262
|
+
return t.figures.flatMap((e) => $n(e, n));
|
|
8263
8263
|
if (v$2.isInstance(t)) {
|
|
8264
8264
|
const e = K(
|
|
8265
8265
|
B(t.contour.segments, n),
|
|
@@ -8291,7 +8291,7 @@ const dt = (t) => "shape" in t ? t.shape : t, mt = (t, n) => {
|
|
|
8291
8291
|
const { color: e } = t;
|
|
8292
8292
|
return e ? `<g stroke="${e}">${n}</g>` : n;
|
|
8293
8293
|
}, Pt = (t) => new mt$1(t.xMin, -t.yMax, t.xMax, -t.yMin);
|
|
8294
|
-
function
|
|
8294
|
+
function ne(t, {
|
|
8295
8295
|
margin: n = 1,
|
|
8296
8296
|
unit: e = null,
|
|
8297
8297
|
viewBox: r
|
|
@@ -8309,7 +8309,7 @@ function te(t, {
|
|
|
8309
8309
|
e
|
|
8310
8310
|
);
|
|
8311
8311
|
}
|
|
8312
|
-
const
|
|
8312
|
+
const Rt = (t) => {
|
|
8313
8313
|
if (t.type === "LINE")
|
|
8314
8314
|
return new at$4(t.firstPoint, t.lastPoint);
|
|
8315
8315
|
if (t.type === "ARC")
|
|
@@ -8337,7 +8337,7 @@ const Tt = (t) => {
|
|
|
8337
8337
|
t.controlPoint
|
|
8338
8338
|
);
|
|
8339
8339
|
if (t.type === "CUBIC_BEZIER")
|
|
8340
|
-
return new Et$
|
|
8340
|
+
return new Et$2(
|
|
8341
8341
|
t.firstPoint,
|
|
8342
8342
|
t.lastPoint,
|
|
8343
8343
|
t.firstControlPoint,
|
|
@@ -8345,33 +8345,33 @@ const Tt = (t) => {
|
|
|
8345
8345
|
);
|
|
8346
8346
|
throw new Error("Unknown segment type");
|
|
8347
8347
|
}, Z = (t) => {
|
|
8348
|
-
const n = t.segments.map(
|
|
8348
|
+
const n = t.segments.map(Rt);
|
|
8349
8349
|
return new _$1(n);
|
|
8350
|
-
},
|
|
8350
|
+
}, Tt = (t) => {
|
|
8351
8351
|
const n = Z(t.contour), e = t.holes.map(Z);
|
|
8352
8352
|
return new v$2(n, e);
|
|
8353
|
-
},
|
|
8354
|
-
const n = t.figures.map(
|
|
8353
|
+
}, Un = (t) => {
|
|
8354
|
+
const n = t.figures.map(Tt);
|
|
8355
8355
|
return new O$2(n);
|
|
8356
8356
|
};
|
|
8357
|
-
function
|
|
8357
|
+
function ee(t) {
|
|
8358
8358
|
if (t.type === "DIAGRAM")
|
|
8359
|
-
return
|
|
8359
|
+
return Un(t);
|
|
8360
8360
|
if (t.type === "FIGURE")
|
|
8361
|
-
return
|
|
8361
|
+
return Tt(t);
|
|
8362
8362
|
if (t.type === "LOOP")
|
|
8363
8363
|
return Z(t);
|
|
8364
8364
|
if (t.type === "LINE" || t.type === "ARC" || t.type === "ELLIPSE_ARC" || t.type === "CUBIC_BEZIER")
|
|
8365
|
-
return
|
|
8365
|
+
return Rt(t);
|
|
8366
8366
|
throw new Error("Unknown shape type");
|
|
8367
8367
|
}
|
|
8368
|
-
const wt = Math.PI / 180,
|
|
8369
|
-
function
|
|
8368
|
+
const wt = Math.PI / 180, Vn = 180 / Math.PI;
|
|
8369
|
+
function re(t, n) {
|
|
8370
8370
|
const e = Math.cos(n * wt) * t, r = Math.sin(n * wt) * t;
|
|
8371
8371
|
return [e, r];
|
|
8372
8372
|
}
|
|
8373
|
-
function
|
|
8374
|
-
const e = Math.sqrt(t * t + n * n), r = Math.atan2(n, t) *
|
|
8373
|
+
function se([t, n]) {
|
|
8374
|
+
const e = Math.sqrt(t * t + n * n), r = Math.atan2(n, t) * Vn;
|
|
8375
8375
|
return [e, r];
|
|
8376
8376
|
}
|
|
8377
8377
|
|
|
@@ -8379,27 +8379,27 @@ var pantograph = /*#__PURE__*/Object.freeze({
|
|
|
8379
8379
|
__proto__: null,
|
|
8380
8380
|
DEG2RAD: wt,
|
|
8381
8381
|
DrawingPen: at$2,
|
|
8382
|
-
RAD2DEG:
|
|
8383
|
-
cartesianToPolar:
|
|
8382
|
+
RAD2DEG: Vn,
|
|
8383
|
+
cartesianToPolar: se,
|
|
8384
8384
|
chamfer: T,
|
|
8385
|
-
confineStrand:
|
|
8386
|
-
cut:
|
|
8385
|
+
confineStrand: Yn,
|
|
8386
|
+
cut: kt,
|
|
8387
8387
|
draw: ut$1,
|
|
8388
|
-
eraseStrand:
|
|
8389
|
-
exportJSON: Et,
|
|
8390
|
-
exportSVG:
|
|
8388
|
+
eraseStrand: Qn,
|
|
8389
|
+
exportJSON: Et$1,
|
|
8390
|
+
exportSVG: ne,
|
|
8391
8391
|
fillet: R,
|
|
8392
|
-
fuse:
|
|
8392
|
+
fuse: pn,
|
|
8393
8393
|
fuseAll: z,
|
|
8394
|
-
importJSON:
|
|
8395
|
-
intersect:
|
|
8396
|
-
offset:
|
|
8397
|
-
outlineStroke:
|
|
8398
|
-
polarToCartesian:
|
|
8399
|
-
selectCorners:
|
|
8394
|
+
importJSON: ee,
|
|
8395
|
+
intersect: Jn,
|
|
8396
|
+
offset: Zn,
|
|
8397
|
+
outlineStroke: Wn,
|
|
8398
|
+
polarToCartesian: re,
|
|
8399
|
+
selectCorners: jn,
|
|
8400
8400
|
svgBody: pt,
|
|
8401
|
-
tesselate:
|
|
8402
|
-
tesselatePoints:
|
|
8401
|
+
tesselate: te,
|
|
8402
|
+
tesselatePoints: $n
|
|
8403
8403
|
});
|
|
8404
8404
|
|
|
8405
8405
|
function sketchSegment(segment, plane) {
|
|
@@ -8422,7 +8422,7 @@ function sketchSegment(segment, plane) {
|
|
|
8422
8422
|
plane.toWorldCoords(segment.lastPoint),
|
|
8423
8423
|
]);
|
|
8424
8424
|
}
|
|
8425
|
-
if (segment instanceof Et$
|
|
8425
|
+
if (segment instanceof Et$2) {
|
|
8426
8426
|
return makeBezierCurve([
|
|
8427
8427
|
plane.toWorldCoords(segment.firstPoint),
|
|
8428
8428
|
plane.toWorldCoords(segment.firstControlPoint),
|
|
@@ -8476,7 +8476,7 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
8476
8476
|
pantographObject instanceof ct$3 ||
|
|
8477
8477
|
pantographObject instanceof jt$1 ||
|
|
8478
8478
|
pantographObject instanceof _t$1 ||
|
|
8479
|
-
pantographObject instanceof Et$
|
|
8479
|
+
pantographObject instanceof Et$2) {
|
|
8480
8480
|
return sketchFromSegments([sketchSegment(pantographObject, plane)], plane);
|
|
8481
8481
|
}
|
|
8482
8482
|
throw new Error(`Unsupported object type "${pantographObject.constructor.name}"`);
|
|
@@ -8533,13 +8533,13 @@ class Drawing {
|
|
|
8533
8533
|
return new Drawing(this.diagram.clone());
|
|
8534
8534
|
}
|
|
8535
8535
|
serialize() {
|
|
8536
|
-
return JSON.stringify(Et(this.diagram));
|
|
8536
|
+
return JSON.stringify(Et$1(this.diagram));
|
|
8537
8537
|
}
|
|
8538
8538
|
get boundingBox() {
|
|
8539
8539
|
return this.diagram.boundingBox;
|
|
8540
8540
|
}
|
|
8541
8541
|
get repr() {
|
|
8542
|
-
return JSON.stringify(Et(this.diagram));
|
|
8542
|
+
return JSON.stringify(Et$1(this.diagram));
|
|
8543
8543
|
}
|
|
8544
8544
|
rotate(angle, center) {
|
|
8545
8545
|
return new Drawing(this.diagram.rotate(angle, center));
|
|
@@ -8565,17 +8565,17 @@ class Drawing {
|
|
|
8565
8565
|
cut(other) {
|
|
8566
8566
|
const base = this.diagram;
|
|
8567
8567
|
const tool = other.diagram;
|
|
8568
|
-
return new Drawing(
|
|
8568
|
+
return new Drawing(kt(base, tool));
|
|
8569
8569
|
}
|
|
8570
8570
|
fuse(other) {
|
|
8571
8571
|
const base = this.diagram;
|
|
8572
8572
|
const tool = other.diagram;
|
|
8573
|
-
return new Drawing(
|
|
8573
|
+
return new Drawing(pn(base, tool));
|
|
8574
8574
|
}
|
|
8575
8575
|
intersect(other) {
|
|
8576
8576
|
const base = this.diagram;
|
|
8577
8577
|
const tool = other.diagram;
|
|
8578
|
-
return new Drawing(
|
|
8578
|
+
return new Drawing(Jn(base, tool));
|
|
8579
8579
|
}
|
|
8580
8580
|
fillet(radius, filter) {
|
|
8581
8581
|
return new Drawing(R(this.diagram, radius, filter));
|
|
@@ -8590,7 +8590,7 @@ class Drawing {
|
|
|
8590
8590
|
return sketchOnPlane(this.diagram, inputPlane, origin);
|
|
8591
8591
|
}
|
|
8592
8592
|
toSVG(margin) {
|
|
8593
|
-
return
|
|
8593
|
+
return ne(this.diagram, { margin });
|
|
8594
8594
|
}
|
|
8595
8595
|
toSVGViewBox(margin = 1) {
|
|
8596
8596
|
return v(this.diagram.boundingBox, margin);
|
|
@@ -8599,7 +8599,7 @@ class Drawing {
|
|
|
8599
8599
|
return svgPathsForShape(this.diagram);
|
|
8600
8600
|
}
|
|
8601
8601
|
offset(distance) {
|
|
8602
|
-
return new Drawing(
|
|
8602
|
+
return new Drawing(Zn(this.diagram, distance));
|
|
8603
8603
|
}
|
|
8604
8604
|
}
|
|
8605
8605
|
class ReDrawingPen extends at$2 {
|