build-dxf 0.0.42 → 0.0.43
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/package.json +1 -1
- package/src/build.js +338 -326
- package/src/utils/DxfSystem/utils/drawHelper.d.ts +6 -0
package/src/build.js
CHANGED
|
@@ -4,8 +4,8 @@ import pt from "clipper-lib";
|
|
|
4
4
|
import $ from "dxf-writer";
|
|
5
5
|
import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
6
6
|
function K() {
|
|
7
|
-
return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(
|
|
8
|
-
var t = Math.random() * 16 | 0, e =
|
|
7
|
+
return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(d) {
|
|
8
|
+
var t = Math.random() * 16 | 0, e = d == "x" ? t : t & 3 | 8;
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
@@ -202,8 +202,8 @@ class N {
|
|
|
202
202
|
const o = this.points;
|
|
203
203
|
for (let c = 0; c < 4; c++) {
|
|
204
204
|
const l = o[c], h = o[(c + 1) % 4];
|
|
205
|
-
for (let
|
|
206
|
-
const f = e[
|
|
205
|
+
for (let u = 0; u < 4; u++) {
|
|
206
|
+
const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), D = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
|
|
207
207
|
if (y * x < 0 && m * D < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || m === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || D === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
|
|
208
208
|
return !0;
|
|
209
209
|
}
|
|
@@ -216,9 +216,9 @@ class N {
|
|
|
216
216
|
const a = (c) => {
|
|
217
217
|
let l = 0;
|
|
218
218
|
for (let h = 0; h < 4; h++) {
|
|
219
|
-
const
|
|
219
|
+
const u = e[h], f = e[(h + 1) % 4], p = (f.x - u.x) * (c.y - u.y) - (f.y - u.y) * (c.x - u.x);
|
|
220
220
|
if (p === 0) {
|
|
221
|
-
const y = Math.abs(f.x -
|
|
221
|
+
const y = Math.abs(f.x - u.x) > 1e-10 ? f.x - u.x : f.y - u.y, x = y ? (c.x - u.x) / y : 0;
|
|
222
222
|
if (x >= 0 && x <= 1) return !0;
|
|
223
223
|
} else {
|
|
224
224
|
const y = p > 0 ? 1 : -1;
|
|
@@ -523,8 +523,8 @@ class nt {
|
|
|
523
523
|
if (Math.max(p, y) >= 0 && Math.min(p, y) <= 1)
|
|
524
524
|
return !0;
|
|
525
525
|
} else {
|
|
526
|
-
const
|
|
527
|
-
if (
|
|
526
|
+
const u = ((o.x - e.x) * l - (o.y - e.y) * c) / h, f = ((o.x - e.x) * i - (o.y - e.y) * s) / h;
|
|
527
|
+
if (u >= 0 && u <= 1 && f >= 0 && f <= 1)
|
|
528
528
|
return !0;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
@@ -786,12 +786,12 @@ class A {
|
|
|
786
786
|
const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y;
|
|
787
787
|
return (y.x * r.x + y.y * r.y) / x;
|
|
788
788
|
};
|
|
789
|
-
let h = l(a),
|
|
789
|
+
let h = l(a), u = l(c);
|
|
790
790
|
const f = (p) => {
|
|
791
791
|
const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, m = s.y + y * r.y;
|
|
792
792
|
return new M(x, m);
|
|
793
793
|
};
|
|
794
|
-
return (h < 0 || h > 1) && (a = f(h)), (
|
|
794
|
+
return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new A(a, a) : new A(a, c);
|
|
795
795
|
}
|
|
796
796
|
/**
|
|
797
797
|
* 计算一条线段在另一条直线上的投影
|
|
@@ -804,13 +804,13 @@ class A {
|
|
|
804
804
|
if (i.x === 0 && i.y === 0)
|
|
805
805
|
throw new Error("投影目标线段的两个点不能重合");
|
|
806
806
|
let o = ((l) => {
|
|
807
|
-
const h = new M(l.x - n.x, l.y - n.y),
|
|
807
|
+
const h = new M(l.x - n.x, l.y - n.y), u = i.x * i.x + i.y * i.y, p = (h.x * i.x + h.y * i.y) / u, y = n.x + p * i.x, x = n.y + p * i.y;
|
|
808
808
|
return new M(y, x);
|
|
809
809
|
})(t);
|
|
810
810
|
if (!e) return o;
|
|
811
811
|
let c = ((l) => {
|
|
812
|
-
const h = new M(l.x - n.x, l.y - n.y),
|
|
813
|
-
return (h.x * i.x + h.y * i.y) /
|
|
812
|
+
const h = new M(l.x - n.x, l.y - n.y), u = i.x * i.x + i.y * i.y;
|
|
813
|
+
return (h.x * i.x + h.y * i.y) / u;
|
|
814
814
|
})(o);
|
|
815
815
|
return c < 0 || c > 1 ? null : o;
|
|
816
816
|
}
|
|
@@ -828,8 +828,8 @@ class A {
|
|
|
828
828
|
function a(f, p, y) {
|
|
829
829
|
return Math.min(p.x, y.x) - 1e-10 <= f.x && f.x <= Math.max(p.x, y.x) + 1e-10 && Math.min(p.y, y.y) - 1e-10 <= f.y && f.y <= Math.max(p.y, y.y) + 1e-10;
|
|
830
830
|
}
|
|
831
|
-
const c = o(n, s, i), l = o(n, s, r), h = o(i, r, n),
|
|
832
|
-
return !!(c * l < 0 && h *
|
|
831
|
+
const c = o(n, s, i), l = o(n, s, r), h = o(i, r, n), u = o(i, r, s);
|
|
832
|
+
return !!(c * l < 0 && h * u < 0 || e && (Math.abs(c) < 1e-10 && a(i, n, s) || Math.abs(l) < 1e-10 && a(r, n, s) || Math.abs(h) < 1e-10 && a(n, i, r) || Math.abs(u) < 1e-10 && a(s, i, r)));
|
|
833
833
|
}
|
|
834
834
|
/**
|
|
835
835
|
* 判断一个点是否在线段上(含端点)
|
|
@@ -931,8 +931,8 @@ class A {
|
|
|
931
931
|
if (l > 1)
|
|
932
932
|
return n.distance(r);
|
|
933
933
|
{
|
|
934
|
-
const h = i.x + l * o,
|
|
935
|
-
return n.distance(new M(h,
|
|
934
|
+
const h = i.x + l * o, u = i.y + l * a;
|
|
935
|
+
return n.distance(new M(h, u));
|
|
936
936
|
}
|
|
937
937
|
};
|
|
938
938
|
return Math.min(
|
|
@@ -983,8 +983,8 @@ class A {
|
|
|
983
983
|
const n = /* @__PURE__ */ new Set();
|
|
984
984
|
function s(r, o, a) {
|
|
985
985
|
if (o.has(r)) return;
|
|
986
|
-
const c = e.queryPoint(r.start).filter((f) => f.userData !== r && r.parallel(f.userData, 0.1)), l = e.queryPoint(r.end).filter((f) => f.userData !== r && r.parallel(f.userData, 0.1)), h = c[0]?.userData,
|
|
987
|
-
return h && !a.has(h) && (a.add(h), s(h, o, a)),
|
|
986
|
+
const c = e.queryPoint(r.start).filter((f) => f.userData !== r && r.parallel(f.userData, 0.1)), l = e.queryPoint(r.end).filter((f) => f.userData !== r && r.parallel(f.userData, 0.1)), h = c[0]?.userData, u = l[0]?.userData;
|
|
987
|
+
return h && !a.has(h) && (a.add(h), s(h, o, a)), u && !a.has(u) && (a.add(u), s(u, o, a)), o.add(r), a;
|
|
988
988
|
}
|
|
989
989
|
const i = [];
|
|
990
990
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -1001,14 +1001,14 @@ class A {
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
static mergeLinesByMaxlength(...t) {
|
|
1003
1003
|
if (t.length === 1) return t[0];
|
|
1004
|
-
const n = t.slice(0).sort((h,
|
|
1004
|
+
const n = t.slice(0).sort((h, u) => u.length() - h.length())[0], s = n.direction().normalize();
|
|
1005
1005
|
let i = n.start.clone(), r = n.end.clone();
|
|
1006
1006
|
const o = (h) => h.x * s.x + h.y * s.y;
|
|
1007
1007
|
let a = o(i), c = o(r);
|
|
1008
1008
|
for (const h of t)
|
|
1009
|
-
for (const
|
|
1010
|
-
const f = o(
|
|
1011
|
-
f < a && (a = f, i = n.projectPoint(
|
|
1009
|
+
for (const u of h.points) {
|
|
1010
|
+
const f = o(u);
|
|
1011
|
+
f < a && (a = f, i = n.projectPoint(u, !1)), f > c && (c = f, r = n.projectPoint(u, !1));
|
|
1012
1012
|
}
|
|
1013
1013
|
const l = new A(i, r);
|
|
1014
1014
|
return t.forEach((h) => h.userData.fittedLine = l), l;
|
|
@@ -1029,7 +1029,7 @@ class A {
|
|
|
1029
1029
|
const y = p.x * s.x + p.y * s.y;
|
|
1030
1030
|
i = Math.min(i, y), r = Math.max(r, y), o += p.x, a += p.y;
|
|
1031
1031
|
});
|
|
1032
|
-
const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y),
|
|
1032
|
+
const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y), u = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new A(h, u);
|
|
1033
1033
|
return t.forEach((p) => p.userData.fittedLine = f), f;
|
|
1034
1034
|
}
|
|
1035
1035
|
/** 合并满足平行的线段
|
|
@@ -1289,13 +1289,13 @@ class M {
|
|
|
1289
1289
|
return new M(0, 0);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
async function Y(
|
|
1292
|
+
async function Y(d, t = !0) {
|
|
1293
1293
|
if (typeof global < "u" && typeof require < "u")
|
|
1294
|
-
return require(
|
|
1294
|
+
return require(d);
|
|
1295
1295
|
{
|
|
1296
1296
|
let e = await import(
|
|
1297
1297
|
/* @vite-ignore */
|
|
1298
|
-
|
|
1298
|
+
d
|
|
1299
1299
|
);
|
|
1300
1300
|
return t && (e = e.default), e;
|
|
1301
1301
|
}
|
|
@@ -1442,8 +1442,8 @@ class F {
|
|
|
1442
1442
|
const [r, o] = i.line.points, a = o.x - r.x, c = o.y - r.y, l = a * a + c * c;
|
|
1443
1443
|
let h = ((t.x - r.x) * a + (t.y - r.y) * c) / l;
|
|
1444
1444
|
h = Math.max(0, Math.min(1, h));
|
|
1445
|
-
const
|
|
1446
|
-
t.distance(new M(
|
|
1445
|
+
const u = r.x + h * a, f = r.y + h * c;
|
|
1446
|
+
t.distance(new M(u, f)) <= e && n.push(i);
|
|
1447
1447
|
}
|
|
1448
1448
|
if (!this.isLeaf)
|
|
1449
1449
|
for (const i of this.children)
|
|
@@ -1511,9 +1511,9 @@ class F {
|
|
|
1511
1511
|
})), t;
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
|
-
function J(
|
|
1515
|
-
return e || (e = new F(N.fromByLineSegment(...
|
|
1516
|
-
const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index:
|
|
1514
|
+
function J(d, t = 0, e) {
|
|
1515
|
+
return e || (e = new F(N.fromByLineSegment(...d)), d.forEach((n) => e?.insert({ line: n, userData: void 0 }))), d.map((n) => {
|
|
1516
|
+
const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: d.indexOf(o.line) }));
|
|
1517
1517
|
return {
|
|
1518
1518
|
start: n.start.toJson(t),
|
|
1519
1519
|
end: n.end.toJson(t),
|
|
@@ -1533,9 +1533,9 @@ function J(u, t = 0, e) {
|
|
|
1533
1533
|
};
|
|
1534
1534
|
});
|
|
1535
1535
|
}
|
|
1536
|
-
function lt(
|
|
1537
|
-
const e = new F(N.fromByLineSegment(...
|
|
1538
|
-
return
|
|
1536
|
+
function lt(d, t = 0.03) {
|
|
1537
|
+
const e = new F(N.fromByLineSegment(...d));
|
|
1538
|
+
return d.forEach((n) => e.insert({ line: n, userData: void 0 })), d.flatMap((n) => {
|
|
1539
1539
|
const s = e.queryLineSegment(n, !0).map((i) => {
|
|
1540
1540
|
if (i.line === n) return;
|
|
1541
1541
|
const r = i.line.getIntersection(n);
|
|
@@ -1554,8 +1554,8 @@ function lt(u, t = 0.03) {
|
|
|
1554
1554
|
return n;
|
|
1555
1555
|
}).filter((n) => n.length() >= t);
|
|
1556
1556
|
}
|
|
1557
|
-
function tt(...
|
|
1558
|
-
|
|
1557
|
+
function tt(...d) {
|
|
1558
|
+
d.forEach((t) => {
|
|
1559
1559
|
const e = t.direction();
|
|
1560
1560
|
t.userData.drawWindow?.forEach((n) => {
|
|
1561
1561
|
try {
|
|
@@ -1572,13 +1572,13 @@ function tt(...u) {
|
|
|
1572
1572
|
});
|
|
1573
1573
|
});
|
|
1574
1574
|
}
|
|
1575
|
-
function ie(
|
|
1576
|
-
e || (e = new X(),
|
|
1575
|
+
function ie(d, t = 0.1, e) {
|
|
1576
|
+
e || (e = new X(), d.forEach((i) => {
|
|
1577
1577
|
i.userData.isDoor || i.points.forEach((r) => e?.insert(r, i));
|
|
1578
1578
|
}));
|
|
1579
1579
|
const n = [], s = /* @__PURE__ */ new Set();
|
|
1580
|
-
for (let i = 0; i <
|
|
1581
|
-
const r =
|
|
1580
|
+
for (let i = 0; i < d.length; i++) {
|
|
1581
|
+
const r = d[i], o = /* @__PURE__ */ new Map();
|
|
1582
1582
|
r.userData.isDoor || r.points.forEach((a) => {
|
|
1583
1583
|
if (s.has(a)) return !1;
|
|
1584
1584
|
if (e.queryPoint(a).length > 1) return;
|
|
@@ -1597,29 +1597,29 @@ function ie(u, t = 0.1, e) {
|
|
|
1597
1597
|
});
|
|
1598
1598
|
if (c.length === 0) return;
|
|
1599
1599
|
s.add(a), s.add(c[0].point);
|
|
1600
|
-
const l = c[0].userData, h = r.projectLineSegment(l),
|
|
1601
|
-
f === 0 && p === 0 ? n.push(new A(a.clone(), c[0].point.clone())) : n.push(new A(h.center,
|
|
1600
|
+
const l = c[0].userData, h = r.projectLineSegment(l), u = l.projectLineSegment(r), f = h.length(), p = u.length();
|
|
1601
|
+
f === 0 && p === 0 ? n.push(new A(a.clone(), c[0].point.clone())) : n.push(new A(h.center, u.center));
|
|
1602
1602
|
});
|
|
1603
1603
|
}
|
|
1604
|
-
return [...
|
|
1604
|
+
return [...d, ...n];
|
|
1605
1605
|
}
|
|
1606
|
-
function re(
|
|
1607
|
-
const t = new X(), e = new F(N.fromByLineSegment(...
|
|
1608
|
-
return
|
|
1606
|
+
function re(d) {
|
|
1607
|
+
const t = new X(), e = new F(N.fromByLineSegment(...d)), n = [];
|
|
1608
|
+
return d.forEach((s) => {
|
|
1609
1609
|
s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
|
|
1610
1610
|
}), n.forEach((s) => {
|
|
1611
1611
|
const i = t.queryPoint(s.start), r = t.queryPoint(s.end);
|
|
1612
1612
|
i.length ? s.userData.startIntersection = i[0].userData : s.userData.startIntersection = e.queryPoint(s.start)[0]?.line, r.length ? s.userData.endIntersection = r[0].userData : s.userData.endIntersection = e.queryPoint(s.end)[0]?.line;
|
|
1613
|
-
}),
|
|
1613
|
+
}), d = ie(d, 0.3, t), d;
|
|
1614
1614
|
}
|
|
1615
|
-
function oe(
|
|
1616
|
-
const t = new F(N.fromByLineSegment(...
|
|
1617
|
-
|
|
1615
|
+
function oe(d) {
|
|
1616
|
+
const t = new F(N.fromByLineSegment(...d));
|
|
1617
|
+
d.forEach((n) => {
|
|
1618
1618
|
n.userData.isDoor || t.insert({ line: n, userData: void 0 });
|
|
1619
1619
|
});
|
|
1620
1620
|
const e = /* @__PURE__ */ new Map();
|
|
1621
|
-
for (let n = 0; n <
|
|
1622
|
-
const s =
|
|
1621
|
+
for (let n = 0; n < d.length; n++) {
|
|
1622
|
+
const s = d[n], i = t.queryLineSegment(s).filter((r) => r.line !== s).map((r) => {
|
|
1623
1623
|
const o = s.getSameEndpoint(r.line) ?? [];
|
|
1624
1624
|
return {
|
|
1625
1625
|
line: r.line,
|
|
@@ -1632,36 +1632,38 @@ function oe(u) {
|
|
|
1632
1632
|
}
|
|
1633
1633
|
return e;
|
|
1634
1634
|
}
|
|
1635
|
-
function ae(
|
|
1636
|
-
const s = [
|
|
1637
|
-
function a(
|
|
1638
|
-
|
|
1639
|
-
|
|
1635
|
+
function ae(d, t, e, n = 15) {
|
|
1636
|
+
const s = [d], i = [], r = [], o = [];
|
|
1637
|
+
function a(u) {
|
|
1638
|
+
if (u.userData.isDoor) return r.push(u);
|
|
1639
|
+
const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x);
|
|
1640
|
+
let y = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x) - f;
|
|
1640
1641
|
for (; y > Math.PI; ) y -= 2 * Math.PI;
|
|
1641
1642
|
for (; y < -Math.PI; ) y += 2 * Math.PI;
|
|
1642
|
-
const x =
|
|
1643
|
-
return
|
|
1643
|
+
const x = u.center;
|
|
1644
|
+
return u.start.rotate(x, y), u.end.rotate(x, y), u.userData.isDoor ? r.push(u) : s.push(u), u;
|
|
1644
1645
|
}
|
|
1645
|
-
function c(
|
|
1646
|
-
|
|
1646
|
+
function c(u) {
|
|
1647
|
+
if (u.userData.isDoor) return r.push(u);
|
|
1648
|
+
const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x), p = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x);
|
|
1647
1649
|
let y = p + Math.PI / 2 - f, x = p - Math.PI / 2 - f;
|
|
1648
1650
|
for (; y > Math.PI; ) y -= 2 * Math.PI;
|
|
1649
1651
|
for (; y < -Math.PI; ) y += 2 * Math.PI;
|
|
1650
1652
|
for (; x > Math.PI; ) x -= 2 * Math.PI;
|
|
1651
1653
|
for (; x < -Math.PI; ) x += 2 * Math.PI;
|
|
1652
|
-
const m = Math.abs(y) < Math.abs(x) ? y : x, D =
|
|
1653
|
-
return
|
|
1654
|
+
const m = Math.abs(y) < Math.abs(x) ? y : x, D = u.center;
|
|
1655
|
+
return u.start.rotate(D, m), u.end.rotate(D, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
|
|
1654
1656
|
}
|
|
1655
|
-
function l(
|
|
1656
|
-
if (p) return l(
|
|
1657
|
-
|
|
1657
|
+
function l(u, f, p = !1) {
|
|
1658
|
+
if (p) return l(u === "parallel" ? "vertical" : "parallel", f);
|
|
1659
|
+
u === "parallel" ? a(f) : c(f);
|
|
1658
1660
|
}
|
|
1659
1661
|
const h = [];
|
|
1660
|
-
for (let
|
|
1661
|
-
const f = t[
|
|
1662
|
-
if (
|
|
1663
|
-
if (f.userData.isWindow && o.push(f), f.parallel(
|
|
1664
|
-
else if (f.vertical(
|
|
1662
|
+
for (let u = 0; u < t.length; u++) {
|
|
1663
|
+
const f = t[u];
|
|
1664
|
+
if (d !== f)
|
|
1665
|
+
if (f.userData.isWindow && o.push(f), f.parallel(d, n)) a(f);
|
|
1666
|
+
else if (f.vertical(d, n)) c(f);
|
|
1665
1667
|
else {
|
|
1666
1668
|
const y = e.get(f)?.reduce((x, m) => (m.sourcePoint && (x.has(m.sourcePoint) || x.set(m.sourcePoint, []), x.get(m.sourcePoint)?.push(m)), x), /* @__PURE__ */ new Map());
|
|
1667
1669
|
y && y.size > 1 ? h.push(() => {
|
|
@@ -1680,11 +1682,11 @@ function ae(u, t, e, n = 15) {
|
|
|
1680
1682
|
}) : c(f);
|
|
1681
1683
|
}
|
|
1682
1684
|
}
|
|
1683
|
-
return h.forEach((
|
|
1685
|
+
return h.forEach((u) => u()), { parallelLines: s, verticalLines: i, doorLines: r, windowLines: o };
|
|
1684
1686
|
}
|
|
1685
|
-
function yt(
|
|
1687
|
+
function yt(d, t, e, n, s) {
|
|
1686
1688
|
const i = [], r = /* @__PURE__ */ new Map();
|
|
1687
|
-
|
|
1689
|
+
d.forEach((c) => {
|
|
1688
1690
|
const l = e.projectPoint(c.start, !1);
|
|
1689
1691
|
l && (l.userData = c, i.push(l), r.set(c, l));
|
|
1690
1692
|
}), i.sort((c, l) => l.distance(e.start) - c.distance(e.start));
|
|
@@ -1706,39 +1708,39 @@ function yt(u, t, e, n, s) {
|
|
|
1706
1708
|
});
|
|
1707
1709
|
});
|
|
1708
1710
|
l.sort((p, y) => p.distance(t.start) - y.distance(t.start));
|
|
1709
|
-
const h = /* @__PURE__ */ new Map(),
|
|
1711
|
+
const h = /* @__PURE__ */ new Map(), u = [];
|
|
1710
1712
|
let f = [];
|
|
1711
1713
|
return l.forEach((p, y) => {
|
|
1712
|
-
h.size === 0 && y > 0 && l[y - 1].distance(p) > n && (f.push([...
|
|
1714
|
+
h.size === 0 && y > 0 && l[y - 1].distance(p) > n && (f.push([...u]), u.length = 0), h.set(p.userData, (h.get(p.userData) ?? 0) + 1);
|
|
1713
1715
|
for (const x of h.values()) if (x !== 2) return;
|
|
1714
|
-
|
|
1715
|
-
}), f.push([...
|
|
1716
|
+
u.push(...h.keys()), h.clear();
|
|
1717
|
+
}), f.push([...u]), f;
|
|
1716
1718
|
});
|
|
1717
1719
|
}
|
|
1718
|
-
function xt(
|
|
1720
|
+
function xt(d, t, e, n) {
|
|
1719
1721
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), o = [];
|
|
1720
|
-
|
|
1721
|
-
const f = e.projectPoint(
|
|
1722
|
-
f && (f.userData =
|
|
1722
|
+
d.forEach((u) => {
|
|
1723
|
+
const f = e.projectPoint(u.start, !1);
|
|
1724
|
+
f && (f.userData = u, s.set(u, f), o.push(f)), u.points.forEach((p, y) => {
|
|
1723
1725
|
const x = t.projectPoint(p, !1);
|
|
1724
|
-
x && (x.userData =
|
|
1726
|
+
x && (x.userData = u, y === 0 ? i.set(u, x) : r.set(u, x));
|
|
1725
1727
|
});
|
|
1726
|
-
}), o.sort((
|
|
1727
|
-
const a = o.map((
|
|
1728
|
-
const f =
|
|
1728
|
+
}), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
|
|
1729
|
+
const a = o.map((u) => {
|
|
1730
|
+
const f = u.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
|
|
1729
1731
|
for (let D = 0; D < o.length; D++) {
|
|
1730
1732
|
const w = o[D];
|
|
1731
|
-
if (
|
|
1733
|
+
if (u !== w && u.distance(w) < n) {
|
|
1732
1734
|
const g = w.userData, S = i.get(g), E = r.get(g);
|
|
1733
1735
|
(x.isPointOnSegment(S) || x.isPointOnSegment(E)) && m.push(D);
|
|
1734
1736
|
}
|
|
1735
1737
|
}
|
|
1736
1738
|
return m;
|
|
1737
1739
|
});
|
|
1738
|
-
function c(
|
|
1739
|
-
if (p.has(
|
|
1740
|
-
const y = f[
|
|
1741
|
-
p.add(
|
|
1740
|
+
function c(u, f, p = /* @__PURE__ */ new Set()) {
|
|
1741
|
+
if (p.has(u)) return p;
|
|
1742
|
+
const y = f[u];
|
|
1743
|
+
p.add(u);
|
|
1742
1744
|
for (let x = 0; x < y.length; x++) {
|
|
1743
1745
|
const m = y[x];
|
|
1744
1746
|
c(m, f, p);
|
|
@@ -1746,9 +1748,9 @@ function xt(u, t, e, n) {
|
|
|
1746
1748
|
return p;
|
|
1747
1749
|
}
|
|
1748
1750
|
const l = /* @__PURE__ */ new Set(), h = [];
|
|
1749
|
-
for (let
|
|
1750
|
-
if (l.has(
|
|
1751
|
-
const f = c(
|
|
1751
|
+
for (let u = 0; u < o.length; u++) {
|
|
1752
|
+
if (l.has(u)) continue;
|
|
1753
|
+
const f = c(u, a), p = [];
|
|
1752
1754
|
if (f.forEach((y) => {
|
|
1753
1755
|
l.add(y), p.push(o[y].userData);
|
|
1754
1756
|
}), p.length > 2) {
|
|
@@ -1777,7 +1779,7 @@ function xt(u, t, e, n) {
|
|
|
1777
1779
|
}
|
|
1778
1780
|
return h;
|
|
1779
1781
|
}
|
|
1780
|
-
function gt(
|
|
1782
|
+
function gt(d, t) {
|
|
1781
1783
|
function e(i, r = /* @__PURE__ */ new Set()) {
|
|
1782
1784
|
if (r.has(i)) return r;
|
|
1783
1785
|
r.add(i);
|
|
@@ -1790,49 +1792,55 @@ function gt(u, t) {
|
|
|
1790
1792
|
return r;
|
|
1791
1793
|
}
|
|
1792
1794
|
const n = /* @__PURE__ */ new Set(), s = [];
|
|
1793
|
-
for (let i = 0; i <
|
|
1794
|
-
const r =
|
|
1795
|
+
for (let i = 0; i < d.length; i++) {
|
|
1796
|
+
const r = d[i];
|
|
1795
1797
|
if (n.has(r)) continue;
|
|
1796
1798
|
const o = e(r);
|
|
1797
1799
|
s.push([...o]);
|
|
1798
1800
|
}
|
|
1799
1801
|
return s;
|
|
1800
1802
|
}
|
|
1801
|
-
function ce(
|
|
1803
|
+
function ce(d, t, e, n, s, i) {
|
|
1802
1804
|
const {
|
|
1803
1805
|
principalAxisThreshold: r = 0.3,
|
|
1804
1806
|
crossAxistThreshold: o = 0.06,
|
|
1805
1807
|
groupMethod: a = "principalAndCross"
|
|
1806
1808
|
} = i ?? {}, c = {
|
|
1807
1809
|
cross: () => [
|
|
1808
|
-
...xt(
|
|
1810
|
+
...xt(d, n, e, o),
|
|
1809
1811
|
...xt(t, e, n, o)
|
|
1810
1812
|
],
|
|
1811
1813
|
principalAndCross: () => [
|
|
1812
|
-
...yt(
|
|
1814
|
+
...yt(d, n, e, r, o),
|
|
1813
1815
|
...yt(t, e, n, r, o)
|
|
1814
1816
|
],
|
|
1815
1817
|
originalInterPoint: () => [
|
|
1816
|
-
...gt(
|
|
1818
|
+
...gt(d, s),
|
|
1817
1819
|
...gt(t, s)
|
|
1818
1820
|
]
|
|
1819
1821
|
};
|
|
1820
1822
|
return c[a] ? c[a]() : c.originalInterPoint();
|
|
1821
1823
|
}
|
|
1822
|
-
function le(
|
|
1824
|
+
function le(d, t) {
|
|
1823
1825
|
const e = /* @__PURE__ */ new Set();
|
|
1824
|
-
return
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
(
|
|
1826
|
+
return d.forEach((n) => {
|
|
1827
|
+
const s = /* @__PURE__ */ new Map();
|
|
1828
|
+
n.map((i) => {
|
|
1829
|
+
t.get(i)?.forEach((o) => {
|
|
1830
|
+
s.has(o.line) || s.set(o.line, []), s.get(o.line)?.push({ intersect: o, targetLine: i });
|
|
1831
|
+
});
|
|
1832
|
+
});
|
|
1833
|
+
for (let i = 1; i < n.length; i++) {
|
|
1834
|
+
const r = n[i], o = n[i - 1];
|
|
1835
|
+
[...t.get(r) ?? [], ...t.get(o) ?? []].forEach((c) => {
|
|
1836
|
+
(c.line.sameEndpointAsStart(r) && c.line.sameEndpointAsEnd(o) || c.line.sameEndpointAsStart(o) && c.line.sameEndpointAsEnd(r)) && e.add(c);
|
|
1829
1837
|
});
|
|
1830
1838
|
}
|
|
1831
|
-
}),
|
|
1839
|
+
}), d.map((n) => n.filter((s) => !e.has(s)));
|
|
1832
1840
|
}
|
|
1833
|
-
function he(
|
|
1841
|
+
function he(d, t = 0.1, e) {
|
|
1834
1842
|
const { fittingMethod: n = "average" } = e ?? {};
|
|
1835
|
-
return
|
|
1843
|
+
return d.map((s) => {
|
|
1836
1844
|
if (s.length === 0) return;
|
|
1837
1845
|
if (s.length === 1) return s[0];
|
|
1838
1846
|
const i = [];
|
|
@@ -1840,34 +1848,34 @@ function he(u, t = 0.1, e) {
|
|
|
1840
1848
|
const r = n === "average" ? A.mergeLines(...s) : A.mergeLinesByMaxlength(...s);
|
|
1841
1849
|
r.userData.rooftopPz = Math.min(
|
|
1842
1850
|
...s.map((h) => {
|
|
1843
|
-
const { drawDoorData:
|
|
1851
|
+
const { drawDoorData: u, drawWindow: f, rooftopPz: p, ...y } = h.userData;
|
|
1844
1852
|
return Object.assign(r.userData, y), p ?? 1 / 0;
|
|
1845
1853
|
})
|
|
1846
1854
|
), r.userData.rooftopPz === 1 / 0 && (r.userData.rooftopPz = 0);
|
|
1847
1855
|
let o = 1 / 0, a = -1 / 0;
|
|
1848
1856
|
const c = s[0].normal().normalize();
|
|
1849
1857
|
o = 1 / 0, a = -1 / 0, i.forEach((h) => {
|
|
1850
|
-
const
|
|
1851
|
-
o = Math.min(o,
|
|
1858
|
+
const u = h.x * c.x + h.y * c.y;
|
|
1859
|
+
o = Math.min(o, u), a = Math.max(a, u);
|
|
1852
1860
|
});
|
|
1853
1861
|
const l = a - o;
|
|
1854
1862
|
return l >= t && (r.userData.wallWidth = l), s.forEach((h) => h.userData.fittedLine = r), r;
|
|
1855
1863
|
}).filter((s) => !!s);
|
|
1856
1864
|
}
|
|
1857
|
-
function mt(
|
|
1858
|
-
const e = new F(N.fromByLineSegment(...
|
|
1859
|
-
|
|
1865
|
+
function mt(d, t = 0.4) {
|
|
1866
|
+
const e = new F(N.fromByLineSegment(...d));
|
|
1867
|
+
d.forEach((s) => e.insert(s));
|
|
1860
1868
|
const n = new A();
|
|
1861
|
-
for (let s = 0; s <
|
|
1862
|
-
const i =
|
|
1869
|
+
for (let s = 0; s < d.length; s++) {
|
|
1870
|
+
const i = d[s];
|
|
1863
1871
|
if (i.userData.isAdsorbed) continue;
|
|
1864
1872
|
const r = i.direction().multiplyScalar(t), [o, a] = i.points.map((c) => {
|
|
1865
1873
|
n.set(c, c), n.start.add(r), n.end.add(r.multiplyScalar(-1));
|
|
1866
|
-
const l = /* @__PURE__ */ new Map(), h = e.queryLineSegment(n).filter((
|
|
1867
|
-
const f =
|
|
1868
|
-
return l.set(
|
|
1869
|
-
}).sort((
|
|
1870
|
-
const p = l.get(
|
|
1874
|
+
const l = /* @__PURE__ */ new Map(), h = e.queryLineSegment(n).filter((u) => u.line !== i).map((u) => {
|
|
1875
|
+
const f = u.line.getIntersection(n);
|
|
1876
|
+
return l.set(u.line, f), u.line;
|
|
1877
|
+
}).sort((u, f) => {
|
|
1878
|
+
const p = l.get(u), y = l.get(f);
|
|
1871
1879
|
return p && y ? p.distance(c) - y.distance(c) : 0;
|
|
1872
1880
|
});
|
|
1873
1881
|
return h.length ? l.get(h[0]) : void 0;
|
|
@@ -1875,55 +1883,57 @@ function mt(u, t = 0.4) {
|
|
|
1875
1883
|
if (o && a) {
|
|
1876
1884
|
if (o.equal(a)) {
|
|
1877
1885
|
const c = i.start.distance(o), l = i.end.distance(a);
|
|
1878
|
-
c < l ? i.directionMove(i.
|
|
1886
|
+
c < l ? i.directionMove(i.end.direction(i.start), c) : i.directionMove(i.start.direction(i.end), l);
|
|
1879
1887
|
} else
|
|
1880
1888
|
i.start.copy(o), i.end.copy(a);
|
|
1881
1889
|
i.userData.isAdsorbed = !0;
|
|
1882
1890
|
} else o ? i.directionMove(o.direction(i.start), i.start.distance(o)) : a && i.directionMove(a.direction(i.end), i.end.distance(a));
|
|
1883
1891
|
e.update(i);
|
|
1884
1892
|
}
|
|
1885
|
-
return
|
|
1893
|
+
return d.filter((s) => s.length() > 1e-3);
|
|
1886
1894
|
}
|
|
1887
|
-
function ue(
|
|
1888
|
-
const e = new X();
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
if (
|
|
1900
|
-
const
|
|
1901
|
-
if (l)
|
|
1902
|
-
|
|
1903
|
-
|
|
1895
|
+
function ue(d, t) {
|
|
1896
|
+
const e = new X(), n = new F(N.fromByLineSegment(...d));
|
|
1897
|
+
d.forEach((r) => {
|
|
1898
|
+
r.userData.isDoor || (n.insert(r), r.points.forEach((o) => e.insert(o, r)));
|
|
1899
|
+
});
|
|
1900
|
+
const s = /* @__PURE__ */ new Map();
|
|
1901
|
+
function i(r, o) {
|
|
1902
|
+
s.has(r) || s.set(r, []), s.get(r)?.push(o);
|
|
1903
|
+
}
|
|
1904
|
+
for (let r = 0; r < d.length; r++) {
|
|
1905
|
+
const o = d[r];
|
|
1906
|
+
o.points.forEach((a) => {
|
|
1907
|
+
if (e.queryPoint(a).filter((f) => f.userData !== o).length !== 0 || n.queryCircle(a, 1e-3).filter((f) => f.line !== o).length > 0) return;
|
|
1908
|
+
const l = e.queryCircle(a, t).filter((f) => f.userData !== o && f.userData?.vertical(o)).sort((f, p) => f.point.distance(a) - p.point.distance(a));
|
|
1909
|
+
if (!l.length) return;
|
|
1910
|
+
const h = l[0], u = h.userData?.projectPoint(a, !1);
|
|
1911
|
+
if (u) {
|
|
1912
|
+
const f = h.userData;
|
|
1913
|
+
i(o, new A(a.clone(), u.clone())), i(f, new A(h.point.clone(), u.clone()));
|
|
1904
1914
|
}
|
|
1905
1915
|
});
|
|
1906
1916
|
}
|
|
1907
|
-
return
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
}),
|
|
1917
|
+
return s.forEach((r, o) => {
|
|
1918
|
+
const a = A.mergeLines(o, ...r);
|
|
1919
|
+
o.set(a.start, a.end);
|
|
1920
|
+
}), d;
|
|
1911
1921
|
}
|
|
1912
|
-
function de(
|
|
1922
|
+
function de(d, t) {
|
|
1913
1923
|
const { snapThreshold: e = 0.2 } = t ?? {};
|
|
1914
|
-
return
|
|
1924
|
+
return d = mt(d, e), d = mt(d, e), d = ue(d, e), d;
|
|
1915
1925
|
}
|
|
1916
|
-
function fe(
|
|
1926
|
+
function fe(d) {
|
|
1917
1927
|
const t = /* @__PURE__ */ new Set();
|
|
1918
|
-
for (let e = 0; e <
|
|
1919
|
-
const n =
|
|
1928
|
+
for (let e = 0; e < d.length; e++) {
|
|
1929
|
+
const n = d[e], s = n.userData.fittedLine;
|
|
1920
1930
|
s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : tt(n);
|
|
1921
1931
|
}
|
|
1922
1932
|
t.forEach((e) => tt(e));
|
|
1923
1933
|
}
|
|
1924
|
-
function pe(
|
|
1925
|
-
for (let t = 0; t <
|
|
1926
|
-
const e =
|
|
1934
|
+
function pe(d) {
|
|
1935
|
+
for (let t = 0; t < d.length; t++) {
|
|
1936
|
+
const e = d[t];
|
|
1927
1937
|
let { endIntersection: n, startIntersection: s } = e.userData;
|
|
1928
1938
|
if (!(!n || !s)) {
|
|
1929
1939
|
if (s.userData.fittedLine && (s = s.userData.fittedLine), n.userData.fittedLine && (n = n.userData.fittedLine), e.parallel(s))
|
|
@@ -1940,11 +1950,11 @@ function pe(u) {
|
|
|
1940
1950
|
}
|
|
1941
1951
|
}
|
|
1942
1952
|
}
|
|
1943
|
-
return
|
|
1953
|
+
return d;
|
|
1944
1954
|
}
|
|
1945
|
-
function ye(
|
|
1955
|
+
function ye(d, t = 0.01) {
|
|
1946
1956
|
const e = new X();
|
|
1947
|
-
return
|
|
1957
|
+
return d.forEach((n) => n.points.forEach((s) => e.insert(s, n))), d.filter((n) => {
|
|
1948
1958
|
if (n.length() <= t) {
|
|
1949
1959
|
const s = e.queryPoint(n.start).filter((r) => r.userData !== n).length === 0, i = e.queryPoint(n.end).filter((r) => r.userData !== n).length === 0;
|
|
1950
1960
|
if (s || i) return !1;
|
|
@@ -1961,14 +1971,14 @@ class Pt {
|
|
|
1961
1971
|
*/
|
|
1962
1972
|
static correction(t, e, n) {
|
|
1963
1973
|
t = re(t.map((x) => x.clone()));
|
|
1964
|
-
const s = oe(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = ae(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(),
|
|
1974
|
+
const s = oe(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = ae(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new A(
|
|
1965
1975
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
1966
1976
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
1967
1977
|
), f = new A(
|
|
1968
1978
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
1969
1979
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
1970
1980
|
);
|
|
1971
|
-
let p = ce(i, r,
|
|
1981
|
+
let p = ce(i, r, u, f, s, n);
|
|
1972
1982
|
p = le(p, s);
|
|
1973
1983
|
let y = he(p, 0.1, n);
|
|
1974
1984
|
return y = de(y, n), fe(a), pe(o), y = lt(y, 1e-9), y.push(...o), y = ye(y, 0.08), y = y, y;
|
|
@@ -1978,8 +1988,8 @@ const xe = new A(
|
|
|
1978
1988
|
new M(0, 0),
|
|
1979
1989
|
new M(0, 1)
|
|
1980
1990
|
);
|
|
1981
|
-
function ge(
|
|
1982
|
-
const t = [...
|
|
1991
|
+
function ge(d) {
|
|
1992
|
+
const t = [...d].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
|
|
1983
1993
|
let r = parseInt(xe.includedAngle(i) + "");
|
|
1984
1994
|
return r > 90 && (r = 180 - r), r;
|
|
1985
1995
|
}), n = /* @__PURE__ */ new Map();
|
|
@@ -1987,10 +1997,10 @@ function ge(u) {
|
|
|
1987
1997
|
n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
|
|
1988
1998
|
}), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
|
|
1989
1999
|
}
|
|
1990
|
-
function me(
|
|
2000
|
+
function me(d) {
|
|
1991
2001
|
let t = [], e = -1;
|
|
1992
2002
|
const n = [];
|
|
1993
|
-
return
|
|
2003
|
+
return d.forEach(({ start: i, end: r, ...o }, a) => {
|
|
1994
2004
|
n.push(i.z ?? 0, r.z ?? 0);
|
|
1995
2005
|
const c = new A(
|
|
1996
2006
|
M.from(i),
|
|
@@ -2047,17 +2057,17 @@ const we = {
|
|
|
2047
2057
|
Parsecs: 3240779289666404e-32
|
|
2048
2058
|
// 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
|
|
2049
2059
|
};
|
|
2050
|
-
function wt(
|
|
2060
|
+
function wt(d) {
|
|
2051
2061
|
const t = [];
|
|
2052
|
-
for (let e = 0; e <
|
|
2062
|
+
for (let e = 0; e < d.length; e++)
|
|
2053
2063
|
t.push(new A(
|
|
2054
|
-
|
|
2055
|
-
|
|
2064
|
+
d[e].clone(),
|
|
2065
|
+
d[(e + 1) % d.length].clone()
|
|
2056
2066
|
));
|
|
2057
2067
|
return t;
|
|
2058
2068
|
}
|
|
2059
|
-
function Mt(
|
|
2060
|
-
return
|
|
2069
|
+
function Mt(d) {
|
|
2070
|
+
return d.flatMap((t, e) => (e === d.length - 1 && [...t.points, d[0].points[0]], [t.points[0]]));
|
|
2061
2071
|
}
|
|
2062
2072
|
class k extends _ {
|
|
2063
2073
|
static name = "Dxf";
|
|
@@ -2172,8 +2182,8 @@ class k extends _ {
|
|
|
2172
2182
|
createGroups() {
|
|
2173
2183
|
const t = [], e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), i = (r, o, a = -1) => {
|
|
2174
2184
|
if (!this.data[r]) return;
|
|
2175
|
-
const [c, l, h,
|
|
2176
|
-
if (e.add(r),
|
|
2185
|
+
const [c, l, h, u] = this.data[r];
|
|
2186
|
+
if (e.add(r), u)
|
|
2177
2187
|
return s.has(r) || s.set(r, []), s.get(r)?.push(a), n.add(this.data[r]);
|
|
2178
2188
|
o.push([c, l]), h.forEach((f) => {
|
|
2179
2189
|
e.has(f) || i(f, o, r);
|
|
@@ -2299,9 +2309,9 @@ class k extends _ {
|
|
|
2299
2309
|
continue;
|
|
2300
2310
|
}
|
|
2301
2311
|
let l = n[++r];
|
|
2302
|
-
const h = s[s.length - 1],
|
|
2312
|
+
const h = s[s.length - 1], u = h.direction();
|
|
2303
2313
|
for (; r < n.length; ) {
|
|
2304
|
-
const p =
|
|
2314
|
+
const p = u.angleBetween(l.direction()) / i;
|
|
2305
2315
|
if (l.length() <= e || p < 4 || p > 176)
|
|
2306
2316
|
l = n[++r];
|
|
2307
2317
|
else break;
|
|
@@ -2408,13 +2418,13 @@ class k extends _ {
|
|
|
2408
2418
|
function i(c, l) {
|
|
2409
2419
|
n.line.push([c.x * e, c.y * e, l.x * e, l.y * e, s]);
|
|
2410
2420
|
}
|
|
2411
|
-
function r(c, l, h,
|
|
2421
|
+
function r(c, l, h, u) {
|
|
2412
2422
|
n.arc.push([
|
|
2413
2423
|
c.x * e,
|
|
2414
2424
|
c.y * e,
|
|
2415
2425
|
l * e,
|
|
2416
2426
|
h,
|
|
2417
|
-
|
|
2427
|
+
u,
|
|
2418
2428
|
s
|
|
2419
2429
|
]);
|
|
2420
2430
|
}
|
|
@@ -2427,7 +2437,7 @@ class k extends _ {
|
|
|
2427
2437
|
}
|
|
2428
2438
|
this.wallsGroup.forEach((c) => {
|
|
2429
2439
|
for (let l = 0; l < c.length; l++) {
|
|
2430
|
-
const h = c[l],
|
|
2440
|
+
const h = c[l], u = l === c.length - 1 ? 0 : l + 1, f = c[u];
|
|
2431
2441
|
i(h, f);
|
|
2432
2442
|
}
|
|
2433
2443
|
});
|
|
@@ -2438,28 +2448,28 @@ class k extends _ {
|
|
|
2438
2448
|
if (s = "cyan", l.length() < 1.2) {
|
|
2439
2449
|
l.expansion(-o * 0.5);
|
|
2440
2450
|
const h = c.normal();
|
|
2441
|
-
let
|
|
2451
|
+
let u = new A(
|
|
2442
2452
|
l.start.clone(),
|
|
2443
2453
|
l.start.clone().add(h.clone().multiplyScalar(l.length()))
|
|
2444
2454
|
);
|
|
2445
|
-
const f =
|
|
2455
|
+
const f = u.clone().directionMove(u.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
|
|
2446
2456
|
for (let g = 0; g < a.length; g++)
|
|
2447
2457
|
if (a[g].intersectRectangle(f)) {
|
|
2448
|
-
|
|
2458
|
+
u = new A(
|
|
2449
2459
|
l.start.clone(),
|
|
2450
2460
|
l.start.clone().add(h.clone().multiplyScalar(-l.length()))
|
|
2451
2461
|
);
|
|
2452
2462
|
break;
|
|
2453
2463
|
}
|
|
2454
|
-
|
|
2455
|
-
const p = l.length(), y =
|
|
2464
|
+
u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
|
|
2465
|
+
const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [D, w] = this.getArcAngleRange(m, l.end, u.end);
|
|
2456
2466
|
r(m, x, Math.min(D, w), Math.max(D, w)), a.push(f);
|
|
2457
2467
|
} else
|
|
2458
|
-
l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h,
|
|
2468
|
+
l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), o * 0.5).directionMove(l.direction(), o * 0.5).expansion(-l.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), -o * 0.5).directionMove(l.direction(), -o * 0.5).expansion(-l.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u));
|
|
2459
2469
|
}), s = "yellow", this.lineSegments.forEach((c) => {
|
|
2460
2470
|
if (!c.userData.isWindow) return !1;
|
|
2461
2471
|
Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
|
|
2462
|
-
const { p: h, width:
|
|
2472
|
+
const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new A(p, y);
|
|
2463
2473
|
i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, D) => i(m, D));
|
|
2464
2474
|
});
|
|
2465
2475
|
}), n;
|
|
@@ -2485,12 +2495,12 @@ class k extends _ {
|
|
|
2485
2495
|
};
|
|
2486
2496
|
i.width = s.width + r * 2, i.height = s.height + r * 2;
|
|
2487
2497
|
const a = i.getContext("2d");
|
|
2488
|
-
return n && (a.fillStyle = n, a.fillRect(0, 0, i.width, i.height)), a.translate(s.width * 0.5 + r, s.height * 0.5 + r), a.scale(1, -1), s.line.forEach(([c, l, h,
|
|
2489
|
-
a.strokeStyle = o[f], a.beginPath(), a.moveTo(c, l), a.lineTo(h,
|
|
2490
|
-
}), s.arc.forEach(([c, l, h,
|
|
2491
|
-
a.strokeStyle = o[p], a.beginPath(), a.arc(c, l, h,
|
|
2498
|
+
return n && (a.fillStyle = n, a.fillRect(0, 0, i.width, i.height)), a.translate(s.width * 0.5 + r, s.height * 0.5 + r), a.scale(1, -1), s.line.forEach(([c, l, h, u, f]) => {
|
|
2499
|
+
a.strokeStyle = o[f], a.beginPath(), a.moveTo(c, l), a.lineTo(h, u), a.closePath(), a.stroke();
|
|
2500
|
+
}), s.arc.forEach(([c, l, h, u, f, p]) => {
|
|
2501
|
+
a.strokeStyle = o[p], a.beginPath(), a.arc(c, l, h, u * (Math.PI / 180), f * (Math.PI / 180)), a.stroke();
|
|
2492
2502
|
}), a.beginPath(), s.dimensionLine.forEach((c) => {
|
|
2493
|
-
let [l, h,
|
|
2503
|
+
let [l, h, u, f] = c;
|
|
2494
2504
|
const p = Math.min(h, f), y = Math.max(h, f), x = (i.width * 0.5 - 0.4 * s.scale) * (l < 0 ? -1 : 1), m = (y - p) * 0.45;
|
|
2495
2505
|
a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x, m + p), a.moveTo(x, y), a.lineTo(x, y - m), a.moveTo(x - 0.1 * s.scale, y), a.lineTo(x + 0.1 * s.scale, y);
|
|
2496
2506
|
}), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in i ? new Promise((c) => {
|
|
@@ -2588,13 +2598,13 @@ class k extends _ {
|
|
|
2588
2598
|
});
|
|
2589
2599
|
}
|
|
2590
2600
|
}
|
|
2591
|
-
function ct(
|
|
2592
|
-
if (
|
|
2593
|
-
if (
|
|
2594
|
-
if (Array.isArray(
|
|
2601
|
+
function ct(d) {
|
|
2602
|
+
if (d === null || typeof d != "object") return d;
|
|
2603
|
+
if (d instanceof Date) return new Date(d.getTime());
|
|
2604
|
+
if (Array.isArray(d)) return d.map(ct);
|
|
2595
2605
|
const t = {};
|
|
2596
|
-
for (const e in
|
|
2597
|
-
Object.prototype.hasOwnProperty.call(
|
|
2606
|
+
for (const e in d)
|
|
2607
|
+
Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ct(d[e]));
|
|
2598
2608
|
return t;
|
|
2599
2609
|
}
|
|
2600
2610
|
const z = new A();
|
|
@@ -2610,8 +2620,8 @@ class Me extends k {
|
|
|
2610
2620
|
for (let c = 0; c < e.originalData.length; c++) {
|
|
2611
2621
|
const l = e.originalData[c];
|
|
2612
2622
|
if (z.start.copy(l.start), z.end.copy(l.end), l.isVerticalReferenceLine) {
|
|
2613
|
-
const [h,
|
|
2614
|
-
s = -new A(h,
|
|
2623
|
+
const [h, u] = l.start.y < l.end.y ? [z.start, z.end] : [z.end, z.start];
|
|
2624
|
+
s = -new A(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
|
|
2615
2625
|
break;
|
|
2616
2626
|
}
|
|
2617
2627
|
(!i || z.length() > i.length()) && (i = z.clone(), i.userData.index = c);
|
|
@@ -2622,10 +2632,10 @@ class Me extends k {
|
|
|
2622
2632
|
s = -new A(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
|
|
2623
2633
|
}
|
|
2624
2634
|
const r = e.originalBox.center, o = M.zero(), a = e.originalData.map((c) => {
|
|
2625
|
-
const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z),
|
|
2626
|
-
return
|
|
2635
|
+
const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z), u = Object.assign(ct(c), { start: l, end: h });
|
|
2636
|
+
return u.drawWindow && u.drawWindow.forEach((f) => {
|
|
2627
2637
|
f.p = o.copy(f.p).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(f.p.z);
|
|
2628
|
-
}),
|
|
2638
|
+
}), u;
|
|
2629
2639
|
});
|
|
2630
2640
|
n.appendLineSegmentList.forEach((c) => {
|
|
2631
2641
|
const l = c.clone();
|
|
@@ -2732,13 +2742,13 @@ class Se {
|
|
|
2732
2742
|
return o.forEach((c) => {
|
|
2733
2743
|
const l = new A(c?.start, c?.end), h = l.length();
|
|
2734
2744
|
if (h < n) return;
|
|
2735
|
-
const
|
|
2745
|
+
const u = l.normal(), f = l.direction(), p = (h - r.width * 2) / 2;
|
|
2736
2746
|
for (let y = 0; y < 3; y++) {
|
|
2737
2747
|
const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), m = new A(
|
|
2738
2748
|
x,
|
|
2739
|
-
x.clone().add(
|
|
2749
|
+
x.clone().add(u.clone().multiplyScalar(1))
|
|
2740
2750
|
);
|
|
2741
|
-
if (m.directionMove(
|
|
2751
|
+
if (m.directionMove(u, -0.5), this.quadtree.queryLineSegment(m).length) return;
|
|
2742
2752
|
}
|
|
2743
2753
|
a.push(l);
|
|
2744
2754
|
}), a;
|
|
@@ -2786,8 +2796,8 @@ class Se {
|
|
|
2786
2796
|
} else if (o.drawDoorData) {
|
|
2787
2797
|
const a = M.from(o.drawDoorData.start), c = M.from(o.drawDoorData.n), l = s.queryPoint(a).filter((h) => {
|
|
2788
2798
|
if (h.userData === r) return !1;
|
|
2789
|
-
const
|
|
2790
|
-
|
|
2799
|
+
const u = h.userData, f = u.direction();
|
|
2800
|
+
u.start.equal(a) && f.multiplyScalar(-1);
|
|
2791
2801
|
const p = c.angleBetween(f, "angle");
|
|
2792
2802
|
return p > 170 || p < 10;
|
|
2793
2803
|
});
|
|
@@ -2826,7 +2836,9 @@ class Se {
|
|
|
2826
2836
|
m.start === x && g.multiplyScalar(-1);
|
|
2827
2837
|
const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), E = [];
|
|
2828
2838
|
for (let L = 0; L < S.length; L++) {
|
|
2829
|
-
const b = e.findIndex((O) => O.point === S[L].point)
|
|
2839
|
+
const b = e.findIndex((O) => O.point === S[L].point);
|
|
2840
|
+
if (b === -1) continue;
|
|
2841
|
+
const R = t[D].uuid, P = e[b].uuid;
|
|
2830
2842
|
if (w.has(`${R}.${P}`)) continue;
|
|
2831
2843
|
w.add(`${R}.${P}`), w.add(`${P}.${R}`);
|
|
2832
2844
|
const B = S[L].point, C = new A(x.clone(), B.clone());
|
|
@@ -2867,18 +2879,18 @@ class Se {
|
|
|
2867
2879
|
h.has(D.doorUuid) || h.set(D.doorUuid, []), h.get(D.doorUuid)?.push(D), h.has(D.findUuid) || h.set(D.findUuid, []), h.get(D.findUuid)?.push(D);
|
|
2868
2880
|
}
|
|
2869
2881
|
});
|
|
2870
|
-
const
|
|
2882
|
+
const u = /* @__PURE__ */ new Set();
|
|
2871
2883
|
h.forEach((x) => {
|
|
2872
2884
|
if (x.length > 1) {
|
|
2873
2885
|
x.sort((m, D) => m.doorLine.length() - D.doorLine.length());
|
|
2874
|
-
for (let m = 1; m < x.length; m++)
|
|
2886
|
+
for (let m = 1; m < x.length; m++) u.add(x[m]);
|
|
2875
2887
|
}
|
|
2876
2888
|
});
|
|
2877
2889
|
const f = [], p = [];
|
|
2878
2890
|
l.forEach((x) => {
|
|
2879
2891
|
if (x.length) {
|
|
2880
2892
|
const m = x[0];
|
|
2881
|
-
|
|
2893
|
+
u.has(m) || (f.push(m), p.push(m.doorUuid, m.findUuid));
|
|
2882
2894
|
}
|
|
2883
2895
|
});
|
|
2884
2896
|
const y = [];
|
|
@@ -2937,22 +2949,22 @@ class Se {
|
|
|
2937
2949
|
searchAlongNormalDirection({ point: t, line: e }, n = this.doorSearchDistance) {
|
|
2938
2950
|
const s = this.pointVirtualGrid, i = this.quadtree, r = e.direction(), o = e.start.normal(e.end), a = e.start.clone();
|
|
2939
2951
|
e.start === t && r.multiplyScalar(-1), e.start === t && a.copy(e.end);
|
|
2940
|
-
const c = s.queryPoint(a).filter((
|
|
2941
|
-
for (let
|
|
2942
|
-
const f = c[
|
|
2952
|
+
const c = s.queryPoint(a).filter((u) => u.userData !== e);
|
|
2953
|
+
for (let u = 0; u < c.length; u++) {
|
|
2954
|
+
const f = c[u], p = f.userData, y = p.direction();
|
|
2943
2955
|
if (p.start === f.point && r.multiplyScalar(-1), y.angleBetween(o) / (Math.PI / 180) > 90) {
|
|
2944
2956
|
o.multiplyScalar(-1);
|
|
2945
2957
|
break;
|
|
2946
2958
|
}
|
|
2947
2959
|
}
|
|
2948
|
-
const l = new A(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((
|
|
2949
|
-
point:
|
|
2950
|
-
line:
|
|
2951
|
-
})).filter((
|
|
2960
|
+
const l = new A(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((u) => ({
|
|
2961
|
+
point: u.line.getIntersection(l),
|
|
2962
|
+
line: u.line
|
|
2963
|
+
})).filter((u) => u.point).sort((u, f) => t.distance(u.point) - t.distance(f.point));
|
|
2952
2964
|
if (h.length) {
|
|
2953
|
-
const
|
|
2954
|
-
if (Math.abs(90 -
|
|
2955
|
-
return
|
|
2965
|
+
const u = h[0];
|
|
2966
|
+
if (Math.abs(90 - u.line.direction().angleBetween(o, "angle")) < 5)
|
|
2967
|
+
return u;
|
|
2956
2968
|
}
|
|
2957
2969
|
}
|
|
2958
2970
|
/**
|
|
@@ -3033,13 +3045,13 @@ class De extends _ {
|
|
|
3033
3045
|
createRectangle(t) {
|
|
3034
3046
|
const e = this.Dxf, n = t.project, s = t.project2;
|
|
3035
3047
|
n.includedAngle(s) > 135 && (s.points = [s.points[1], s.points[0]]), this.addData(n.points[0], s.points[0]), this.addData(n.points[1], s.points[1]);
|
|
3036
|
-
const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / e.width), a = i / o, c = r / o, l = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]),
|
|
3048
|
+
const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / e.width), a = i / o, c = r / o, l = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), u = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(u);
|
|
3037
3049
|
p.multiplyScalar(e.width * 0.5);
|
|
3038
|
-
const y =
|
|
3050
|
+
const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), D = y.direction(x);
|
|
3039
3051
|
if (!(m.x > 0 && D.x < 0 || m.x < 0 && D.x > 0 || m.y > 0 && D.y < 0 || m.y < 0 && D.y > 0)) {
|
|
3040
|
-
|
|
3052
|
+
u.set(y.x, y.y), f.set(x.x, x.y);
|
|
3041
3053
|
for (let w = 1; w < o; w++) {
|
|
3042
|
-
const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), E =
|
|
3054
|
+
const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), E = u.clone().add(g), L = f.clone().add(S);
|
|
3043
3055
|
this.addData(E, L);
|
|
3044
3056
|
}
|
|
3045
3057
|
}
|
|
@@ -3125,8 +3137,8 @@ class Le extends _ {
|
|
|
3125
3137
|
const t = this.parent?.findComponentByName("LineAnalysis"), e = this.parent?.findComponentByName("Dxf"), n = this.parent?.findComponentByName("AngleCorrectionDxf"), s = /* @__PURE__ */ new Map();
|
|
3126
3138
|
let i = [...e.lineSegments], r = [], o = [];
|
|
3127
3139
|
t.resultList.forEach((l) => {
|
|
3128
|
-
const h = s.get(l.target) ?? [],
|
|
3129
|
-
f.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...f.points),
|
|
3140
|
+
const h = s.get(l.target) ?? [], u = s.get(l.source) ?? [], f = l.project.clone(), p = l.project2.clone();
|
|
3141
|
+
f.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...f.points), u.push(...p.points), s.set(l.target, h), s.set(l.source, u);
|
|
3130
3142
|
const y = new A(f.start, p.start), x = new A(f.end, p.end), m = new A(y.center, x.center);
|
|
3131
3143
|
m.userData.wallWidth = Math.max(y.length(), x.length()), r.push(m);
|
|
3132
3144
|
});
|
|
@@ -3134,19 +3146,19 @@ class Le extends _ {
|
|
|
3134
3146
|
i = i.filter((l) => {
|
|
3135
3147
|
if (o.indexOf(l) > -1) return !1;
|
|
3136
3148
|
if (s.has(l)) {
|
|
3137
|
-
const h = s.get(l),
|
|
3149
|
+
const h = s.get(l), u = l.clone();
|
|
3138
3150
|
if (h) {
|
|
3139
3151
|
for (let p = 0; p < h.length; p += 2) {
|
|
3140
3152
|
const y = h[p], x = h[p + 1];
|
|
3141
|
-
y.userData.length = y.distance(
|
|
3153
|
+
y.userData.length = y.distance(u.start), x.userData.length = x.distance(u.start), y.userData.type = "start", x.userData.type = "end", u.start.distance(y) > u.start.distance(x) && (h[p] = x, h[p + 1] = y, y.userData.type = "end", x.userData.type = "start");
|
|
3142
3154
|
}
|
|
3143
3155
|
h.sort((p, y) => p.userData.length - y.userData.length);
|
|
3144
3156
|
const f = [];
|
|
3145
3157
|
for (let p = 0; p < h.length; p++) {
|
|
3146
3158
|
const y = h[p];
|
|
3147
|
-
y.userData.type === "start" ? (f.length === 0 && (a.push(new A(
|
|
3159
|
+
y.userData.type === "start" ? (f.length === 0 && (a.push(new A(u.start.clone(), y.clone())), u.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && u.start.copy(y));
|
|
3148
3160
|
}
|
|
3149
|
-
a.push(
|
|
3161
|
+
a.push(u);
|
|
3150
3162
|
}
|
|
3151
3163
|
return !1;
|
|
3152
3164
|
}
|
|
@@ -3320,7 +3332,7 @@ class ut {
|
|
|
3320
3332
|
const P = L.projectPoint(E, !1);
|
|
3321
3333
|
E.copy(P), L.isPointOnSegment(P) || (L.start.distance(P) < L.end.distance(P) ? R.push(new A(P.clone(), L.start.clone())) : R.push(new A(P.clone(), L.end.clone())));
|
|
3322
3334
|
}
|
|
3323
|
-
} else if (!
|
|
3335
|
+
} else if (!u.includes(w) && E) {
|
|
3324
3336
|
let P = L.projectPoint(E, !1), B;
|
|
3325
3337
|
if (L.start.distance(E) < L.end.distance(E) ? B = L.start : B = L.end, P) {
|
|
3326
3338
|
R.push(new A(E.clone(), P.clone()));
|
|
@@ -3336,15 +3348,15 @@ class ut {
|
|
|
3336
3348
|
return E.userData = S, a.push(w.z ?? 0, g.z ?? 0), E;
|
|
3337
3349
|
});
|
|
3338
3350
|
const l = a.reduce((w, g) => w + g, 0) / a.length;
|
|
3339
|
-
let
|
|
3340
|
-
c = c.filter((w) => !
|
|
3351
|
+
let u = ut.findExtWallByTraj(c, o).filter((w) => w.userData.expandDirect);
|
|
3352
|
+
c = c.filter((w) => !u.includes(w)), c.push(...u);
|
|
3341
3353
|
const p = this.parent?.findComponentByName("Renderer");
|
|
3342
|
-
o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(
|
|
3343
|
-
const y = A.groupBySamePointAndParallel(
|
|
3354
|
+
o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(u, 0, { color: 65280 }).position.z = l + 1e-3;
|
|
3355
|
+
const y = A.groupBySamePointAndParallel(u), x = new F(N.fromByLineSegment(...c));
|
|
3344
3356
|
c.forEach((w) => w.userData.isDoor || x.insert(w));
|
|
3345
3357
|
const m = y.map((w) => w.flatMap((g) => s(g, x))), D = [];
|
|
3346
3358
|
return y.flatMap((w, g) => (w.forEach((E) => (i(E), x.update(E))), m[g].filter((E) => {
|
|
3347
|
-
if (!
|
|
3359
|
+
if (!u.includes(E.resultLine)) {
|
|
3348
3360
|
let L;
|
|
3349
3361
|
return Object.defineProperty(E, "newLine", {
|
|
3350
3362
|
get() {
|
|
@@ -3493,55 +3505,55 @@ const Dt = {
|
|
|
3493
3505
|
quaternion: "rotation",
|
|
3494
3506
|
morphTargetInfluences: "weights"
|
|
3495
3507
|
}, Ee = new Ft(), Lt = 12, Ae = 1179937895, Te = 2, Et = 8, be = 1313821514, Ie = 5130562;
|
|
3496
|
-
function H(
|
|
3497
|
-
return
|
|
3508
|
+
function H(d, t) {
|
|
3509
|
+
return d.length === t.length && d.every(function(e, n) {
|
|
3498
3510
|
return e === t[n];
|
|
3499
3511
|
});
|
|
3500
3512
|
}
|
|
3501
|
-
function Pe(
|
|
3502
|
-
return new TextEncoder().encode(
|
|
3513
|
+
function Pe(d) {
|
|
3514
|
+
return new TextEncoder().encode(d).buffer;
|
|
3503
3515
|
}
|
|
3504
|
-
function Re(
|
|
3505
|
-
return H(
|
|
3516
|
+
function Re(d) {
|
|
3517
|
+
return H(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
3506
3518
|
}
|
|
3507
|
-
function ve(
|
|
3519
|
+
function ve(d, t, e) {
|
|
3508
3520
|
const n = {
|
|
3509
|
-
min: new Array(
|
|
3510
|
-
max: new Array(
|
|
3521
|
+
min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
3522
|
+
max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
3511
3523
|
};
|
|
3512
3524
|
for (let s = t; s < t + e; s++)
|
|
3513
|
-
for (let i = 0; i <
|
|
3525
|
+
for (let i = 0; i < d.itemSize; i++) {
|
|
3514
3526
|
let r;
|
|
3515
|
-
|
|
3527
|
+
d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r = at.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
|
|
3516
3528
|
}
|
|
3517
3529
|
return n;
|
|
3518
3530
|
}
|
|
3519
|
-
function vt(
|
|
3520
|
-
return Math.ceil(
|
|
3531
|
+
function vt(d) {
|
|
3532
|
+
return Math.ceil(d / 4) * 4;
|
|
3521
3533
|
}
|
|
3522
|
-
function rt(
|
|
3523
|
-
const e = vt(
|
|
3524
|
-
if (e !==
|
|
3534
|
+
function rt(d, t = 0) {
|
|
3535
|
+
const e = vt(d.byteLength);
|
|
3536
|
+
if (e !== d.byteLength) {
|
|
3525
3537
|
const n = new Uint8Array(e);
|
|
3526
|
-
if (n.set(new Uint8Array(
|
|
3527
|
-
for (let s =
|
|
3538
|
+
if (n.set(new Uint8Array(d)), t !== 0)
|
|
3539
|
+
for (let s = d.byteLength; s < e; s++)
|
|
3528
3540
|
n[s] = t;
|
|
3529
3541
|
return n.buffer;
|
|
3530
3542
|
}
|
|
3531
|
-
return
|
|
3543
|
+
return d;
|
|
3532
3544
|
}
|
|
3533
3545
|
function At() {
|
|
3534
3546
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
3535
3547
|
}
|
|
3536
|
-
function Ne(
|
|
3537
|
-
if (typeof OffscreenCanvas < "u" &&
|
|
3548
|
+
function Ne(d, t) {
|
|
3549
|
+
if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
|
|
3538
3550
|
let e;
|
|
3539
|
-
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8),
|
|
3551
|
+
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
|
|
3540
3552
|
type: t,
|
|
3541
3553
|
quality: e
|
|
3542
3554
|
});
|
|
3543
3555
|
} else
|
|
3544
|
-
return new Promise((e) =>
|
|
3556
|
+
return new Promise((e) => d.toBlob(e, t));
|
|
3545
3557
|
}
|
|
3546
3558
|
class Ce {
|
|
3547
3559
|
constructor() {
|
|
@@ -3585,8 +3597,8 @@ class Ce {
|
|
|
3585
3597
|
const s = this, i = s.buffers, r = s.json;
|
|
3586
3598
|
n = s.options;
|
|
3587
3599
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
3588
|
-
l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? ot(c).then(function(
|
|
3589
|
-
const f = rt(
|
|
3600
|
+
l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? ot(c).then(function(u) {
|
|
3601
|
+
const f = rt(u), p = new DataView(new ArrayBuffer(Et));
|
|
3590
3602
|
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Ie, !0);
|
|
3591
3603
|
const y = rt(Pe(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Et));
|
|
3592
3604
|
x.setUint32(0, y.byteLength, !0), x.setUint32(4, be, !0);
|
|
@@ -3604,8 +3616,8 @@ class Ce {
|
|
|
3604
3616
|
ot(g).then((S) => {
|
|
3605
3617
|
e(S);
|
|
3606
3618
|
});
|
|
3607
|
-
}) : r.buffers && r.buffers.length > 0 ? He(c).then((
|
|
3608
|
-
r.buffers[0].uri =
|
|
3619
|
+
}) : r.buffers && r.buffers.length > 0 ? He(c).then((u) => {
|
|
3620
|
+
r.buffers[0].uri = u, e(r);
|
|
3609
3621
|
}) : e(r);
|
|
3610
3622
|
}
|
|
3611
3623
|
/**
|
|
@@ -3714,8 +3726,8 @@ class Ce {
|
|
|
3714
3726
|
l.data[y] = f(p[y] / 256) * 256;
|
|
3715
3727
|
}
|
|
3716
3728
|
c.putImageData(l, 0, 0);
|
|
3717
|
-
const
|
|
3718
|
-
return
|
|
3729
|
+
const u = (t || e).clone();
|
|
3730
|
+
return u.source = new jt(a), u.colorSpace = zt, u.channel = (t || e).channel, t && e && t.channel !== e.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), u;
|
|
3719
3731
|
}
|
|
3720
3732
|
async decompressTextureAsync(t, e = 1 / 0) {
|
|
3721
3733
|
if (this.textureUtils === null)
|
|
@@ -3767,12 +3779,12 @@ class Ce {
|
|
|
3767
3779
|
}
|
|
3768
3780
|
h % a !== 0 && (h += a - h % a);
|
|
3769
3781
|
}
|
|
3770
|
-
const
|
|
3782
|
+
const u = {
|
|
3771
3783
|
buffer: this.processBuffer(l.buffer),
|
|
3772
3784
|
byteOffset: this.byteOffset,
|
|
3773
3785
|
byteLength: c
|
|
3774
3786
|
};
|
|
3775
|
-
return i !== void 0 && (
|
|
3787
|
+
return i !== void 0 && (u.target = i), i === T.ARRAY_BUFFER && (u.byteStride = a), this.byteOffset += c, r.bufferViews.push(u), {
|
|
3776
3788
|
id: r.bufferViews.length - 1,
|
|
3777
3789
|
byteLength: 0
|
|
3778
3790
|
};
|
|
@@ -3859,7 +3871,7 @@ class Ce {
|
|
|
3859
3871
|
const l = r.images.get(t), h = s + ":flipY/" + n.toString();
|
|
3860
3872
|
if (l[h] !== void 0) return l[h];
|
|
3861
3873
|
o.images || (o.images = []);
|
|
3862
|
-
const
|
|
3874
|
+
const u = { mimeType: s }, f = At();
|
|
3863
3875
|
f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
|
|
3864
3876
|
const p = f.getContext("2d", {
|
|
3865
3877
|
willReadFrequently: !0
|
|
@@ -3876,10 +3888,10 @@ class Ce {
|
|
|
3876
3888
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
3877
3889
|
a.binary === !0 ? c.push(
|
|
3878
3890
|
Ne(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
|
|
3879
|
-
|
|
3891
|
+
u.bufferView = x;
|
|
3880
3892
|
})
|
|
3881
|
-
) :
|
|
3882
|
-
const y = o.images.push(
|
|
3893
|
+
) : u.uri = _t.getDataURL(f, s);
|
|
3894
|
+
const y = o.images.push(u) - 1;
|
|
3883
3895
|
return l[h] = y, y;
|
|
3884
3896
|
} else
|
|
3885
3897
|
throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");
|
|
@@ -3996,7 +4008,7 @@ class Ce {
|
|
|
3996
4008
|
const r = t.geometry;
|
|
3997
4009
|
let o;
|
|
3998
4010
|
t.isLineSegments ? o = T.LINES : t.isLineLoop ? o = T.LINE_LOOP : t.isLine ? o = T.LINE_STRIP : t.isPoints ? o = T.POINTS : o = t.material.wireframe ? T.LINES : T.TRIANGLES;
|
|
3999
|
-
const a = {}, c = {}, l = [], h = [],
|
|
4011
|
+
const a = {}, c = {}, l = [], h = [], u = {
|
|
4000
4012
|
uv: "TEXCOORD_0",
|
|
4001
4013
|
uv1: "TEXCOORD_1",
|
|
4002
4014
|
uv2: "TEXCOORD_2",
|
|
@@ -4010,7 +4022,7 @@ class Ce {
|
|
|
4010
4022
|
for (let g in r.attributes) {
|
|
4011
4023
|
if (g.slice(0, 5) === "morph") continue;
|
|
4012
4024
|
const S = r.attributes[g];
|
|
4013
|
-
if (g =
|
|
4025
|
+
if (g = u[g] || g.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g) || (g = "_" + g), e.attributes.has(this.getUID(S))) {
|
|
4014
4026
|
c[g] = e.attributes.get(this.getUID(S));
|
|
4015
4027
|
continue;
|
|
4016
4028
|
}
|
|
@@ -4151,15 +4163,15 @@ class Ce {
|
|
|
4151
4163
|
const i = t.tracks, r = [], o = [];
|
|
4152
4164
|
for (let c = 0; c < i.length; ++c) {
|
|
4153
4165
|
const l = i[c], h = Q.parseTrackName(l.name);
|
|
4154
|
-
let
|
|
4166
|
+
let u = Q.findNode(e, h.nodeName);
|
|
4155
4167
|
const f = Dt[h.propertyName];
|
|
4156
|
-
if (h.objectName === "bones" && (
|
|
4168
|
+
if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !f) {
|
|
4157
4169
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
|
|
4158
4170
|
continue;
|
|
4159
4171
|
}
|
|
4160
4172
|
const p = 1;
|
|
4161
4173
|
let y = l.values.length / l.times.length;
|
|
4162
|
-
f === Dt.morphTargetInfluences && (y /=
|
|
4174
|
+
f === Dt.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
|
|
4163
4175
|
let x;
|
|
4164
4176
|
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
|
|
4165
4177
|
input: this.processAccessor(new q(l.times, p)),
|
|
@@ -4168,7 +4180,7 @@ class Ce {
|
|
|
4168
4180
|
}), r.push({
|
|
4169
4181
|
sampler: o.length - 1,
|
|
4170
4182
|
target: {
|
|
4171
|
-
node: s.get(
|
|
4183
|
+
node: s.get(u),
|
|
4172
4184
|
path: f
|
|
4173
4185
|
}
|
|
4174
4186
|
});
|
|
@@ -4521,42 +4533,42 @@ class We {
|
|
|
4521
4533
|
const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new bt(), c = new Z(), l = new Ut(), h = new Z();
|
|
4522
4534
|
for (let f = 0; f < s.count; f++)
|
|
4523
4535
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
|
|
4524
|
-
const
|
|
4536
|
+
const u = {
|
|
4525
4537
|
TRANSLATION: n.processAccessor(new q(i, 3)),
|
|
4526
4538
|
ROTATION: n.processAccessor(new q(r, 4)),
|
|
4527
4539
|
SCALE: n.processAccessor(new q(o, 3))
|
|
4528
4540
|
};
|
|
4529
|
-
s.instanceColor && (
|
|
4541
|
+
s.instanceColor && (u._COLOR_0 = n.processAccessor(s.instanceColor)), e.extensions = e.extensions || {}, e.extensions[this.name] = { attributes: u }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
|
|
4530
4542
|
}
|
|
4531
4543
|
}
|
|
4532
4544
|
et.Utils = {
|
|
4533
|
-
insertKeyframe: function(
|
|
4534
|
-
const n =
|
|
4545
|
+
insertKeyframe: function(d, t) {
|
|
4546
|
+
const n = d.getValueSize(), s = new d.TimeBufferType(d.times.length + 1), i = new d.ValueBufferType(d.values.length + n), r = d.createInterpolant(new d.ValueBufferType(n));
|
|
4535
4547
|
let o;
|
|
4536
|
-
if (
|
|
4548
|
+
if (d.times.length === 0) {
|
|
4537
4549
|
s[0] = t;
|
|
4538
4550
|
for (let a = 0; a < n; a++)
|
|
4539
4551
|
i[a] = 0;
|
|
4540
4552
|
o = 0;
|
|
4541
|
-
} else if (t <
|
|
4542
|
-
if (Math.abs(
|
|
4543
|
-
s[0] = t, s.set(
|
|
4544
|
-
} else if (t >
|
|
4545
|
-
if (Math.abs(
|
|
4546
|
-
return
|
|
4547
|
-
s[s.length - 1] = t, s.set(
|
|
4553
|
+
} else if (t < d.times[0]) {
|
|
4554
|
+
if (Math.abs(d.times[0] - t) < 1e-3) return 0;
|
|
4555
|
+
s[0] = t, s.set(d.times, 1), i.set(r.evaluate(t), 0), i.set(d.values, n), o = 0;
|
|
4556
|
+
} else if (t > d.times[d.times.length - 1]) {
|
|
4557
|
+
if (Math.abs(d.times[d.times.length - 1] - t) < 1e-3)
|
|
4558
|
+
return d.times.length - 1;
|
|
4559
|
+
s[s.length - 1] = t, s.set(d.times, 0), i.set(d.values, 0), i.set(r.evaluate(t), d.values.length), o = s.length - 1;
|
|
4548
4560
|
} else
|
|
4549
|
-
for (let a = 0; a <
|
|
4550
|
-
if (Math.abs(
|
|
4551
|
-
if (
|
|
4552
|
-
s.set(
|
|
4561
|
+
for (let a = 0; a < d.times.length; a++) {
|
|
4562
|
+
if (Math.abs(d.times[a] - t) < 1e-3) return a;
|
|
4563
|
+
if (d.times[a] < t && d.times[a + 1] > t) {
|
|
4564
|
+
s.set(d.times.slice(0, a + 1), 0), s[a + 1] = t, s.set(d.times.slice(a + 1), a + 2), i.set(d.values.slice(0, (a + 1) * n), 0), i.set(r.evaluate(t), (a + 1) * n), i.set(d.values.slice((a + 1) * n), (a + 2) * n), o = a + 1;
|
|
4553
4565
|
break;
|
|
4554
4566
|
}
|
|
4555
4567
|
}
|
|
4556
|
-
return
|
|
4568
|
+
return d.times = s, d.values = i, o;
|
|
4557
4569
|
},
|
|
4558
|
-
mergeMorphTargetTracks: function(
|
|
4559
|
-
const e = [], n = {}, s =
|
|
4570
|
+
mergeMorphTargetTracks: function(d, t) {
|
|
4571
|
+
const e = [], n = {}, s = d.tracks;
|
|
4560
4572
|
for (let i = 0; i < s.length; ++i) {
|
|
4561
4573
|
let r = s[i];
|
|
4562
4574
|
const o = Q.parseTrackName(r.name), a = Q.findNode(t, o.nodeName);
|
|
@@ -4581,60 +4593,60 @@ et.Utils = {
|
|
|
4581
4593
|
h.name = (o.nodeName || "") + ".morphTargetInfluences", h.values = f, n[a.uuid] = h, e.push(h);
|
|
4582
4594
|
continue;
|
|
4583
4595
|
}
|
|
4584
|
-
const
|
|
4596
|
+
const u = r.createInterpolant(new r.ValueBufferType(1));
|
|
4585
4597
|
h = n[a.uuid];
|
|
4586
4598
|
for (let f = 0; f < h.times.length; f++)
|
|
4587
|
-
h.values[f * c + l] =
|
|
4599
|
+
h.values[f * c + l] = u.evaluate(h.times[f]);
|
|
4588
4600
|
for (let f = 0; f < r.times.length; f++) {
|
|
4589
4601
|
const p = this.insertKeyframe(h, r.times[f]);
|
|
4590
4602
|
h.values[p * c + l] = r.values[f];
|
|
4591
4603
|
}
|
|
4592
4604
|
}
|
|
4593
|
-
return
|
|
4605
|
+
return d.tracks = e, d;
|
|
4594
4606
|
},
|
|
4595
|
-
toFloat32BufferAttribute: function(
|
|
4596
|
-
const t = new q(new Float32Array(
|
|
4597
|
-
if (!
|
|
4598
|
-
return t.array.set(
|
|
4599
|
-
for (let e = 0, n =
|
|
4600
|
-
for (let s = 0; s <
|
|
4601
|
-
t.setComponent(e, s,
|
|
4607
|
+
toFloat32BufferAttribute: function(d) {
|
|
4608
|
+
const t = new q(new Float32Array(d.count * d.itemSize), d.itemSize, !1);
|
|
4609
|
+
if (!d.normalized && !d.isInterleavedBufferAttribute)
|
|
4610
|
+
return t.array.set(d.array), t;
|
|
4611
|
+
for (let e = 0, n = d.count; e < n; e++)
|
|
4612
|
+
for (let s = 0; s < d.itemSize; s++)
|
|
4613
|
+
t.setComponent(e, s, d.getComponent(e, s));
|
|
4602
4614
|
return t;
|
|
4603
4615
|
}
|
|
4604
4616
|
};
|
|
4605
|
-
async function He(
|
|
4617
|
+
async function He(d) {
|
|
4606
4618
|
if (typeof FileReader > "u") {
|
|
4607
|
-
const t = await
|
|
4608
|
-
return `data:${
|
|
4619
|
+
const t = await d.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
4620
|
+
return `data:${d.type};base64,${n}`;
|
|
4609
4621
|
} else
|
|
4610
4622
|
return new Promise((t, e) => {
|
|
4611
4623
|
const n = new FileReader();
|
|
4612
|
-
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(
|
|
4624
|
+
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(d);
|
|
4613
4625
|
});
|
|
4614
4626
|
}
|
|
4615
|
-
async function ot(
|
|
4616
|
-
if (typeof
|
|
4617
|
-
return await
|
|
4627
|
+
async function ot(d) {
|
|
4628
|
+
if (typeof d.arrayBuffer == "function")
|
|
4629
|
+
return await d.arrayBuffer();
|
|
4618
4630
|
if (typeof FileReader < "u")
|
|
4619
4631
|
return new Promise((t, e) => {
|
|
4620
4632
|
const n = new FileReader();
|
|
4621
|
-
n.onload = () => t(n.result), n.onerror = () => e(n.error), n.readAsArrayBuffer(
|
|
4633
|
+
n.onload = () => t(n.result), n.onerror = () => e(n.error), n.readAsArrayBuffer(d);
|
|
4622
4634
|
});
|
|
4623
4635
|
{
|
|
4624
|
-
const t = Buffer.from(await
|
|
4636
|
+
const t = Buffer.from(await d.text());
|
|
4625
4637
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
4626
4638
|
}
|
|
4627
4639
|
}
|
|
4628
4640
|
const Je = new ne(), $e = new et();
|
|
4629
|
-
function Ke(
|
|
4630
|
-
const n = t.normal(
|
|
4641
|
+
function Ke(d, t, e = 0.1) {
|
|
4642
|
+
const n = t.normal(d), s = t.direction(d).mutiplyScalar(e * 0.5), i = d.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
|
|
4631
4643
|
return {
|
|
4632
4644
|
points: [
|
|
4633
4645
|
// 第一条线
|
|
4634
|
-
new M(
|
|
4646
|
+
new M(d.x + r, d.y + o).add(i),
|
|
4635
4647
|
new M(t.x + r, t.y + o).add(s),
|
|
4636
4648
|
// 第二条线
|
|
4637
|
-
new M(
|
|
4649
|
+
new M(d.x - r, d.y - o).add(i),
|
|
4638
4650
|
new M(t.x - r, t.y - o).add(s)
|
|
4639
4651
|
],
|
|
4640
4652
|
indices: [0, 1, 1, 3, 3, 2, 2, 0],
|
|
@@ -4883,17 +4895,17 @@ const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4883
4895
|
DxfLineModel: Bt,
|
|
4884
4896
|
WhiteModel: Nt
|
|
4885
4897
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4886
|
-
function Tt(
|
|
4898
|
+
function Tt(d, t = {}) {
|
|
4887
4899
|
const {
|
|
4888
4900
|
detailsPoint: e = !0,
|
|
4889
4901
|
whiteModel: n = !0,
|
|
4890
4902
|
dxfLineModel: s = !0
|
|
4891
4903
|
} = t;
|
|
4892
|
-
s &&
|
|
4904
|
+
s && d.addComponent(new Bt()), n && d.addComponent(new Nt()), e && d.addComponent(new Ct());
|
|
4893
4905
|
}
|
|
4894
4906
|
const Qe = Object.assign(Tt, {
|
|
4895
|
-
create(
|
|
4896
|
-
return (t) => Tt(t,
|
|
4907
|
+
create(d = {}) {
|
|
4908
|
+
return (t) => Tt(t, d);
|
|
4897
4909
|
}
|
|
4898
4910
|
}), tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4899
4911
|
__proto__: null,
|
|
@@ -4907,7 +4919,7 @@ function nn() {
|
|
|
4907
4919
|
return import("./index3.js");
|
|
4908
4920
|
}
|
|
4909
4921
|
let dt = null;
|
|
4910
|
-
async function hn(
|
|
4922
|
+
async function hn(d, t, e = !1, n) {
|
|
4911
4923
|
const s = await Promise.resolve().then(() => tn), i = await en(), r = await nn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
|
|
4912
4924
|
detailsPoint: !1,
|
|
4913
4925
|
whiteModel: !0
|
|
@@ -4918,13 +4930,13 @@ async function hn(u, t, e = !1, n) {
|
|
|
4918
4930
|
orbitControls: e,
|
|
4919
4931
|
camera: t
|
|
4920
4932
|
})).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
|
|
4921
|
-
return a &&
|
|
4933
|
+
return a && d.appendChild(a.domElement), dt = o, {
|
|
4922
4934
|
dxfSystem: o,
|
|
4923
4935
|
getFileAll: () => sn(o)
|
|
4924
4936
|
};
|
|
4925
4937
|
}
|
|
4926
|
-
async function sn(
|
|
4927
|
-
const t =
|
|
4938
|
+
async function sn(d = dt) {
|
|
4939
|
+
const t = d.findComponentByName("WhiteModel"), e = new File([await d.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([d.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([d.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(d.Dxf.originalData)], "json.json", { type: "application/json" });
|
|
4928
4940
|
return {
|
|
4929
4941
|
dxf: n,
|
|
4930
4942
|
obj: i,
|