build-dxf 0.0.38 → 0.0.39
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/README.md +5 -0
- package/package.json +1 -1
- package/src/build.js +237 -197
- package/src/utils/DxfSystem/plugin/RenderPlugin/pages/Dxf.vue.d.ts +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ const whiteModel = dxfSystem.findComponentByType(components.WhiteModel)
|
|
|
22
22
|
// 获取详情点数据生成组件
|
|
23
23
|
const detailsPoint = dxfSystem.findComponentByType(components.DetailsPoint)
|
|
24
24
|
|
|
25
|
+
const threeVJia = dxfSystem.findComponentByName("ThreeVJia")
|
|
26
|
+
|
|
25
27
|
// trajectory222为轨迹文件数据
|
|
26
28
|
dxfSystem.Dxf.addEventListener("preprocessing", ({ setData, data }) => {
|
|
27
29
|
setData( utils.BoundExt.boundExtbyTraj.call(dxfSystem.Dxf, data, trajectory222 ) )
|
|
@@ -36,6 +38,9 @@ detailsPoint.addEventListener("handleSuccess", () => {
|
|
|
36
38
|
// 下载白模,gltf或glb格式, 第二个参数为true时是glb,默认为true
|
|
37
39
|
whiteModel.downloadGltf("001.glb", true)
|
|
38
40
|
|
|
41
|
+
// 下载三维家 json
|
|
42
|
+
threeVJia.download("json.json")
|
|
43
|
+
|
|
39
44
|
// 下载为图片
|
|
40
45
|
dxfSystem.AngleCorrectionDxf.downloadImage("001.jpg")
|
|
41
46
|
|
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as I from "three";
|
|
2
|
-
import { EventDispatcher as Bt, Color as Ot, Matrix4 as
|
|
2
|
+
import { EventDispatcher as Bt, Color as Ot, Matrix4 as Lt, Vector3 as J, Quaternion as Ft, BufferAttribute as _, REVISION as Ut, CompressedTexture as tt, Source as Gt, NoColorSpace as jt, MathUtils as it, RGBAFormat as zt, ImageUtils as _t, DoubleSide as qt, PropertyBinding as $, InterpolateDiscrete as Yt, Scene as ut, SRGBColorSpace as kt, NearestFilter as Xt, NearestMipmapNearestFilter as Vt, NearestMipmapLinearFilter as Wt, LinearFilter as Ht, LinearMipmapNearestFilter as Jt, LinearMipmapLinearFilter as $t, ClampToEdgeWrapping as Kt, RepeatWrapping as Zt, MirroredRepeatWrapping as Qt, InterpolateLinear as te } from "three";
|
|
3
3
|
import dt from "clipper-lib";
|
|
4
4
|
import H from "dxf-writer";
|
|
5
5
|
import { OBJExporter as ee } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
@@ -336,7 +336,7 @@ class R {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class X {
|
|
340
340
|
map = /* @__PURE__ */ new Map();
|
|
341
341
|
targetMap = /* @__PURE__ */ new Map();
|
|
342
342
|
gridSize;
|
|
@@ -624,7 +624,7 @@ class Q {
|
|
|
624
624
|
]);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
class
|
|
627
|
+
class D {
|
|
628
628
|
points = [new M(), new M()];
|
|
629
629
|
userData = {};
|
|
630
630
|
// line: any
|
|
@@ -788,7 +788,7 @@ class L {
|
|
|
788
788
|
const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, g = s.y + y * r.y;
|
|
789
789
|
return new M(x, g);
|
|
790
790
|
};
|
|
791
|
-
return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new
|
|
791
|
+
return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new D(a, a) : new D(a, c);
|
|
792
792
|
}
|
|
793
793
|
/**
|
|
794
794
|
* 计算一条线段在另一条直线上的投影
|
|
@@ -869,7 +869,7 @@ class L {
|
|
|
869
869
|
* @param line
|
|
870
870
|
*/
|
|
871
871
|
parallel(t, e = 1) {
|
|
872
|
-
return t instanceof
|
|
872
|
+
return t instanceof D ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
|
|
873
873
|
}
|
|
874
874
|
/** 两条线段或角度是否 垂直
|
|
875
875
|
* @param line
|
|
@@ -877,7 +877,7 @@ class L {
|
|
|
877
877
|
* @returns
|
|
878
878
|
*/
|
|
879
879
|
vertical(t, e = 0.1) {
|
|
880
|
-
return t instanceof
|
|
880
|
+
return t instanceof D ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
|
|
881
881
|
}
|
|
882
882
|
/**
|
|
883
883
|
* 两条线段方向相反否一致
|
|
@@ -952,7 +952,7 @@ class L {
|
|
|
952
952
|
* @returns
|
|
953
953
|
*/
|
|
954
954
|
clone() {
|
|
955
|
-
const t = new
|
|
955
|
+
const t = new D(
|
|
956
956
|
this.points[0].clone(),
|
|
957
957
|
this.points[1].clone()
|
|
958
958
|
);
|
|
@@ -975,7 +975,7 @@ class L {
|
|
|
975
975
|
* @param selectLines
|
|
976
976
|
*/
|
|
977
977
|
static groupBySamePointAndParallel(t) {
|
|
978
|
-
const e = new
|
|
978
|
+
const e = new X();
|
|
979
979
|
t.forEach((r) => r.points.forEach((o) => e.insert(o, r)));
|
|
980
980
|
const n = /* @__PURE__ */ new Set();
|
|
981
981
|
function s(r, o, a) {
|
|
@@ -1007,7 +1007,7 @@ class L {
|
|
|
1007
1007
|
const f = o(u);
|
|
1008
1008
|
f < a && (a = f, i = n.projectPoint(u, !1)), f > c && (c = f, r = n.projectPoint(u, !1));
|
|
1009
1009
|
}
|
|
1010
|
-
const l = new
|
|
1010
|
+
const l = new D(i, r);
|
|
1011
1011
|
return t.forEach((h) => h.userData.fittedLine = l), l;
|
|
1012
1012
|
}
|
|
1013
1013
|
/** 合并平行线段
|
|
@@ -1026,7 +1026,7 @@ class L {
|
|
|
1026
1026
|
const y = p.x * s.x + p.y * s.y;
|
|
1027
1027
|
i = Math.min(i, y), r = Math.max(r, y), o += p.x, a += p.y;
|
|
1028
1028
|
});
|
|
1029
|
-
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
|
|
1029
|
+
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 D(h, u);
|
|
1030
1030
|
return t.forEach((p) => p.userData.fittedLine = f), f;
|
|
1031
1031
|
}
|
|
1032
1032
|
/** 合并满足平行的线段
|
|
@@ -1191,7 +1191,7 @@ class M {
|
|
|
1191
1191
|
* @param length
|
|
1192
1192
|
*/
|
|
1193
1193
|
expandAsLine(t, e, n) {
|
|
1194
|
-
const s = new
|
|
1194
|
+
const s = new D(
|
|
1195
1195
|
this.clone(),
|
|
1196
1196
|
this.clone().add(t.clone().multiplyScalar(e))
|
|
1197
1197
|
);
|
|
@@ -1313,7 +1313,7 @@ class F {
|
|
|
1313
1313
|
* @param node 线段节点
|
|
1314
1314
|
*/
|
|
1315
1315
|
insert(t) {
|
|
1316
|
-
if (t instanceof
|
|
1316
|
+
if (t instanceof D) {
|
|
1317
1317
|
this.insert({ line: t, userData: {} });
|
|
1318
1318
|
return;
|
|
1319
1319
|
}
|
|
@@ -1338,7 +1338,7 @@ class F {
|
|
|
1338
1338
|
* @param node
|
|
1339
1339
|
*/
|
|
1340
1340
|
remove(t) {
|
|
1341
|
-
if (t instanceof
|
|
1341
|
+
if (t instanceof D) {
|
|
1342
1342
|
t = this.targetMap.get(t), t && this.remove(t);
|
|
1343
1343
|
return;
|
|
1344
1344
|
}
|
|
@@ -1542,7 +1542,7 @@ function at(d, t = 0.03) {
|
|
|
1542
1542
|
}).filter((n) => n.length() >= t);
|
|
1543
1543
|
}
|
|
1544
1544
|
function se(d, t) {
|
|
1545
|
-
t || (t = new
|
|
1545
|
+
t || (t = new X(), d.forEach((n) => {
|
|
1546
1546
|
n.userData.isDoor || n.points.forEach((s) => t?.insert(s, n));
|
|
1547
1547
|
}));
|
|
1548
1548
|
const e = [];
|
|
@@ -1554,7 +1554,7 @@ function se(d, t) {
|
|
|
1554
1554
|
const l = c.userData;
|
|
1555
1555
|
if (l === s || !s.parallel(l, 25)) return !1;
|
|
1556
1556
|
if (t.queryPoint(c.point).length > 1) return;
|
|
1557
|
-
const h = new
|
|
1557
|
+
const h = new D(r, c.point), u = new D(s.start === r ? s.end : s.start, l.start === c.point ? l.end : l.start);
|
|
1558
1558
|
if (!h.intersectLineSegment(u)) return !1;
|
|
1559
1559
|
const f = r.distance(c.point);
|
|
1560
1560
|
return f < 1e-3 ? !1 : (i.set(c.point, f), !0);
|
|
@@ -1564,13 +1564,13 @@ function se(d, t) {
|
|
|
1564
1564
|
});
|
|
1565
1565
|
if (o.length === 0) return;
|
|
1566
1566
|
const a = o[0].userData;
|
|
1567
|
-
e.push(new
|
|
1567
|
+
e.push(new D(s.projectLineSegment(a).center, a.projectLineSegment(s).center));
|
|
1568
1568
|
});
|
|
1569
1569
|
}
|
|
1570
1570
|
return [...d, ...e];
|
|
1571
1571
|
}
|
|
1572
1572
|
function ie(d) {
|
|
1573
|
-
const t = new
|
|
1573
|
+
const t = new X(), e = new F(R.fromByLineSegment(...d)), n = [];
|
|
1574
1574
|
return d.forEach((s) => {
|
|
1575
1575
|
s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
|
|
1576
1576
|
}), n.forEach((s) => {
|
|
@@ -1691,7 +1691,7 @@ function pt(d, t, e, n) {
|
|
|
1691
1691
|
});
|
|
1692
1692
|
}), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
|
|
1693
1693
|
const a = o.map((u) => {
|
|
1694
|
-
const f = u.userData, p = i.get(f), y = r.get(f), x = new
|
|
1694
|
+
const f = u.userData, p = i.get(f), y = r.get(f), x = new D(p, y), g = [];
|
|
1695
1695
|
for (let w = 0; w < o.length; w++) {
|
|
1696
1696
|
const E = o[w];
|
|
1697
1697
|
if (u !== E && u.distance(E) < n) {
|
|
@@ -1722,14 +1722,14 @@ function pt(d, t, e, n) {
|
|
|
1722
1722
|
y.sort((E, m) => m.distance(e.start) - E.distance(e.start));
|
|
1723
1723
|
const x = y[0], g = y[y.length - 1];
|
|
1724
1724
|
if (x.distance(g) > n) {
|
|
1725
|
-
const E = [...p].sort((C, G) => G.length() - C.length()), m = E[0], S = E[1], T = s.get(m),
|
|
1726
|
-
if (T.distance(
|
|
1725
|
+
const E = [...p].sort((C, G) => G.length() - C.length()), m = E[0], S = E[1], T = s.get(m), L = s.get(S), A = m.length(), P = S.length(), N = m.projectLineSegment(S), O = N.length();
|
|
1726
|
+
if (T.distance(L) || P / A > 0.5 && O / P < 0.5) {
|
|
1727
1727
|
const C = [m], G = [S];
|
|
1728
1728
|
for (let B = 0; B < y.length; B++) {
|
|
1729
|
-
const v = y[B],
|
|
1730
|
-
if (v === T || v ===
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1729
|
+
const v = y[B], V = v.userData;
|
|
1730
|
+
if (v === T || v === L) continue;
|
|
1731
|
+
const j = S.projectLineSegment(V), Ct = j.length();
|
|
1732
|
+
L.distance(v) <= n && Ct / P > 0 ? G.push(V) : C.push(V);
|
|
1733
1733
|
}
|
|
1734
1734
|
h.push(C, G);
|
|
1735
1735
|
} else {
|
|
@@ -1803,7 +1803,7 @@ function le(d, t = 0.1, e) {
|
|
|
1803
1803
|
if (s.length === 1) return s[0];
|
|
1804
1804
|
const i = [];
|
|
1805
1805
|
s.forEach((h) => i.push(h.start.clone(), h.end.clone()));
|
|
1806
|
-
const r = n === "average" ?
|
|
1806
|
+
const r = n === "average" ? D.mergeLines(...s) : D.mergeLinesByMaxlength(...s);
|
|
1807
1807
|
r.userData.rooftopPz = Math.min(
|
|
1808
1808
|
...s.map((h) => {
|
|
1809
1809
|
const { drawDoorData: u, drawWindow: f, rooftopPz: p, ...y } = h.userData;
|
|
@@ -1823,7 +1823,7 @@ function le(d, t = 0.1, e) {
|
|
|
1823
1823
|
function he(d, t = 0.4) {
|
|
1824
1824
|
const e = new F(R.fromByLineSegment(...d));
|
|
1825
1825
|
d.forEach((s) => e.insert(s));
|
|
1826
|
-
const n = new
|
|
1826
|
+
const n = new D();
|
|
1827
1827
|
for (let s = 0; s < d.length; s++) {
|
|
1828
1828
|
const i = d[s];
|
|
1829
1829
|
if (i.userData.isAdsorbed) continue;
|
|
@@ -1851,10 +1851,35 @@ function he(d, t = 0.4) {
|
|
|
1851
1851
|
return d.filter((s) => s.length() > 1e-3);
|
|
1852
1852
|
}
|
|
1853
1853
|
function ue(d, t) {
|
|
1854
|
+
const e = new X();
|
|
1855
|
+
d.forEach((i) => i.points.forEach((r) => e.insert(r, i)));
|
|
1856
|
+
const n = /* @__PURE__ */ new Map();
|
|
1857
|
+
function s(i, r) {
|
|
1858
|
+
n.has(i) || n.set(i, []), n.get(i)?.push(r);
|
|
1859
|
+
}
|
|
1860
|
+
for (let i = 0; i < d.length; i++) {
|
|
1861
|
+
const r = d[i];
|
|
1862
|
+
r.points.forEach((o) => {
|
|
1863
|
+
if (e.queryPoint(o).filter((h) => h.userData !== r).length !== 0) return;
|
|
1864
|
+
const a = e.queryCircle(o, t).filter((h) => h.userData !== r && h.userData?.vertical(r));
|
|
1865
|
+
if (!a.length) return;
|
|
1866
|
+
const c = a.sort((h, u) => h.userData.length() - u.userData.length())[0], l = c.userData?.projectPoint(o, !1);
|
|
1867
|
+
if (l) {
|
|
1868
|
+
const h = c.userData;
|
|
1869
|
+
s(r, new D(o.clone(), l.clone())), s(h, new D(c.point.clone(), l.clone()));
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
return n.forEach((i, r) => {
|
|
1874
|
+
const o = D.mergeLines(r, ...i);
|
|
1875
|
+
r.set(o.start, o.end);
|
|
1876
|
+
}), d;
|
|
1877
|
+
}
|
|
1878
|
+
function de(d, t) {
|
|
1854
1879
|
const { snapThreshold: e = 0.2 } = t ?? {};
|
|
1855
|
-
return d = he(d, e), d;
|
|
1880
|
+
return d = he(d, e), d = ue(d, e), d;
|
|
1856
1881
|
}
|
|
1857
|
-
function
|
|
1882
|
+
function fe(d) {
|
|
1858
1883
|
for (let t = 0; t < d.length; t++) {
|
|
1859
1884
|
const e = d[t], n = e.userData.fittedLine;
|
|
1860
1885
|
if (n) {
|
|
@@ -1864,7 +1889,7 @@ function de(d) {
|
|
|
1864
1889
|
r.clone().add(s.clone().multiplyScalar(i.width * 0.5))
|
|
1865
1890
|
), a = n.projectPoint(
|
|
1866
1891
|
r.clone().add(s.clone().multiplyScalar(i.width * -0.5))
|
|
1867
|
-
), c = new
|
|
1892
|
+
), c = new D(o, a), l = c.center;
|
|
1868
1893
|
n.userData.drawWindow?.push({
|
|
1869
1894
|
p: new I.Vector3(l?.x ?? 0, l?.y ?? 0, i.p.z),
|
|
1870
1895
|
width: c.length(),
|
|
@@ -1874,7 +1899,7 @@ function de(d) {
|
|
|
1874
1899
|
}
|
|
1875
1900
|
}
|
|
1876
1901
|
}
|
|
1877
|
-
function
|
|
1902
|
+
function pe(d) {
|
|
1878
1903
|
for (let t = 0; t < d.length; t++) {
|
|
1879
1904
|
const e = d[t];
|
|
1880
1905
|
let { endIntersection: n, startIntersection: s } = e.userData;
|
|
@@ -1895,6 +1920,16 @@ function fe(d) {
|
|
|
1895
1920
|
}
|
|
1896
1921
|
return d;
|
|
1897
1922
|
}
|
|
1923
|
+
function ye(d, t = 0.01) {
|
|
1924
|
+
const e = new X();
|
|
1925
|
+
return d.forEach((n) => n.points.forEach((s) => e.insert(s, n))), d.filter((n) => {
|
|
1926
|
+
if (n.length() <= t) {
|
|
1927
|
+
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;
|
|
1928
|
+
if (s || i) return !1;
|
|
1929
|
+
}
|
|
1930
|
+
return !0;
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1898
1933
|
class Tt {
|
|
1899
1934
|
/**
|
|
1900
1935
|
* 轴对齐垂直修正
|
|
@@ -1904,33 +1939,33 @@ class Tt {
|
|
|
1904
1939
|
*/
|
|
1905
1940
|
static correction(t, e, n) {
|
|
1906
1941
|
t = ie(t.map((x) => x.clone()));
|
|
1907
|
-
const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new
|
|
1942
|
+
const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new D(
|
|
1908
1943
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
1909
1944
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
1910
|
-
), f = new
|
|
1945
|
+
), f = new D(
|
|
1911
1946
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
1912
1947
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
1913
1948
|
);
|
|
1914
1949
|
let p = ae(i, r, u, f, s, n);
|
|
1915
1950
|
p = ce(p, s);
|
|
1916
1951
|
let y = le(p, 0.1, n);
|
|
1917
|
-
return y =
|
|
1952
|
+
return y = de(y, n), fe(a), pe(o), y = at(y, 1e-9), y.push(...o), y = ye(y, 0.08), y;
|
|
1918
1953
|
}
|
|
1919
1954
|
}
|
|
1920
|
-
const
|
|
1955
|
+
const xe = new D(
|
|
1921
1956
|
new M(0, 0),
|
|
1922
1957
|
new M(0, 1)
|
|
1923
1958
|
);
|
|
1924
|
-
function
|
|
1959
|
+
function ge(d) {
|
|
1925
1960
|
const t = [...d].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
|
|
1926
|
-
let r = parseInt(
|
|
1961
|
+
let r = parseInt(xe.includedAngle(i) + "");
|
|
1927
1962
|
return r > 90 && (r = 180 - r), r;
|
|
1928
1963
|
}), n = /* @__PURE__ */ new Map();
|
|
1929
1964
|
return e.forEach((i, r) => {
|
|
1930
1965
|
n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
|
|
1931
1966
|
}), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
|
|
1932
1967
|
}
|
|
1933
|
-
const
|
|
1968
|
+
const me = {
|
|
1934
1969
|
Unitless: 1,
|
|
1935
1970
|
// 无单位,1米 = 1(无单位)
|
|
1936
1971
|
Inches: 39.37007874015748,
|
|
@@ -1977,7 +2012,7 @@ const xe = {
|
|
|
1977
2012
|
function xt(d) {
|
|
1978
2013
|
const t = [];
|
|
1979
2014
|
for (let e = 0; e < d.length; e++)
|
|
1980
|
-
t.push(new
|
|
2015
|
+
t.push(new D(
|
|
1981
2016
|
d[e].clone(),
|
|
1982
2017
|
d[(e + 1) % d.length].clone()
|
|
1983
2018
|
));
|
|
@@ -2034,13 +2069,13 @@ class k extends q {
|
|
|
2034
2069
|
const r = [];
|
|
2035
2070
|
if (t.forEach(({ start: a, end: c, ...l }, h) => {
|
|
2036
2071
|
r.push(a.z ?? 0, c.z ?? 0);
|
|
2037
|
-
const u = new
|
|
2072
|
+
const u = new D(
|
|
2038
2073
|
M.from(a),
|
|
2039
2074
|
M.from(c)
|
|
2040
2075
|
);
|
|
2041
2076
|
u.userData = l, s.push(u), l.isVerticalReferenceLine && (i = h);
|
|
2042
2077
|
}), this.originalZAverage = r.reduce((a, c) => a + c, 0) / r.length, i === -1) {
|
|
2043
|
-
const a =
|
|
2078
|
+
const a = ge(s);
|
|
2044
2079
|
i = s.indexOf(a);
|
|
2045
2080
|
}
|
|
2046
2081
|
const o = s[i];
|
|
@@ -2049,7 +2084,7 @@ class k extends q {
|
|
|
2049
2084
|
data: t,
|
|
2050
2085
|
setData(a) {
|
|
2051
2086
|
s = a.map(({ start: c, end: l, ...h }) => {
|
|
2052
|
-
const u = new
|
|
2087
|
+
const u = new D(M.from(c), M.from(l));
|
|
2053
2088
|
return u.userData = h, u;
|
|
2054
2089
|
}), t = a;
|
|
2055
2090
|
}
|
|
@@ -2307,7 +2342,7 @@ class k extends q {
|
|
|
2307
2342
|
* 转为绘制数据
|
|
2308
2343
|
*/
|
|
2309
2344
|
toDrawDataJson(t = "Millimeters") {
|
|
2310
|
-
const e =
|
|
2345
|
+
const e = me[t], n = {
|
|
2311
2346
|
unit: t,
|
|
2312
2347
|
line: [],
|
|
2313
2348
|
arc: [],
|
|
@@ -2351,14 +2386,14 @@ class k extends q {
|
|
|
2351
2386
|
if (s = "cyan", l.length() < 1.2) {
|
|
2352
2387
|
l.expansion(-o * 0.5);
|
|
2353
2388
|
const h = c.normal();
|
|
2354
|
-
let u = new
|
|
2389
|
+
let u = new D(
|
|
2355
2390
|
l.start.clone(),
|
|
2356
2391
|
l.start.clone().add(h.clone().multiplyScalar(l.length()))
|
|
2357
2392
|
);
|
|
2358
2393
|
const f = u.clone().directionMove(u.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
|
|
2359
2394
|
for (let m = 0; m < a.length; m++)
|
|
2360
2395
|
if (a[m].intersectRectangle(f)) {
|
|
2361
|
-
u = new
|
|
2396
|
+
u = new D(
|
|
2362
2397
|
l.start.clone(),
|
|
2363
2398
|
l.start.clone().add(h.clone().multiplyScalar(-l.length()))
|
|
2364
2399
|
);
|
|
@@ -2372,7 +2407,7 @@ class k extends q {
|
|
|
2372
2407
|
}), s = "yellow", this.lineSegments.forEach((c) => {
|
|
2373
2408
|
if (!c.userData.isWindow) return !1;
|
|
2374
2409
|
Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
|
|
2375
|
-
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
|
|
2410
|
+
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 D(p, y);
|
|
2376
2411
|
i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((g, w) => i(g, w));
|
|
2377
2412
|
});
|
|
2378
2413
|
}), n;
|
|
@@ -2510,8 +2545,8 @@ function ot(d) {
|
|
|
2510
2545
|
Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ot(d[e]));
|
|
2511
2546
|
return t;
|
|
2512
2547
|
}
|
|
2513
|
-
const
|
|
2514
|
-
class
|
|
2548
|
+
const z = new D();
|
|
2549
|
+
class we extends k {
|
|
2515
2550
|
static name = "AngleCorrectionDxf";
|
|
2516
2551
|
angle = 0;
|
|
2517
2552
|
onAddFromParent(t) {
|
|
@@ -2522,17 +2557,17 @@ class ge extends k {
|
|
|
2522
2557
|
let s = 0, i = null;
|
|
2523
2558
|
for (let c = 0; c < e.originalData.length; c++) {
|
|
2524
2559
|
const l = e.originalData[c];
|
|
2525
|
-
if (
|
|
2526
|
-
const [h, u] = l.start.y < l.end.y ? [
|
|
2527
|
-
s = -new
|
|
2560
|
+
if (z.start.copy(l.start), z.end.copy(l.end), l.isVerticalReferenceLine) {
|
|
2561
|
+
const [h, u] = l.start.y < l.end.y ? [z.start, z.end] : [z.end, z.start];
|
|
2562
|
+
s = -new D(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
|
|
2528
2563
|
break;
|
|
2529
2564
|
}
|
|
2530
|
-
(!i ||
|
|
2565
|
+
(!i || z.length() > i.length()) && (i = z.clone(), i.userData.index = c);
|
|
2531
2566
|
}
|
|
2532
2567
|
if (i) {
|
|
2533
2568
|
e.originalData[i.userData.index].isVerticalReferenceLine = !0;
|
|
2534
2569
|
const [c, l] = i.start.y < i.end.y ? [i.start, i.end] : [i.end, i.start];
|
|
2535
|
-
s = -new
|
|
2570
|
+
s = -new D(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
|
|
2536
2571
|
}
|
|
2537
2572
|
const r = e.originalBox.center, o = M.zero(), a = e.originalData.map((c) => {
|
|
2538
2573
|
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(ot(c), { start: l, end: h });
|
|
@@ -2583,13 +2618,13 @@ class bt extends q {
|
|
|
2583
2618
|
if (t in this) return this[t];
|
|
2584
2619
|
}
|
|
2585
2620
|
}
|
|
2586
|
-
class
|
|
2621
|
+
class Me {
|
|
2587
2622
|
// 所有可查找的点位
|
|
2588
2623
|
possibleDoorPoints = [];
|
|
2589
2624
|
doorPoint = [];
|
|
2590
2625
|
dxf;
|
|
2591
2626
|
// 包含所有点的虚拟网格
|
|
2592
|
-
pointVirtualGrid = new
|
|
2627
|
+
pointVirtualGrid = new X();
|
|
2593
2628
|
// 只包含可查找点的虚拟网格
|
|
2594
2629
|
findPointVirtualGrid;
|
|
2595
2630
|
quadtree;
|
|
@@ -2602,7 +2637,7 @@ class me {
|
|
|
2602
2637
|
lineAnalysis;
|
|
2603
2638
|
continueFind = !0;
|
|
2604
2639
|
constructor(t) {
|
|
2605
|
-
if (this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new
|
|
2640
|
+
if (this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new X(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
|
|
2606
2641
|
this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
|
|
2607
2642
|
}), this.doorPoint = this.getDoorPoint(), !this.continueFind) return;
|
|
2608
2643
|
const e = this.searchDoubleLinePoint();
|
|
@@ -2632,11 +2667,11 @@ class me {
|
|
|
2632
2667
|
);
|
|
2633
2668
|
const a = [];
|
|
2634
2669
|
return o.forEach((c) => {
|
|
2635
|
-
const l = new
|
|
2670
|
+
const l = new D(c?.start, c?.end), h = l.length();
|
|
2636
2671
|
if (h < n) return;
|
|
2637
2672
|
const u = l.normal(), f = l.direction(), p = (h - r.width * 2) / 2;
|
|
2638
2673
|
for (let y = 0; y < 3; y++) {
|
|
2639
|
-
const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), g = new
|
|
2674
|
+
const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), g = new D(
|
|
2640
2675
|
x,
|
|
2641
2676
|
x.clone().add(u.clone().multiplyScalar(1))
|
|
2642
2677
|
);
|
|
@@ -2686,7 +2721,7 @@ class me {
|
|
|
2686
2721
|
});
|
|
2687
2722
|
} else if (r.doorDirectConnection) {
|
|
2688
2723
|
this.continueFind = !1;
|
|
2689
|
-
const o = new
|
|
2724
|
+
const o = new D(M.from(r.start), M.from(r.end));
|
|
2690
2725
|
o.userData = {
|
|
2691
2726
|
doorDirectConnection: !0,
|
|
2692
2727
|
isDoor: !0
|
|
@@ -2719,16 +2754,16 @@ class me {
|
|
|
2719
2754
|
function o({ point: x, line: g }, w, E) {
|
|
2720
2755
|
const m = g.direction();
|
|
2721
2756
|
g.start === x && m.multiplyScalar(-1);
|
|
2722
|
-
const S = i.queryCircle(x, n).filter((
|
|
2723
|
-
for (let
|
|
2724
|
-
const A = e.findIndex((B) => B.point === S[
|
|
2757
|
+
const S = i.queryCircle(x, n).filter((L) => L.userData !== g).sort((L, A) => L.point.distance(x) - A.point.distance(x)), T = [];
|
|
2758
|
+
for (let L = 0; L < S.length; L++) {
|
|
2759
|
+
const A = e.findIndex((B) => B.point === S[L].point), P = t[w].uuid, N = e[A].uuid;
|
|
2725
2760
|
if (E.has(`${P}.${N}`)) continue;
|
|
2726
2761
|
E.add(`${P}.${N}`), E.add(`${N}.${P}`);
|
|
2727
|
-
const O = S[
|
|
2762
|
+
const O = S[L].point, C = new D(x.clone(), O.clone());
|
|
2728
2763
|
if (C.direction().angleBetween(m, "angle") < s) {
|
|
2729
2764
|
const B = t[A].line.direction();
|
|
2730
|
-
S[
|
|
2731
|
-
findData: S[
|
|
2765
|
+
S[L].userData.start.equal(S[L].point) && B.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(B, "angle") < s && (r.queryLineSegment(C).length || T.push({
|
|
2766
|
+
findData: S[L],
|
|
2732
2767
|
findUuid: N,
|
|
2733
2768
|
doorLine: C,
|
|
2734
2769
|
doorUuid: P
|
|
@@ -2742,13 +2777,13 @@ class me {
|
|
|
2742
2777
|
const S = [];
|
|
2743
2778
|
m && S.push(m);
|
|
2744
2779
|
for (let T = 0; T < w.length; T++) {
|
|
2745
|
-
const
|
|
2746
|
-
if (g.has(
|
|
2747
|
-
const A = g.get(
|
|
2748
|
-
a(
|
|
2749
|
-
} else S.push(
|
|
2780
|
+
const L = w[T];
|
|
2781
|
+
if (g.has(L.findUuid)) {
|
|
2782
|
+
const A = g.get(L.findUuid);
|
|
2783
|
+
a(L.findUuid, g, A, E, L) && S.push(L);
|
|
2784
|
+
} else S.push(L);
|
|
2750
2785
|
}
|
|
2751
|
-
return S.sort((T,
|
|
2786
|
+
return S.sort((T, L) => T.doorLine.length() - L.doorLine.length()), m && S[0] === m ? (w.splice(0), !0) : (w.splice(1), !1);
|
|
2752
2787
|
}
|
|
2753
2788
|
const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
2754
2789
|
t.map((x, g) => {
|
|
@@ -2778,10 +2813,10 @@ class me {
|
|
|
2778
2813
|
});
|
|
2779
2814
|
const y = [];
|
|
2780
2815
|
return f.forEach((x) => {
|
|
2781
|
-
const g = t.findIndex((A) => A.uuid === x.doorUuid), w = e.findIndex((A) => A.uuid === x.findUuid), E = t[g].point.clone(), m = e[w].point.clone(), S = this.findLongLineSegment(t[g].line), T = this.findLongLineSegment(e[w].line),
|
|
2782
|
-
if (
|
|
2783
|
-
E.copy(
|
|
2784
|
-
const A = new
|
|
2816
|
+
const g = t.findIndex((A) => A.uuid === x.doorUuid), w = e.findIndex((A) => A.uuid === x.findUuid), E = t[g].point.clone(), m = e[w].point.clone(), S = this.findLongLineSegment(t[g].line), T = this.findLongLineSegment(e[w].line), L = S.projectPoint(m);
|
|
2817
|
+
if (L) {
|
|
2818
|
+
E.copy(L);
|
|
2819
|
+
const A = new D(E, m), P = T.includedAngle(A);
|
|
2785
2820
|
(P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
|
|
2786
2821
|
start: E,
|
|
2787
2822
|
end: m
|
|
@@ -2789,7 +2824,7 @@ class me {
|
|
|
2789
2824
|
} else {
|
|
2790
2825
|
const A = T.projectPoint(E);
|
|
2791
2826
|
A && m.copy(A);
|
|
2792
|
-
const P = new
|
|
2827
|
+
const P = new D(E, m), N = S.includedAngle(P);
|
|
2793
2828
|
(N < 10 || N > 170 || Math.abs(90 - N) < 10) && y.push({
|
|
2794
2829
|
start: E,
|
|
2795
2830
|
end: m
|
|
@@ -2813,7 +2848,7 @@ class me {
|
|
|
2813
2848
|
searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
|
|
2814
2849
|
const s = this.quadtree, i = e.direction();
|
|
2815
2850
|
e.start === t && i.multiplyScalar(-1);
|
|
2816
|
-
const r = t.clone().add(i.clone().multiplyScalar(n)), o = new
|
|
2851
|
+
const r = t.clone().add(i.clone().multiplyScalar(n)), o = new D(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
|
|
2817
2852
|
point: c.line.getIntersection(o),
|
|
2818
2853
|
line: c.line
|
|
2819
2854
|
})).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
|
|
@@ -2840,7 +2875,7 @@ class me {
|
|
|
2840
2875
|
break;
|
|
2841
2876
|
}
|
|
2842
2877
|
}
|
|
2843
|
-
const l = new
|
|
2878
|
+
const l = new D(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((u) => ({
|
|
2844
2879
|
point: u.line.getIntersection(l),
|
|
2845
2880
|
line: u.line
|
|
2846
2881
|
})).filter((u) => u.point).sort((u, f) => t.distance(u.point) - t.distance(f.point));
|
|
@@ -2874,7 +2909,7 @@ class me {
|
|
|
2874
2909
|
return e;
|
|
2875
2910
|
}
|
|
2876
2911
|
}
|
|
2877
|
-
class
|
|
2912
|
+
class Se extends q {
|
|
2878
2913
|
static name = "LineAnalysis";
|
|
2879
2914
|
Dxf = null;
|
|
2880
2915
|
Variable = null;
|
|
@@ -2920,7 +2955,7 @@ class we extends q {
|
|
|
2920
2955
|
*/
|
|
2921
2956
|
addData(t, e) {
|
|
2922
2957
|
const n = this.Dxf;
|
|
2923
|
-
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new
|
|
2958
|
+
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new D(t.clone(), e.clone()));
|
|
2924
2959
|
}
|
|
2925
2960
|
/** 结果分析创建矩形
|
|
2926
2961
|
* @param result
|
|
@@ -2934,8 +2969,8 @@ class we extends q {
|
|
|
2934
2969
|
if (!(g.x > 0 && w.x < 0 || g.x < 0 && w.x > 0 || g.y > 0 && w.y < 0 || g.y < 0 && w.y > 0)) {
|
|
2935
2970
|
u.set(y.x, y.y), f.set(x.x, x.y);
|
|
2936
2971
|
for (let E = 1; E < o; E++) {
|
|
2937
|
-
const m = l.clone().multiplyScalar(a * E), S = h.clone().multiplyScalar(c * E), T = u.clone().add(m),
|
|
2938
|
-
this.addData(T,
|
|
2972
|
+
const m = l.clone().multiplyScalar(a * E), S = h.clone().multiplyScalar(c * E), T = u.clone().add(m), L = f.clone().add(S);
|
|
2973
|
+
this.addData(T, L);
|
|
2939
2974
|
}
|
|
2940
2975
|
}
|
|
2941
2976
|
}
|
|
@@ -3006,12 +3041,12 @@ class we extends q {
|
|
|
3006
3041
|
doors = [];
|
|
3007
3042
|
DoorsAnalysis;
|
|
3008
3043
|
doorsAnalysis() {
|
|
3009
|
-
this.DoorsAnalysis = new
|
|
3044
|
+
this.DoorsAnalysis = new Me(this), this.dispatchEvent({
|
|
3010
3045
|
type: "analysisCompleted"
|
|
3011
3046
|
});
|
|
3012
3047
|
}
|
|
3013
3048
|
}
|
|
3014
|
-
class
|
|
3049
|
+
class Ee extends q {
|
|
3015
3050
|
static name = "ThreeVJia";
|
|
3016
3051
|
lineSegments = [];
|
|
3017
3052
|
onAddFromParent() {
|
|
@@ -3023,7 +3058,7 @@ class Me extends q {
|
|
|
3023
3058
|
t.resultList.forEach((l) => {
|
|
3024
3059
|
const h = s.get(l.target) ?? [], u = s.get(l.source) ?? [], f = l.project.clone(), p = l.project2.clone();
|
|
3025
3060
|
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);
|
|
3026
|
-
const y = new
|
|
3061
|
+
const y = new D(f.start, p.start), x = new D(f.end, p.end), g = new D(y.center, x.center);
|
|
3027
3062
|
g.userData.wallWidth = Math.max(y.length(), x.length()), r.push(g);
|
|
3028
3063
|
});
|
|
3029
3064
|
const a = [];
|
|
@@ -3040,7 +3075,7 @@ class Me extends q {
|
|
|
3040
3075
|
const f = [];
|
|
3041
3076
|
for (let p = 0; p < h.length; p++) {
|
|
3042
3077
|
const y = h[p];
|
|
3043
|
-
y.userData.type === "start" ? (f.length === 0 && (a.push(new
|
|
3078
|
+
y.userData.type === "start" ? (f.length === 0 && (a.push(new D(u.start.clone(), y.clone())), u.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && u.start.copy(y));
|
|
3044
3079
|
}
|
|
3045
3080
|
a.push(u);
|
|
3046
3081
|
}
|
|
@@ -3146,7 +3181,7 @@ class ct extends ne {
|
|
|
3146
3181
|
* @param scale 原始数据缩放比例
|
|
3147
3182
|
*/
|
|
3148
3183
|
constructor(t = 0.1, e = 1) {
|
|
3149
|
-
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new
|
|
3184
|
+
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new we(), this.Variable = new bt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Se()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Ee()), ct.finalInstance = this;
|
|
3150
3185
|
}
|
|
3151
3186
|
usePlugin(t) {
|
|
3152
3187
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -3163,12 +3198,17 @@ function It(...d) {
|
|
|
3163
3198
|
d.forEach((t) => {
|
|
3164
3199
|
const e = t.direction();
|
|
3165
3200
|
t.userData.drawWindow?.forEach((n) => {
|
|
3166
|
-
|
|
3167
|
-
s.
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3201
|
+
try {
|
|
3202
|
+
const s = M.from(n.p), i = t.projectPoint(
|
|
3203
|
+
s.clone().add(e.clone().multiplyScalar(n.width * 0.5)),
|
|
3204
|
+
!1
|
|
3205
|
+
), r = t.projectPoint(
|
|
3206
|
+
s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
|
|
3207
|
+
!1
|
|
3208
|
+
), o = t.projectLineSegment(new D(i, r)), a = o.center;
|
|
3209
|
+
n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
|
|
3210
|
+
} catch {
|
|
3211
|
+
}
|
|
3172
3212
|
});
|
|
3173
3213
|
});
|
|
3174
3214
|
}
|
|
@@ -3184,7 +3224,7 @@ class lt {
|
|
|
3184
3224
|
const r = i.center, o = /* @__PURE__ */ new Set();
|
|
3185
3225
|
for (const a of e) {
|
|
3186
3226
|
if (o.size === 2) break;
|
|
3187
|
-
const c = new
|
|
3227
|
+
const c = new D(r, a);
|
|
3188
3228
|
if (!s.queryLineSegment(c).filter((h) => !(h.line === i || h.line.parallel(i) && i.getMinLength(h.line) < n && h.line.projectLineSegment(i).length() / i.length() > 0.6)).length) {
|
|
3189
3229
|
const h = i.pointPosition(a);
|
|
3190
3230
|
h !== "on" && o.add(h);
|
|
@@ -3221,33 +3261,33 @@ class lt {
|
|
|
3221
3261
|
g.directionMove(E, n * 0.5);
|
|
3222
3262
|
}
|
|
3223
3263
|
}
|
|
3224
|
-
function r({ resultLine: g, type: w, direction: E, point: m }, S, T,
|
|
3264
|
+
function r({ resultLine: g, type: w, direction: E, point: m }, S, T, L) {
|
|
3225
3265
|
if (w === "intersect")
|
|
3226
3266
|
m && m.copy(S.projectPoint(m) ?? m);
|
|
3227
3267
|
else if (E === "vertical") {
|
|
3228
3268
|
if (m) {
|
|
3229
3269
|
const A = S.projectPoint(m, !1);
|
|
3230
|
-
m.copy(A), S.isPointOnSegment(A) || (S.start.distance(A) < S.end.distance(A) ?
|
|
3270
|
+
m.copy(A), S.isPointOnSegment(A) || (S.start.distance(A) < S.end.distance(A) ? L.push(new D(A.clone(), S.start.clone())) : L.push(new D(A.clone(), S.end.clone())));
|
|
3231
3271
|
}
|
|
3232
3272
|
} else if (!u.includes(g) && m) {
|
|
3233
3273
|
let A = S.projectPoint(m, !1), P;
|
|
3234
3274
|
if (S.start.distance(m) < S.end.distance(m) ? P = S.start : P = S.end, A) {
|
|
3235
|
-
|
|
3236
|
-
const N = new
|
|
3237
|
-
N.length() &&
|
|
3275
|
+
L.push(new D(m.clone(), A.clone()));
|
|
3276
|
+
const N = new D(A.clone(), P.clone());
|
|
3277
|
+
N.length() && L.push(N);
|
|
3238
3278
|
}
|
|
3239
3279
|
}
|
|
3240
3280
|
T.update(g);
|
|
3241
3281
|
}
|
|
3242
3282
|
const o = Object.keys(e).map((g) => M.from(e[g])), a = [];
|
|
3243
3283
|
let c = t.map(({ start: g, end: w, ...E }) => {
|
|
3244
|
-
const m = new
|
|
3284
|
+
const m = new D(M.from(g), M.from(w));
|
|
3245
3285
|
return m.userData = E, a.push(g.z ?? 0, w.z ?? 0), m;
|
|
3246
3286
|
});
|
|
3247
|
-
const l = a.reduce((g, w) => g + w, 0) / a.length
|
|
3248
|
-
let u =
|
|
3249
|
-
c = c.filter((g) => !
|
|
3250
|
-
const f =
|
|
3287
|
+
const l = a.reduce((g, w) => g + w, 0) / a.length;
|
|
3288
|
+
let u = lt.findExtWallByTraj(c, o).filter((g) => g.userData.expandDirect);
|
|
3289
|
+
c = c.filter((g) => !u.includes(g)), c.push(...u);
|
|
3290
|
+
const f = D.groupBySamePointAndParallel(u), p = new F(R.fromByLineSegment(...c));
|
|
3251
3291
|
c.forEach((g) => g.userData.isDoor || p.insert(g));
|
|
3252
3292
|
const y = f.map((g) => g.flatMap((w) => s(w, p))), x = [];
|
|
3253
3293
|
return f.flatMap((g, w) => (g.forEach((m) => (i(m), p.update(m))), y[w].filter((m) => {
|
|
@@ -3255,11 +3295,11 @@ class lt {
|
|
|
3255
3295
|
let S;
|
|
3256
3296
|
return Object.defineProperty(m, "newLine", {
|
|
3257
3297
|
get() {
|
|
3258
|
-
return S || (S =
|
|
3298
|
+
return S || (S = D.mergeLines(...g)), S;
|
|
3259
3299
|
}
|
|
3260
3300
|
}), !0;
|
|
3261
3301
|
}
|
|
3262
|
-
r(m,
|
|
3302
|
+
r(m, D.mergeLines(...g), p, x);
|
|
3263
3303
|
}))).reduce((g, w) => (g.has(w.resultLine) || g.set(w.resultLine, []), g.get(w.resultLine)?.push(w), g), /* @__PURE__ */ new Map()).forEach((g) => {
|
|
3264
3304
|
g.reduce((w, E) => (w.has(E.point) || w.set(E.point, []), w.get(E.point)?.push(E), w), /* @__PURE__ */ new Map()).forEach((w) => {
|
|
3265
3305
|
const E = /* @__PURE__ */ new Set();
|
|
@@ -3268,10 +3308,10 @@ class lt {
|
|
|
3268
3308
|
E.has(S.point) || (r(S, S.newLine, p, x), E.add(S.point));
|
|
3269
3309
|
}
|
|
3270
3310
|
});
|
|
3271
|
-
}), c.push(...
|
|
3311
|
+
}), c.push(...D.deduplication(x)), c.forEach((g) => g.userData.isWindow && It(g)), c = at(c), c = D.deduplication(c), K(c, l);
|
|
3272
3312
|
}
|
|
3273
3313
|
}
|
|
3274
|
-
const
|
|
3314
|
+
const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3275
3315
|
__proto__: null,
|
|
3276
3316
|
AxisAlignCorr: Tt,
|
|
3277
3317
|
BoundExt: lt,
|
|
@@ -3309,33 +3349,33 @@ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3309
3349
|
class Z {
|
|
3310
3350
|
constructor() {
|
|
3311
3351
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
3312
|
-
return new
|
|
3313
|
-
}), this.register(function(t) {
|
|
3314
|
-
return new Ne(t);
|
|
3315
|
-
}), this.register(function(t) {
|
|
3316
|
-
return new Fe(t);
|
|
3352
|
+
return new Ce(t);
|
|
3317
3353
|
}), this.register(function(t) {
|
|
3318
|
-
return new
|
|
3354
|
+
return new Be(t);
|
|
3319
3355
|
}), this.register(function(t) {
|
|
3320
3356
|
return new Ge(t);
|
|
3321
3357
|
}), this.register(function(t) {
|
|
3322
|
-
return new
|
|
3358
|
+
return new je(t);
|
|
3323
3359
|
}), this.register(function(t) {
|
|
3324
|
-
return new
|
|
3360
|
+
return new ze(t);
|
|
3325
3361
|
}), this.register(function(t) {
|
|
3326
|
-
return new
|
|
3362
|
+
return new _e(t);
|
|
3327
3363
|
}), this.register(function(t) {
|
|
3328
3364
|
return new Oe(t);
|
|
3329
3365
|
}), this.register(function(t) {
|
|
3330
|
-
return new
|
|
3366
|
+
return new Fe(t);
|
|
3331
3367
|
}), this.register(function(t) {
|
|
3332
|
-
return new
|
|
3368
|
+
return new Ue(t);
|
|
3333
3369
|
}), this.register(function(t) {
|
|
3334
3370
|
return new qe(t);
|
|
3335
3371
|
}), this.register(function(t) {
|
|
3336
3372
|
return new Ye(t);
|
|
3337
3373
|
}), this.register(function(t) {
|
|
3338
3374
|
return new ke(t);
|
|
3375
|
+
}), this.register(function(t) {
|
|
3376
|
+
return new Xe(t);
|
|
3377
|
+
}), this.register(function(t) {
|
|
3378
|
+
return new Ve(t);
|
|
3339
3379
|
});
|
|
3340
3380
|
}
|
|
3341
3381
|
register(t) {
|
|
@@ -3348,7 +3388,7 @@ class Z {
|
|
|
3348
3388
|
return this.textureUtils = t, this;
|
|
3349
3389
|
}
|
|
3350
3390
|
parse(t, e, n, s) {
|
|
3351
|
-
const i = new
|
|
3391
|
+
const i = new Ne(), r = [];
|
|
3352
3392
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
3353
3393
|
r.push(this.pluginCallbacks[o](i));
|
|
3354
3394
|
i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
|
|
@@ -3399,19 +3439,19 @@ const wt = {
|
|
|
3399
3439
|
position: "translation",
|
|
3400
3440
|
quaternion: "rotation",
|
|
3401
3441
|
morphTargetInfluences: "weights"
|
|
3402
|
-
},
|
|
3403
|
-
function
|
|
3442
|
+
}, De = new Ot(), Mt = 12, Le = 1179937895, Ae = 2, St = 8, Te = 1313821514, be = 5130562;
|
|
3443
|
+
function W(d, t) {
|
|
3404
3444
|
return d.length === t.length && d.every(function(e, n) {
|
|
3405
3445
|
return e === t[n];
|
|
3406
3446
|
});
|
|
3407
3447
|
}
|
|
3408
|
-
function
|
|
3448
|
+
function Ie(d) {
|
|
3409
3449
|
return new TextEncoder().encode(d).buffer;
|
|
3410
3450
|
}
|
|
3411
|
-
function
|
|
3412
|
-
return
|
|
3451
|
+
function Pe(d) {
|
|
3452
|
+
return W(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
3413
3453
|
}
|
|
3414
|
-
function
|
|
3454
|
+
function Re(d, t, e) {
|
|
3415
3455
|
const n = {
|
|
3416
3456
|
min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
3417
3457
|
max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -3440,7 +3480,7 @@ function nt(d, t = 0) {
|
|
|
3440
3480
|
function Et() {
|
|
3441
3481
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
3442
3482
|
}
|
|
3443
|
-
function
|
|
3483
|
+
function ve(d, t) {
|
|
3444
3484
|
if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
|
|
3445
3485
|
let e;
|
|
3446
3486
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
|
|
@@ -3450,7 +3490,7 @@ function Pe(d, t) {
|
|
|
3450
3490
|
} else
|
|
3451
3491
|
return new Promise((e) => d.toBlob(e, t));
|
|
3452
3492
|
}
|
|
3453
|
-
class
|
|
3493
|
+
class Ne {
|
|
3454
3494
|
constructor() {
|
|
3455
3495
|
this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
|
|
3456
3496
|
asset: {
|
|
@@ -3494,11 +3534,11 @@ class Re {
|
|
|
3494
3534
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
3495
3535
|
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 ? st(c).then(function(u) {
|
|
3496
3536
|
const f = nt(u), p = new DataView(new ArrayBuffer(St));
|
|
3497
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
3498
|
-
const y = nt(
|
|
3499
|
-
x.setUint32(0, y.byteLength, !0), x.setUint32(4,
|
|
3537
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, be, !0);
|
|
3538
|
+
const y = nt(Ie(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(St));
|
|
3539
|
+
x.setUint32(0, y.byteLength, !0), x.setUint32(4, Te, !0);
|
|
3500
3540
|
const g = new ArrayBuffer(Mt), w = new DataView(g);
|
|
3501
|
-
w.setUint32(0,
|
|
3541
|
+
w.setUint32(0, Le, !0), w.setUint32(4, Ae, !0);
|
|
3502
3542
|
const E = Mt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
|
|
3503
3543
|
w.setUint32(8, E, !0);
|
|
3504
3544
|
const m = new Blob([
|
|
@@ -3511,7 +3551,7 @@ class Re {
|
|
|
3511
3551
|
st(m).then((S) => {
|
|
3512
3552
|
e(S);
|
|
3513
3553
|
});
|
|
3514
|
-
}) : r.buffers && r.buffers.length > 0 ?
|
|
3554
|
+
}) : r.buffers && r.buffers.length > 0 ? We(c).then((u) => {
|
|
3515
3555
|
r.buffers[0].uri = u, e(r);
|
|
3516
3556
|
}) : e(r);
|
|
3517
3557
|
}
|
|
@@ -3622,7 +3662,7 @@ class Re {
|
|
|
3622
3662
|
}
|
|
3623
3663
|
c.putImageData(l, 0, 0);
|
|
3624
3664
|
const u = (t || e).clone();
|
|
3625
|
-
return u.source = new Gt(a), u.colorSpace =
|
|
3665
|
+
return u.source = new Gt(a), u.colorSpace = jt, 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;
|
|
3626
3666
|
}
|
|
3627
3667
|
async decompressTextureAsync(t, e = 1 / 0) {
|
|
3628
3668
|
if (this.textureUtils === null)
|
|
@@ -3737,7 +3777,7 @@ class Re {
|
|
|
3737
3777
|
else
|
|
3738
3778
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
3739
3779
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
3740
|
-
const a =
|
|
3780
|
+
const a = Re(t, n, s);
|
|
3741
3781
|
let c;
|
|
3742
3782
|
e !== void 0 && (c = t === e.index ? b.ELEMENT_ARRAY_BUFFER : b.ARRAY_BUFFER);
|
|
3743
3783
|
const l = this.processBufferView(t, o, n, s, c), h = {
|
|
@@ -3772,7 +3812,7 @@ class Re {
|
|
|
3772
3812
|
willReadFrequently: !0
|
|
3773
3813
|
});
|
|
3774
3814
|
if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
|
|
3775
|
-
e !==
|
|
3815
|
+
e !== zt && console.error("GLTFExporter: Only RGBAFormat is supported.", e), (t.width > a.maxTextureSize || t.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", t);
|
|
3776
3816
|
const x = new Uint8ClampedArray(t.height * t.width * 4);
|
|
3777
3817
|
for (let g = 0; g < x.length; g += 4)
|
|
3778
3818
|
x[g + 0] = t.data[g + 0], x[g + 1] = t.data[g + 1], x[g + 2] = t.data[g + 2], x[g + 3] = t.data[g + 3];
|
|
@@ -3782,7 +3822,7 @@ class Re {
|
|
|
3782
3822
|
else
|
|
3783
3823
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
3784
3824
|
a.binary === !0 ? c.push(
|
|
3785
|
-
|
|
3825
|
+
ve(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
|
|
3786
3826
|
u.bufferView = x;
|
|
3787
3827
|
})
|
|
3788
3828
|
) : u.uri = _t.getDataURL(f, s);
|
|
@@ -3842,7 +3882,7 @@ class Re {
|
|
|
3842
3882
|
const s = { pbrMetallicRoughness: {} };
|
|
3843
3883
|
t.isMeshStandardMaterial !== !0 && t.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
3844
3884
|
const i = t.color.toArray().concat([t.opacity]);
|
|
3845
|
-
if (
|
|
3885
|
+
if (W(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), t.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = t.metalness, s.pbrMetallicRoughness.roughnessFactor = t.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), t.metalnessMap || t.roughnessMap) {
|
|
3846
3886
|
const o = await this.buildMetalRoughTextureAsync(t.metalnessMap, t.roughnessMap), a = {
|
|
3847
3887
|
index: await this.processTextureAsync(o),
|
|
3848
3888
|
texCoord: o.channel
|
|
@@ -3922,8 +3962,8 @@ class Re {
|
|
|
3922
3962
|
continue;
|
|
3923
3963
|
}
|
|
3924
3964
|
p = null;
|
|
3925
|
-
const
|
|
3926
|
-
m === "JOINTS_0" && !(
|
|
3965
|
+
const L = S.array;
|
|
3966
|
+
m === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(L), S.itemSize, S.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !m.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${m}" converted to type FLOAT.`), p = Z.Utils.toFloat32BufferAttribute(S));
|
|
3927
3967
|
const A = this.processAccessor(p || S, r);
|
|
3928
3968
|
A !== null && (m.startsWith("_") || this.detectMeshQuantization(m, S), c[m] = A, e.attributes.set(this.getUID(S), A));
|
|
3929
3969
|
}
|
|
@@ -3931,9 +3971,9 @@ class Re {
|
|
|
3931
3971
|
if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
|
|
3932
3972
|
const m = [], S = [], T = {};
|
|
3933
3973
|
if (t.morphTargetDictionary !== void 0)
|
|
3934
|
-
for (const
|
|
3935
|
-
T[t.morphTargetDictionary[
|
|
3936
|
-
for (let
|
|
3974
|
+
for (const L in t.morphTargetDictionary)
|
|
3975
|
+
T[t.morphTargetDictionary[L]] = L;
|
|
3976
|
+
for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
|
|
3937
3977
|
const A = {};
|
|
3938
3978
|
let P = !1;
|
|
3939
3979
|
for (const N in r.morphAttributes) {
|
|
@@ -3941,19 +3981,19 @@ class Re {
|
|
|
3941
3981
|
P || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), P = !0);
|
|
3942
3982
|
continue;
|
|
3943
3983
|
}
|
|
3944
|
-
const O = r.morphAttributes[N][
|
|
3984
|
+
const O = r.morphAttributes[N][L], C = N.toUpperCase(), G = r.attributes[N];
|
|
3945
3985
|
if (e.attributes.has(this.getUID(O, !0))) {
|
|
3946
3986
|
A[C] = e.attributes.get(this.getUID(O, !0));
|
|
3947
3987
|
continue;
|
|
3948
3988
|
}
|
|
3949
3989
|
const B = O.clone();
|
|
3950
3990
|
if (!r.morphTargetsRelative)
|
|
3951
|
-
for (let v = 0,
|
|
3952
|
-
for (let
|
|
3953
|
-
|
|
3991
|
+
for (let v = 0, V = O.count; v < V; v++)
|
|
3992
|
+
for (let j = 0; j < O.itemSize; j++)
|
|
3993
|
+
j === 0 && B.setX(v, O.getX(v) - G.getX(v)), j === 1 && B.setY(v, O.getY(v) - G.getY(v)), j === 2 && B.setZ(v, O.getZ(v) - G.getZ(v)), j === 3 && B.setW(v, O.getW(v) - G.getW(v));
|
|
3954
3994
|
A[C] = this.processAccessor(B, r), e.attributes.set(this.getUID(G, !0), A[C]);
|
|
3955
3995
|
}
|
|
3956
|
-
h.push(A), m.push(t.morphTargetInfluences[
|
|
3996
|
+
h.push(A), m.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(T[L]);
|
|
3957
3997
|
}
|
|
3958
3998
|
a.weights = m, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
|
|
3959
3999
|
}
|
|
@@ -3976,8 +4016,8 @@ class Re {
|
|
|
3976
4016
|
let A = this.getUID(r.index);
|
|
3977
4017
|
(w[m].start !== void 0 || w[m].count !== void 0) && (A += ":" + w[m].start + ":" + w[m].count), e.attributes.has(A) ? T.indices = e.attributes.get(A) : (T.indices = this.processAccessor(r.index, r, w[m].start, w[m].count), e.attributes.set(A, T.indices)), T.indices === null && delete T.indices;
|
|
3978
4018
|
}
|
|
3979
|
-
const
|
|
3980
|
-
|
|
4019
|
+
const L = await this.processMaterialAsync(g[w[m].materialIndex]);
|
|
4020
|
+
L !== null && (T.material = L), l.push(T);
|
|
3981
4021
|
}
|
|
3982
4022
|
x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(m) {
|
|
3983
4023
|
m.writeMesh && m.writeMesh(t, a);
|
|
@@ -4096,7 +4136,7 @@ class Re {
|
|
|
4096
4136
|
if (i === void 0) return null;
|
|
4097
4137
|
const r = t.skeleton.bones[0];
|
|
4098
4138
|
if (r === void 0) return null;
|
|
4099
|
-
const o = [], a = new Float32Array(i.bones.length * 16), c = new
|
|
4139
|
+
const o = [], a = new Float32Array(i.bones.length * 16), c = new Lt();
|
|
4100
4140
|
for (let h = 0; h < i.bones.length; ++h)
|
|
4101
4141
|
o.push(n.get(i.bones[h])), c.copy(i.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
|
|
4102
4142
|
return e.skins === void 0 && (e.skins = []), e.skins.push({
|
|
@@ -4116,9 +4156,9 @@ class Re {
|
|
|
4116
4156
|
const i = {};
|
|
4117
4157
|
if (n.trs) {
|
|
4118
4158
|
const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
|
|
4119
|
-
|
|
4159
|
+
W(o, [0, 0, 0, 1]) || (i.rotation = o), W(a, [0, 0, 0]) || (i.translation = a), W(c, [1, 1, 1]) || (i.scale = c);
|
|
4120
4160
|
} else
|
|
4121
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
4161
|
+
t.matrixAutoUpdate && t.updateMatrix(), Pe(t.matrix) === !1 && (i.matrix = t.matrix.elements);
|
|
4122
4162
|
if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
|
|
4123
4163
|
const o = await this.processMeshAsync(t);
|
|
4124
4164
|
o !== null && (i.mesh = o);
|
|
@@ -4195,7 +4235,7 @@ class Re {
|
|
|
4195
4235
|
await t(this.plugins[e]);
|
|
4196
4236
|
}
|
|
4197
4237
|
}
|
|
4198
|
-
class
|
|
4238
|
+
class Ce {
|
|
4199
4239
|
constructor(t) {
|
|
4200
4240
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
4201
4241
|
}
|
|
@@ -4211,7 +4251,7 @@ class ve {
|
|
|
4211
4251
|
o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
|
|
4212
4252
|
}
|
|
4213
4253
|
}
|
|
4214
|
-
class
|
|
4254
|
+
class Be {
|
|
4215
4255
|
constructor(t) {
|
|
4216
4256
|
this.writer = t, this.name = "KHR_materials_unlit";
|
|
4217
4257
|
}
|
|
@@ -4221,7 +4261,7 @@ class Ne {
|
|
|
4221
4261
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
4222
4262
|
}
|
|
4223
4263
|
}
|
|
4224
|
-
class
|
|
4264
|
+
class Oe {
|
|
4225
4265
|
constructor(t) {
|
|
4226
4266
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
4227
4267
|
}
|
|
@@ -4252,7 +4292,7 @@ class Ce {
|
|
|
4252
4292
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4253
4293
|
}
|
|
4254
4294
|
}
|
|
4255
|
-
class
|
|
4295
|
+
class Fe {
|
|
4256
4296
|
constructor(t) {
|
|
4257
4297
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
4258
4298
|
}
|
|
@@ -4262,7 +4302,7 @@ class Be {
|
|
|
4262
4302
|
i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4263
4303
|
}
|
|
4264
4304
|
}
|
|
4265
|
-
class
|
|
4305
|
+
class Ue {
|
|
4266
4306
|
constructor(t) {
|
|
4267
4307
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
4268
4308
|
}
|
|
@@ -4286,7 +4326,7 @@ class Oe {
|
|
|
4286
4326
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4287
4327
|
}
|
|
4288
4328
|
}
|
|
4289
|
-
class
|
|
4329
|
+
class Ge {
|
|
4290
4330
|
constructor(t) {
|
|
4291
4331
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
4292
4332
|
}
|
|
@@ -4303,7 +4343,7 @@ class Fe {
|
|
|
4303
4343
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4304
4344
|
}
|
|
4305
4345
|
}
|
|
4306
|
-
class
|
|
4346
|
+
class je {
|
|
4307
4347
|
constructor(t) {
|
|
4308
4348
|
this.writer = t, this.name = "KHR_materials_volume";
|
|
4309
4349
|
}
|
|
@@ -4320,7 +4360,7 @@ class Ue {
|
|
|
4320
4360
|
t.attenuationDistance !== 1 / 0 && (i.attenuationDistance = t.attenuationDistance), i.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4321
4361
|
}
|
|
4322
4362
|
}
|
|
4323
|
-
class
|
|
4363
|
+
class ze {
|
|
4324
4364
|
constructor(t) {
|
|
4325
4365
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
4326
4366
|
}
|
|
@@ -4330,12 +4370,12 @@ class Ge {
|
|
|
4330
4370
|
i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4331
4371
|
}
|
|
4332
4372
|
}
|
|
4333
|
-
class
|
|
4373
|
+
class _e {
|
|
4334
4374
|
constructor(t) {
|
|
4335
4375
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
4336
4376
|
}
|
|
4337
4377
|
async writeMaterialAsync(t, e) {
|
|
4338
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
4378
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(De) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
4339
4379
|
const n = this.writer, s = n.extensionsUsed, i = {};
|
|
4340
4380
|
if (t.specularIntensityMap) {
|
|
4341
4381
|
const r = {
|
|
@@ -4354,7 +4394,7 @@ class ze {
|
|
|
4354
4394
|
i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4355
4395
|
}
|
|
4356
4396
|
}
|
|
4357
|
-
class
|
|
4397
|
+
class qe {
|
|
4358
4398
|
constructor(t) {
|
|
4359
4399
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
4360
4400
|
}
|
|
@@ -4378,7 +4418,7 @@ class je {
|
|
|
4378
4418
|
i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4379
4419
|
}
|
|
4380
4420
|
}
|
|
4381
|
-
class
|
|
4421
|
+
class Ye {
|
|
4382
4422
|
constructor(t) {
|
|
4383
4423
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
4384
4424
|
}
|
|
@@ -4392,7 +4432,7 @@ class _e {
|
|
|
4392
4432
|
i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4393
4433
|
}
|
|
4394
4434
|
}
|
|
4395
|
-
class
|
|
4435
|
+
class ke {
|
|
4396
4436
|
constructor(t) {
|
|
4397
4437
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
4398
4438
|
}
|
|
@@ -4402,7 +4442,7 @@ class qe {
|
|
|
4402
4442
|
i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4403
4443
|
}
|
|
4404
4444
|
}
|
|
4405
|
-
class
|
|
4445
|
+
class Xe {
|
|
4406
4446
|
constructor(t) {
|
|
4407
4447
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
4408
4448
|
}
|
|
@@ -4419,13 +4459,13 @@ class Ye {
|
|
|
4419
4459
|
i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4420
4460
|
}
|
|
4421
4461
|
}
|
|
4422
|
-
class
|
|
4462
|
+
class Ve {
|
|
4423
4463
|
constructor(t) {
|
|
4424
4464
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
4425
4465
|
}
|
|
4426
4466
|
writeNode(t, e) {
|
|
4427
4467
|
if (!t.isInstancedMesh) return;
|
|
4428
|
-
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
|
|
4468
|
+
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 Lt(), c = new J(), l = new Ft(), h = new J();
|
|
4429
4469
|
for (let f = 0; f < s.count; f++)
|
|
4430
4470
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
|
|
4431
4471
|
const u = {
|
|
@@ -4509,7 +4549,7 @@ Z.Utils = {
|
|
|
4509
4549
|
return t;
|
|
4510
4550
|
}
|
|
4511
4551
|
};
|
|
4512
|
-
async function
|
|
4552
|
+
async function We(d) {
|
|
4513
4553
|
if (typeof FileReader > "u") {
|
|
4514
4554
|
const t = await d.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
4515
4555
|
return `data:${d.type};base64,${n}`;
|
|
@@ -4532,8 +4572,8 @@ async function st(d) {
|
|
|
4532
4572
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
4533
4573
|
}
|
|
4534
4574
|
}
|
|
4535
|
-
const
|
|
4536
|
-
function
|
|
4575
|
+
const He = new ee(), Je = new Z();
|
|
4576
|
+
function $e(d, t, e = 0.1) {
|
|
4537
4577
|
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;
|
|
4538
4578
|
return {
|
|
4539
4579
|
points: [
|
|
@@ -4578,7 +4618,7 @@ class Rt extends q {
|
|
|
4578
4618
|
new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
|
|
4579
4619
|
);
|
|
4580
4620
|
}), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
|
|
4581
|
-
const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } =
|
|
4621
|
+
const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = $e(r, o, t.width);
|
|
4582
4622
|
return {
|
|
4583
4623
|
points: a,
|
|
4584
4624
|
indices: c,
|
|
@@ -4611,7 +4651,7 @@ class Rt extends q {
|
|
|
4611
4651
|
toOBJ() {
|
|
4612
4652
|
return new Promise((t) => {
|
|
4613
4653
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
4614
|
-
t(
|
|
4654
|
+
t(He.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
4615
4655
|
}, 20);
|
|
4616
4656
|
});
|
|
4617
4657
|
}
|
|
@@ -4623,7 +4663,7 @@ class Rt extends q {
|
|
|
4623
4663
|
toGltf(t = !0) {
|
|
4624
4664
|
return new Promise((e) => {
|
|
4625
4665
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
4626
|
-
|
|
4666
|
+
Je.parse(this.whiteModelGroup.children, (n) => {
|
|
4627
4667
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
4628
4668
|
}, () => {
|
|
4629
4669
|
e(void 0);
|
|
@@ -4784,13 +4824,13 @@ class Nt extends q {
|
|
|
4784
4824
|
});
|
|
4785
4825
|
}
|
|
4786
4826
|
}
|
|
4787
|
-
const
|
|
4827
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4788
4828
|
__proto__: null,
|
|
4789
4829
|
DetailsPoint: vt,
|
|
4790
4830
|
DxfLineModel: Nt,
|
|
4791
4831
|
WhiteModel: Rt
|
|
4792
4832
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4793
|
-
function
|
|
4833
|
+
function Dt(d, t = {}) {
|
|
4794
4834
|
const {
|
|
4795
4835
|
detailsPoint: e = !0,
|
|
4796
4836
|
whiteModel: n = !0,
|
|
@@ -4798,24 +4838,24 @@ function Lt(d, t = {}) {
|
|
|
4798
4838
|
} = t;
|
|
4799
4839
|
s && d.addComponent(new Nt()), n && d.addComponent(new Rt()), e && d.addComponent(new vt());
|
|
4800
4840
|
}
|
|
4801
|
-
const
|
|
4841
|
+
const Ze = Object.assign(Dt, {
|
|
4802
4842
|
create(d = {}) {
|
|
4803
|
-
return (t) =>
|
|
4843
|
+
return (t) => Dt(t, d);
|
|
4804
4844
|
}
|
|
4805
|
-
}),
|
|
4845
|
+
}), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4806
4846
|
__proto__: null,
|
|
4807
|
-
ModelDataPlugin:
|
|
4808
|
-
components:
|
|
4847
|
+
ModelDataPlugin: Ze,
|
|
4848
|
+
components: Ke
|
|
4809
4849
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4810
|
-
function
|
|
4850
|
+
function tn() {
|
|
4811
4851
|
return import("./index2.js");
|
|
4812
4852
|
}
|
|
4813
|
-
function
|
|
4853
|
+
function en() {
|
|
4814
4854
|
return import("./index3.js");
|
|
4815
4855
|
}
|
|
4816
4856
|
let ht = null;
|
|
4817
|
-
async function
|
|
4818
|
-
const s = await Promise.resolve().then(() =>
|
|
4857
|
+
async function ln(d, t, e = !1, n) {
|
|
4858
|
+
const s = await Promise.resolve().then(() => Qe), i = await tn(), r = await en(), o = new ct().usePlugin(s.ModelDataPlugin.create({
|
|
4819
4859
|
detailsPoint: !1,
|
|
4820
4860
|
whiteModel: !0
|
|
4821
4861
|
})).usePlugin(i.RenderPlugin.create({
|
|
@@ -4827,10 +4867,10 @@ async function an(d, t, e = !1, n) {
|
|
|
4827
4867
|
})).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
|
|
4828
4868
|
return a && d.appendChild(a.domElement), ht = o, {
|
|
4829
4869
|
dxfSystem: o,
|
|
4830
|
-
getFileAll: () =>
|
|
4870
|
+
getFileAll: () => nn(o)
|
|
4831
4871
|
};
|
|
4832
4872
|
}
|
|
4833
|
-
async function
|
|
4873
|
+
async function nn(d = ht) {
|
|
4834
4874
|
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" });
|
|
4835
4875
|
return {
|
|
4836
4876
|
dxf: n,
|
|
@@ -4842,7 +4882,7 @@ async function tn(d = ht) {
|
|
|
4842
4882
|
correctionDxf: s
|
|
4843
4883
|
};
|
|
4844
4884
|
}
|
|
4845
|
-
function
|
|
4885
|
+
function hn() {
|
|
4846
4886
|
return ht;
|
|
4847
4887
|
}
|
|
4848
4888
|
export {
|
|
@@ -4851,21 +4891,21 @@ export {
|
|
|
4851
4891
|
q as C,
|
|
4852
4892
|
ct as D,
|
|
4853
4893
|
At as E,
|
|
4854
|
-
L,
|
|
4855
|
-
|
|
4894
|
+
D as L,
|
|
4895
|
+
Ze as M,
|
|
4856
4896
|
M as P,
|
|
4857
4897
|
F as Q,
|
|
4858
|
-
|
|
4898
|
+
Ee as T,
|
|
4859
4899
|
bt as V,
|
|
4860
4900
|
Rt as W,
|
|
4861
4901
|
vt as a,
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4902
|
+
X as b,
|
|
4903
|
+
ln as c,
|
|
4904
|
+
hn as d,
|
|
4865
4905
|
k as e,
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4906
|
+
cn as f,
|
|
4907
|
+
nn as g,
|
|
4908
|
+
Ke as i,
|
|
4869
4909
|
It as r,
|
|
4870
4910
|
rt as u
|
|
4871
4911
|
};
|