build-dxf 0.0.52 → 0.0.54
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 +167 -156
- package/package.json +45 -45
- package/src/build.js +431 -373
- package/src/index.css +1 -1
- package/src/utils/DxfSystem/components/Dxf.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +1 -1
- package/src/utils/DxfSystem/utils/CAD.d.ts +16 -0
- package/src/utils/LineSegment.d.ts +5 -0
- package/src/utils/Polygon.d.ts +11 -1
package/src/build.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as I from "three";
|
|
2
|
-
import { EventDispatcher as
|
|
3
|
-
import
|
|
2
|
+
import { EventDispatcher as Ae, Color as Pe, Matrix4 as Zt, Vector3 as ut, Quaternion as Ie, BufferAttribute as X, REVISION as ve, CompressedTexture as xt, Source as Re, NoColorSpace as Ce, MathUtils as St, RGBAFormat as Be, ImageUtils as Ne, DoubleSide as je, PropertyBinding as ht, InterpolateDiscrete as Fe, Scene as Ft, SRGBColorSpace as Oe, NearestFilter as qe, NearestMipmapNearestFilter as Ge, NearestMipmapLinearFilter as ze, LinearFilter as Ue, LinearMipmapNearestFilter as ke, LinearMipmapLinearFilter as _e, ClampToEdgeWrapping as We, RepeatWrapping as Ye, MirroredRepeatWrapping as Xe, InterpolateLinear as Ve } from "three";
|
|
3
|
+
import Ot from "clipper-lib";
|
|
4
4
|
import ct from "dxf-writer";
|
|
5
|
-
import { OBJExporter as
|
|
5
|
+
import { OBJExporter as He } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
6
6
|
function V() {
|
|
7
7
|
return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(u) {
|
|
8
8
|
var t = Math.random() * 16 | 0, e = u == "x" ? t : t & 3 | 8;
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
class it extends
|
|
12
|
+
class it extends Ae {
|
|
13
13
|
uuid = V();
|
|
14
14
|
addEventListener(t, e, n) {
|
|
15
15
|
const { once: s = !1 } = n ?? {}, r = (o) => {
|
|
@@ -48,7 +48,7 @@ class z extends it {
|
|
|
48
48
|
this.destroyed = !0;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class Qt extends it {
|
|
52
52
|
static EventType = {
|
|
53
53
|
ADD_COMPONENT: "addComponent"
|
|
54
54
|
};
|
|
@@ -336,7 +336,7 @@ class v {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class te extends Array {
|
|
340
340
|
userDataList() {
|
|
341
341
|
return this.map((t) => t.userData);
|
|
342
342
|
}
|
|
@@ -478,7 +478,7 @@ class G {
|
|
|
478
478
|
* @param point
|
|
479
479
|
*/
|
|
480
480
|
queryPoint(t, e = !1) {
|
|
481
|
-
const n = new
|
|
481
|
+
const n = new te();
|
|
482
482
|
let s;
|
|
483
483
|
if (t.currentData[this.id])
|
|
484
484
|
s = t.currentData[this.id]?.set;
|
|
@@ -526,7 +526,7 @@ class G {
|
|
|
526
526
|
if (t.size === 1) return [...t][0];
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function k(u) {
|
|
530
530
|
if (!u || typeof u != "object")
|
|
531
531
|
return u;
|
|
532
532
|
const t = Array.isArray(u) ? [] : {}, e = Object.keys(u);
|
|
@@ -537,11 +537,11 @@ function _(u) {
|
|
|
537
537
|
continue;
|
|
538
538
|
}
|
|
539
539
|
if (Array.isArray(s)) {
|
|
540
|
-
t[n] = s.map((r) =>
|
|
540
|
+
t[n] = s.map((r) => k(r));
|
|
541
541
|
continue;
|
|
542
542
|
}
|
|
543
543
|
if (Object.getPrototypeOf(s) === Object.prototype) {
|
|
544
|
-
t[n] =
|
|
544
|
+
t[n] = k(s);
|
|
545
545
|
continue;
|
|
546
546
|
}
|
|
547
547
|
}
|
|
@@ -706,7 +706,7 @@ class nt {
|
|
|
706
706
|
]);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
class
|
|
709
|
+
class B {
|
|
710
710
|
bounds;
|
|
711
711
|
// 包围盒
|
|
712
712
|
capacity;
|
|
@@ -792,25 +792,25 @@ class N {
|
|
|
792
792
|
if (!this.isLeaf) return;
|
|
793
793
|
this.isLeaf = !1, this.children = [];
|
|
794
794
|
const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
|
|
795
|
-
this.children[0] = new
|
|
795
|
+
this.children[0] = new B(
|
|
796
796
|
new v(this.bounds.minX, t, this.bounds.minY, e),
|
|
797
797
|
this.capacity,
|
|
798
798
|
this.maxDepth,
|
|
799
799
|
this.depth + 1,
|
|
800
800
|
this.id
|
|
801
|
-
), this.children[1] = new
|
|
801
|
+
), this.children[1] = new B(
|
|
802
802
|
new v(t, this.bounds.maxX, this.bounds.minY, e),
|
|
803
803
|
this.capacity,
|
|
804
804
|
this.maxDepth,
|
|
805
805
|
this.depth + 1,
|
|
806
806
|
this.id
|
|
807
|
-
), this.children[2] = new
|
|
807
|
+
), this.children[2] = new B(
|
|
808
808
|
new v(this.bounds.minX, t, e, this.bounds.maxY),
|
|
809
809
|
this.capacity,
|
|
810
810
|
this.maxDepth,
|
|
811
811
|
this.depth + 1,
|
|
812
812
|
this.id
|
|
813
|
-
), this.children[3] = new
|
|
813
|
+
), this.children[3] = new B(
|
|
814
814
|
new v(t, this.bounds.maxX, e, this.bounds.maxY),
|
|
815
815
|
this.capacity,
|
|
816
816
|
this.maxDepth,
|
|
@@ -1020,7 +1020,7 @@ class Q {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
const lt = /* @__PURE__ */ new Set();
|
|
1023
|
-
function
|
|
1023
|
+
function $e(u) {
|
|
1024
1024
|
lt.size === 0 && queueMicrotask(() => {
|
|
1025
1025
|
lt.forEach((t) => t.cachedLength = null), lt.clear();
|
|
1026
1026
|
}), lt.add(u);
|
|
@@ -1184,7 +1184,7 @@ class E {
|
|
|
1184
1184
|
*/
|
|
1185
1185
|
cachedLength = null;
|
|
1186
1186
|
length(t = !1) {
|
|
1187
|
-
return t ? (this.cachedLength === null && (this.cachedLength = this.getLength(),
|
|
1187
|
+
return t ? (this.cachedLength === null && (this.cachedLength = this.getLength(), $e(this)), this.cachedLength) : this.getLength();
|
|
1188
1188
|
}
|
|
1189
1189
|
/**
|
|
1190
1190
|
* 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
|
|
@@ -1414,7 +1414,7 @@ class E {
|
|
|
1414
1414
|
this.points[0].clone(),
|
|
1415
1415
|
this.points[1].clone()
|
|
1416
1416
|
);
|
|
1417
|
-
return t.userData =
|
|
1417
|
+
return t.userData = k(this.userData), t;
|
|
1418
1418
|
}
|
|
1419
1419
|
/**
|
|
1420
1420
|
* 获取最长线段
|
|
@@ -1433,7 +1433,7 @@ class E {
|
|
|
1433
1433
|
* @param lines
|
|
1434
1434
|
*/
|
|
1435
1435
|
static groupBySamePointAndParallel(t) {
|
|
1436
|
-
const e = new G(), n = new
|
|
1436
|
+
const e = new G(), n = new B(v.fromByLineSegment(...t));
|
|
1437
1437
|
t.forEach((o) => {
|
|
1438
1438
|
o.points.forEach((a) => e.insert(a, o)), n.insert(o);
|
|
1439
1439
|
});
|
|
@@ -1496,6 +1496,39 @@ class E {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
return r;
|
|
1498
1498
|
}
|
|
1499
|
+
/** 通过最大叶子路径,给线段分组,每条路径没有分叉
|
|
1500
|
+
* @param lines
|
|
1501
|
+
* @returns
|
|
1502
|
+
*/
|
|
1503
|
+
static groupByLeafPath(t) {
|
|
1504
|
+
const e = new G(), n = /* @__PURE__ */ new Set();
|
|
1505
|
+
t.forEach((i) => i.points.forEach((o) => e.insert(o, i)));
|
|
1506
|
+
function s(i, o, a = []) {
|
|
1507
|
+
const c = e.queryPoint(i, !0);
|
|
1508
|
+
if (c.length === 0)
|
|
1509
|
+
return a.length < o.size && (a.length = 0, a.push(...o)), a;
|
|
1510
|
+
for (let l = 0; l < c.length; l++) {
|
|
1511
|
+
const h = c[l].userData, d = h.getAnotherPoint(c[l].point);
|
|
1512
|
+
if (o.has(h) || n.has(h)) {
|
|
1513
|
+
a.length < o.size && (a.length = 0, a.push(...o));
|
|
1514
|
+
continue;
|
|
1515
|
+
}
|
|
1516
|
+
o.add(h), s(d, o, a), o.delete(h);
|
|
1517
|
+
}
|
|
1518
|
+
return a;
|
|
1519
|
+
}
|
|
1520
|
+
const r = [];
|
|
1521
|
+
for (let i = 0; i < t.length; i++) {
|
|
1522
|
+
const o = t[i];
|
|
1523
|
+
if (n.has(o)) continue;
|
|
1524
|
+
n.add(o);
|
|
1525
|
+
const a = s(o.start, /* @__PURE__ */ new Set([]));
|
|
1526
|
+
a.forEach((l) => n.add(l));
|
|
1527
|
+
const c = s(o.end, /* @__PURE__ */ new Set([]));
|
|
1528
|
+
c.forEach((l) => n.add(l)), r.push([...a.reverse(), o, ...c]);
|
|
1529
|
+
}
|
|
1530
|
+
return r;
|
|
1531
|
+
}
|
|
1499
1532
|
/** 分组,通过点
|
|
1500
1533
|
* @param lines
|
|
1501
1534
|
* @returns
|
|
@@ -1917,24 +1950,24 @@ async function K(u, t = !0) {
|
|
|
1917
1950
|
return t && (e = e.default), e;
|
|
1918
1951
|
}
|
|
1919
1952
|
}
|
|
1920
|
-
function
|
|
1953
|
+
function ee(u, t = 0, e, n) {
|
|
1921
1954
|
const s = u.userData, r = s.drawWindow, i = e ? e.queryLineSegment(u).filter((a) => a.line !== u && !a.userData?.isDoor).map((a) => ({ index: n?.indexOf(a.line) })) : [];
|
|
1922
1955
|
return {
|
|
1923
|
-
...
|
|
1956
|
+
...k(s),
|
|
1924
1957
|
start: u.start.toJson(t),
|
|
1925
1958
|
end: u.end.toJson(t),
|
|
1926
1959
|
insetionArr: i,
|
|
1927
1960
|
length: u.length(),
|
|
1928
1961
|
drawWindow: r && r.map((a) => ({
|
|
1929
|
-
...
|
|
1962
|
+
...k(a),
|
|
1930
1963
|
p: { x: a.p.x, y: a.p.y, z: a.p.z }
|
|
1931
1964
|
}))
|
|
1932
1965
|
};
|
|
1933
1966
|
}
|
|
1934
1967
|
function rt(u, t = 0, e) {
|
|
1935
|
-
return e || (e = new
|
|
1968
|
+
return e || (e = new B(v.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 })), Promise.resolve().then(() => e?.clear())), u.map((n) => ee(n, t, e, u));
|
|
1936
1969
|
}
|
|
1937
|
-
function
|
|
1970
|
+
function qt(u, t) {
|
|
1938
1971
|
if (t.userData.isWindow && (u.userData.isWindow = !0, u.userData.drawWindow = t.userData.drawWindow?.filter((e) => {
|
|
1939
1972
|
const n = D.from(e.p);
|
|
1940
1973
|
return !!u.projectPoint(n);
|
|
@@ -1945,8 +1978,8 @@ function Ot(u, t) {
|
|
|
1945
1978
|
});
|
|
1946
1979
|
}
|
|
1947
1980
|
}
|
|
1948
|
-
function
|
|
1949
|
-
const e = new
|
|
1981
|
+
function Tt(u, t = 0.03) {
|
|
1982
|
+
const e = new B(v.fromByLineSegment(...u));
|
|
1950
1983
|
u.forEach((s) => e.insert({ line: s, userData: void 0 }));
|
|
1951
1984
|
const n = u.flatMap((s) => {
|
|
1952
1985
|
const r = e.queryLineSegment(s, !0).map((i) => {
|
|
@@ -1960,9 +1993,9 @@ function bt(u, t = 0.03) {
|
|
|
1960
1993
|
r.sort((a, c) => i.start.distance(a) - i.start.distance(c));
|
|
1961
1994
|
const o = r.map((a) => {
|
|
1962
1995
|
const c = i.clone();
|
|
1963
|
-
return c.set(i.start.clone(), a), i.start.copy(a),
|
|
1996
|
+
return c.set(i.start.clone(), a), i.start.copy(a), qt(c, s), c;
|
|
1964
1997
|
});
|
|
1965
|
-
return
|
|
1998
|
+
return qt(i, s), [...o, i];
|
|
1966
1999
|
}
|
|
1967
2000
|
return s;
|
|
1968
2001
|
}).filter((s) => s.length() >= t);
|
|
@@ -1995,7 +2028,7 @@ function ot(...u) {
|
|
|
1995
2028
|
}), t.userData.drawWindow = t.userData.drawWindow?.filter((n) => n.width > 1e-9);
|
|
1996
2029
|
});
|
|
1997
2030
|
}
|
|
1998
|
-
function
|
|
2031
|
+
function ne(...u) {
|
|
1999
2032
|
u.forEach((t) => {
|
|
2000
2033
|
t.userData.drawWindow?.forEach((e) => {
|
|
2001
2034
|
try {
|
|
@@ -2010,7 +2043,7 @@ function ee(...u) {
|
|
|
2010
2043
|
}), t.userData.drawWindow = t.userData.drawWindow?.filter((e) => e.width > 1e-9);
|
|
2011
2044
|
});
|
|
2012
2045
|
}
|
|
2013
|
-
function
|
|
2046
|
+
function se(...u) {
|
|
2014
2047
|
u.forEach((t) => {
|
|
2015
2048
|
if (!t.userData.drawWindow || t.userData.drawWindow.length < 2) return;
|
|
2016
2049
|
const e = t.center, n = t.userData.drawWindow.map((l) => {
|
|
@@ -2051,15 +2084,15 @@ function ne(...u) {
|
|
|
2051
2084
|
t.userData.drawWindow = c;
|
|
2052
2085
|
});
|
|
2053
2086
|
}
|
|
2054
|
-
function
|
|
2087
|
+
function _(u, t) {
|
|
2055
2088
|
if (Array.isArray(t))
|
|
2056
|
-
return t.forEach((s) =>
|
|
2089
|
+
return t.forEach((s) => _(u, s));
|
|
2057
2090
|
const { drawWindow: e, ...n } = t.userData;
|
|
2058
2091
|
Object.keys(n).forEach((s) => {
|
|
2059
2092
|
n[s] === void 0 && delete n[s];
|
|
2060
2093
|
}), e && (u.userData.drawWindow || (u.userData.drawWindow = []), u.userData.drawWindow.push(...e)), Object.assign(u.userData, n);
|
|
2061
2094
|
}
|
|
2062
|
-
function
|
|
2095
|
+
function At(u, t) {
|
|
2063
2096
|
const { drawWindow: e, ...n } = t.userData;
|
|
2064
2097
|
e && (u.userData.drawWindow || (u.userData.drawWindow = []), e.forEach((s) => {
|
|
2065
2098
|
const r = D.from(s.p);
|
|
@@ -2260,7 +2293,7 @@ class pt {
|
|
|
2260
2293
|
}
|
|
2261
2294
|
static findDoubleLine(t, e = 0.4) {
|
|
2262
2295
|
const n = t.filter((o) => !o.userData.isDoor && !C.hasType(o, "doubleWall")), s = /* @__PURE__ */ new Set(), r = [];
|
|
2263
|
-
let i = new
|
|
2296
|
+
let i = new B(v.fromByLineSegment(...n));
|
|
2264
2297
|
return n.forEach((o, a) => i.insert({ line: o, userData: a })), n.forEach((o, a) => {
|
|
2265
2298
|
const c = nt.fromByLineSegment(o, e * 2, !1, -0.01);
|
|
2266
2299
|
i.queryRect(c).map((h) => h.userData).filter((h) => h !== a).forEach((h) => {
|
|
@@ -2296,17 +2329,17 @@ class pt {
|
|
|
2296
2329
|
const p = new E(l.start.clone(), h.start.clone()), g = new E(l.end.clone(), h.end.clone());
|
|
2297
2330
|
o.push(p, g), a(d, l), a(f, h);
|
|
2298
2331
|
}), i.forEach((c, l) => {
|
|
2299
|
-
const h = E.clipping(l, c,
|
|
2332
|
+
const h = E.clipping(l, c, At);
|
|
2300
2333
|
t.push(...h);
|
|
2301
|
-
}), t = t.filter((c) => !r.has(c)), s.clear(), s = new
|
|
2334
|
+
}), t = t.filter((c) => !r.has(c)), s.clear(), s = new B(v.fromByLineSegment(...t)), t.forEach((c) => c.userData.isDoor || s.insert(c)), o = E.autoMergeLines(o).lines, o = o.filter((c) => c.length() !== 0).map((c) => {
|
|
2302
2335
|
const l = s.queryLineSegment(c).filter((d) => !(!d.line.parallel(c) || d.line.projectLineSegment(c).length() === 0)).map((d) => d.line);
|
|
2303
2336
|
if (l.length === 0)
|
|
2304
2337
|
return s.insert(c), c;
|
|
2305
2338
|
const h = E.mergeLines(...l, c);
|
|
2306
2339
|
return l.forEach((d) => {
|
|
2307
|
-
|
|
2340
|
+
_(h, d), s.remove(d), r.add(d);
|
|
2308
2341
|
}), s.insert(h), h;
|
|
2309
|
-
}), o = o.filter((c) => !r.has(c)), t = t.filter((c) => !r.has(c)), t.push(...o), t =
|
|
2342
|
+
}), o = o.filter((c) => !r.has(c)), t = t.filter((c) => !r.has(c)), t.push(...o), t = Tt(t, 1e-9), s.clear(), t;
|
|
2310
2343
|
}
|
|
2311
2344
|
}
|
|
2312
2345
|
class gt {
|
|
@@ -2345,18 +2378,18 @@ function $(u) {
|
|
|
2345
2378
|
t.insert(e.start, e), t.insert(e.end, e);
|
|
2346
2379
|
return t;
|
|
2347
2380
|
}
|
|
2348
|
-
function
|
|
2349
|
-
const t = new
|
|
2381
|
+
function Pt(u) {
|
|
2382
|
+
const t = new B(v.fromByLineSegment(...u));
|
|
2350
2383
|
for (const e of u)
|
|
2351
2384
|
t.insert(e);
|
|
2352
2385
|
return t;
|
|
2353
2386
|
}
|
|
2354
|
-
const
|
|
2387
|
+
const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2355
2388
|
__proto__: null,
|
|
2356
2389
|
createPointVirtualGrid: $,
|
|
2357
|
-
createQuadtree:
|
|
2390
|
+
createQuadtree: Pt
|
|
2358
2391
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2359
|
-
function
|
|
2392
|
+
function Ke(u, t, e, n = !0) {
|
|
2360
2393
|
e = e ?? /* @__PURE__ */ new Set();
|
|
2361
2394
|
const s = !!t, r = t || $(u);
|
|
2362
2395
|
function i(o) {
|
|
@@ -2370,7 +2403,7 @@ function Je(u, t, e, n = !0) {
|
|
|
2370
2403
|
}
|
|
2371
2404
|
return s || r.clear(), e;
|
|
2372
2405
|
}
|
|
2373
|
-
function
|
|
2406
|
+
function It(u, t, e = !1) {
|
|
2374
2407
|
t = t || /* @__PURE__ */ new Set();
|
|
2375
2408
|
const n = new et();
|
|
2376
2409
|
for (u.forEach((s) => {
|
|
@@ -2391,7 +2424,7 @@ function Pt(u, t, e = !1) {
|
|
|
2391
2424
|
}
|
|
2392
2425
|
return t;
|
|
2393
2426
|
}
|
|
2394
|
-
function
|
|
2427
|
+
function re(u) {
|
|
2395
2428
|
const t = new et(), e = new et();
|
|
2396
2429
|
u.forEach((n) => {
|
|
2397
2430
|
n.points.forEach((s, r) => {
|
|
@@ -2406,7 +2439,7 @@ function se(u) {
|
|
|
2406
2439
|
}
|
|
2407
2440
|
return t;
|
|
2408
2441
|
}
|
|
2409
|
-
class
|
|
2442
|
+
class ie {
|
|
2410
2443
|
adjacencyList;
|
|
2411
2444
|
get size() {
|
|
2412
2445
|
return this.adjacencyList.size;
|
|
@@ -2448,7 +2481,8 @@ class re {
|
|
|
2448
2481
|
* @returns
|
|
2449
2482
|
*/
|
|
2450
2483
|
getPaths() {
|
|
2451
|
-
|
|
2484
|
+
let t = [];
|
|
2485
|
+
const e = /* @__PURE__ */ new Set(), n = (s, r) => {
|
|
2452
2486
|
r.push(s), e.add(s);
|
|
2453
2487
|
let i = !1;
|
|
2454
2488
|
const o = this.getNeighbors(s);
|
|
@@ -2469,7 +2503,7 @@ class re {
|
|
|
2469
2503
|
t(e, n);
|
|
2470
2504
|
}
|
|
2471
2505
|
}
|
|
2472
|
-
class yt extends
|
|
2506
|
+
class yt extends ie {
|
|
2473
2507
|
// 线段存储:使用规范化 key (小索引-大索引) 避免双向存储
|
|
2474
2508
|
lineMap = /* @__PURE__ */ new Map();
|
|
2475
2509
|
// 点坐标映射
|
|
@@ -2560,6 +2594,7 @@ class yt extends re {
|
|
|
2560
2594
|
return t.map((i) => (i.start.rotate(r, e * (Math.PI / 180)), i.end.rotate(r, e * (Math.PI / 180)), n && n(i, r, e), i));
|
|
2561
2595
|
}
|
|
2562
2596
|
}
|
|
2597
|
+
let wt = !1;
|
|
2563
2598
|
class at extends Array {
|
|
2564
2599
|
constructor(t = []) {
|
|
2565
2600
|
super(...t);
|
|
@@ -2614,26 +2649,50 @@ class at extends Array {
|
|
|
2614
2649
|
pointWithin(t) {
|
|
2615
2650
|
return this.pointPosition(t) !== "inside";
|
|
2616
2651
|
}
|
|
2617
|
-
/**
|
|
2652
|
+
/** 转为线段
|
|
2653
|
+
* @param closed
|
|
2654
|
+
* @returns
|
|
2655
|
+
*/
|
|
2656
|
+
toLines(t = !0) {
|
|
2657
|
+
const e = [];
|
|
2658
|
+
for (let n = 0; n < this.length && !(!t && n === this.length - 1); n++) {
|
|
2659
|
+
const s = this[n], r = this[(n + 1) % this.length];
|
|
2660
|
+
e.push(new E(s, r));
|
|
2661
|
+
}
|
|
2662
|
+
return e;
|
|
2663
|
+
}
|
|
2664
|
+
/** 通过线段创建, 默认路径只有一条
|
|
2618
2665
|
* @param lines
|
|
2619
2666
|
* @returns
|
|
2620
2667
|
*/
|
|
2621
2668
|
static fromByLines(t) {
|
|
2622
|
-
|
|
2669
|
+
wt || (t = E.groupByLeafPath(t).sort((i, o) => o.length - i.length)[0]);
|
|
2670
|
+
const e = new G(), n = /* @__PURE__ */ new Set();
|
|
2623
2671
|
t.forEach((i) => i.points.forEach((o) => e.insert(o, i)));
|
|
2624
|
-
|
|
2625
|
-
|
|
2672
|
+
const s = t[0].start;
|
|
2673
|
+
let r = s;
|
|
2674
|
+
for (n.add(t[0].end), n.add(r); ; ) {
|
|
2626
2675
|
const i = e.queryPoint(r, !0);
|
|
2627
2676
|
if (i.length !== 1) break;
|
|
2628
2677
|
const { point: o, userData: a } = i[0];
|
|
2629
|
-
if (r = a?.getAnotherPoint(o),
|
|
2630
|
-
|
|
2678
|
+
if (r = a?.getAnotherPoint(o), n.has(r)) break;
|
|
2679
|
+
n.add(r);
|
|
2631
2680
|
}
|
|
2632
|
-
return
|
|
2681
|
+
return n.add(s.clone()), new at([...n].map((i) => i.clone()));
|
|
2682
|
+
}
|
|
2683
|
+
/** 通过线段创建,返回所有路径
|
|
2684
|
+
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
2685
|
+
* @param lines
|
|
2686
|
+
*/
|
|
2687
|
+
static multipleFromByLines(t) {
|
|
2688
|
+
const e = E.groupByLeafPath(t);
|
|
2689
|
+
wt = !0;
|
|
2690
|
+
const n = e.map((s) => this.fromByLines(s));
|
|
2691
|
+
return wt = !0, n;
|
|
2633
2692
|
}
|
|
2634
2693
|
}
|
|
2635
|
-
const
|
|
2636
|
-
function
|
|
2694
|
+
const Ze = Math.PI / 180;
|
|
2695
|
+
function vt(u, t, e = !1) {
|
|
2637
2696
|
const n = $(u), s = new E(), r = new E(), i = [], o = /* @__PURE__ */ new Set(), a = new E(), c = new E();
|
|
2638
2697
|
function l(f, p, g) {
|
|
2639
2698
|
if (f.vertical(g)) {
|
|
@@ -2643,7 +2702,7 @@ function It(u, t, e = !1) {
|
|
|
2643
2702
|
const y = f.center, m = f.normal(), x = f.getAnotherPoint(p), M = x.direction(p);
|
|
2644
2703
|
s.start.copy(y), s.end.copy(y).add(m.clone().multiplyScalar(1));
|
|
2645
2704
|
const w = g.getIntersection(s);
|
|
2646
|
-
return s.end.copy(w), g.direction().angleBetween(M) >
|
|
2705
|
+
return s.end.copy(w), g.direction().angleBetween(M) > Ze * 170 && s.mirror(), s.clone();
|
|
2647
2706
|
}
|
|
2648
2707
|
function h(f, p, g, y, m, x = !0) {
|
|
2649
2708
|
if (m.length > u.length || o.has(p)) return;
|
|
@@ -2691,7 +2750,7 @@ function It(u, t, e = !1) {
|
|
|
2691
2750
|
}
|
|
2692
2751
|
return i.filter((f) => f.length);
|
|
2693
2752
|
}
|
|
2694
|
-
function
|
|
2753
|
+
function oe(u) {
|
|
2695
2754
|
const t = new H(), e = [];
|
|
2696
2755
|
u.forEach((n) => t.append(n.length, n));
|
|
2697
2756
|
for (const n of t.values()) {
|
|
@@ -2703,7 +2762,7 @@ function ie(u) {
|
|
|
2703
2762
|
}
|
|
2704
2763
|
return e;
|
|
2705
2764
|
}
|
|
2706
|
-
function
|
|
2765
|
+
function ae(u, t = !1) {
|
|
2707
2766
|
const e = /* @__PURE__ */ new Map(), n = new Q(u.length), s = [];
|
|
2708
2767
|
u.forEach((o, a) => {
|
|
2709
2768
|
for (let c = 0; c < o.length; c++) {
|
|
@@ -2713,14 +2772,14 @@ function oe(u, t = !1) {
|
|
|
2713
2772
|
});
|
|
2714
2773
|
const r = new ft(), i = n.getAllSets().valueArray.map((o) => {
|
|
2715
2774
|
let a = o.map((l) => u[l]);
|
|
2716
|
-
return a.length === 1 ? a[0] : (r.clear(), a =
|
|
2775
|
+
return a.length === 1 ? a[0] : (r.clear(), a = oe(a), a.forEach((l) => l.forEach((h) => r.set(h))), t && (r.forEach((l, h) => drawText(l, h.center)), drawLines(u.flat(), { color: randomColor() })), r.reduce((l, h, d) => (h === 1 ? l.push(d) : s.push(d), l), []));
|
|
2717
2776
|
});
|
|
2718
2777
|
return {
|
|
2719
2778
|
internalEdges: s,
|
|
2720
2779
|
rings: i
|
|
2721
2780
|
};
|
|
2722
2781
|
}
|
|
2723
|
-
function
|
|
2782
|
+
function ce(u) {
|
|
2724
2783
|
const t = new yt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
2725
2784
|
function r(i) {
|
|
2726
2785
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
@@ -2736,14 +2795,14 @@ function ae(u) {
|
|
|
2736
2795
|
n.has(i) || r(i);
|
|
2737
2796
|
}), s;
|
|
2738
2797
|
}
|
|
2739
|
-
function
|
|
2740
|
-
let t =
|
|
2798
|
+
function le(u) {
|
|
2799
|
+
let t = It(u, /* @__PURE__ */ new Set(), !0);
|
|
2741
2800
|
u = u.filter((o) => !t.has(o));
|
|
2742
2801
|
const e = E.groupByPath(u), n = [], s = [];
|
|
2743
2802
|
e.forEach((o, a) => {
|
|
2744
2803
|
try {
|
|
2745
|
-
let c =
|
|
2746
|
-
const l =
|
|
2804
|
+
let c = ce(o);
|
|
2805
|
+
const l = ae(vt(o, c));
|
|
2747
2806
|
n.push(...l.rings), s.push(...l.internalEdges);
|
|
2748
2807
|
} catch (c) {
|
|
2749
2808
|
console.warn("环查找出现异常:", c);
|
|
@@ -2759,7 +2818,7 @@ function ce(u) {
|
|
|
2759
2818
|
function Z(u, t = [], e = !0, n = !1) {
|
|
2760
2819
|
const s = [];
|
|
2761
2820
|
u = u.filter((a) => a.userData.isBayWindow || a.userData.isWindow && C.hasType(a, "bayWindow") ? (s.push(a), !1) : !0);
|
|
2762
|
-
let { newLines: r, rings: i } =
|
|
2821
|
+
let { newLines: r, rings: i } = le(u), o = new Set(i.flat());
|
|
2763
2822
|
if (e) {
|
|
2764
2823
|
const a = new G(), c = /* @__PURE__ */ new Set();
|
|
2765
2824
|
r.forEach((d) => !o.has(d) && a.insert(d.center, d)), t.forEach((d) => a.insert(d.center, d));
|
|
@@ -2767,7 +2826,6 @@ function Z(u, t = [], e = !0, n = !1) {
|
|
|
2767
2826
|
t.forEach((d) => {
|
|
2768
2827
|
C.replace(d, l, "door") || C.set(d, l, "door");
|
|
2769
2828
|
}), i.forEach((d) => {
|
|
2770
|
-
TEST;
|
|
2771
2829
|
const f = V();
|
|
2772
2830
|
d.forEach((p) => {
|
|
2773
2831
|
C.replace(p, f, "doubleWall") || C.set(p, f, "doubleWall"), C.removeByType(p, "wall");
|
|
@@ -2778,12 +2836,12 @@ function Z(u, t = [], e = !0, n = !1) {
|
|
|
2778
2836
|
const h = t.filter((d) => !c.has(d));
|
|
2779
2837
|
t.length = 0, t.push(...h);
|
|
2780
2838
|
}
|
|
2781
|
-
return r.push(...s), E.brokenLineMerging(r,
|
|
2839
|
+
return r.push(...s), E.brokenLineMerging(r, _);
|
|
2782
2840
|
}
|
|
2783
|
-
function
|
|
2841
|
+
function bt(u, t = !0) {
|
|
2784
2842
|
const e = u.filter((s) => s.userData.isBayWindow), n = /* @__PURE__ */ new Set();
|
|
2785
2843
|
return e.forEach((s) => {
|
|
2786
|
-
let r =
|
|
2844
|
+
let r = vt(u, [s], !1);
|
|
2787
2845
|
if (r = r.filter((i) => i.some((o) => o.userData.isWindow && C.hasType(o, "bayWindow"))), r.length) {
|
|
2788
2846
|
const i = r[0], o = V();
|
|
2789
2847
|
i.forEach((a) => {
|
|
@@ -2792,7 +2850,7 @@ function St(u, t = !0) {
|
|
|
2792
2850
|
} else t && C.clear(s);
|
|
2793
2851
|
}), t && u.forEach((s) => n.has(s) || C.clear(s)), u;
|
|
2794
2852
|
}
|
|
2795
|
-
function
|
|
2853
|
+
function Qe(u, t = 0.1, e) {
|
|
2796
2854
|
e || (e = new G(), u.forEach((r) => {
|
|
2797
2855
|
r.userData.isDoor || r.points.forEach((i) => e?.insert(i, r));
|
|
2798
2856
|
}));
|
|
@@ -2823,17 +2881,17 @@ function Ze(u, t = 0.1, e) {
|
|
|
2823
2881
|
}
|
|
2824
2882
|
return [...u, ...n];
|
|
2825
2883
|
}
|
|
2826
|
-
function
|
|
2827
|
-
const t = new G(), e = new
|
|
2884
|
+
function tn(u) {
|
|
2885
|
+
const t = new G(), e = new B(v.fromByLineSegment(...u)), n = [];
|
|
2828
2886
|
return u.forEach((s) => {
|
|
2829
2887
|
s.userData.isDoor ? n.push(s) : (s.points.forEach((r) => t.insert(r, s)), e.insert(s));
|
|
2830
2888
|
}), n.forEach((s) => {
|
|
2831
2889
|
const r = t.queryPoint(s.start), i = t.queryPoint(s.end);
|
|
2832
2890
|
r.length ? s.userData.startIntersection = r[0].userData : s.userData.startIntersection = e.queryPoint(s.start)[0]?.line, i.length ? s.userData.endIntersection = i[0].userData : s.userData.endIntersection = e.queryPoint(s.end)[0]?.line;
|
|
2833
|
-
}), u =
|
|
2891
|
+
}), u = Qe(u, 0.4, t), t.clear(), e.clear(), u;
|
|
2834
2892
|
}
|
|
2835
|
-
function
|
|
2836
|
-
const t = new
|
|
2893
|
+
function en(u) {
|
|
2894
|
+
const t = new B(v.fromByLineSegment(...u));
|
|
2837
2895
|
u.forEach((n) => {
|
|
2838
2896
|
n.userData.isDoor || t.insert({ line: n, userData: void 0 });
|
|
2839
2897
|
});
|
|
@@ -2852,7 +2910,7 @@ function tn(u) {
|
|
|
2852
2910
|
}
|
|
2853
2911
|
return t.clear(), e;
|
|
2854
2912
|
}
|
|
2855
|
-
function
|
|
2913
|
+
function nn(u, t, e, n = 15) {
|
|
2856
2914
|
const s = [u], r = [], i = [], o = [];
|
|
2857
2915
|
function a(d) {
|
|
2858
2916
|
if (d.userData.isDoor) return i.push(d);
|
|
@@ -2904,7 +2962,7 @@ function en(u, t, e, n = 15) {
|
|
|
2904
2962
|
}
|
|
2905
2963
|
return h.forEach((d) => d()), { parallelLines: s, verticalLines: r, doorLines: i, windowLines: o };
|
|
2906
2964
|
}
|
|
2907
|
-
function
|
|
2965
|
+
function Gt(u, t, e, n, s) {
|
|
2908
2966
|
const r = [], i = /* @__PURE__ */ new Map();
|
|
2909
2967
|
u.forEach((c) => {
|
|
2910
2968
|
const l = e.projectPoint(c.start, !1);
|
|
@@ -2937,7 +2995,7 @@ function qt(u, t, e, n, s) {
|
|
|
2937
2995
|
}), f.push([...d]), f;
|
|
2938
2996
|
});
|
|
2939
2997
|
}
|
|
2940
|
-
function
|
|
2998
|
+
function zt(u, t, e, n) {
|
|
2941
2999
|
const s = /* @__PURE__ */ new Map(), r = [], i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
2942
3000
|
u.forEach((f) => {
|
|
2943
3001
|
const p = e.projectValue(f.start), g = e.projectPoint(f.start, !1), y = { value: p, line: f, point: g, index: -1 };
|
|
@@ -2990,7 +3048,7 @@ function Gt(u, t, e, n) {
|
|
|
2990
3048
|
return [p.slice(0, T).map((A) => A.line), p.slice(T).map((A) => A.line)];
|
|
2991
3049
|
}).flat(1), d;
|
|
2992
3050
|
}
|
|
2993
|
-
function
|
|
3051
|
+
function Ut(u, t) {
|
|
2994
3052
|
function e(r, i = /* @__PURE__ */ new Set()) {
|
|
2995
3053
|
if (i.has(r)) return i;
|
|
2996
3054
|
i.add(r);
|
|
@@ -3011,28 +3069,28 @@ function zt(u, t) {
|
|
|
3011
3069
|
}
|
|
3012
3070
|
return s;
|
|
3013
3071
|
}
|
|
3014
|
-
function
|
|
3072
|
+
function sn(u, t, e, n, s, r) {
|
|
3015
3073
|
const {
|
|
3016
3074
|
principalAxisThreshold: i = 0.3,
|
|
3017
3075
|
crossAxistThreshold: o = 0.08,
|
|
3018
3076
|
groupMethod: a = "principalAndCross"
|
|
3019
3077
|
} = r ?? {}, c = {
|
|
3020
3078
|
cross: () => [
|
|
3021
|
-
...
|
|
3022
|
-
...
|
|
3079
|
+
...zt(u, n, e, o),
|
|
3080
|
+
...zt(t, e, n, o)
|
|
3023
3081
|
],
|
|
3024
3082
|
principalAndCross: () => [
|
|
3025
|
-
...
|
|
3026
|
-
...
|
|
3083
|
+
...Gt(u, n, e, i, o),
|
|
3084
|
+
...Gt(t, e, n, i, o)
|
|
3027
3085
|
],
|
|
3028
3086
|
originalInterPoint: () => [
|
|
3029
|
-
...
|
|
3030
|
-
...
|
|
3087
|
+
...Ut(u, s),
|
|
3088
|
+
...Ut(t, s)
|
|
3031
3089
|
]
|
|
3032
3090
|
};
|
|
3033
3091
|
return c[a] ? c[a]() : c.originalInterPoint();
|
|
3034
3092
|
}
|
|
3035
|
-
function
|
|
3093
|
+
function rn(u, t) {
|
|
3036
3094
|
const e = /* @__PURE__ */ new Set();
|
|
3037
3095
|
return u.forEach((n) => {
|
|
3038
3096
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -3048,7 +3106,7 @@ function sn(u, t) {
|
|
|
3048
3106
|
}
|
|
3049
3107
|
}), u.map((n) => n.filter((s) => !e.has(s)));
|
|
3050
3108
|
}
|
|
3051
|
-
function
|
|
3109
|
+
function on(u, t = 0.1, e) {
|
|
3052
3110
|
const { fittingMethod: n = "average" } = e ?? {};
|
|
3053
3111
|
return u.map((s) => {
|
|
3054
3112
|
if (s.length === 0) return;
|
|
@@ -3060,7 +3118,7 @@ function rn(u, t = 0.1, e) {
|
|
|
3060
3118
|
s.forEach((f) => {
|
|
3061
3119
|
const { drawDoorData: p, drawWindow: g, rooftopPz: y, isWindow: m, ...x } = f.userData;
|
|
3062
3120
|
Object.assign(i.userData, x), o.push(y ?? 1 / 0), m && (a.push(...g), i.userData.isWindow = !0);
|
|
3063
|
-
}), a.length && (i.userData.drawWindow = a,
|
|
3121
|
+
}), a.length && (i.userData.drawWindow = a, ne(i)), i.userData.rooftopPz = Math.min(...o), i.userData.rooftopPz === 1 / 0 && (i.userData.rooftopPz = 0);
|
|
3064
3122
|
let c = 1 / 0, l = -1 / 0;
|
|
3065
3123
|
const h = s[0].normal().normalize();
|
|
3066
3124
|
c = 1 / 0, l = -1 / 0, r.forEach((f) => {
|
|
@@ -3073,8 +3131,8 @@ function rn(u, t = 0.1, e) {
|
|
|
3073
3131
|
}), i.currentData.isFittedLine = !0, i;
|
|
3074
3132
|
}).filter((s) => !!s);
|
|
3075
3133
|
}
|
|
3076
|
-
function
|
|
3077
|
-
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new
|
|
3134
|
+
function an(u, t, e) {
|
|
3135
|
+
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new B(v.fromByLineSegment(...u)), i = new E(), o = /* @__PURE__ */ new Map();
|
|
3078
3136
|
u.forEach((d) => {
|
|
3079
3137
|
d.userData.isDoor || (r.insert(d), d.points.forEach((f) => s.insert(f, d)));
|
|
3080
3138
|
});
|
|
@@ -3127,15 +3185,15 @@ function on(u, t, e) {
|
|
|
3127
3185
|
f.set(p.start, p.end);
|
|
3128
3186
|
}), s.clear(), r.clear(), u;
|
|
3129
3187
|
}
|
|
3130
|
-
function
|
|
3131
|
-
const n =
|
|
3188
|
+
function cn(u, t, e = 0.01) {
|
|
3189
|
+
const n = It([...u, ...t]), s = $([...n]);
|
|
3132
3190
|
for (let r = 0; r < t.length; r++)
|
|
3133
3191
|
t[r].points.forEach((o) => {
|
|
3134
3192
|
s.queryPoint(o, !0).forEach((a) => n.delete(a.userData));
|
|
3135
3193
|
});
|
|
3136
|
-
return u = u.filter((r) => !n.has(r) || r.length() > e), u = E.brokenLineMerging(u,
|
|
3194
|
+
return u = u.filter((r) => !n.has(r) || r.length() > e), u = E.brokenLineMerging(u, _), ot(...u), u;
|
|
3137
3195
|
}
|
|
3138
|
-
function
|
|
3196
|
+
function ln(u) {
|
|
3139
3197
|
const t = [];
|
|
3140
3198
|
for (let e = 0; e < u.length; e++) {
|
|
3141
3199
|
const n = u[e];
|
|
@@ -3158,8 +3216,8 @@ function cn(u) {
|
|
|
3158
3216
|
}
|
|
3159
3217
|
return { doorLines: u, doorIntersectLines: t };
|
|
3160
3218
|
}
|
|
3161
|
-
function
|
|
3162
|
-
const e = $(u), n =
|
|
3219
|
+
function un(u, t) {
|
|
3220
|
+
const e = $(u), n = Pt(u);
|
|
3163
3221
|
for (let s = 0; s < t.length; s++) {
|
|
3164
3222
|
const r = t[s];
|
|
3165
3223
|
r.points.map((a) => {
|
|
@@ -3196,7 +3254,7 @@ function ln(u, t) {
|
|
|
3196
3254
|
}
|
|
3197
3255
|
}
|
|
3198
3256
|
}
|
|
3199
|
-
class
|
|
3257
|
+
class ue {
|
|
3200
3258
|
/**
|
|
3201
3259
|
* 轴对齐垂直修正
|
|
3202
3260
|
* @param lines 待调整线段组
|
|
@@ -3205,36 +3263,36 @@ class le {
|
|
|
3205
3263
|
*/
|
|
3206
3264
|
static correction(t, e, n) {
|
|
3207
3265
|
const s = t.indexOf(e);
|
|
3208
|
-
t = t.map((m) => m.clone()), e = s > -1 ? t[s] : e, t =
|
|
3209
|
-
const r =
|
|
3266
|
+
t = t.map((m) => m.clone()), e = s > -1 ? t[s] : e, t = tn(t);
|
|
3267
|
+
const r = en(t), { parallelLines: i, verticalLines: o, doorLines: a } = nn(e, t, r, 25), c = e.normal(), l = e.center, h = e.direction(), d = new E(
|
|
3210
3268
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
3211
3269
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
3212
3270
|
), f = new E(
|
|
3213
3271
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
3214
3272
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
3215
3273
|
);
|
|
3216
|
-
let p =
|
|
3217
|
-
p =
|
|
3218
|
-
let g =
|
|
3219
|
-
g = E.brokenLineMerging(g,
|
|
3274
|
+
let p = sn(i, o, d, f, r, n);
|
|
3275
|
+
p = rn(p, r);
|
|
3276
|
+
let g = on(p, 0.1, n);
|
|
3277
|
+
g = E.brokenLineMerging(g, _), g = an(g, r, n), g = Tt(g, 1e-9), ln(a), g = cn(g, a, 0.15), g = bt(g);
|
|
3220
3278
|
const { wallGroup: y = !0 } = n ?? {};
|
|
3221
|
-
return y && (g = Z(g), g = pt.complementSide(g), g = Z(g, a, !0, !1), g =
|
|
3279
|
+
return y && (g = Z(g), g = pt.complementSide(g), g = Z(g, a, !0, !1), g = bt(g, !1)), un(g, a), ot(...g), g.push(...a), g;
|
|
3222
3280
|
}
|
|
3223
3281
|
}
|
|
3224
|
-
const
|
|
3282
|
+
const hn = new E(
|
|
3225
3283
|
new D(0, 0),
|
|
3226
3284
|
new D(0, 1)
|
|
3227
3285
|
);
|
|
3228
|
-
function
|
|
3286
|
+
function he(u) {
|
|
3229
3287
|
const t = [...u].sort((r, i) => i.length() - r.length()).slice(0, 20), e = t.map((r) => {
|
|
3230
|
-
let i = parseInt(
|
|
3288
|
+
let i = parseInt(hn.includedAngle(r) + "");
|
|
3231
3289
|
return i > 90 && (i = 180 - i), i;
|
|
3232
3290
|
}), n = /* @__PURE__ */ new Map();
|
|
3233
3291
|
return e.forEach((r, i) => {
|
|
3234
3292
|
n.has(r) || n.set(r, []), n.get(r)?.push(t[i]);
|
|
3235
3293
|
}), [...n.values()].sort((r, i) => i.length - r.length)[0].sort((r, i) => i.length() - r.length())[0];
|
|
3236
3294
|
}
|
|
3237
|
-
function
|
|
3295
|
+
function de(u) {
|
|
3238
3296
|
let t = [], e = -1;
|
|
3239
3297
|
const n = [];
|
|
3240
3298
|
return u.forEach(({ start: r, end: i, ...o }, a) => {
|
|
@@ -3250,7 +3308,7 @@ function he(u) {
|
|
|
3250
3308
|
verticalReferenceIndex: e
|
|
3251
3309
|
};
|
|
3252
3310
|
}
|
|
3253
|
-
function
|
|
3311
|
+
function fe(u) {
|
|
3254
3312
|
if (u.length < 3) return 0;
|
|
3255
3313
|
let t = 0;
|
|
3256
3314
|
const e = u.length;
|
|
@@ -3260,7 +3318,7 @@ function de(u) {
|
|
|
3260
3318
|
}
|
|
3261
3319
|
return Math.abs(t) / 2;
|
|
3262
3320
|
}
|
|
3263
|
-
const
|
|
3321
|
+
const dn = {
|
|
3264
3322
|
Unitless: 1,
|
|
3265
3323
|
// 无单位,1米 = 1(无单位)
|
|
3266
3324
|
Inches: 39.37007874015748,
|
|
@@ -3304,7 +3362,7 @@ const hn = {
|
|
|
3304
3362
|
Parsecs: 3240779289666404e-32
|
|
3305
3363
|
// 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
|
|
3306
3364
|
};
|
|
3307
|
-
function
|
|
3365
|
+
function kt(u) {
|
|
3308
3366
|
const t = [];
|
|
3309
3367
|
for (let e = 0; e < u.length; e++)
|
|
3310
3368
|
t.push(new E(
|
|
@@ -3361,9 +3419,9 @@ class U extends z {
|
|
|
3361
3419
|
* @param data
|
|
3362
3420
|
*/
|
|
3363
3421
|
preprocessing(t) {
|
|
3364
|
-
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } =
|
|
3422
|
+
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = de(t);
|
|
3365
3423
|
if (this.originalZAverage = s, n === -1) {
|
|
3366
|
-
const i =
|
|
3424
|
+
const i = he(e);
|
|
3367
3425
|
n = e.indexOf(i);
|
|
3368
3426
|
}
|
|
3369
3427
|
const r = e[n];
|
|
@@ -3528,7 +3586,7 @@ class U extends z {
|
|
|
3528
3586
|
break;
|
|
3529
3587
|
}
|
|
3530
3588
|
}
|
|
3531
|
-
const e = this.mergeSameDirectionLine(
|
|
3589
|
+
const e = this.mergeSameDirectionLine(kt(t)), n = [e[0]];
|
|
3532
3590
|
for (let s = 1; s < e.length; s++) {
|
|
3533
3591
|
const r = e[s], i = e[(e.length + s - 1) % e.length];
|
|
3534
3592
|
if (r.length() > this.width * 0.9) {
|
|
@@ -3551,7 +3609,7 @@ class U extends z {
|
|
|
3551
3609
|
* @param path
|
|
3552
3610
|
*/
|
|
3553
3611
|
removeShortLine(t, e = this.shortLine) {
|
|
3554
|
-
const n =
|
|
3612
|
+
const n = kt(t), s = [], r = Math.PI / 180;
|
|
3555
3613
|
for (let i = 0; i < n.length; i++) {
|
|
3556
3614
|
const o = n[i], a = o.length(), c = i;
|
|
3557
3615
|
if (a > e || s.length === 0) {
|
|
@@ -3585,15 +3643,15 @@ class U extends z {
|
|
|
3585
3643
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
3586
3644
|
*/
|
|
3587
3645
|
lineOffset(t = U.EndType.etOpenSquare, e = U.JoinType.jtMiter, n = 1e4) {
|
|
3588
|
-
let s = new
|
|
3589
|
-
const r = new
|
|
3646
|
+
let s = new Ot.Paths();
|
|
3647
|
+
const r = new Ot.ClipperOffset(20, 0.25);
|
|
3590
3648
|
return this.pointsGroups.forEach((i) => {
|
|
3591
3649
|
const o = this.lineTopology(i).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
|
|
3592
3650
|
r.AddPaths(o, e, t);
|
|
3593
3651
|
}), r.Execute(s, this.width / 2 * n), this.wallsGroup = s.map((i) => {
|
|
3594
3652
|
let o = i.map((a) => D.from(a).divisionScalar(n));
|
|
3595
3653
|
return o = this.lineSegmentStraightening(o), t == U.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
|
|
3596
|
-
}).filter((i) => i.length > 4 ||
|
|
3654
|
+
}).filter((i) => i.length > 4 || fe(i) > 0.2), this.dispatchEvent({
|
|
3597
3655
|
type: "lineOffset",
|
|
3598
3656
|
wallsGroup: this.wallsGroup
|
|
3599
3657
|
}), this.wallsGroup;
|
|
@@ -3601,12 +3659,12 @@ class U extends z {
|
|
|
3601
3659
|
/** 垂直纠正
|
|
3602
3660
|
* @param option
|
|
3603
3661
|
*/
|
|
3604
|
-
axisAlignCorr(t) {
|
|
3662
|
+
async axisAlignCorr(t) {
|
|
3605
3663
|
if (this.verticalReferenceLine) {
|
|
3606
|
-
const e = this.getLineSegments(), n = performance.now(), s =
|
|
3664
|
+
const e = this.getLineSegments(), n = performance.now(), s = ue.correction(e, this.verticalReferenceLine, t);
|
|
3607
3665
|
console.log("垂直纠正消耗时间:", (performance.now() - n).toFixed(2), "ms", "处理线段数量:", e.length);
|
|
3608
3666
|
const r = rt(s);
|
|
3609
|
-
this.set(r);
|
|
3667
|
+
await this.set(r);
|
|
3610
3668
|
} else
|
|
3611
3669
|
throw new Error("未找到一条垂直纠正基准轴线");
|
|
3612
3670
|
}
|
|
@@ -3655,7 +3713,7 @@ class U extends z {
|
|
|
3655
3713
|
* 转为绘制数据
|
|
3656
3714
|
*/
|
|
3657
3715
|
toDrawDataJson(t = "Millimeters") {
|
|
3658
|
-
const e =
|
|
3716
|
+
const e = dn[t], n = {
|
|
3659
3717
|
unit: t,
|
|
3660
3718
|
line: [],
|
|
3661
3719
|
arc: [],
|
|
@@ -3850,7 +3908,7 @@ class U extends z {
|
|
|
3850
3908
|
}
|
|
3851
3909
|
}
|
|
3852
3910
|
const Y = new E();
|
|
3853
|
-
class
|
|
3911
|
+
class pe extends U {
|
|
3854
3912
|
static name = "AngleCorrectionDxf";
|
|
3855
3913
|
angle = 0;
|
|
3856
3914
|
onAddFromParent(t) {
|
|
@@ -3877,7 +3935,7 @@ class fe extends U {
|
|
|
3877
3935
|
return l.division(o).rotate(D.zero(), h * (Math.PI / 180));
|
|
3878
3936
|
}
|
|
3879
3937
|
const o = e.originalBox.center, a = D.zero(), c = e.originalData.map((l) => {
|
|
3880
|
-
const h = i(a.copy(l.start), s).toJson(l.start.z), d = i(a.copy(l.end), s).toJson(l.start.z), f = Object.assign(
|
|
3938
|
+
const h = i(a.copy(l.start), s).toJson(l.start.z), d = i(a.copy(l.end), s).toJson(l.start.z), f = Object.assign(k(l), { start: h, end: d });
|
|
3881
3939
|
return f.drawWindow && f.drawWindow.forEach((p) => p.p = i(a.copy(p.p), s).toJson(p.p.z)), f;
|
|
3882
3940
|
});
|
|
3883
3941
|
n.appendLineSegmentList.forEach((l) => {
|
|
@@ -3896,7 +3954,7 @@ class fe extends U {
|
|
|
3896
3954
|
});
|
|
3897
3955
|
}
|
|
3898
3956
|
}
|
|
3899
|
-
class
|
|
3957
|
+
class Rt extends z {
|
|
3900
3958
|
static name = "Variable";
|
|
3901
3959
|
originalLineVisible = !0;
|
|
3902
3960
|
dxfVisible = !0;
|
|
@@ -3923,7 +3981,7 @@ class vt extends z {
|
|
|
3923
3981
|
if (t in this) return this[t];
|
|
3924
3982
|
}
|
|
3925
3983
|
}
|
|
3926
|
-
class
|
|
3984
|
+
class Ct extends z {
|
|
3927
3985
|
static name = "LineAnalysis";
|
|
3928
3986
|
Dxf = null;
|
|
3929
3987
|
Variable = null;
|
|
@@ -3937,7 +3995,7 @@ class Rt extends z {
|
|
|
3937
3995
|
* @param parent
|
|
3938
3996
|
*/
|
|
3939
3997
|
onAddFromParent(t) {
|
|
3940
|
-
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(
|
|
3998
|
+
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(Rt), this.Dxf.addEventListener("setDta", () => {
|
|
3941
3999
|
this.lineAnalysis(), this.dispatchEvent({ type: "analysisCompleted" });
|
|
3942
4000
|
});
|
|
3943
4001
|
}
|
|
@@ -3996,7 +4054,7 @@ class Rt extends z {
|
|
|
3996
4054
|
*/
|
|
3997
4055
|
buildQuadtree() {
|
|
3998
4056
|
const t = this.Dxf, e = [];
|
|
3999
|
-
this.quadtree = new
|
|
4057
|
+
this.quadtree = new B(t.originalBox, 2), t.lineSegments.forEach((n) => {
|
|
4000
4058
|
n.userData?.isDoor || (this.quadtree?.insert({
|
|
4001
4059
|
line: n,
|
|
4002
4060
|
userData: e.length
|
|
@@ -4053,7 +4111,7 @@ class Rt extends z {
|
|
|
4053
4111
|
}
|
|
4054
4112
|
}
|
|
4055
4113
|
}
|
|
4056
|
-
class
|
|
4114
|
+
class fn {
|
|
4057
4115
|
// 所有可查找的点位
|
|
4058
4116
|
possibleDoorPoints = [];
|
|
4059
4117
|
doorPoint = [];
|
|
@@ -4161,7 +4219,7 @@ class dn {
|
|
|
4161
4219
|
this.continueFind = !1;
|
|
4162
4220
|
const h = new E(D.from(a), D.from(c));
|
|
4163
4221
|
h.userData = {
|
|
4164
|
-
...
|
|
4222
|
+
...k(l),
|
|
4165
4223
|
doorDirectConnection: !0,
|
|
4166
4224
|
isDoor: !0
|
|
4167
4225
|
}, this.dxf.doorLineSegment.push(h), h.points.forEach((d) => {
|
|
@@ -4222,8 +4280,8 @@ class dn {
|
|
|
4222
4280
|
M.add(`${A}.${R}`), M.add(`${R}.${A}`);
|
|
4223
4281
|
const j = L[S].point, F = new E(y.clone(), j.clone());
|
|
4224
4282
|
if (F.direction().angleBetween(w, "angle") < s) {
|
|
4225
|
-
const q = t[x].line.direction(),
|
|
4226
|
-
|
|
4283
|
+
const q = t[x].line.direction(), N = L[S].userData;
|
|
4284
|
+
N.start.equal(L[S].point) && q.multiplyScalar(-1), F.direction().multiplyScalar(-1).angleBetween(q, "angle") < s && (i.queryLineSegment(F).filter((mt) => !(mt.line.start.equal(y) || mt.line.end.equal(y) || mt.line === N)).length || b.push({
|
|
4227
4285
|
findData: L[S],
|
|
4228
4286
|
findUuid: R,
|
|
4229
4287
|
doorLine: F,
|
|
@@ -4370,7 +4428,7 @@ class dn {
|
|
|
4370
4428
|
return e;
|
|
4371
4429
|
}
|
|
4372
4430
|
}
|
|
4373
|
-
class
|
|
4431
|
+
class ge extends z {
|
|
4374
4432
|
doorSearchNearAngle = 110;
|
|
4375
4433
|
doorSearchDistance = 2;
|
|
4376
4434
|
DoorsAnalysis;
|
|
@@ -4382,13 +4440,13 @@ class pe extends z {
|
|
|
4382
4440
|
* @param parent
|
|
4383
4441
|
*/
|
|
4384
4442
|
onAddFromParent(t) {
|
|
4385
|
-
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(
|
|
4443
|
+
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(Ct);
|
|
4386
4444
|
e.addEventListener("createGroup", () => {
|
|
4387
|
-
this.DoorsAnalysis = new
|
|
4445
|
+
this.DoorsAnalysis = new fn(n, this.skipFindDoor), this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])), this.skipFindDoor = !1, this.dispatchEvent({ type: "analysisCompleted" });
|
|
4388
4446
|
});
|
|
4389
4447
|
}
|
|
4390
4448
|
}
|
|
4391
|
-
function
|
|
4449
|
+
function pn(u) {
|
|
4392
4450
|
const t = u.reduce((d, f) => !d || f.length(!0) > d.length(!0) ? f : d), e = t.normal(), n = 0.1, s = t.center.expandAsLine(e, n).directionMove(e.multiplyScalar(-1), n * 0.5), r = s.projectValue(t.start);
|
|
4393
4451
|
let i = 1 / 0, o = null, a = -1 / 0, c = null;
|
|
4394
4452
|
for (let d = 0; d < u.length; d++) {
|
|
@@ -4401,8 +4459,8 @@ function fn(u) {
|
|
|
4401
4459
|
const [l, h] = [[r, t], [i, o], [a, c]].sort((d, f) => d[0] - f[0])[1];
|
|
4402
4460
|
return h;
|
|
4403
4461
|
}
|
|
4404
|
-
function
|
|
4405
|
-
const e = new
|
|
4462
|
+
function gn(u, t) {
|
|
4463
|
+
const e = new B(v.fromByLineSegment(...u)), n = t.clone().expansion(100), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
4406
4464
|
u.forEach((c) => e.insert(c));
|
|
4407
4465
|
const i = e.queryLineSegment(n);
|
|
4408
4466
|
for (let c = 0; c < i.length; c++) {
|
|
@@ -4414,14 +4472,14 @@ function pn(u, t) {
|
|
|
4414
4472
|
const h = l.getIntersection(n);
|
|
4415
4473
|
if (h) {
|
|
4416
4474
|
if (l.start.equal(h) || l.end.equal(h)) continue;
|
|
4417
|
-
const d = E.clipping(l, [h],
|
|
4475
|
+
const d = E.clipping(l, [h], At);
|
|
4418
4476
|
s.add(l), d.forEach((f) => r.add(f));
|
|
4419
4477
|
}
|
|
4420
4478
|
}
|
|
4421
4479
|
u = u.filter((c) => !s.has(c)), u.push(...r);
|
|
4422
4480
|
const o = E.groupByPosition(u, n), a = [];
|
|
4423
4481
|
return o.forEach((c) => {
|
|
4424
|
-
const l = [...
|
|
4482
|
+
const l = [...re(c).keys()].sort((h, d) => h.distance(n.start, !0) - d.distance(n.start, !0));
|
|
4425
4483
|
for (let h = 0; h < l.length; h += 2) {
|
|
4426
4484
|
const d = l[h], f = l[h + 1];
|
|
4427
4485
|
c.push(new E(d.clone(), f.clone()));
|
|
@@ -4429,8 +4487,8 @@ function pn(u, t) {
|
|
|
4429
4487
|
a.push(c);
|
|
4430
4488
|
}), e.clear(), a;
|
|
4431
4489
|
}
|
|
4432
|
-
function
|
|
4433
|
-
u = u.map((i) => i.clone()), u = E.brokenLineMerging(u,
|
|
4490
|
+
function ye(u) {
|
|
4491
|
+
u = u.map((i) => i.clone()), u = E.brokenLineMerging(u, _);
|
|
4434
4492
|
const t = [u], e = [], n = 2e4;
|
|
4435
4493
|
let s, r = 0;
|
|
4436
4494
|
for (; (s = t.pop()) !== void 0; ) {
|
|
@@ -4439,47 +4497,47 @@ function ge(u) {
|
|
|
4439
4497
|
e.push(s);
|
|
4440
4498
|
continue;
|
|
4441
4499
|
}
|
|
4442
|
-
const i =
|
|
4500
|
+
const i = pn(s);
|
|
4443
4501
|
if (!i) {
|
|
4444
4502
|
e.push(s);
|
|
4445
4503
|
continue;
|
|
4446
4504
|
}
|
|
4447
|
-
const o =
|
|
4505
|
+
const o = gn(s, i).flatMap((a) => E.groupByPath(a));
|
|
4448
4506
|
if (o.length === 1) {
|
|
4449
4507
|
e.push(s);
|
|
4450
4508
|
continue;
|
|
4451
4509
|
}
|
|
4452
4510
|
o.forEach((a) => {
|
|
4453
|
-
a = E.brokenLineMerging(a,
|
|
4511
|
+
a = E.brokenLineMerging(a, _), a.length === 4 ? e.push(a) : t.push(a);
|
|
4454
4512
|
});
|
|
4455
4513
|
}
|
|
4456
4514
|
return e;
|
|
4457
4515
|
}
|
|
4458
|
-
function
|
|
4516
|
+
function yn(u) {
|
|
4459
4517
|
const t = [];
|
|
4460
4518
|
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = pt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4461
4519
|
}
|
|
4462
|
-
function
|
|
4463
|
-
return t && (u =
|
|
4520
|
+
function mn(u, t = !0) {
|
|
4521
|
+
return t && (u = yn(u)), u.reduce((n, s) => (C.get(s).forEach((i) => {
|
|
4464
4522
|
let o = i.id ?? "wall";
|
|
4465
4523
|
i.type === "wall" && (o = "wall"), n.append(o, s);
|
|
4466
4524
|
}), n), new H());
|
|
4467
4525
|
}
|
|
4468
|
-
function
|
|
4526
|
+
function xn(u) {
|
|
4469
4527
|
const t = u.group((i) => C.everyType(i, "bayWindow") ? "wall" : C.everyType(i, "doubleWall") ? "doubleWall" : "wall"), e = t.get("wall") ?? [], n = t.get("doubleWall") ?? [];
|
|
4470
4528
|
let s = [], r = new Set(n.flat());
|
|
4471
4529
|
return e.forEach((i) => {
|
|
4472
4530
|
i.forEach((o) => r.has(o) || s.push(o));
|
|
4473
4531
|
}), n.forEach((i) => {
|
|
4474
|
-
i = [...new Set(i)],
|
|
4532
|
+
i = [...new Set(i)], ye(i).forEach((a) => {
|
|
4475
4533
|
if (a.length < 4) return s.push(...a);
|
|
4476
4534
|
a = a.sort((d, f) => d.length() - f.length());
|
|
4477
4535
|
const c = a[0], l = a[1], h = new E(c.center.clone(), l.center.clone());
|
|
4478
|
-
|
|
4536
|
+
_(h, a), h.userData.wallWidth = c.length(), s.push(h), se(h);
|
|
4479
4537
|
});
|
|
4480
4538
|
}), s = s.map((i) => i.clone()), s.filter((i) => !i.userData.isBayWindow);
|
|
4481
4539
|
}
|
|
4482
|
-
function
|
|
4540
|
+
function wn(u, t = "测试", e = "") {
|
|
4483
4541
|
const s = /* @__PURE__ */ new Map();
|
|
4484
4542
|
let r = 0;
|
|
4485
4543
|
return {
|
|
@@ -4549,9 +4607,9 @@ function xn(u, t = "测试", e = "") {
|
|
|
4549
4607
|
rooms: []
|
|
4550
4608
|
};
|
|
4551
4609
|
}
|
|
4552
|
-
function
|
|
4553
|
-
const n =
|
|
4554
|
-
let s =
|
|
4610
|
+
function me(u, t = 0, e = !0) {
|
|
4611
|
+
const n = mn(u, e);
|
|
4612
|
+
let s = xn(n);
|
|
4555
4613
|
return s = yt.rotate(s, t, (r, i, o) => {
|
|
4556
4614
|
r.userData.drawWindow && r.userData.drawWindow.forEach((a) => {
|
|
4557
4615
|
const c = D.from(a.p);
|
|
@@ -4560,11 +4618,11 @@ function ye(u, t = 0, e = !0) {
|
|
|
4560
4618
|
}), {
|
|
4561
4619
|
lines: s,
|
|
4562
4620
|
toJson(r = "测试", i = "") {
|
|
4563
|
-
return
|
|
4621
|
+
return wn(s, r, i);
|
|
4564
4622
|
}
|
|
4565
4623
|
};
|
|
4566
4624
|
}
|
|
4567
|
-
class
|
|
4625
|
+
class xe extends z {
|
|
4568
4626
|
static name = "ThreeVJia";
|
|
4569
4627
|
lineSegments = [];
|
|
4570
4628
|
neededUpdate = !0;
|
|
@@ -4581,7 +4639,7 @@ class me extends z {
|
|
|
4581
4639
|
updateData() {
|
|
4582
4640
|
if (!this.neededUpdate) return;
|
|
4583
4641
|
const t = this.parent?.findComponentByName("Dxf"), e = this.parent?.findComponentByName("AngleCorrectionDxf");
|
|
4584
|
-
this.cacheJson =
|
|
4642
|
+
this.cacheJson = me(t.getLineSegments(), e.angle).toJson(), this.neededUpdate = !1;
|
|
4585
4643
|
}
|
|
4586
4644
|
/** 转为json
|
|
4587
4645
|
* @param name
|
|
@@ -4602,7 +4660,7 @@ class me extends z {
|
|
|
4602
4660
|
} else typeof global < "u" && (await K("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
|
|
4603
4661
|
}
|
|
4604
4662
|
}
|
|
4605
|
-
class tt extends
|
|
4663
|
+
class tt extends Qt {
|
|
4606
4664
|
Dxf;
|
|
4607
4665
|
AngleCorrectionDxf;
|
|
4608
4666
|
Variable;
|
|
@@ -4616,7 +4674,7 @@ class tt extends Zt {
|
|
|
4616
4674
|
* @param scale 原始数据缩放比例
|
|
4617
4675
|
*/
|
|
4618
4676
|
constructor(t = 0.1, e = 1) {
|
|
4619
|
-
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new U(this.wallWidth, e), this.AngleCorrectionDxf = new
|
|
4677
|
+
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new U(this.wallWidth, e), this.AngleCorrectionDxf = new pe(), this.Variable = new Rt(), this.LineAnalysis = new Ct(), this.DoorsAnalysis = new ge(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(this.LineAnalysis), this.addComponent(this.DoorsAnalysis), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new xe()), tt.finalInstance = this;
|
|
4620
4678
|
}
|
|
4621
4679
|
usePlugin(t) {
|
|
4622
4680
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -4629,19 +4687,19 @@ class tt extends Zt {
|
|
|
4629
4687
|
});
|
|
4630
4688
|
}
|
|
4631
4689
|
}
|
|
4632
|
-
const
|
|
4633
|
-
LineAnalysis:
|
|
4634
|
-
ThreeVJia:
|
|
4635
|
-
Variable:
|
|
4690
|
+
const Mn = {
|
|
4691
|
+
LineAnalysis: Ct,
|
|
4692
|
+
ThreeVJia: xe,
|
|
4693
|
+
Variable: Rt,
|
|
4636
4694
|
Dxf: U,
|
|
4637
|
-
DoorsAnalysisComponent:
|
|
4638
|
-
AngleCorrectionDxf:
|
|
4695
|
+
DoorsAnalysisComponent: ge,
|
|
4696
|
+
AngleCorrectionDxf: pe
|
|
4639
4697
|
};
|
|
4640
|
-
function
|
|
4698
|
+
function Dn(u) {
|
|
4641
4699
|
const t = [];
|
|
4642
4700
|
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = pt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4643
4701
|
}
|
|
4644
|
-
function
|
|
4702
|
+
function Wt(u, t, e) {
|
|
4645
4703
|
return e.reduce((n, s, r) => {
|
|
4646
4704
|
const i = s.userData;
|
|
4647
4705
|
if (i.parallel(u)) n[0] = r;
|
|
@@ -4652,23 +4710,23 @@ function kt(u, t, e) {
|
|
|
4652
4710
|
return n;
|
|
4653
4711
|
}, [-1, -1, -1]);
|
|
4654
4712
|
}
|
|
4655
|
-
function
|
|
4713
|
+
function Ln(u, t, e, n, s) {
|
|
4656
4714
|
const { point: r } = u[e[0]], i = new E(r.clone(), t.clone());
|
|
4657
4715
|
return i.points.forEach((o) => s.insert(o, i)), n.push(i), i;
|
|
4658
4716
|
}
|
|
4659
|
-
function
|
|
4717
|
+
function En(u, t, e, n) {
|
|
4660
4718
|
const { point: s } = u[e[1]];
|
|
4661
4719
|
s.copy(t), n.update(s);
|
|
4662
4720
|
}
|
|
4663
|
-
function
|
|
4721
|
+
function Sn(u, t, e, n) {
|
|
4664
4722
|
const { point: s } = u[e[2]];
|
|
4665
4723
|
s.copy(t), n.update(s);
|
|
4666
4724
|
}
|
|
4667
|
-
function
|
|
4725
|
+
function Yt(u, t, e, n, s) {
|
|
4668
4726
|
const r = e[0] > -1, i = e[1] > -1, o = e[2] > -1;
|
|
4669
|
-
if (i &&
|
|
4670
|
-
const a =
|
|
4671
|
-
i && (a.userData =
|
|
4727
|
+
if (i && En(t, u, e, s), r) {
|
|
4728
|
+
const a = Ln(t, u, e, n, s);
|
|
4729
|
+
i && (a.userData = k(t[e[1]].userData?.userData ?? {}));
|
|
4672
4730
|
return;
|
|
4673
4731
|
}
|
|
4674
4732
|
if (o) {
|
|
@@ -4676,21 +4734,21 @@ function Wt(u, t, e, n, s) {
|
|
|
4676
4734
|
const a = t[e[1]].userData;
|
|
4677
4735
|
u = a.start.distance(t[e[2]].point) < a.end.distance(t[e[2]].point) ? a.start : a.end;
|
|
4678
4736
|
}
|
|
4679
|
-
|
|
4737
|
+
Sn(t, u, e, s);
|
|
4680
4738
|
}
|
|
4681
4739
|
}
|
|
4682
|
-
function
|
|
4683
|
-
const s = n.queryPoint(u.start, !0), r = n.queryPoint(u.end, !0), i = u.userData.expandDirect, o =
|
|
4684
|
-
u.directionMove(c, t * 0.5), u.points.forEach((l) => n.update(l)),
|
|
4740
|
+
function bn(u, t = 0.12, e, n) {
|
|
4741
|
+
const s = n.queryPoint(u.start, !0), r = n.queryPoint(u.end, !0), i = u.userData.expandDirect, o = Wt(u, i, s), a = Wt(u, i, r), c = i === "left" ? u.getRightDirection() : u.getLeftDirection();
|
|
4742
|
+
u.directionMove(c, t * 0.5), u.points.forEach((l) => n.update(l)), Yt(u.start, s, o, e, n), Yt(u.end, r, a, e, n);
|
|
4685
4743
|
}
|
|
4686
|
-
class
|
|
4744
|
+
class Bt {
|
|
4687
4745
|
/** 通过轨迹点查找外墙
|
|
4688
4746
|
* @param lines
|
|
4689
4747
|
* @param trajectoryPoints
|
|
4690
4748
|
* @returns
|
|
4691
4749
|
*/
|
|
4692
4750
|
static findExtWallByTraj(t, e, n = 0.4) {
|
|
4693
|
-
const s = new
|
|
4751
|
+
const s = new B(v.fromByLineSegment(...t));
|
|
4694
4752
|
return t.forEach((r) => s.insert({ line: r, userData: void 0 })), t = t.filter((r) => {
|
|
4695
4753
|
if (C.hasType(r, "doubleWall") || r.userData.isDoor || r.userData.isBayWindow) return;
|
|
4696
4754
|
const i = r.center, o = /* @__PURE__ */ new Set();
|
|
@@ -4727,13 +4785,13 @@ class Ct {
|
|
|
4727
4785
|
*/
|
|
4728
4786
|
static boundExtbyTraj(t) {
|
|
4729
4787
|
let { lines: e, trajectory: n, wallWidth: s = 0.12, updateDoubleWallGroup: r = !1, findCallBack: i } = t;
|
|
4730
|
-
r && (e =
|
|
4788
|
+
r && (e = Dn(e));
|
|
4731
4789
|
const o = Object.keys(n).map((d) => D.from(n[d]));
|
|
4732
|
-
let c =
|
|
4790
|
+
let c = Bt.findExtWallByTraj(e, o).filter((d) => d.userData.expandDirect);
|
|
4733
4791
|
e = e.filter((d) => !c.includes(d)), e.push(...c), i && i(c, o);
|
|
4734
4792
|
const l = $(e), h = [];
|
|
4735
4793
|
return c.forEach((d) => {
|
|
4736
|
-
d.userData.isDoor ||
|
|
4794
|
+
d.userData.isDoor || bn(d, s, h, l);
|
|
4737
4795
|
}), e.push(...h.filter((d) => d.length() > 1e-9)), ot(...e), {
|
|
4738
4796
|
lines: e,
|
|
4739
4797
|
toOriginalData(d) {
|
|
@@ -4742,7 +4800,7 @@ class Ct {
|
|
|
4742
4800
|
};
|
|
4743
4801
|
}
|
|
4744
4802
|
}
|
|
4745
|
-
function
|
|
4803
|
+
function we(u) {
|
|
4746
4804
|
const t = new yt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
4747
4805
|
function r(i) {
|
|
4748
4806
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
@@ -4758,7 +4816,7 @@ function xe(u) {
|
|
|
4758
4816
|
n.has(i) || r(i);
|
|
4759
4817
|
}), s;
|
|
4760
4818
|
}
|
|
4761
|
-
function
|
|
4819
|
+
function Tn(u, t) {
|
|
4762
4820
|
const e = $(u), n = new E(), s = new E(), r = [], i = /* @__PURE__ */ new Set();
|
|
4763
4821
|
function o(c, l) {
|
|
4764
4822
|
const h = c.center, d = c.normal();
|
|
@@ -4821,7 +4879,7 @@ function bn(u, t) {
|
|
|
4821
4879
|
}
|
|
4822
4880
|
return r;
|
|
4823
4881
|
}
|
|
4824
|
-
function
|
|
4882
|
+
function An(u) {
|
|
4825
4883
|
const t = new H(), e = [];
|
|
4826
4884
|
u.forEach((n) => t.append(n.length, n));
|
|
4827
4885
|
for (const n of t.values()) {
|
|
@@ -4833,8 +4891,8 @@ function Tn(u) {
|
|
|
4833
4891
|
}
|
|
4834
4892
|
return e;
|
|
4835
4893
|
}
|
|
4836
|
-
function
|
|
4837
|
-
const e =
|
|
4894
|
+
function Pn(u, t) {
|
|
4895
|
+
const e = Tn(u, t), n = /* @__PURE__ */ new Map(), s = new Q(e.length), r = [];
|
|
4838
4896
|
e.forEach((a, c) => {
|
|
4839
4897
|
for (let l = 0; l < a.length; l++) {
|
|
4840
4898
|
const h = a[l];
|
|
@@ -4843,19 +4901,19 @@ function An(u, t) {
|
|
|
4843
4901
|
});
|
|
4844
4902
|
const i = new ft(), o = s.getAllSets().valueArray.map((a) => {
|
|
4845
4903
|
let c = a.map((h) => e[h]);
|
|
4846
|
-
return c.length === 1 ? c[0] : (i.clear(), c =
|
|
4904
|
+
return c.length === 1 ? c[0] : (i.clear(), c = An(c), c.forEach((h) => h.forEach((d) => i.set(d))), i.reduce((h, d, f) => (d === 1 ? h.push(f) : r.push(f), h), []));
|
|
4847
4905
|
});
|
|
4848
4906
|
return {
|
|
4849
4907
|
internalEdges: r,
|
|
4850
4908
|
rings: o
|
|
4851
4909
|
};
|
|
4852
4910
|
}
|
|
4853
|
-
function
|
|
4911
|
+
function In(u) {
|
|
4854
4912
|
const t = E.groupByPath(u), e = [], n = [];
|
|
4855
4913
|
t.forEach((i, o) => {
|
|
4856
4914
|
try {
|
|
4857
|
-
let a =
|
|
4858
|
-
const c =
|
|
4915
|
+
let a = we(i);
|
|
4916
|
+
const c = Pn(i, a);
|
|
4859
4917
|
e.push(...c.rings), n.push(...c.internalEdges);
|
|
4860
4918
|
} catch (a) {
|
|
4861
4919
|
console.warn("环查找出现异常:", a.message);
|
|
@@ -4868,7 +4926,7 @@ function Pn(u) {
|
|
|
4868
4926
|
internalEdges: n
|
|
4869
4927
|
};
|
|
4870
4928
|
}
|
|
4871
|
-
function
|
|
4929
|
+
function Me(u, t, e = 1e-3) {
|
|
4872
4930
|
if (Array.isArray(u) && u[0] instanceof D) {
|
|
4873
4931
|
const s = u;
|
|
4874
4932
|
u = s.map((r, i) => {
|
|
@@ -4876,7 +4934,7 @@ function we(u, t, e = 1e-3) {
|
|
|
4876
4934
|
return new E(r, o);
|
|
4877
4935
|
});
|
|
4878
4936
|
}
|
|
4879
|
-
if (u instanceof E) return
|
|
4937
|
+
if (u instanceof E) return Me([u], t, e);
|
|
4880
4938
|
const n = tt.finalInstance;
|
|
4881
4939
|
if (n) {
|
|
4882
4940
|
const s = n.findComponentByName("Renderer");
|
|
@@ -4888,7 +4946,7 @@ function we(u, t, e = 1e-3) {
|
|
|
4888
4946
|
}
|
|
4889
4947
|
}
|
|
4890
4948
|
}
|
|
4891
|
-
function
|
|
4949
|
+
function vn(u, t, e = 1e-3) {
|
|
4892
4950
|
const n = tt.finalInstance;
|
|
4893
4951
|
if (n) {
|
|
4894
4952
|
const s = n.findComponentByName("Renderer");
|
|
@@ -4898,7 +4956,7 @@ function In(u, t, e = 1e-3) {
|
|
|
4898
4956
|
}
|
|
4899
4957
|
}
|
|
4900
4958
|
}
|
|
4901
|
-
function
|
|
4959
|
+
function Rn(u, t, e, n = 1e-3) {
|
|
4902
4960
|
const s = tt.finalInstance;
|
|
4903
4961
|
if (s) {
|
|
4904
4962
|
const r = s.findComponentByName("Renderer"), i = s.findComponentByName("Editor");
|
|
@@ -4908,7 +4966,7 @@ function vn(u, t, e, n = 1e-3) {
|
|
|
4908
4966
|
}
|
|
4909
4967
|
}
|
|
4910
4968
|
}
|
|
4911
|
-
const
|
|
4969
|
+
const Xt = {
|
|
4912
4970
|
POSITION: [
|
|
4913
4971
|
"byte",
|
|
4914
4972
|
"byte normalized",
|
|
@@ -4939,11 +4997,9 @@ const Yt = {
|
|
|
4939
4997
|
class dt {
|
|
4940
4998
|
constructor() {
|
|
4941
4999
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
4942
|
-
return new
|
|
5000
|
+
return new kn(t);
|
|
4943
5001
|
}), this.register(function(t) {
|
|
4944
5002
|
return new _n(t);
|
|
4945
|
-
}), this.register(function(t) {
|
|
4946
|
-
return new Xn(t);
|
|
4947
5003
|
}), this.register(function(t) {
|
|
4948
5004
|
return new Vn(t);
|
|
4949
5005
|
}), this.register(function(t) {
|
|
@@ -4951,13 +5007,13 @@ class dt {
|
|
|
4951
5007
|
}), this.register(function(t) {
|
|
4952
5008
|
return new $n(t);
|
|
4953
5009
|
}), this.register(function(t) {
|
|
4954
|
-
return new
|
|
5010
|
+
return new Jn(t);
|
|
4955
5011
|
}), this.register(function(t) {
|
|
4956
5012
|
return new Wn(t);
|
|
4957
5013
|
}), this.register(function(t) {
|
|
4958
5014
|
return new Yn(t);
|
|
4959
5015
|
}), this.register(function(t) {
|
|
4960
|
-
return new
|
|
5016
|
+
return new Xn(t);
|
|
4961
5017
|
}), this.register(function(t) {
|
|
4962
5018
|
return new Kn(t);
|
|
4963
5019
|
}), this.register(function(t) {
|
|
@@ -4966,6 +5022,8 @@ class dt {
|
|
|
4966
5022
|
return new Qn(t);
|
|
4967
5023
|
}), this.register(function(t) {
|
|
4968
5024
|
return new ts(t);
|
|
5025
|
+
}), this.register(function(t) {
|
|
5026
|
+
return new es(t);
|
|
4969
5027
|
});
|
|
4970
5028
|
}
|
|
4971
5029
|
register(t) {
|
|
@@ -4978,7 +5036,7 @@ class dt {
|
|
|
4978
5036
|
return this.textureUtils = t, this;
|
|
4979
5037
|
}
|
|
4980
5038
|
parse(t, e, n, s) {
|
|
4981
|
-
const r = new
|
|
5039
|
+
const r = new Un(), i = [];
|
|
4982
5040
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
4983
5041
|
i.push(this.pluginCallbacks[o](r));
|
|
4984
5042
|
r.setPlugins(i), r.setTextureUtils(this.textureUtils), r.writeAsync(t, e, s).catch(n);
|
|
@@ -5014,34 +5072,34 @@ const P = {
|
|
|
5014
5072
|
CLAMP_TO_EDGE: 33071,
|
|
5015
5073
|
MIRRORED_REPEAT: 33648,
|
|
5016
5074
|
REPEAT: 10497
|
|
5017
|
-
},
|
|
5018
|
-
O[
|
|
5019
|
-
O[
|
|
5020
|
-
O[
|
|
5021
|
-
O[
|
|
5022
|
-
O[
|
|
5075
|
+
}, Mt = "KHR_mesh_quantization", O = {};
|
|
5076
|
+
O[qe] = P.NEAREST;
|
|
5077
|
+
O[Ge] = P.NEAREST_MIPMAP_NEAREST;
|
|
5078
|
+
O[ze] = P.NEAREST_MIPMAP_LINEAR;
|
|
5079
|
+
O[Ue] = P.LINEAR;
|
|
5080
|
+
O[ke] = P.LINEAR_MIPMAP_NEAREST;
|
|
5023
5081
|
O[_e] = P.LINEAR_MIPMAP_LINEAR;
|
|
5024
|
-
O[
|
|
5025
|
-
O[
|
|
5026
|
-
O[
|
|
5027
|
-
const
|
|
5082
|
+
O[We] = P.CLAMP_TO_EDGE;
|
|
5083
|
+
O[Ye] = P.REPEAT;
|
|
5084
|
+
O[Xe] = P.MIRRORED_REPEAT;
|
|
5085
|
+
const Vt = {
|
|
5028
5086
|
scale: "scale",
|
|
5029
5087
|
position: "translation",
|
|
5030
5088
|
quaternion: "rotation",
|
|
5031
5089
|
morphTargetInfluences: "weights"
|
|
5032
|
-
},
|
|
5090
|
+
}, Cn = new Pe(), Ht = 12, Bn = 1179937895, Nn = 2, $t = 8, jn = 1313821514, Fn = 5130562;
|
|
5033
5091
|
function st(u, t) {
|
|
5034
5092
|
return u.length === t.length && u.every(function(e, n) {
|
|
5035
5093
|
return e === t[n];
|
|
5036
5094
|
});
|
|
5037
5095
|
}
|
|
5038
|
-
function
|
|
5096
|
+
function On(u) {
|
|
5039
5097
|
return new TextEncoder().encode(u).buffer;
|
|
5040
5098
|
}
|
|
5041
|
-
function
|
|
5099
|
+
function qn(u) {
|
|
5042
5100
|
return st(u.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
5043
5101
|
}
|
|
5044
|
-
function
|
|
5102
|
+
function Gn(u, t, e) {
|
|
5045
5103
|
const n = {
|
|
5046
5104
|
min: new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
5047
5105
|
max: new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -5049,15 +5107,15 @@ function qn(u, t, e) {
|
|
|
5049
5107
|
for (let s = t; s < t + e; s++)
|
|
5050
5108
|
for (let r = 0; r < u.itemSize; r++) {
|
|
5051
5109
|
let i;
|
|
5052
|
-
u.itemSize > 4 ? i = u.array[s * u.itemSize + r] : (r === 0 ? i = u.getX(s) : r === 1 ? i = u.getY(s) : r === 2 ? i = u.getZ(s) : r === 3 && (i = u.getW(s)), u.normalized === !0 && (i =
|
|
5110
|
+
u.itemSize > 4 ? i = u.array[s * u.itemSize + r] : (r === 0 ? i = u.getX(s) : r === 1 ? i = u.getY(s) : r === 2 ? i = u.getZ(s) : r === 3 && (i = u.getW(s)), u.normalized === !0 && (i = St.normalize(i, u.array))), n.min[r] = Math.min(n.min[r], i), n.max[r] = Math.max(n.max[r], i);
|
|
5053
5111
|
}
|
|
5054
5112
|
return n;
|
|
5055
5113
|
}
|
|
5056
|
-
function
|
|
5114
|
+
function De(u) {
|
|
5057
5115
|
return Math.ceil(u / 4) * 4;
|
|
5058
5116
|
}
|
|
5059
|
-
function
|
|
5060
|
-
const e =
|
|
5117
|
+
function Dt(u, t = 0) {
|
|
5118
|
+
const e = De(u.byteLength);
|
|
5061
5119
|
if (e !== u.byteLength) {
|
|
5062
5120
|
const n = new Uint8Array(e);
|
|
5063
5121
|
if (n.set(new Uint8Array(u)), t !== 0)
|
|
@@ -5067,10 +5125,10 @@ function Mt(u, t = 0) {
|
|
|
5067
5125
|
}
|
|
5068
5126
|
return u;
|
|
5069
5127
|
}
|
|
5070
|
-
function
|
|
5128
|
+
function Jt() {
|
|
5071
5129
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
5072
5130
|
}
|
|
5073
|
-
function
|
|
5131
|
+
function zn(u, t) {
|
|
5074
5132
|
if (typeof OffscreenCanvas < "u" && u instanceof OffscreenCanvas) {
|
|
5075
5133
|
let e;
|
|
5076
5134
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), u.convertToBlob({
|
|
@@ -5080,12 +5138,12 @@ function Gn(u, t) {
|
|
|
5080
5138
|
} else
|
|
5081
5139
|
return new Promise((e) => u.toBlob(e, t));
|
|
5082
5140
|
}
|
|
5083
|
-
class
|
|
5141
|
+
class Un {
|
|
5084
5142
|
constructor() {
|
|
5085
5143
|
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 = {
|
|
5086
5144
|
asset: {
|
|
5087
5145
|
version: "2.0",
|
|
5088
|
-
generator: "THREE.GLTFExporter r" +
|
|
5146
|
+
generator: "THREE.GLTFExporter r" + ve
|
|
5089
5147
|
}
|
|
5090
5148
|
}, this.cache = {
|
|
5091
5149
|
meshes: /* @__PURE__ */ new Map(),
|
|
@@ -5122,14 +5180,14 @@ class zn {
|
|
|
5122
5180
|
const s = this, r = s.buffers, i = s.json;
|
|
5123
5181
|
n = s.options;
|
|
5124
5182
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(r, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
5125
|
-
l.length > 0 && (i.extensionsUsed = l), h.length > 0 && (i.extensionsRequired = h), i.buffers && i.buffers.length > 0 && (i.buffers[0].byteLength = c.size), n.binary === !0 ?
|
|
5126
|
-
const f =
|
|
5127
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
5128
|
-
const g =
|
|
5129
|
-
y.setUint32(0, g.byteLength, !0), y.setUint32(4,
|
|
5130
|
-
const m = new ArrayBuffer(
|
|
5131
|
-
x.setUint32(0,
|
|
5132
|
-
const M =
|
|
5183
|
+
l.length > 0 && (i.extensionsUsed = l), h.length > 0 && (i.extensionsRequired = h), i.buffers && i.buffers.length > 0 && (i.buffers[0].byteLength = c.size), n.binary === !0 ? Lt(c).then(function(d) {
|
|
5184
|
+
const f = Dt(d), p = new DataView(new ArrayBuffer($t));
|
|
5185
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Fn, !0);
|
|
5186
|
+
const g = Dt(On(JSON.stringify(i)), 32), y = new DataView(new ArrayBuffer($t));
|
|
5187
|
+
y.setUint32(0, g.byteLength, !0), y.setUint32(4, jn, !0);
|
|
5188
|
+
const m = new ArrayBuffer(Ht), x = new DataView(m);
|
|
5189
|
+
x.setUint32(0, Bn, !0), x.setUint32(4, Nn, !0);
|
|
5190
|
+
const M = Ht + y.byteLength + g.byteLength + p.byteLength + f.byteLength;
|
|
5133
5191
|
x.setUint32(8, M, !0);
|
|
5134
5192
|
const w = new Blob([
|
|
5135
5193
|
m,
|
|
@@ -5138,10 +5196,10 @@ class zn {
|
|
|
5138
5196
|
p,
|
|
5139
5197
|
f
|
|
5140
5198
|
], { type: "application/octet-stream" });
|
|
5141
|
-
|
|
5199
|
+
Lt(w).then((L) => {
|
|
5142
5200
|
e(L);
|
|
5143
5201
|
});
|
|
5144
|
-
}) : i.buffers && i.buffers.length > 0 ?
|
|
5202
|
+
}) : i.buffers && i.buffers.length > 0 ? ns(c).then((d) => {
|
|
5145
5203
|
i.buffers[0].uri = d, e(i);
|
|
5146
5204
|
}) : e(i);
|
|
5147
5205
|
}
|
|
@@ -5224,14 +5282,14 @@ class zn {
|
|
|
5224
5282
|
async buildMetalRoughTextureAsync(t, e) {
|
|
5225
5283
|
if (t === e) return t;
|
|
5226
5284
|
function n(f) {
|
|
5227
|
-
return f.colorSpace ===
|
|
5285
|
+
return f.colorSpace === Oe ? function(g) {
|
|
5228
5286
|
return g < 0.04045 ? g * 0.0773993808 : Math.pow(g * 0.9478672986 + 0.0521327014, 2.4);
|
|
5229
5287
|
} : function(g) {
|
|
5230
5288
|
return g;
|
|
5231
5289
|
};
|
|
5232
5290
|
}
|
|
5233
5291
|
t instanceof xt && (t = await this.decompressTextureAsync(t)), e instanceof xt && (e = await this.decompressTextureAsync(e));
|
|
5234
|
-
const s = t ? t.image : null, r = e ? e.image : null, i = Math.max(s ? s.width : 0, r ? r.width : 0), o = Math.max(s ? s.height : 0, r ? r.height : 0), a =
|
|
5292
|
+
const s = t ? t.image : null, r = e ? e.image : null, i = Math.max(s ? s.width : 0, r ? r.width : 0), o = Math.max(s ? s.height : 0, r ? r.height : 0), a = Jt();
|
|
5235
5293
|
a.width = i, a.height = o;
|
|
5236
5294
|
const c = a.getContext("2d", {
|
|
5237
5295
|
willReadFrequently: !0
|
|
@@ -5252,7 +5310,7 @@ class zn {
|
|
|
5252
5310
|
}
|
|
5253
5311
|
c.putImageData(l, 0, 0);
|
|
5254
5312
|
const d = (t || e).clone();
|
|
5255
|
-
return d.source = new
|
|
5313
|
+
return d.source = new Re(a), d.colorSpace = Ce, d.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."), d;
|
|
5256
5314
|
}
|
|
5257
5315
|
async decompressTextureAsync(t, e = 1 / 0) {
|
|
5258
5316
|
if (this.textureUtils === null)
|
|
@@ -5295,12 +5353,12 @@ class zn {
|
|
|
5295
5353
|
}
|
|
5296
5354
|
let a = t.itemSize * o;
|
|
5297
5355
|
r === P.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
|
|
5298
|
-
const c =
|
|
5356
|
+
const c = De(s * a), l = new DataView(new ArrayBuffer(c));
|
|
5299
5357
|
let h = 0;
|
|
5300
5358
|
for (let p = n; p < n + s; p++) {
|
|
5301
5359
|
for (let g = 0; g < t.itemSize; g++) {
|
|
5302
5360
|
let y;
|
|
5303
|
-
t.itemSize > 4 ? y = t.array[p * t.itemSize + g] : (g === 0 ? y = t.getX(p) : g === 1 ? y = t.getY(p) : g === 2 ? y = t.getZ(p) : g === 3 && (y = t.getW(p)), t.normalized === !0 && (y =
|
|
5361
|
+
t.itemSize > 4 ? y = t.array[p * t.itemSize + g] : (g === 0 ? y = t.getX(p) : g === 1 ? y = t.getY(p) : g === 2 ? y = t.getZ(p) : g === 3 && (y = t.getW(p)), t.normalized === !0 && (y = St.normalize(y, t.array))), e === P.FLOAT ? l.setFloat32(h, y, !0) : e === P.INT ? l.setInt32(h, y, !0) : e === P.UNSIGNED_INT ? l.setUint32(h, y, !0) : e === P.SHORT ? l.setInt16(h, y, !0) : e === P.UNSIGNED_SHORT ? l.setUint16(h, y, !0) : e === P.BYTE ? l.setInt8(h, y) : e === P.UNSIGNED_BYTE && l.setUint8(h, y), h += o;
|
|
5304
5362
|
}
|
|
5305
5363
|
h % a !== 0 && (h += a - h % a);
|
|
5306
5364
|
}
|
|
@@ -5322,8 +5380,8 @@ class zn {
|
|
|
5322
5380
|
processBufferViewImage(t) {
|
|
5323
5381
|
const e = this, n = e.json;
|
|
5324
5382
|
return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
|
|
5325
|
-
|
|
5326
|
-
const i =
|
|
5383
|
+
Lt(t).then((r) => {
|
|
5384
|
+
const i = Dt(r), o = {
|
|
5327
5385
|
buffer: e.processBuffer(i),
|
|
5328
5386
|
byteOffset: e.byteOffset,
|
|
5329
5387
|
byteLength: i.byteLength
|
|
@@ -5367,7 +5425,7 @@ class zn {
|
|
|
5367
5425
|
else
|
|
5368
5426
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
5369
5427
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
5370
|
-
const a =
|
|
5428
|
+
const a = Gn(t, n, s);
|
|
5371
5429
|
let c;
|
|
5372
5430
|
e !== void 0 && (c = t === e.index ? P.ELEMENT_ARRAY_BUFFER : P.ARRAY_BUFFER);
|
|
5373
5431
|
const l = this.processBufferView(t, o, n, s, c), h = {
|
|
@@ -5396,13 +5454,13 @@ class zn {
|
|
|
5396
5454
|
const l = i.images.get(t), h = s + ":flipY/" + n.toString();
|
|
5397
5455
|
if (l[h] !== void 0) return l[h];
|
|
5398
5456
|
o.images || (o.images = []);
|
|
5399
|
-
const d = { mimeType: s }, f =
|
|
5457
|
+
const d = { mimeType: s }, f = Jt();
|
|
5400
5458
|
f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
|
|
5401
5459
|
const p = f.getContext("2d", {
|
|
5402
5460
|
willReadFrequently: !0
|
|
5403
5461
|
});
|
|
5404
5462
|
if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
|
|
5405
|
-
e !==
|
|
5463
|
+
e !== Be && 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);
|
|
5406
5464
|
const y = new Uint8ClampedArray(t.height * t.width * 4);
|
|
5407
5465
|
for (let m = 0; m < y.length; m += 4)
|
|
5408
5466
|
y[m + 0] = t.data[m + 0], y[m + 1] = t.data[m + 1], y[m + 2] = t.data[m + 2], y[m + 3] = t.data[m + 3];
|
|
@@ -5412,7 +5470,7 @@ class zn {
|
|
|
5412
5470
|
else
|
|
5413
5471
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
5414
5472
|
a.binary === !0 ? c.push(
|
|
5415
|
-
|
|
5473
|
+
zn(f, s).then((y) => r.processBufferViewImage(y)).then((y) => {
|
|
5416
5474
|
d.bufferView = y;
|
|
5417
5475
|
})
|
|
5418
5476
|
) : d.uri = Ne.getDataURL(f, s);
|
|
@@ -5510,7 +5568,7 @@ class zn {
|
|
|
5510
5568
|
};
|
|
5511
5569
|
t.aoMapIntensity !== 1 && (o.strength = t.aoMapIntensity), this.applyTextureTransform(o, t.aoMap), s.occlusionTexture = o;
|
|
5512
5570
|
}
|
|
5513
|
-
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side ===
|
|
5571
|
+
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === je && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
|
|
5514
5572
|
o.writeMaterialAsync && await o.writeMaterialAsync(t, s);
|
|
5515
5573
|
});
|
|
5516
5574
|
const i = n.materials.push(s) - 1;
|
|
@@ -5578,9 +5636,9 @@ class zn {
|
|
|
5578
5636
|
}
|
|
5579
5637
|
const q = j.clone();
|
|
5580
5638
|
if (!i.morphTargetsRelative)
|
|
5581
|
-
for (let
|
|
5639
|
+
for (let N = 0, jt = j.count; N < jt; N++)
|
|
5582
5640
|
for (let J = 0; J < j.itemSize; J++)
|
|
5583
|
-
J === 0 && q.setX(
|
|
5641
|
+
J === 0 && q.setX(N, j.getX(N) - W.getX(N)), J === 1 && q.setY(N, j.getY(N) - W.getY(N)), J === 2 && q.setZ(N, j.getZ(N) - W.getZ(N)), J === 3 && q.setW(N, j.getW(N) - W.getW(N));
|
|
5584
5642
|
T[F] = this.processAccessor(q, i), e.attributes.set(this.getUID(W, !0), T[F]);
|
|
5585
5643
|
}
|
|
5586
5644
|
h.push(T), w.push(t.morphTargetInfluences[S]), t.morphTargetDictionary !== void 0 && L.push(b[S]);
|
|
@@ -5627,7 +5685,7 @@ class zn {
|
|
|
5627
5685
|
* @param {THREE.BufferAttribute} attribute
|
|
5628
5686
|
*/
|
|
5629
5687
|
detectMeshQuantization(t, e) {
|
|
5630
|
-
if (this.extensionsUsed[
|
|
5688
|
+
if (this.extensionsUsed[Mt]) return;
|
|
5631
5689
|
let n;
|
|
5632
5690
|
switch (e.array.constructor) {
|
|
5633
5691
|
case Int8Array:
|
|
@@ -5647,7 +5705,7 @@ class zn {
|
|
|
5647
5705
|
}
|
|
5648
5706
|
e.normalized && (n += " normalized");
|
|
5649
5707
|
const s = t.split("_", 1)[0];
|
|
5650
|
-
|
|
5708
|
+
Xt[s] && Xt[s].includes(n) && (this.extensionsUsed[Mt] = !0, this.extensionsRequired[Mt] = !0);
|
|
5651
5709
|
}
|
|
5652
5710
|
/**
|
|
5653
5711
|
* Process camera
|
|
@@ -5667,7 +5725,7 @@ class zn {
|
|
|
5667
5725
|
znear: t.near < 0 ? 0 : t.near
|
|
5668
5726
|
} : s.perspective = {
|
|
5669
5727
|
aspectRatio: t.aspect,
|
|
5670
|
-
yfov:
|
|
5728
|
+
yfov: St.degToRad(t.fov),
|
|
5671
5729
|
zfar: t.far <= 0 ? 1e-3 : t.far,
|
|
5672
5730
|
znear: t.near < 0 ? 0 : t.near
|
|
5673
5731
|
}, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
|
|
@@ -5689,16 +5747,16 @@ class zn {
|
|
|
5689
5747
|
for (let c = 0; c < r.length; ++c) {
|
|
5690
5748
|
const l = r[c], h = ht.parseTrackName(l.name);
|
|
5691
5749
|
let d = ht.findNode(e, h.nodeName);
|
|
5692
|
-
const f =
|
|
5750
|
+
const f = Vt[h.propertyName];
|
|
5693
5751
|
if (h.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(h.objectIndex) : d = void 0), !d || !f) {
|
|
5694
5752
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
|
|
5695
5753
|
continue;
|
|
5696
5754
|
}
|
|
5697
5755
|
const p = 1;
|
|
5698
5756
|
let g = l.values.length / l.times.length;
|
|
5699
|
-
f ===
|
|
5757
|
+
f === Vt.morphTargetInfluences && (g /= d.morphTargetInfluences.length);
|
|
5700
5758
|
let y;
|
|
5701
|
-
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (y = "CUBICSPLINE", g /= 3) : l.getInterpolation() ===
|
|
5759
|
+
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (y = "CUBICSPLINE", g /= 3) : l.getInterpolation() === Fe ? y = "STEP" : y = "LINEAR", o.push({
|
|
5702
5760
|
input: this.processAccessor(new X(l.times, p)),
|
|
5703
5761
|
output: this.processAccessor(new X(l.values, g)),
|
|
5704
5762
|
interpolation: y
|
|
@@ -5726,7 +5784,7 @@ class zn {
|
|
|
5726
5784
|
if (r === void 0) return null;
|
|
5727
5785
|
const i = t.skeleton.bones[0];
|
|
5728
5786
|
if (i === void 0) return null;
|
|
5729
|
-
const o = [], a = new Float32Array(r.bones.length * 16), c = new
|
|
5787
|
+
const o = [], a = new Float32Array(r.bones.length * 16), c = new Zt();
|
|
5730
5788
|
for (let h = 0; h < r.bones.length; ++h)
|
|
5731
5789
|
o.push(n.get(r.bones[h])), c.copy(r.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
|
|
5732
5790
|
return e.skins === void 0 && (e.skins = []), e.skins.push({
|
|
@@ -5748,7 +5806,7 @@ class zn {
|
|
|
5748
5806
|
const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
|
|
5749
5807
|
st(o, [0, 0, 0, 1]) || (r.rotation = o), st(a, [0, 0, 0]) || (r.translation = a), st(c, [1, 1, 1]) || (r.scale = c);
|
|
5750
5808
|
} else
|
|
5751
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
5809
|
+
t.matrixAutoUpdate && t.updateMatrix(), qn(t.matrix) === !1 && (r.matrix = t.matrix.elements);
|
|
5752
5810
|
if (t.name !== "" && (r.name = String(t.name)), this.serializeUserData(t, r), t.isMesh || t.isLine || t.isPoints) {
|
|
5753
5811
|
const o = await this.processMeshAsync(t);
|
|
5754
5812
|
o !== null && (r.mesh = o);
|
|
@@ -5794,7 +5852,7 @@ class zn {
|
|
|
5794
5852
|
* @param {Array<THREE.Object3D>} objects List of objects to process
|
|
5795
5853
|
*/
|
|
5796
5854
|
async processObjectsAsync(t) {
|
|
5797
|
-
const e = new
|
|
5855
|
+
const e = new Ft();
|
|
5798
5856
|
e.name = "AuxScene";
|
|
5799
5857
|
for (let n = 0; n < t.length; n++)
|
|
5800
5858
|
e.children.push(t[n]);
|
|
@@ -5810,7 +5868,7 @@ class zn {
|
|
|
5810
5868
|
});
|
|
5811
5869
|
const n = [];
|
|
5812
5870
|
for (let s = 0; s < t.length; s++)
|
|
5813
|
-
t[s] instanceof
|
|
5871
|
+
t[s] instanceof Ft ? await this.processSceneAsync(t[s]) : n.push(t[s]);
|
|
5814
5872
|
n.length > 0 && await this.processObjectsAsync(n);
|
|
5815
5873
|
for (let s = 0; s < this.skins.length; ++s)
|
|
5816
5874
|
this.processSkin(this.skins[s]);
|
|
@@ -5825,7 +5883,7 @@ class zn {
|
|
|
5825
5883
|
await t(this.plugins[e]);
|
|
5826
5884
|
}
|
|
5827
5885
|
}
|
|
5828
|
-
class
|
|
5886
|
+
class kn {
|
|
5829
5887
|
constructor(t) {
|
|
5830
5888
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
5831
5889
|
}
|
|
@@ -5851,7 +5909,7 @@ class _n {
|
|
|
5851
5909
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
5852
5910
|
}
|
|
5853
5911
|
}
|
|
5854
|
-
class
|
|
5912
|
+
class Wn {
|
|
5855
5913
|
constructor(t) {
|
|
5856
5914
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
5857
5915
|
}
|
|
@@ -5882,7 +5940,7 @@ class kn {
|
|
|
5882
5940
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5883
5941
|
}
|
|
5884
5942
|
}
|
|
5885
|
-
class
|
|
5943
|
+
class Yn {
|
|
5886
5944
|
constructor(t) {
|
|
5887
5945
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
5888
5946
|
}
|
|
@@ -5892,7 +5950,7 @@ class Wn {
|
|
|
5892
5950
|
r.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5893
5951
|
}
|
|
5894
5952
|
}
|
|
5895
|
-
class
|
|
5953
|
+
class Xn {
|
|
5896
5954
|
constructor(t) {
|
|
5897
5955
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
5898
5956
|
}
|
|
@@ -5916,7 +5974,7 @@ class Yn {
|
|
|
5916
5974
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5917
5975
|
}
|
|
5918
5976
|
}
|
|
5919
|
-
class
|
|
5977
|
+
class Vn {
|
|
5920
5978
|
constructor(t) {
|
|
5921
5979
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
5922
5980
|
}
|
|
@@ -5933,7 +5991,7 @@ class Xn {
|
|
|
5933
5991
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5934
5992
|
}
|
|
5935
5993
|
}
|
|
5936
|
-
class
|
|
5994
|
+
class Hn {
|
|
5937
5995
|
constructor(t) {
|
|
5938
5996
|
this.writer = t, this.name = "KHR_materials_volume";
|
|
5939
5997
|
}
|
|
@@ -5950,7 +6008,7 @@ class Vn {
|
|
|
5950
6008
|
t.attenuationDistance !== 1 / 0 && (r.attenuationDistance = t.attenuationDistance), r.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5951
6009
|
}
|
|
5952
6010
|
}
|
|
5953
|
-
class
|
|
6011
|
+
class $n {
|
|
5954
6012
|
constructor(t) {
|
|
5955
6013
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
5956
6014
|
}
|
|
@@ -5960,12 +6018,12 @@ class Hn {
|
|
|
5960
6018
|
r.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5961
6019
|
}
|
|
5962
6020
|
}
|
|
5963
|
-
class
|
|
6021
|
+
class Jn {
|
|
5964
6022
|
constructor(t) {
|
|
5965
6023
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
5966
6024
|
}
|
|
5967
6025
|
async writeMaterialAsync(t, e) {
|
|
5968
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
6026
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Cn) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
5969
6027
|
const n = this.writer, s = n.extensionsUsed, r = {};
|
|
5970
6028
|
if (t.specularIntensityMap) {
|
|
5971
6029
|
const i = {
|
|
@@ -5984,7 +6042,7 @@ class $n {
|
|
|
5984
6042
|
r.specularFactor = t.specularIntensity, r.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5985
6043
|
}
|
|
5986
6044
|
}
|
|
5987
|
-
class
|
|
6045
|
+
class Kn {
|
|
5988
6046
|
constructor(t) {
|
|
5989
6047
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
5990
6048
|
}
|
|
@@ -6008,7 +6066,7 @@ class Jn {
|
|
|
6008
6066
|
r.sheenRoughnessFactor = t.sheenRoughness, r.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6009
6067
|
}
|
|
6010
6068
|
}
|
|
6011
|
-
class
|
|
6069
|
+
class Zn {
|
|
6012
6070
|
constructor(t) {
|
|
6013
6071
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
6014
6072
|
}
|
|
@@ -6022,7 +6080,7 @@ class Kn {
|
|
|
6022
6080
|
r.anisotropyStrength = t.anisotropy, r.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6023
6081
|
}
|
|
6024
6082
|
}
|
|
6025
|
-
class
|
|
6083
|
+
class Qn {
|
|
6026
6084
|
constructor(t) {
|
|
6027
6085
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
6028
6086
|
}
|
|
@@ -6032,7 +6090,7 @@ class Zn {
|
|
|
6032
6090
|
r.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6033
6091
|
}
|
|
6034
6092
|
}
|
|
6035
|
-
class
|
|
6093
|
+
class ts {
|
|
6036
6094
|
constructor(t) {
|
|
6037
6095
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
6038
6096
|
}
|
|
@@ -6049,13 +6107,13 @@ class Qn {
|
|
|
6049
6107
|
r.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6050
6108
|
}
|
|
6051
6109
|
}
|
|
6052
|
-
class
|
|
6110
|
+
class es {
|
|
6053
6111
|
constructor(t) {
|
|
6054
6112
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
6055
6113
|
}
|
|
6056
6114
|
writeNode(t, e) {
|
|
6057
6115
|
if (!t.isInstancedMesh) return;
|
|
6058
|
-
const n = this.writer, s = t, r = new Float32Array(s.count * 3), i = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new
|
|
6116
|
+
const n = this.writer, s = t, r = new Float32Array(s.count * 3), i = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new Zt(), c = new ut(), l = new Ie(), h = new ut();
|
|
6059
6117
|
for (let f = 0; f < s.count; f++)
|
|
6060
6118
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(r, f * 3), l.toArray(i, f * 4), h.toArray(o, f * 3);
|
|
6061
6119
|
const d = {
|
|
@@ -6104,7 +6162,7 @@ dt.Utils = {
|
|
|
6104
6162
|
if (i.createInterpolant !== i.InterpolantFactoryMethodDiscrete && i.createInterpolant !== i.InterpolantFactoryMethodLinear) {
|
|
6105
6163
|
if (i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
|
|
6106
6164
|
throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
|
|
6107
|
-
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), i = i.clone(), i.setInterpolation(
|
|
6165
|
+
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), i = i.clone(), i.setInterpolation(Ve);
|
|
6108
6166
|
}
|
|
6109
6167
|
const c = a.morphTargetInfluences.length, l = a.morphTargetDictionary[o.propertyIndex];
|
|
6110
6168
|
if (l === void 0)
|
|
@@ -6139,7 +6197,7 @@ dt.Utils = {
|
|
|
6139
6197
|
return t;
|
|
6140
6198
|
}
|
|
6141
6199
|
};
|
|
6142
|
-
async function
|
|
6200
|
+
async function ns(u) {
|
|
6143
6201
|
if (typeof FileReader > "u") {
|
|
6144
6202
|
const t = await u.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
6145
6203
|
return `data:${u.type};base64,${n}`;
|
|
@@ -6149,7 +6207,7 @@ async function es(u) {
|
|
|
6149
6207
|
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(u);
|
|
6150
6208
|
});
|
|
6151
6209
|
}
|
|
6152
|
-
async function
|
|
6210
|
+
async function Lt(u) {
|
|
6153
6211
|
if (typeof u.arrayBuffer == "function")
|
|
6154
6212
|
return await u.arrayBuffer();
|
|
6155
6213
|
if (typeof FileReader < "u")
|
|
@@ -6162,8 +6220,8 @@ async function Dt(u) {
|
|
|
6162
6220
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
6163
6221
|
}
|
|
6164
6222
|
}
|
|
6165
|
-
const
|
|
6166
|
-
function
|
|
6223
|
+
const ss = new He(), rs = new dt();
|
|
6224
|
+
function is(u, t, e = 0.1) {
|
|
6167
6225
|
const n = t.normal(u), s = t.direction(u).mutiplyScalar(e * 0.5), r = u.direction(t).mutiplyScalar(e * 0.5), i = n.x * e * 0.5, o = n.y * e * 0.5;
|
|
6168
6226
|
return {
|
|
6169
6227
|
points: [
|
|
@@ -6178,7 +6236,7 @@ function rs(u, t, e = 0.1) {
|
|
|
6178
6236
|
rectIndices: [0, 1, 3, 2, 0]
|
|
6179
6237
|
};
|
|
6180
6238
|
}
|
|
6181
|
-
class
|
|
6239
|
+
class Le extends z {
|
|
6182
6240
|
static name = "WhiteModel";
|
|
6183
6241
|
Dxf = null;
|
|
6184
6242
|
Variable = null;
|
|
@@ -6208,7 +6266,7 @@ class De extends z {
|
|
|
6208
6266
|
new I.LineSegments(new I.EdgesGeometry(r), new I.LineBasicMaterial({ color: 0 }))
|
|
6209
6267
|
);
|
|
6210
6268
|
}), t.originalData.map(({ start: n, end: s, insetionArr: r }) => {
|
|
6211
|
-
const i = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } =
|
|
6269
|
+
const i = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = is(i, o, t.width);
|
|
6212
6270
|
return {
|
|
6213
6271
|
points: a,
|
|
6214
6272
|
indices: c,
|
|
@@ -6241,7 +6299,7 @@ class De extends z {
|
|
|
6241
6299
|
toOBJ() {
|
|
6242
6300
|
return new Promise((t) => {
|
|
6243
6301
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
6244
|
-
t(
|
|
6302
|
+
t(ss.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6245
6303
|
}, 20);
|
|
6246
6304
|
});
|
|
6247
6305
|
}
|
|
@@ -6253,7 +6311,7 @@ class De extends z {
|
|
|
6253
6311
|
toGltf(t = !0) {
|
|
6254
6312
|
return new Promise((e) => {
|
|
6255
6313
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
6256
|
-
|
|
6314
|
+
rs.parse(this.whiteModelGroup.children, (n) => {
|
|
6257
6315
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6258
6316
|
}, () => {
|
|
6259
6317
|
e(void 0);
|
|
@@ -6314,7 +6372,7 @@ class De extends z {
|
|
|
6314
6372
|
}
|
|
6315
6373
|
}
|
|
6316
6374
|
}
|
|
6317
|
-
class
|
|
6375
|
+
class Ee extends z {
|
|
6318
6376
|
static name = "DetailsPoint";
|
|
6319
6377
|
Dxf = null;
|
|
6320
6378
|
WhiteModel = null;
|
|
@@ -6391,7 +6449,7 @@ class Le extends z {
|
|
|
6391
6449
|
}, 50);
|
|
6392
6450
|
}
|
|
6393
6451
|
}
|
|
6394
|
-
class
|
|
6452
|
+
class Se extends z {
|
|
6395
6453
|
static name = "DxfLineModel";
|
|
6396
6454
|
dxfLineModel = new I.LineSegments();
|
|
6397
6455
|
dxfDoorsLineModel = new I.LineSegments();
|
|
@@ -6414,30 +6472,30 @@ class Ee extends z {
|
|
|
6414
6472
|
});
|
|
6415
6473
|
}
|
|
6416
6474
|
}
|
|
6417
|
-
const
|
|
6475
|
+
const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6418
6476
|
__proto__: null,
|
|
6419
|
-
DetailsPoint:
|
|
6420
|
-
DxfLineModel:
|
|
6421
|
-
WhiteModel:
|
|
6477
|
+
DetailsPoint: Ee,
|
|
6478
|
+
DxfLineModel: Se,
|
|
6479
|
+
WhiteModel: Le
|
|
6422
6480
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6423
|
-
function
|
|
6481
|
+
function Kt(u, t = {}) {
|
|
6424
6482
|
const {
|
|
6425
6483
|
detailsPoint: e = !0,
|
|
6426
6484
|
whiteModel: n = !0,
|
|
6427
6485
|
dxfLineModel: s = !0
|
|
6428
6486
|
} = t;
|
|
6429
|
-
s && u.addComponent(new
|
|
6487
|
+
s && u.addComponent(new Se()), n && u.addComponent(new Le()), e && u.addComponent(new Ee());
|
|
6430
6488
|
}
|
|
6431
|
-
const
|
|
6489
|
+
const as = Object.assign(Kt, {
|
|
6432
6490
|
create(u = {}) {
|
|
6433
|
-
return (t) =>
|
|
6491
|
+
return (t) => Kt(t, u);
|
|
6434
6492
|
}
|
|
6435
|
-
}),
|
|
6493
|
+
}), cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6436
6494
|
__proto__: null,
|
|
6437
|
-
ModelDataPlugin:
|
|
6438
|
-
components:
|
|
6495
|
+
ModelDataPlugin: as,
|
|
6496
|
+
components: os
|
|
6439
6497
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6440
|
-
class
|
|
6498
|
+
class ls extends I.LineSegments {
|
|
6441
6499
|
geometry = new I.BufferGeometry();
|
|
6442
6500
|
points = [];
|
|
6443
6501
|
pointsObject3D;
|
|
@@ -6467,7 +6525,7 @@ class cs extends I.LineSegments {
|
|
|
6467
6525
|
});
|
|
6468
6526
|
}
|
|
6469
6527
|
}
|
|
6470
|
-
function
|
|
6528
|
+
function Et() {
|
|
6471
6529
|
return new Promise((u) => {
|
|
6472
6530
|
const t = document.createElement("input");
|
|
6473
6531
|
t.type = "file", t.accept = "application/json", t.click(), t.onchange = () => {
|
|
@@ -6475,10 +6533,10 @@ function Lt() {
|
|
|
6475
6533
|
};
|
|
6476
6534
|
});
|
|
6477
6535
|
}
|
|
6478
|
-
const
|
|
6536
|
+
const us = Object.assign(Et, {
|
|
6479
6537
|
arrayBuffer() {
|
|
6480
6538
|
return new Promise(async (u) => {
|
|
6481
|
-
const t = await
|
|
6539
|
+
const t = await Et();
|
|
6482
6540
|
if (t instanceof File) {
|
|
6483
6541
|
const e = new FileReader();
|
|
6484
6542
|
e.onload = () => {
|
|
@@ -6489,7 +6547,7 @@ const ls = Object.assign(Lt, {
|
|
|
6489
6547
|
},
|
|
6490
6548
|
text() {
|
|
6491
6549
|
return new Promise(async (u) => {
|
|
6492
|
-
const t = await
|
|
6550
|
+
const t = await Et();
|
|
6493
6551
|
if (t instanceof File) {
|
|
6494
6552
|
const e = new FileReader();
|
|
6495
6553
|
e.onload = () => {
|
|
@@ -6503,7 +6561,7 @@ const ls = Object.assign(Lt, {
|
|
|
6503
6561
|
if (u) return JSON.parse(u);
|
|
6504
6562
|
}
|
|
6505
6563
|
});
|
|
6506
|
-
class
|
|
6564
|
+
class be extends it {
|
|
6507
6565
|
list = [];
|
|
6508
6566
|
rollbacklist = [];
|
|
6509
6567
|
revokeRollbacklist = [];
|
|
@@ -6535,7 +6593,7 @@ class Se extends it {
|
|
|
6535
6593
|
return this.revokeRollbacklist.push(t), this;
|
|
6536
6594
|
}
|
|
6537
6595
|
}
|
|
6538
|
-
class
|
|
6596
|
+
class hs extends it {
|
|
6539
6597
|
commandFlowMap = /* @__PURE__ */ new Map();
|
|
6540
6598
|
lock = !1;
|
|
6541
6599
|
abortController = null;
|
|
@@ -6562,7 +6620,7 @@ class us extends it {
|
|
|
6562
6620
|
*/
|
|
6563
6621
|
addCommandFlow(t) {
|
|
6564
6622
|
if (this.commandFlowMap.has(t)) throw new Error(`${t} 命令已经存在`);
|
|
6565
|
-
const e = new
|
|
6623
|
+
const e = new be();
|
|
6566
6624
|
return this.commandFlowMap.set(t, e), e;
|
|
6567
6625
|
}
|
|
6568
6626
|
executionPromise = null;
|
|
@@ -6645,16 +6703,16 @@ class us extends it {
|
|
|
6645
6703
|
}, { once: !0 });
|
|
6646
6704
|
}
|
|
6647
6705
|
}
|
|
6648
|
-
const
|
|
6706
|
+
const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6649
6707
|
__proto__: null,
|
|
6650
6708
|
ArrayMap: H,
|
|
6651
|
-
AxisAlignCorr:
|
|
6652
|
-
BoundExt:
|
|
6709
|
+
AxisAlignCorr: ue,
|
|
6710
|
+
BoundExt: Bt,
|
|
6653
6711
|
Box2: v,
|
|
6654
|
-
CommandFlow:
|
|
6655
|
-
CommandManager:
|
|
6712
|
+
CommandFlow: be,
|
|
6713
|
+
CommandManager: hs,
|
|
6656
6714
|
Component: z,
|
|
6657
|
-
ComponentManager:
|
|
6715
|
+
ComponentManager: Qt,
|
|
6658
6716
|
CountMap: ft,
|
|
6659
6717
|
DoubleWallHelper: pt,
|
|
6660
6718
|
DxfSystem: tt,
|
|
@@ -6663,57 +6721,57 @@ const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
6663
6721
|
LineIndexGenerator: gt,
|
|
6664
6722
|
LineSegment: E,
|
|
6665
6723
|
LineSegmentUndirectedGraph: yt,
|
|
6666
|
-
Lines:
|
|
6724
|
+
Lines: ls,
|
|
6667
6725
|
MapEnhance: et,
|
|
6668
6726
|
Point: D,
|
|
6669
6727
|
PointVirtualGrid: G,
|
|
6670
6728
|
Polygon: at,
|
|
6671
|
-
PvgList:
|
|
6672
|
-
Quadtree:
|
|
6729
|
+
PvgList: te,
|
|
6730
|
+
Quadtree: B,
|
|
6673
6731
|
Rectangle: nt,
|
|
6674
|
-
SelectLocalFile:
|
|
6675
|
-
UndirectedGraph:
|
|
6732
|
+
SelectLocalFile: us,
|
|
6733
|
+
UndirectedGraph: ie,
|
|
6676
6734
|
UnionFindSet: Q,
|
|
6677
|
-
buildBayWindowGroup:
|
|
6735
|
+
buildBayWindowGroup: bt,
|
|
6678
6736
|
buildDoubleWallGroup: Z,
|
|
6679
|
-
clippingDoubleWall:
|
|
6680
|
-
clippingLineUserData:
|
|
6681
|
-
cloneUserData:
|
|
6682
|
-
closedPathArea:
|
|
6683
|
-
components:
|
|
6737
|
+
clippingDoubleWall: ye,
|
|
6738
|
+
clippingLineUserData: At,
|
|
6739
|
+
cloneUserData: k,
|
|
6740
|
+
closedPathArea: fe,
|
|
6741
|
+
components: Mn,
|
|
6684
6742
|
createPointVirtualGrid: $,
|
|
6685
|
-
createQuadtree:
|
|
6686
|
-
findCircleEdges:
|
|
6687
|
-
findClosedPolygons:
|
|
6688
|
-
findDiscretePoint:
|
|
6689
|
-
findDiscretePointLine:
|
|
6690
|
-
findDiscretePointLine2:
|
|
6691
|
-
findLargestCircle:
|
|
6692
|
-
findRingEdges:
|
|
6693
|
-
findVerticalReference:
|
|
6743
|
+
createQuadtree: Pt,
|
|
6744
|
+
findCircleEdges: ce,
|
|
6745
|
+
findClosedPolygons: In,
|
|
6746
|
+
findDiscretePoint: re,
|
|
6747
|
+
findDiscretePointLine: Ke,
|
|
6748
|
+
findDiscretePointLine2: It,
|
|
6749
|
+
findLargestCircle: le,
|
|
6750
|
+
findRingEdges: we,
|
|
6751
|
+
findVerticalReference: he,
|
|
6694
6752
|
lineDataToOriginalData: rt,
|
|
6695
|
-
lineDataToThreeVJiaJson:
|
|
6696
|
-
lineSegmentClipping:
|
|
6697
|
-
mergeLineUserData:
|
|
6698
|
-
mergeSmallestCircle:
|
|
6699
|
-
mergeWindow:
|
|
6700
|
-
originalDataToLineData:
|
|
6753
|
+
lineDataToThreeVJiaJson: me,
|
|
6754
|
+
lineSegmentClipping: Tt,
|
|
6755
|
+
mergeLineUserData: _,
|
|
6756
|
+
mergeSmallestCircle: ae,
|
|
6757
|
+
mergeWindow: se,
|
|
6758
|
+
originalDataToLineData: de,
|
|
6701
6759
|
recomputedWindow: ot,
|
|
6702
|
-
recomputedWindowCenter:
|
|
6703
|
-
ringsDeduplication:
|
|
6704
|
-
smallestCircle:
|
|
6705
|
-
toOriginalDataItem:
|
|
6706
|
-
tools:
|
|
6760
|
+
recomputedWindowCenter: ne,
|
|
6761
|
+
ringsDeduplication: oe,
|
|
6762
|
+
smallestCircle: vt,
|
|
6763
|
+
toOriginalDataItem: ee,
|
|
6764
|
+
tools: Je,
|
|
6707
6765
|
uuid: V
|
|
6708
6766
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6709
|
-
function
|
|
6767
|
+
function ds() {
|
|
6710
6768
|
return import("./index2.js");
|
|
6711
6769
|
}
|
|
6712
|
-
function
|
|
6770
|
+
function fs() {
|
|
6713
6771
|
return import("./index3.js");
|
|
6714
6772
|
}
|
|
6715
6773
|
let Nt = null;
|
|
6716
|
-
class
|
|
6774
|
+
class Te {
|
|
6717
6775
|
static preTime = performance.now();
|
|
6718
6776
|
static firstTime = performance.now();
|
|
6719
6777
|
static clear() {
|
|
@@ -6728,10 +6786,10 @@ class be {
|
|
|
6728
6786
|
return console.log(t + " %c totalTime " + parseFloat(n.toFixed(6)) + "ms", "color: green;"), this.preTime = e, n;
|
|
6729
6787
|
}
|
|
6730
6788
|
}
|
|
6731
|
-
typeof window < "u" && (window.drawLines =
|
|
6732
|
-
typeof globalThis < "u" && (globalThis.Log =
|
|
6733
|
-
async function
|
|
6734
|
-
const s = await Promise.resolve().then(() =>
|
|
6789
|
+
typeof window < "u" && (window.drawLines = Me, window.drawPoint = vn, window.drawText = Rn, window.randomColor = () => Math.floor(Math.random() * 16777215), window.Log = Te, window.TEST = !1);
|
|
6790
|
+
typeof globalThis < "u" && (globalThis.Log = Te);
|
|
6791
|
+
async function Ms(u, t, e = !1, n) {
|
|
6792
|
+
const s = await Promise.resolve().then(() => cs), r = await ds(), i = await fs(), o = new tt().usePlugin(s.ModelDataPlugin.create({
|
|
6735
6793
|
detailsPoint: !1,
|
|
6736
6794
|
whiteModel: !0
|
|
6737
6795
|
})).usePlugin(r.RenderPlugin.create({
|
|
@@ -6743,10 +6801,10 @@ async function ws(u, t, e = !1, n) {
|
|
|
6743
6801
|
})).usePlugin(i.Editor.create({ viewPermission: n })), a = o.findComponentByType(r.components.DomContainer);
|
|
6744
6802
|
return a && u.appendChild(a.domElement), Nt = o, {
|
|
6745
6803
|
dxfSystem: o,
|
|
6746
|
-
getFileAll: () =>
|
|
6804
|
+
getFileAll: () => ps(o)
|
|
6747
6805
|
};
|
|
6748
6806
|
}
|
|
6749
|
-
async function
|
|
6807
|
+
async function ps(u = Nt) {
|
|
6750
6808
|
const t = u.findComponentByName("WhiteModel"), e = new File([await u.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([u.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([u.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), r = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), i = 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(u.Dxf.originalData)], "json.json", { type: "application/json" });
|
|
6751
6809
|
return {
|
|
6752
6810
|
dxf: n,
|
|
@@ -6758,35 +6816,35 @@ async function fs(u = Nt) {
|
|
|
6758
6816
|
correctionDxf: s
|
|
6759
6817
|
};
|
|
6760
6818
|
}
|
|
6761
|
-
function
|
|
6819
|
+
function Ds() {
|
|
6762
6820
|
return Nt;
|
|
6763
6821
|
}
|
|
6764
6822
|
export {
|
|
6765
|
-
|
|
6823
|
+
ue as A,
|
|
6766
6824
|
v as B,
|
|
6767
6825
|
z as C,
|
|
6768
6826
|
tt as D,
|
|
6769
|
-
|
|
6770
|
-
|
|
6827
|
+
ls as L,
|
|
6828
|
+
as as M,
|
|
6771
6829
|
D as P,
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6830
|
+
B as Q,
|
|
6831
|
+
us as S,
|
|
6832
|
+
xe as T,
|
|
6833
|
+
Rt as V,
|
|
6834
|
+
Le as W,
|
|
6835
|
+
Ee as a,
|
|
6778
6836
|
E as b,
|
|
6779
6837
|
G as c,
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6838
|
+
k as d,
|
|
6839
|
+
ge as e,
|
|
6840
|
+
hs as f,
|
|
6841
|
+
Ms as g,
|
|
6842
|
+
ps as h,
|
|
6843
|
+
Ds as i,
|
|
6786
6844
|
U as j,
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6845
|
+
cs as k,
|
|
6846
|
+
ws as l,
|
|
6847
|
+
Mn as m,
|
|
6790
6848
|
ot as r,
|
|
6791
6849
|
V as u
|
|
6792
6850
|
};
|