build-dxf 0.0.38 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/package.json +1 -1
- package/src/build.js +571 -566
- package/src/index.css +1 -1
- package/src/index3.js +66 -64
- package/src/utils/DxfSystem/plugin/RenderPlugin/pages/Dxf.vue.d.ts +1 -1
- package/src/utils/Quadtree/LineSegment.d.ts +1 -0
package/src/build.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as I from "three";
|
|
2
|
-
import { EventDispatcher as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { OBJExporter as
|
|
6
|
-
function
|
|
2
|
+
import { EventDispatcher as Ot, Color as Ft, Matrix4 as bt, Vector3 as $, Quaternion as Gt, BufferAttribute as _, REVISION as Ut, CompressedTexture as nt, Source as zt, NoColorSpace as jt, MathUtils as ot, RGBAFormat as _t, ImageUtils as qt, DoubleSide as Yt, PropertyBinding as K, InterpolateDiscrete as kt, Scene as ft, SRGBColorSpace as Vt, NearestFilter as Xt, NearestMipmapNearestFilter as Wt, NearestMipmapLinearFilter as Ht, LinearFilter as Jt, LinearMipmapNearestFilter as $t, LinearMipmapLinearFilter as Kt, ClampToEdgeWrapping as Zt, RepeatWrapping as Qt, MirroredRepeatWrapping as te, InterpolateLinear as ee } from "three";
|
|
3
|
+
import pt from "clipper-lib";
|
|
4
|
+
import J from "dxf-writer";
|
|
5
|
+
import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
6
|
+
function at() {
|
|
7
7
|
return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(d) {
|
|
8
8
|
var t = Math.random() * 16 | 0, e = d == "x" ? t : t & 3 | 8;
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
class
|
|
13
|
-
uuid =
|
|
12
|
+
class It extends Ot {
|
|
13
|
+
uuid = at();
|
|
14
14
|
addEventListener(t, e, n) {
|
|
15
15
|
const { once: s = !1 } = n ?? {}, i = (o) => {
|
|
16
16
|
e(o), s && r();
|
|
@@ -30,7 +30,7 @@ class At extends Bt {
|
|
|
30
30
|
e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class q extends
|
|
33
|
+
class q extends It {
|
|
34
34
|
parent;
|
|
35
35
|
destroyed = !1;
|
|
36
36
|
constructor(...t) {
|
|
@@ -48,7 +48,7 @@ class q extends At {
|
|
|
48
48
|
this.destroyed = !0;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class se extends It {
|
|
52
52
|
static EventType = {
|
|
53
53
|
ADD_COMPONENT: "addComponent"
|
|
54
54
|
};
|
|
@@ -116,7 +116,7 @@ class ne extends At {
|
|
|
116
116
|
return e || null;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class N {
|
|
120
120
|
minX = 0;
|
|
121
121
|
maxX = 0;
|
|
122
122
|
minY = 0;
|
|
@@ -203,8 +203,8 @@ class R {
|
|
|
203
203
|
for (let c = 0; c < 4; c++) {
|
|
204
204
|
const l = o[c], h = o[(c + 1) % 4];
|
|
205
205
|
for (let u = 0; u < 4; u++) {
|
|
206
|
-
const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x),
|
|
207
|
-
if (y * x < 0 &&
|
|
206
|
+
const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), E = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
|
|
207
|
+
if (y * x < 0 && m * E < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || m === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || E === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
|
|
208
208
|
return !0;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -299,7 +299,7 @@ class R {
|
|
|
299
299
|
* @returns
|
|
300
300
|
*/
|
|
301
301
|
clone() {
|
|
302
|
-
return new
|
|
302
|
+
return new N(this.minX, this.maxX, this.minY, this.maxY);
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
305
|
*
|
|
@@ -310,7 +310,7 @@ class R {
|
|
|
310
310
|
const e = [], n = [];
|
|
311
311
|
return t.forEach((s) => {
|
|
312
312
|
e.push(s.x), n.push(s.y);
|
|
313
|
-
}), new
|
|
313
|
+
}), new N(
|
|
314
314
|
Math.min(...e),
|
|
315
315
|
Math.max(...e),
|
|
316
316
|
Math.min(...n),
|
|
@@ -328,7 +328,7 @@ class R {
|
|
|
328
328
|
s?.points?.forEach((i) => {
|
|
329
329
|
e.push(i.x), n.push(i.y);
|
|
330
330
|
});
|
|
331
|
-
}), new
|
|
331
|
+
}), new N(
|
|
332
332
|
Math.min(...e),
|
|
333
333
|
Math.max(...e),
|
|
334
334
|
Math.min(...n),
|
|
@@ -336,7 +336,7 @@ class R {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class X {
|
|
340
340
|
map = /* @__PURE__ */ new Map();
|
|
341
341
|
targetMap = /* @__PURE__ */ new Map();
|
|
342
342
|
gridSize;
|
|
@@ -415,7 +415,7 @@ class W {
|
|
|
415
415
|
* @returns 相交的节点数组
|
|
416
416
|
*/
|
|
417
417
|
queryCircle(t, e) {
|
|
418
|
-
const n = new
|
|
418
|
+
const n = new N(t.x - e, t.x + e, t.y - e, t.y + e), s = Math.ceil(n.minX / this.gridSize), i = Math.ceil(n.maxX / this.gridSize), r = Math.ceil(n.minY / this.gridSize), o = Math.ceil(n.maxY / this.gridSize), a = [];
|
|
419
419
|
for (let c = s; c <= i; c++)
|
|
420
420
|
for (let l = r; l <= o; l++) {
|
|
421
421
|
const h = `${c}.${l}`;
|
|
@@ -465,7 +465,7 @@ class W {
|
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
class
|
|
468
|
+
class et {
|
|
469
469
|
points;
|
|
470
470
|
get p0() {
|
|
471
471
|
return this.points[0];
|
|
@@ -606,7 +606,7 @@ class Q {
|
|
|
606
606
|
let t = 1 / 0, e = -1 / 0, n = 1 / 0, s = -1 / 0;
|
|
607
607
|
return this.points.forEach((i) => {
|
|
608
608
|
e = Math.max(i.x, e), t = Math.min(i.x, t), s = Math.max(i.x, s), n = Math.min(i.x, n);
|
|
609
|
-
}), new
|
|
609
|
+
}), new N(t, e, n, s);
|
|
610
610
|
}
|
|
611
611
|
/**
|
|
612
612
|
*
|
|
@@ -616,7 +616,7 @@ class Q {
|
|
|
616
616
|
*/
|
|
617
617
|
static fromByLineSegment(t, e = 0.1, n = !1, s = 0.5) {
|
|
618
618
|
const i = t.points[0], r = t.points[1], o = r.normal(i), a = n ? r.direction(i).mutiplyScalar(e * s) : M.zero(), c = n ? i.direction(r).mutiplyScalar(e * s) : M.zero(), l = o.x * e * 0.5, h = o.y * e * 0.5;
|
|
619
|
-
return new
|
|
619
|
+
return new et([
|
|
620
620
|
new M(i.x + l, i.y + h).add(c),
|
|
621
621
|
new M(r.x + l, r.y + h).add(a),
|
|
622
622
|
new M(r.x - l, r.y - h).add(a),
|
|
@@ -624,7 +624,7 @@ class Q {
|
|
|
624
624
|
]);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
class
|
|
627
|
+
class A {
|
|
628
628
|
points = [new M(), new M()];
|
|
629
629
|
userData = {};
|
|
630
630
|
// line: any
|
|
@@ -646,6 +646,9 @@ class L {
|
|
|
646
646
|
set(t, e) {
|
|
647
647
|
return this.start.copy(t), this.end.copy(e), this;
|
|
648
648
|
}
|
|
649
|
+
getAnotherPoint(t) {
|
|
650
|
+
return t === this.start ? this.end : this.start;
|
|
651
|
+
}
|
|
649
652
|
/**
|
|
650
653
|
* 是否有相同端点
|
|
651
654
|
* @param line
|
|
@@ -734,7 +737,7 @@ class L {
|
|
|
734
737
|
new M(n.x - a, n.y - c).add(o),
|
|
735
738
|
new M(s.x - a, s.y - c).add(r)
|
|
736
739
|
];
|
|
737
|
-
return new
|
|
740
|
+
return new et([0, 1, 3, 2].map((h) => l[h]));
|
|
738
741
|
}
|
|
739
742
|
/**
|
|
740
743
|
* 计算线段的长度
|
|
@@ -775,8 +778,8 @@ class L {
|
|
|
775
778
|
if (r.x === 0 && r.y === 0)
|
|
776
779
|
throw new Error("投影目标线段的两个点不能重合");
|
|
777
780
|
const o = (p) => {
|
|
778
|
-
const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y,
|
|
779
|
-
return new M(
|
|
781
|
+
const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, E = (y.x * r.x + y.y * r.y) / x, w = s.x + E * r.x, g = s.y + E * r.y;
|
|
782
|
+
return new M(w, g);
|
|
780
783
|
};
|
|
781
784
|
let a = o(e), c = o(n);
|
|
782
785
|
const l = (p) => {
|
|
@@ -785,10 +788,10 @@ class L {
|
|
|
785
788
|
};
|
|
786
789
|
let h = l(a), u = l(c);
|
|
787
790
|
const f = (p) => {
|
|
788
|
-
const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x,
|
|
789
|
-
return new M(x,
|
|
791
|
+
const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, m = s.y + y * r.y;
|
|
792
|
+
return new M(x, m);
|
|
790
793
|
};
|
|
791
|
-
return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new
|
|
794
|
+
return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new A(a, a) : new A(a, c);
|
|
792
795
|
}
|
|
793
796
|
/**
|
|
794
797
|
* 计算一条线段在另一条直线上的投影
|
|
@@ -869,7 +872,7 @@ class L {
|
|
|
869
872
|
* @param line
|
|
870
873
|
*/
|
|
871
874
|
parallel(t, e = 1) {
|
|
872
|
-
return t instanceof
|
|
875
|
+
return t instanceof A ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
|
|
873
876
|
}
|
|
874
877
|
/** 两条线段或角度是否 垂直
|
|
875
878
|
* @param line
|
|
@@ -877,7 +880,7 @@ class L {
|
|
|
877
880
|
* @returns
|
|
878
881
|
*/
|
|
879
882
|
vertical(t, e = 0.1) {
|
|
880
|
-
return t instanceof
|
|
883
|
+
return t instanceof A ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
|
|
881
884
|
}
|
|
882
885
|
/**
|
|
883
886
|
* 两条线段方向相反否一致
|
|
@@ -952,7 +955,7 @@ class L {
|
|
|
952
955
|
* @returns
|
|
953
956
|
*/
|
|
954
957
|
clone() {
|
|
955
|
-
const t = new
|
|
958
|
+
const t = new A(
|
|
956
959
|
this.points[0].clone(),
|
|
957
960
|
this.points[1].clone()
|
|
958
961
|
);
|
|
@@ -975,7 +978,7 @@ class L {
|
|
|
975
978
|
* @param selectLines
|
|
976
979
|
*/
|
|
977
980
|
static groupBySamePointAndParallel(t) {
|
|
978
|
-
const e = new
|
|
981
|
+
const e = new X();
|
|
979
982
|
t.forEach((r) => r.points.forEach((o) => e.insert(o, r)));
|
|
980
983
|
const n = /* @__PURE__ */ new Set();
|
|
981
984
|
function s(r, o, a) {
|
|
@@ -1007,7 +1010,7 @@ class L {
|
|
|
1007
1010
|
const f = o(u);
|
|
1008
1011
|
f < a && (a = f, i = n.projectPoint(u, !1)), f > c && (c = f, r = n.projectPoint(u, !1));
|
|
1009
1012
|
}
|
|
1010
|
-
const l = new
|
|
1013
|
+
const l = new A(i, r);
|
|
1011
1014
|
return t.forEach((h) => h.userData.fittedLine = l), l;
|
|
1012
1015
|
}
|
|
1013
1016
|
/** 合并平行线段
|
|
@@ -1026,7 +1029,7 @@ class L {
|
|
|
1026
1029
|
const y = p.x * s.x + p.y * s.y;
|
|
1027
1030
|
i = Math.min(i, y), r = Math.max(r, y), o += p.x, a += p.y;
|
|
1028
1031
|
});
|
|
1029
|
-
const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y), u = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new
|
|
1032
|
+
const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y), u = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new A(h, u);
|
|
1030
1033
|
return t.forEach((p) => p.userData.fittedLine = f), f;
|
|
1031
1034
|
}
|
|
1032
1035
|
/** 合并满足平行的线段
|
|
@@ -1191,7 +1194,7 @@ class M {
|
|
|
1191
1194
|
* @param length
|
|
1192
1195
|
*/
|
|
1193
1196
|
expandAsLine(t, e, n) {
|
|
1194
|
-
const s = new
|
|
1197
|
+
const s = new A(
|
|
1195
1198
|
this.clone(),
|
|
1196
1199
|
this.clone().add(t.clone().multiplyScalar(e))
|
|
1197
1200
|
);
|
|
@@ -1313,7 +1316,7 @@ class F {
|
|
|
1313
1316
|
* @param node 线段节点
|
|
1314
1317
|
*/
|
|
1315
1318
|
insert(t) {
|
|
1316
|
-
if (t instanceof
|
|
1319
|
+
if (t instanceof A) {
|
|
1317
1320
|
this.insert({ line: t, userData: {} });
|
|
1318
1321
|
return;
|
|
1319
1322
|
}
|
|
@@ -1338,7 +1341,7 @@ class F {
|
|
|
1338
1341
|
* @param node
|
|
1339
1342
|
*/
|
|
1340
1343
|
remove(t) {
|
|
1341
|
-
if (t instanceof
|
|
1344
|
+
if (t instanceof A) {
|
|
1342
1345
|
t = this.targetMap.get(t), t && this.remove(t);
|
|
1343
1346
|
return;
|
|
1344
1347
|
}
|
|
@@ -1369,25 +1372,25 @@ class F {
|
|
|
1369
1372
|
this.isLeaf = !1, this.children = [];
|
|
1370
1373
|
const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
|
|
1371
1374
|
this.children[0] = new F(
|
|
1372
|
-
new
|
|
1375
|
+
new N(this.bounds.minX, t, this.bounds.minY, e),
|
|
1373
1376
|
this.capacity,
|
|
1374
1377
|
this.maxDepth,
|
|
1375
1378
|
this.depth + 1,
|
|
1376
1379
|
this.targetMap
|
|
1377
1380
|
), this.children[1] = new F(
|
|
1378
|
-
new
|
|
1381
|
+
new N(t, this.bounds.maxX, this.bounds.minY, e),
|
|
1379
1382
|
this.capacity,
|
|
1380
1383
|
this.maxDepth,
|
|
1381
1384
|
this.depth + 1,
|
|
1382
1385
|
this.targetMap
|
|
1383
1386
|
), this.children[2] = new F(
|
|
1384
|
-
new
|
|
1387
|
+
new N(this.bounds.minX, t, e, this.bounds.maxY),
|
|
1385
1388
|
this.capacity,
|
|
1386
1389
|
this.maxDepth,
|
|
1387
1390
|
this.depth + 1,
|
|
1388
1391
|
this.targetMap
|
|
1389
1392
|
), this.children[3] = new F(
|
|
1390
|
-
new
|
|
1393
|
+
new N(t, this.bounds.maxX, e, this.bounds.maxY),
|
|
1391
1394
|
this.capacity,
|
|
1392
1395
|
this.maxDepth,
|
|
1393
1396
|
this.depth + 1,
|
|
@@ -1417,7 +1420,7 @@ class F {
|
|
|
1417
1420
|
* @returns 相交的节点数组
|
|
1418
1421
|
*/
|
|
1419
1422
|
queryCircle(t, e) {
|
|
1420
|
-
const n = [], s = new
|
|
1423
|
+
const n = [], s = new N(
|
|
1421
1424
|
t.x - e,
|
|
1422
1425
|
t.x + e,
|
|
1423
1426
|
t.y - e,
|
|
@@ -1498,8 +1501,8 @@ class F {
|
|
|
1498
1501
|
})), t;
|
|
1499
1502
|
}
|
|
1500
1503
|
}
|
|
1501
|
-
function
|
|
1502
|
-
return e || (e = new F(
|
|
1504
|
+
function Z(d, t = 0, e) {
|
|
1505
|
+
return e || (e = new F(N.fromByLineSegment(...d)), d.forEach((n) => e?.insert({ line: n, userData: void 0 }))), d.map((n) => {
|
|
1503
1506
|
const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: d.indexOf(o.line) }));
|
|
1504
1507
|
return {
|
|
1505
1508
|
start: n.start.toJson(t),
|
|
@@ -1520,8 +1523,8 @@ function K(d, t = 0, e) {
|
|
|
1520
1523
|
};
|
|
1521
1524
|
});
|
|
1522
1525
|
}
|
|
1523
|
-
function
|
|
1524
|
-
const e = new F(
|
|
1526
|
+
function lt(d, t = 0.03) {
|
|
1527
|
+
const e = new F(N.fromByLineSegment(...d));
|
|
1525
1528
|
return d.forEach((n) => e.insert({ line: n, userData: void 0 })), d.flatMap((n) => {
|
|
1526
1529
|
const s = e.queryLineSegment(n, !0).map((i) => {
|
|
1527
1530
|
if (i.line === n) return;
|
|
@@ -1541,45 +1544,35 @@ function at(d, t = 0.03) {
|
|
|
1541
1544
|
return n;
|
|
1542
1545
|
}).filter((n) => n.length() >= t);
|
|
1543
1546
|
}
|
|
1544
|
-
function
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
const f = r.distance(c.point);
|
|
1560
|
-
return f < 1e-3 ? !1 : (i.set(c.point, f), !0);
|
|
1561
|
-
}).sort((c, l) => {
|
|
1562
|
-
const h = i.get(c.point), u = i.get(l.point);
|
|
1563
|
-
return h - u;
|
|
1564
|
-
});
|
|
1565
|
-
if (o.length === 0) return;
|
|
1566
|
-
const a = o[0].userData;
|
|
1567
|
-
e.push(new L(s.projectLineSegment(a).center, a.projectLineSegment(s).center));
|
|
1547
|
+
function Q(...d) {
|
|
1548
|
+
d.forEach((t) => {
|
|
1549
|
+
const e = t.direction();
|
|
1550
|
+
t.userData.drawWindow?.forEach((n) => {
|
|
1551
|
+
try {
|
|
1552
|
+
const s = M.from(n.p), i = t.projectPoint(
|
|
1553
|
+
s.clone().add(e.clone().multiplyScalar(n.width * 0.5)),
|
|
1554
|
+
!1
|
|
1555
|
+
), r = t.projectPoint(
|
|
1556
|
+
s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
|
|
1557
|
+
!1
|
|
1558
|
+
), o = t.projectLineSegment(new A(i, r)), a = o.center;
|
|
1559
|
+
n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
|
|
1560
|
+
} catch {
|
|
1561
|
+
}
|
|
1568
1562
|
});
|
|
1569
|
-
}
|
|
1570
|
-
return [...d, ...e];
|
|
1563
|
+
});
|
|
1571
1564
|
}
|
|
1572
1565
|
function ie(d) {
|
|
1573
|
-
const t = new
|
|
1566
|
+
const t = new X(), e = new F(N.fromByLineSegment(...d)), n = [];
|
|
1574
1567
|
return d.forEach((s) => {
|
|
1575
1568
|
s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
|
|
1576
1569
|
}), n.forEach((s) => {
|
|
1577
1570
|
const i = t.queryPoint(s.start), r = t.queryPoint(s.end);
|
|
1578
1571
|
i.length ? s.userData.startIntersection = i[0].userData : s.userData.startIntersection = e.queryPoint(s.start)[0]?.line, r.length ? s.userData.endIntersection = r[0].userData : s.userData.endIntersection = e.queryPoint(s.end)[0]?.line;
|
|
1579
|
-
}), d
|
|
1572
|
+
}), d;
|
|
1580
1573
|
}
|
|
1581
1574
|
function re(d) {
|
|
1582
|
-
const t = new F(
|
|
1575
|
+
const t = new F(N.fromByLineSegment(...d));
|
|
1583
1576
|
d.forEach((n) => {
|
|
1584
1577
|
n.userData.isDoor || t.insert({ line: n, userData: void 0 });
|
|
1585
1578
|
});
|
|
@@ -1598,7 +1591,7 @@ function re(d) {
|
|
|
1598
1591
|
}
|
|
1599
1592
|
return e;
|
|
1600
1593
|
}
|
|
1601
|
-
function oe(d, t, e, n =
|
|
1594
|
+
function oe(d, t, e, n = 15) {
|
|
1602
1595
|
const s = [d], i = [], r = [], o = [];
|
|
1603
1596
|
function a(u) {
|
|
1604
1597
|
const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x);
|
|
@@ -1615,8 +1608,8 @@ function oe(d, t, e, n = 25) {
|
|
|
1615
1608
|
for (; y < -Math.PI; ) y += 2 * Math.PI;
|
|
1616
1609
|
for (; x > Math.PI; ) x -= 2 * Math.PI;
|
|
1617
1610
|
for (; x < -Math.PI; ) x += 2 * Math.PI;
|
|
1618
|
-
const
|
|
1619
|
-
return u.start.rotate(
|
|
1611
|
+
const m = Math.abs(y) < Math.abs(x) ? y : x, E = u.center;
|
|
1612
|
+
return u.start.rotate(E, m), u.end.rotate(E, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
|
|
1620
1613
|
}
|
|
1621
1614
|
function l(u, f, p = !1) {
|
|
1622
1615
|
if (p) return l(u === "parallel" ? "vertical" : "parallel", f);
|
|
@@ -1629,17 +1622,17 @@ function oe(d, t, e, n = 25) {
|
|
|
1629
1622
|
if (f.userData.isWindow && o.push(f), f.parallel(d, n)) a(f);
|
|
1630
1623
|
else if (f.vertical(d, n)) c(f);
|
|
1631
1624
|
else {
|
|
1632
|
-
const y = e.get(f)?.reduce((x,
|
|
1625
|
+
const y = e.get(f)?.reduce((x, m) => (m.sourcePoint && (x.has(m.sourcePoint) || x.set(m.sourcePoint, []), x.get(m.sourcePoint)?.push(m)), x), /* @__PURE__ */ new Map());
|
|
1633
1626
|
y && y.size > 1 ? h.push(() => {
|
|
1634
1627
|
const x = [...y.values()].map(
|
|
1635
|
-
(
|
|
1636
|
-
).map((
|
|
1637
|
-
if (
|
|
1638
|
-
if (
|
|
1639
|
-
if (
|
|
1640
|
-
if (
|
|
1641
|
-
if (
|
|
1642
|
-
return l(
|
|
1628
|
+
(w) => w.map((g) => s.includes(g.line) ? "parallel" : i.includes(g.line) ? "vertical" : null).filter((g) => !!g)
|
|
1629
|
+
).map((w) => [...new Set(w)]), m = x[0], E = x[1];
|
|
1630
|
+
if (m.length === 1 && E.length === 1) {
|
|
1631
|
+
if (m[0] === E[0]) return l(m[0], f, !0);
|
|
1632
|
+
if (m.length === 1) {
|
|
1633
|
+
if (E.includes(m[0])) return l(m[0], f, !0);
|
|
1634
|
+
if (E.length === 1 && m.includes(E[0]))
|
|
1635
|
+
return l(E[0], f, !0);
|
|
1643
1636
|
}
|
|
1644
1637
|
}
|
|
1645
1638
|
c(f);
|
|
@@ -1648,7 +1641,7 @@ function oe(d, t, e, n = 25) {
|
|
|
1648
1641
|
}
|
|
1649
1642
|
return h.forEach((u) => u()), { parallelLines: s, verticalLines: i, doorLines: r, windowLines: o };
|
|
1650
1643
|
}
|
|
1651
|
-
function
|
|
1644
|
+
function yt(d, t, e, n, s) {
|
|
1652
1645
|
const i = [], r = /* @__PURE__ */ new Map();
|
|
1653
1646
|
d.forEach((c) => {
|
|
1654
1647
|
const l = e.projectPoint(c.start, !1);
|
|
@@ -1667,8 +1660,8 @@ function ft(d, t, e, n, s) {
|
|
|
1667
1660
|
const l = c.flatMap((p) => {
|
|
1668
1661
|
const y = p.userData;
|
|
1669
1662
|
return y.points.map((x) => {
|
|
1670
|
-
const
|
|
1671
|
-
return
|
|
1663
|
+
const m = t.projectPoint(x, !1);
|
|
1664
|
+
return m.userData = y, m;
|
|
1672
1665
|
});
|
|
1673
1666
|
});
|
|
1674
1667
|
l.sort((p, y) => p.distance(t.start) - y.distance(t.start));
|
|
@@ -1681,7 +1674,7 @@ function ft(d, t, e, n, s) {
|
|
|
1681
1674
|
}), f.push([...u]), f;
|
|
1682
1675
|
});
|
|
1683
1676
|
}
|
|
1684
|
-
function
|
|
1677
|
+
function xt(d, t, e, n) {
|
|
1685
1678
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), o = [];
|
|
1686
1679
|
d.forEach((u) => {
|
|
1687
1680
|
const f = e.projectPoint(u.start, !1);
|
|
@@ -1691,23 +1684,23 @@ function pt(d, t, e, n) {
|
|
|
1691
1684
|
});
|
|
1692
1685
|
}), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
|
|
1693
1686
|
const a = o.map((u) => {
|
|
1694
|
-
const f = u.userData, p = i.get(f), y = r.get(f), x = new
|
|
1695
|
-
for (let
|
|
1696
|
-
const
|
|
1697
|
-
if (u !==
|
|
1698
|
-
const
|
|
1699
|
-
(x.isPointOnSegment(S) || x.isPointOnSegment(
|
|
1687
|
+
const f = u.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
|
|
1688
|
+
for (let E = 0; E < o.length; E++) {
|
|
1689
|
+
const w = o[E];
|
|
1690
|
+
if (u !== w && u.distance(w) < n) {
|
|
1691
|
+
const g = w.userData, S = i.get(g), D = r.get(g);
|
|
1692
|
+
(x.isPointOnSegment(S) || x.isPointOnSegment(D)) && m.push(E);
|
|
1700
1693
|
}
|
|
1701
1694
|
}
|
|
1702
|
-
return
|
|
1695
|
+
return m;
|
|
1703
1696
|
});
|
|
1704
1697
|
function c(u, f, p = /* @__PURE__ */ new Set()) {
|
|
1705
1698
|
if (p.has(u)) return p;
|
|
1706
1699
|
const y = f[u];
|
|
1707
1700
|
p.add(u);
|
|
1708
1701
|
for (let x = 0; x < y.length; x++) {
|
|
1709
|
-
const
|
|
1710
|
-
c(
|
|
1702
|
+
const m = y[x];
|
|
1703
|
+
c(m, f, p);
|
|
1711
1704
|
}
|
|
1712
1705
|
return p;
|
|
1713
1706
|
}
|
|
@@ -1718,20 +1711,20 @@ function pt(d, t, e, n) {
|
|
|
1718
1711
|
if (f.forEach((y) => {
|
|
1719
1712
|
l.add(y), p.push(o[y].userData);
|
|
1720
1713
|
}), p.length > 2) {
|
|
1721
|
-
const y = p.map((
|
|
1722
|
-
y.sort((
|
|
1723
|
-
const x = y[0],
|
|
1724
|
-
if (x.distance(
|
|
1725
|
-
const
|
|
1726
|
-
if (
|
|
1727
|
-
const C = [
|
|
1728
|
-
for (let
|
|
1729
|
-
const v = y[
|
|
1730
|
-
if (v ===
|
|
1731
|
-
const z = S.projectLineSegment(
|
|
1732
|
-
|
|
1714
|
+
const y = p.map((w) => s.get(w));
|
|
1715
|
+
y.sort((w, g) => g.distance(e.start) - w.distance(e.start));
|
|
1716
|
+
const x = y[0], m = y[y.length - 1];
|
|
1717
|
+
if (x.distance(m) > n) {
|
|
1718
|
+
const w = [...p].sort((C, U) => U.length() - C.length()), g = w[0], S = w[1], D = s.get(g), L = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
|
|
1719
|
+
if (D.distance(L) || R / b > 0.5 && B / R < 0.5) {
|
|
1720
|
+
const C = [g], U = [S];
|
|
1721
|
+
for (let O = 0; O < y.length; O++) {
|
|
1722
|
+
const v = y[O], V = v.userData;
|
|
1723
|
+
if (v === D || v === L) continue;
|
|
1724
|
+
const z = S.projectLineSegment(V), W = z.length();
|
|
1725
|
+
L.distance(v) <= n && W / R > 0 ? U.push(V) : C.push(V);
|
|
1733
1726
|
}
|
|
1734
|
-
h.push(C,
|
|
1727
|
+
h.push(C, U);
|
|
1735
1728
|
} else {
|
|
1736
1729
|
const C = Math.floor(p.length * 0.5);
|
|
1737
1730
|
h.push(p.slice(0, C), p.slice(C));
|
|
@@ -1743,7 +1736,7 @@ function pt(d, t, e, n) {
|
|
|
1743
1736
|
}
|
|
1744
1737
|
return h;
|
|
1745
1738
|
}
|
|
1746
|
-
function
|
|
1739
|
+
function gt(d, t) {
|
|
1747
1740
|
function e(i, r = /* @__PURE__ */ new Set()) {
|
|
1748
1741
|
if (r.has(i)) return r;
|
|
1749
1742
|
r.add(i);
|
|
@@ -1771,16 +1764,16 @@ function ae(d, t, e, n, s, i) {
|
|
|
1771
1764
|
groupMethod: a = "principalAndCross"
|
|
1772
1765
|
} = i ?? {}, c = {
|
|
1773
1766
|
cross: () => [
|
|
1774
|
-
...
|
|
1775
|
-
...
|
|
1767
|
+
...xt(d, n, e, o),
|
|
1768
|
+
...xt(t, e, n, o)
|
|
1776
1769
|
],
|
|
1777
1770
|
principalAndCross: () => [
|
|
1778
|
-
...
|
|
1779
|
-
...
|
|
1771
|
+
...yt(d, n, e, r, o),
|
|
1772
|
+
...yt(t, e, n, r, o)
|
|
1780
1773
|
],
|
|
1781
1774
|
originalInterPoint: () => [
|
|
1782
|
-
...
|
|
1783
|
-
...
|
|
1775
|
+
...gt(d, s),
|
|
1776
|
+
...gt(t, s)
|
|
1784
1777
|
]
|
|
1785
1778
|
};
|
|
1786
1779
|
return c[a] ? c[a]() : c.originalInterPoint();
|
|
@@ -1803,7 +1796,7 @@ function le(d, t = 0.1, e) {
|
|
|
1803
1796
|
if (s.length === 1) return s[0];
|
|
1804
1797
|
const i = [];
|
|
1805
1798
|
s.forEach((h) => i.push(h.start.clone(), h.end.clone()));
|
|
1806
|
-
const r = n === "average" ?
|
|
1799
|
+
const r = n === "average" ? A.mergeLines(...s) : A.mergeLinesByMaxlength(...s);
|
|
1807
1800
|
r.userData.rooftopPz = Math.min(
|
|
1808
1801
|
...s.map((h) => {
|
|
1809
1802
|
const { drawDoorData: u, drawWindow: f, rooftopPz: p, ...y } = h.userData;
|
|
@@ -1820,10 +1813,10 @@ function le(d, t = 0.1, e) {
|
|
|
1820
1813
|
return l >= t && (r.userData.wallWidth = l), s.forEach((h) => h.userData.fittedLine = r), r;
|
|
1821
1814
|
}).filter((s) => !!s);
|
|
1822
1815
|
}
|
|
1823
|
-
function
|
|
1824
|
-
const e = new F(
|
|
1816
|
+
function mt(d, t = 0.4) {
|
|
1817
|
+
const e = new F(N.fromByLineSegment(...d));
|
|
1825
1818
|
d.forEach((s) => e.insert(s));
|
|
1826
|
-
const n = new
|
|
1819
|
+
const n = new A();
|
|
1827
1820
|
for (let s = 0; s < d.length; s++) {
|
|
1828
1821
|
const i = d[s];
|
|
1829
1822
|
if (i.userData.isAdsorbed) continue;
|
|
@@ -1845,47 +1838,60 @@ function he(d, t = 0.4) {
|
|
|
1845
1838
|
} else
|
|
1846
1839
|
i.start.copy(o), i.end.copy(a);
|
|
1847
1840
|
i.userData.isAdsorbed = !0;
|
|
1848
|
-
} else o ? i.start.
|
|
1841
|
+
} else o ? i.directionMove(o.direction(i.start), i.start.distance(o)) : a && i.directionMove(a.direction(i.end), i.end.distance(a));
|
|
1849
1842
|
e.update(i);
|
|
1850
1843
|
}
|
|
1851
1844
|
return d.filter((s) => s.length() > 1e-3);
|
|
1852
1845
|
}
|
|
1846
|
+
function he(d, t) {
|
|
1847
|
+
const e = new X();
|
|
1848
|
+
d.forEach((i) => i.points.forEach((r) => e.insert(r, i)));
|
|
1849
|
+
const n = /* @__PURE__ */ new Map();
|
|
1850
|
+
function s(i, r) {
|
|
1851
|
+
n.has(i) || n.set(i, []), n.get(i)?.push(r);
|
|
1852
|
+
}
|
|
1853
|
+
for (let i = 0; i < d.length; i++) {
|
|
1854
|
+
const r = d[i];
|
|
1855
|
+
r.points.forEach((o) => {
|
|
1856
|
+
if (e.queryPoint(o).filter((h) => h.userData !== r).length !== 0) return;
|
|
1857
|
+
const a = e.queryCircle(o, t).filter((h) => h.userData !== r && h.userData?.vertical(r));
|
|
1858
|
+
if (!a.length) return;
|
|
1859
|
+
const c = a.sort((h, u) => h.userData.length() - u.userData.length())[0], l = c.userData?.projectPoint(o, !1);
|
|
1860
|
+
if (l) {
|
|
1861
|
+
const h = c.userData;
|
|
1862
|
+
s(r, new A(o.clone(), l.clone())), s(h, new A(c.point.clone(), l.clone()));
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
return n.forEach((i, r) => {
|
|
1867
|
+
const o = A.mergeLines(r, ...i);
|
|
1868
|
+
r.set(o.start, o.end);
|
|
1869
|
+
}), d;
|
|
1870
|
+
}
|
|
1853
1871
|
function ue(d, t) {
|
|
1854
1872
|
const { snapThreshold: e = 0.2 } = t ?? {};
|
|
1855
|
-
return d = he(d, e), d;
|
|
1873
|
+
return d = mt(d, e), d = mt(d, e), d = he(d, e), d;
|
|
1856
1874
|
}
|
|
1857
1875
|
function de(d) {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
n.userData.isWindow = !0, n.userData.drawWindow = n.userData.drawWindow ?? [], e.userData.drawWindow?.forEach((i) => {
|
|
1863
|
-
const r = M.from(i.p), o = n.projectPoint(
|
|
1864
|
-
r.clone().add(s.clone().multiplyScalar(i.width * 0.5))
|
|
1865
|
-
), a = n.projectPoint(
|
|
1866
|
-
r.clone().add(s.clone().multiplyScalar(i.width * -0.5))
|
|
1867
|
-
), c = new L(o, a), l = c.center;
|
|
1868
|
-
n.userData.drawWindow?.push({
|
|
1869
|
-
p: new I.Vector3(l?.x ?? 0, l?.y ?? 0, i.p.z),
|
|
1870
|
-
width: c.length(),
|
|
1871
|
-
full: i.full
|
|
1872
|
-
});
|
|
1873
|
-
});
|
|
1874
|
-
}
|
|
1876
|
+
const t = /* @__PURE__ */ new Set();
|
|
1877
|
+
for (let e = 0; e < d.length; e++) {
|
|
1878
|
+
const n = d[e], s = n.userData.fittedLine;
|
|
1879
|
+
s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : Q(n);
|
|
1875
1880
|
}
|
|
1881
|
+
t.forEach((e) => Q(e));
|
|
1876
1882
|
}
|
|
1877
1883
|
function fe(d) {
|
|
1878
1884
|
for (let t = 0; t < d.length; t++) {
|
|
1879
1885
|
const e = d[t];
|
|
1880
1886
|
let { endIntersection: n, startIntersection: s } = e.userData;
|
|
1881
1887
|
if (!(!n || !s)) {
|
|
1882
|
-
if (s.userData.fittedLine && (s = s.userData.fittedLine), n.userData.fittedLine && (n = n.userData.fittedLine), e.
|
|
1888
|
+
if (s.userData.fittedLine && (s = s.userData.fittedLine), n.userData.fittedLine && (n = n.userData.fittedLine), e.parallel(s))
|
|
1883
1889
|
e.start.distance(s.start) < e.start.distance(s.end) ? e.start.copy(s.start) : e.start.copy(s.end);
|
|
1884
1890
|
else {
|
|
1885
1891
|
const i = s.projectPoint(e.start);
|
|
1886
1892
|
i && e.start.copy(i);
|
|
1887
1893
|
}
|
|
1888
|
-
if (e.
|
|
1894
|
+
if (e.parallel(n))
|
|
1889
1895
|
e.end.distance(n.start) < e.end.distance(n.end) ? e.end.copy(n.start) : e.end.copy(n.end);
|
|
1890
1896
|
else {
|
|
1891
1897
|
const i = n.projectPoint(e.end);
|
|
@@ -1895,7 +1901,17 @@ function fe(d) {
|
|
|
1895
1901
|
}
|
|
1896
1902
|
return d;
|
|
1897
1903
|
}
|
|
1898
|
-
|
|
1904
|
+
function pe(d, t = 0.01) {
|
|
1905
|
+
const e = new X();
|
|
1906
|
+
return d.forEach((n) => n.points.forEach((s) => e.insert(s, n))), d.filter((n) => {
|
|
1907
|
+
if (n.length() <= t) {
|
|
1908
|
+
const s = e.queryPoint(n.start).filter((r) => r.userData !== n).length === 0, i = e.queryPoint(n.end).filter((r) => r.userData !== n).length === 0;
|
|
1909
|
+
if (s || i) return !1;
|
|
1910
|
+
}
|
|
1911
|
+
return !0;
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
class Pt {
|
|
1899
1915
|
/**
|
|
1900
1916
|
* 轴对齐垂直修正
|
|
1901
1917
|
* @param lines 待调整线段组
|
|
@@ -1904,33 +1920,33 @@ class Tt {
|
|
|
1904
1920
|
*/
|
|
1905
1921
|
static correction(t, e, n) {
|
|
1906
1922
|
t = ie(t.map((x) => x.clone()));
|
|
1907
|
-
const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new
|
|
1923
|
+
const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new A(
|
|
1908
1924
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
1909
1925
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
1910
|
-
), f = new
|
|
1926
|
+
), f = new A(
|
|
1911
1927
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
1912
1928
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
1913
1929
|
);
|
|
1914
1930
|
let p = ae(i, r, u, f, s, n);
|
|
1915
1931
|
p = ce(p, s);
|
|
1916
1932
|
let y = le(p, 0.1, n);
|
|
1917
|
-
return y = ue(y, n), de(a), fe(o), y =
|
|
1933
|
+
return y = ue(y, n), de(a), fe(o), y = lt(y, 1e-9), y.push(...o), y = pe(y, 0.08), y = y, y;
|
|
1918
1934
|
}
|
|
1919
1935
|
}
|
|
1920
|
-
const
|
|
1936
|
+
const ye = new A(
|
|
1921
1937
|
new M(0, 0),
|
|
1922
1938
|
new M(0, 1)
|
|
1923
1939
|
);
|
|
1924
|
-
function
|
|
1940
|
+
function xe(d) {
|
|
1925
1941
|
const t = [...d].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
|
|
1926
|
-
let r = parseInt(
|
|
1942
|
+
let r = parseInt(ye.includedAngle(i) + "");
|
|
1927
1943
|
return r > 90 && (r = 180 - r), r;
|
|
1928
1944
|
}), n = /* @__PURE__ */ new Map();
|
|
1929
1945
|
return e.forEach((i, r) => {
|
|
1930
1946
|
n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
|
|
1931
1947
|
}), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
|
|
1932
1948
|
}
|
|
1933
|
-
const
|
|
1949
|
+
const ge = {
|
|
1934
1950
|
Unitless: 1,
|
|
1935
1951
|
// 无单位,1米 = 1(无单位)
|
|
1936
1952
|
Inches: 39.37007874015748,
|
|
@@ -1974,16 +1990,16 @@ const xe = {
|
|
|
1974
1990
|
Parsecs: 3240779289666404e-32
|
|
1975
1991
|
// 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
|
|
1976
1992
|
};
|
|
1977
|
-
function
|
|
1993
|
+
function wt(d) {
|
|
1978
1994
|
const t = [];
|
|
1979
1995
|
for (let e = 0; e < d.length; e++)
|
|
1980
|
-
t.push(new
|
|
1996
|
+
t.push(new A(
|
|
1981
1997
|
d[e].clone(),
|
|
1982
1998
|
d[(e + 1) % d.length].clone()
|
|
1983
1999
|
));
|
|
1984
2000
|
return t;
|
|
1985
2001
|
}
|
|
1986
|
-
function
|
|
2002
|
+
function Mt(d) {
|
|
1987
2003
|
return d.flatMap((t, e) => (e === d.length - 1 && [...t.points, d[0].points[0]], [t.points[0]]));
|
|
1988
2004
|
}
|
|
1989
2005
|
class k extends q {
|
|
@@ -1993,8 +2009,8 @@ class k extends q {
|
|
|
1993
2009
|
scale = 1;
|
|
1994
2010
|
originalData = [];
|
|
1995
2011
|
data = [];
|
|
1996
|
-
originalBox = new
|
|
1997
|
-
box = new
|
|
2012
|
+
originalBox = new N(0, 0, 0, 0);
|
|
2013
|
+
box = new N(0, 0, 0, 0);
|
|
1998
2014
|
pointsGroups = [];
|
|
1999
2015
|
wallsGroup = [];
|
|
2000
2016
|
doors = [];
|
|
@@ -2034,22 +2050,22 @@ class k extends q {
|
|
|
2034
2050
|
const r = [];
|
|
2035
2051
|
if (t.forEach(({ start: a, end: c, ...l }, h) => {
|
|
2036
2052
|
r.push(a.z ?? 0, c.z ?? 0);
|
|
2037
|
-
const u = new
|
|
2053
|
+
const u = new A(
|
|
2038
2054
|
M.from(a),
|
|
2039
2055
|
M.from(c)
|
|
2040
2056
|
);
|
|
2041
2057
|
u.userData = l, s.push(u), l.isVerticalReferenceLine && (i = h);
|
|
2042
2058
|
}), this.originalZAverage = r.reduce((a, c) => a + c, 0) / r.length, i === -1) {
|
|
2043
|
-
const a =
|
|
2059
|
+
const a = xe(s);
|
|
2044
2060
|
i = s.indexOf(a);
|
|
2045
2061
|
}
|
|
2046
2062
|
const o = s[i];
|
|
2047
|
-
return o.userData.isVerticalReferenceLine = !0, t[i].isVerticalReferenceLine = !0, e && (s =
|
|
2063
|
+
return o.userData.isVerticalReferenceLine = !0, t[i].isVerticalReferenceLine = !0, e && (s = Pt.correction.call(this, s, o, n), t = Z(s)), this.dispatchEvent({
|
|
2048
2064
|
type: "preprocessing",
|
|
2049
2065
|
data: t,
|
|
2050
2066
|
setData(a) {
|
|
2051
2067
|
s = a.map(({ start: c, end: l, ...h }) => {
|
|
2052
|
-
const u = new
|
|
2068
|
+
const u = new A(M.from(c), M.from(l));
|
|
2053
2069
|
return u.userData = h, u;
|
|
2054
2070
|
}), t = a;
|
|
2055
2071
|
}
|
|
@@ -2202,7 +2218,7 @@ class k extends q {
|
|
|
2202
2218
|
break;
|
|
2203
2219
|
}
|
|
2204
2220
|
}
|
|
2205
|
-
const e = this.mergeSameDirectionLine(
|
|
2221
|
+
const e = this.mergeSameDirectionLine(wt(t)), n = [e[0]];
|
|
2206
2222
|
for (let s = 1; s < e.length; s++) {
|
|
2207
2223
|
const i = e[s], r = e[(e.length + s - 1) % e.length];
|
|
2208
2224
|
if (i.length() > this.width * 0.9) {
|
|
@@ -2217,7 +2233,7 @@ class k extends q {
|
|
|
2217
2233
|
const a = e[s + 2];
|
|
2218
2234
|
a && r.includedAngle(a) < 2 ? (s = s + 2, n.push(a)) : n.push(i);
|
|
2219
2235
|
}
|
|
2220
|
-
return n.length > 3 ?
|
|
2236
|
+
return n.length > 3 ? Mt(this.mergeSameDirectionLine(n)) : [];
|
|
2221
2237
|
}
|
|
2222
2238
|
/**
|
|
2223
2239
|
* 移除短线段
|
|
@@ -2225,7 +2241,7 @@ class k extends q {
|
|
|
2225
2241
|
* @param path
|
|
2226
2242
|
*/
|
|
2227
2243
|
removeShortLine(t, e = this.shortLine) {
|
|
2228
|
-
const n =
|
|
2244
|
+
const n = wt(t), s = [], i = Math.PI / 180;
|
|
2229
2245
|
for (let r = 0; r < n.length; r++) {
|
|
2230
2246
|
const o = n[r], a = o.length(), c = r;
|
|
2231
2247
|
if (a > e || s.length === 0) {
|
|
@@ -2253,14 +2269,14 @@ class k extends q {
|
|
|
2253
2269
|
} else
|
|
2254
2270
|
r = c;
|
|
2255
2271
|
}
|
|
2256
|
-
return s.length > 3 ?
|
|
2272
|
+
return s.length > 3 ? Mt(s) : [];
|
|
2257
2273
|
}
|
|
2258
2274
|
/** 线偏移
|
|
2259
2275
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
2260
2276
|
*/
|
|
2261
2277
|
lineOffset(t = k.EndType.etOpenSquare, e = k.JoinType.jtMiter, n = 1e4) {
|
|
2262
|
-
let s = new
|
|
2263
|
-
const i = new
|
|
2278
|
+
let s = new pt.Paths();
|
|
2279
|
+
const i = new pt.ClipperOffset(20, 0.25);
|
|
2264
2280
|
return this.pointsGroups.forEach((r) => {
|
|
2265
2281
|
const o = this.lineTopology(r).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
|
|
2266
2282
|
i.AddPaths(o, e, t);
|
|
@@ -2301,13 +2317,13 @@ class k extends q {
|
|
|
2301
2317
|
* 线段数据转为原始json数据
|
|
2302
2318
|
*/
|
|
2303
2319
|
lineDataToOriginalData(t, e) {
|
|
2304
|
-
return
|
|
2320
|
+
return Z(t, this.originalZAverage, e);
|
|
2305
2321
|
}
|
|
2306
2322
|
/**
|
|
2307
2323
|
* 转为绘制数据
|
|
2308
2324
|
*/
|
|
2309
2325
|
toDrawDataJson(t = "Millimeters") {
|
|
2310
|
-
const e =
|
|
2326
|
+
const e = ge[t], n = {
|
|
2311
2327
|
unit: t,
|
|
2312
2328
|
line: [],
|
|
2313
2329
|
arc: [],
|
|
@@ -2351,29 +2367,29 @@ class k extends q {
|
|
|
2351
2367
|
if (s = "cyan", l.length() < 1.2) {
|
|
2352
2368
|
l.expansion(-o * 0.5);
|
|
2353
2369
|
const h = c.normal();
|
|
2354
|
-
let u = new
|
|
2370
|
+
let u = new A(
|
|
2355
2371
|
l.start.clone(),
|
|
2356
2372
|
l.start.clone().add(h.clone().multiplyScalar(l.length()))
|
|
2357
2373
|
);
|
|
2358
2374
|
const f = u.clone().directionMove(u.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
|
|
2359
|
-
for (let
|
|
2360
|
-
if (a[
|
|
2361
|
-
u = new
|
|
2375
|
+
for (let g = 0; g < a.length; g++)
|
|
2376
|
+
if (a[g].intersectRectangle(f)) {
|
|
2377
|
+
u = new A(
|
|
2362
2378
|
l.start.clone(),
|
|
2363
2379
|
l.start.clone().add(h.clone().multiplyScalar(-l.length()))
|
|
2364
2380
|
);
|
|
2365
2381
|
break;
|
|
2366
2382
|
}
|
|
2367
|
-
u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((
|
|
2368
|
-
const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y),
|
|
2369
|
-
r(
|
|
2383
|
+
u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
|
|
2384
|
+
const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [E, w] = this.getArcAngleRange(m, l.end, u.end);
|
|
2385
|
+
r(m, x, Math.min(E, w), Math.max(E, w)), a.push(f);
|
|
2370
2386
|
} else
|
|
2371
2387
|
l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), o * 0.5).directionMove(l.direction(), o * 0.5).expansion(-l.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), -o * 0.5).directionMove(l.direction(), -o * 0.5).expansion(-l.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u));
|
|
2372
2388
|
}), s = "yellow", this.lineSegments.forEach((c) => {
|
|
2373
2389
|
if (!c.userData.isWindow) return !1;
|
|
2374
2390
|
Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
|
|
2375
|
-
const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new
|
|
2376
|
-
i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((
|
|
2391
|
+
const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new A(p, y);
|
|
2392
|
+
i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, E) => i(m, E));
|
|
2377
2393
|
});
|
|
2378
2394
|
}), n;
|
|
2379
2395
|
}
|
|
@@ -2404,8 +2420,8 @@ class k extends q {
|
|
|
2404
2420
|
a.strokeStyle = o[p], a.beginPath(), a.arc(c, l, h, u * (Math.PI / 180), f * (Math.PI / 180)), a.stroke();
|
|
2405
2421
|
}), a.beginPath(), s.dimensionLine.forEach((c) => {
|
|
2406
2422
|
let [l, h, u, f] = c;
|
|
2407
|
-
const p = Math.min(h, f), y = Math.max(h, f), x = (i.width * 0.5 - 0.4 * s.scale) * (l < 0 ? -1 : 1),
|
|
2408
|
-
a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x,
|
|
2423
|
+
const p = Math.min(h, f), y = Math.max(h, f), x = (i.width * 0.5 - 0.4 * s.scale) * (l < 0 ? -1 : 1), m = (y - p) * 0.45;
|
|
2424
|
+
a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x, m + p), a.moveTo(x, y), a.lineTo(x, y - m), a.moveTo(x - 0.1 * s.scale, y), a.lineTo(x + 0.1 * s.scale, y);
|
|
2409
2425
|
}), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in i ? new Promise((c) => {
|
|
2410
2426
|
i.toBlob((l) => {
|
|
2411
2427
|
c(l);
|
|
@@ -2416,8 +2432,8 @@ class k extends q {
|
|
|
2416
2432
|
* 将点json结构转换为Dxf string
|
|
2417
2433
|
*/
|
|
2418
2434
|
toDxfString(t = "Millimeters") {
|
|
2419
|
-
const e = new
|
|
2420
|
-
e.setUnits(t), e.addLayer("cyan",
|
|
2435
|
+
const e = new J();
|
|
2436
|
+
e.setUnits(t), e.addLayer("cyan", J.ACI.CYAN, "DOTTED"), e.addLayer("yellow", J.ACI.YELLOW, "DOTTED"), e.addLayer("white", J.ACI.WHITE, "DOTTED");
|
|
2421
2437
|
const n = this.toDrawDataJson();
|
|
2422
2438
|
return n.line.forEach((s) => {
|
|
2423
2439
|
let [i, r, o, a, c] = s;
|
|
@@ -2473,7 +2489,7 @@ class k extends q {
|
|
|
2473
2489
|
* @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
|
|
2474
2490
|
* @returns
|
|
2475
2491
|
*/
|
|
2476
|
-
computedOriginalSize(t, e = new
|
|
2492
|
+
computedOriginalSize(t, e = new N(0, 0, 0, 0)) {
|
|
2477
2493
|
const n = t.flatMap((c) => [c.start.x, c.end.x]), s = t.flatMap((c) => [c.start.y, c.end.y]), i = Math.min(...n), r = Math.min(...s), o = Math.max(...n), a = Math.max(...s);
|
|
2478
2494
|
return e.set(i, r, o, a), e;
|
|
2479
2495
|
}
|
|
@@ -2501,17 +2517,17 @@ class k extends q {
|
|
|
2501
2517
|
});
|
|
2502
2518
|
}
|
|
2503
2519
|
}
|
|
2504
|
-
function
|
|
2520
|
+
function ct(d) {
|
|
2505
2521
|
if (d === null || typeof d != "object") return d;
|
|
2506
2522
|
if (d instanceof Date) return new Date(d.getTime());
|
|
2507
|
-
if (Array.isArray(d)) return d.map(
|
|
2523
|
+
if (Array.isArray(d)) return d.map(ct);
|
|
2508
2524
|
const t = {};
|
|
2509
2525
|
for (const e in d)
|
|
2510
|
-
Object.prototype.hasOwnProperty.call(d, e) && (t[e] =
|
|
2526
|
+
Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ct(d[e]));
|
|
2511
2527
|
return t;
|
|
2512
2528
|
}
|
|
2513
|
-
const j = new
|
|
2514
|
-
class
|
|
2529
|
+
const j = new A();
|
|
2530
|
+
class me extends k {
|
|
2515
2531
|
static name = "AngleCorrectionDxf";
|
|
2516
2532
|
angle = 0;
|
|
2517
2533
|
onAddFromParent(t) {
|
|
@@ -2524,7 +2540,7 @@ class ge extends k {
|
|
|
2524
2540
|
const l = e.originalData[c];
|
|
2525
2541
|
if (j.start.copy(l.start), j.end.copy(l.end), l.isVerticalReferenceLine) {
|
|
2526
2542
|
const [h, u] = l.start.y < l.end.y ? [j.start, j.end] : [j.end, j.start];
|
|
2527
|
-
s = -new
|
|
2543
|
+
s = -new A(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
|
|
2528
2544
|
break;
|
|
2529
2545
|
}
|
|
2530
2546
|
(!i || j.length() > i.length()) && (i = j.clone(), i.userData.index = c);
|
|
@@ -2532,10 +2548,10 @@ class ge extends k {
|
|
|
2532
2548
|
if (i) {
|
|
2533
2549
|
e.originalData[i.userData.index].isVerticalReferenceLine = !0;
|
|
2534
2550
|
const [c, l] = i.start.y < i.end.y ? [i.start, i.end] : [i.end, i.start];
|
|
2535
|
-
s = -new
|
|
2551
|
+
s = -new A(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
|
|
2536
2552
|
}
|
|
2537
2553
|
const r = e.originalBox.center, o = M.zero(), a = e.originalData.map((c) => {
|
|
2538
|
-
const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z), u = Object.assign(
|
|
2554
|
+
const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z), u = Object.assign(ct(c), { start: l, end: h });
|
|
2539
2555
|
return u.drawWindow && u.drawWindow.forEach((f) => {
|
|
2540
2556
|
f.p = o.copy(f.p).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(f.p.z);
|
|
2541
2557
|
}), u;
|
|
@@ -2556,7 +2572,7 @@ class ge extends k {
|
|
|
2556
2572
|
});
|
|
2557
2573
|
}
|
|
2558
2574
|
}
|
|
2559
|
-
class
|
|
2575
|
+
class Rt extends q {
|
|
2560
2576
|
static name = "Variable";
|
|
2561
2577
|
originalLineVisible = !0;
|
|
2562
2578
|
dxfVisible = !0;
|
|
@@ -2583,13 +2599,13 @@ class bt extends q {
|
|
|
2583
2599
|
if (t in this) return this[t];
|
|
2584
2600
|
}
|
|
2585
2601
|
}
|
|
2586
|
-
class
|
|
2602
|
+
class we {
|
|
2587
2603
|
// 所有可查找的点位
|
|
2588
2604
|
possibleDoorPoints = [];
|
|
2589
2605
|
doorPoint = [];
|
|
2590
2606
|
dxf;
|
|
2591
2607
|
// 包含所有点的虚拟网格
|
|
2592
|
-
pointVirtualGrid = new
|
|
2608
|
+
pointVirtualGrid = new X();
|
|
2593
2609
|
// 只包含可查找点的虚拟网格
|
|
2594
2610
|
findPointVirtualGrid;
|
|
2595
2611
|
quadtree;
|
|
@@ -2602,9 +2618,9 @@ class me {
|
|
|
2602
2618
|
lineAnalysis;
|
|
2603
2619
|
continueFind = !0;
|
|
2604
2620
|
constructor(t) {
|
|
2605
|
-
|
|
2621
|
+
this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new X(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
|
|
2606
2622
|
this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
|
|
2607
|
-
}), this.doorPoint = this.getDoorPoint()
|
|
2623
|
+
}), this.doorPoint = this.getDoorPoint();
|
|
2608
2624
|
const e = this.searchDoubleLinePoint();
|
|
2609
2625
|
this.addPointsExcludeRule((n, s, i) => {
|
|
2610
2626
|
const r = this.lineSegments.indexOf(n), o = e.get(r);
|
|
@@ -2612,7 +2628,7 @@ class me {
|
|
|
2612
2628
|
}), this.addPointsExcludeRule((n, s) => !!this.doorPoint.find((i) => i.point.equal(s))), this.possibleDoorPoints = this.getPossiblePoints(), this.possibleDoorPoints.forEach((n) => this.findPointVirtualGrid.insert(n.point, n.line)), this.handle();
|
|
2613
2629
|
}
|
|
2614
2630
|
handle() {
|
|
2615
|
-
this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.
|
|
2631
|
+
this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.dxf.doorLineSegment.length < 2 && this.dxf.doorLineSegment.push(...this.search(this.possibleDoorPoints, this.possibleDoorPoints, 0.6));
|
|
2616
2632
|
}
|
|
2617
2633
|
search(t, e = [], n = 0.6, s = this.doorSearchDistance, i = this.doorSearchNearAngle) {
|
|
2618
2634
|
const r = this.dxf, o = this.searchNearby(t, e, s, i);
|
|
@@ -2632,15 +2648,15 @@ class me {
|
|
|
2632
2648
|
);
|
|
2633
2649
|
const a = [];
|
|
2634
2650
|
return o.forEach((c) => {
|
|
2635
|
-
const l = new
|
|
2651
|
+
const l = new A(c?.start, c?.end), h = l.length();
|
|
2636
2652
|
if (h < n) return;
|
|
2637
2653
|
const u = l.normal(), f = l.direction(), p = (h - r.width * 2) / 2;
|
|
2638
2654
|
for (let y = 0; y < 3; y++) {
|
|
2639
|
-
const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)),
|
|
2655
|
+
const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), m = new A(
|
|
2640
2656
|
x,
|
|
2641
2657
|
x.clone().add(u.clone().multiplyScalar(1))
|
|
2642
2658
|
);
|
|
2643
|
-
if (
|
|
2659
|
+
if (m.directionMove(u, -0.5), this.quadtree.queryLineSegment(m).length) return;
|
|
2644
2660
|
}
|
|
2645
2661
|
a.push(l);
|
|
2646
2662
|
}), a;
|
|
@@ -2660,7 +2676,7 @@ class me {
|
|
|
2660
2676
|
return this.lineSegments.forEach((e) => {
|
|
2661
2677
|
e.points.forEach((n, s) => {
|
|
2662
2678
|
for (let r = 0; r < this._pointsExcludeRule.length; r++) if (this._pointsExcludeRule[r](e, n, s)) return;
|
|
2663
|
-
this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid:
|
|
2679
|
+
this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: at() });
|
|
2664
2680
|
});
|
|
2665
2681
|
}), t;
|
|
2666
2682
|
}
|
|
@@ -2671,7 +2687,14 @@ class me {
|
|
|
2671
2687
|
const t = [], e = this.dxf, n = this.pointVirtualGrid;
|
|
2672
2688
|
return e.doors.forEach((s) => {
|
|
2673
2689
|
const i = e.lineSegments[s[4]], r = e.originalData[s[4]];
|
|
2674
|
-
if (r.
|
|
2690
|
+
if (r.doorDirectConnection) {
|
|
2691
|
+
this.continueFind = !1;
|
|
2692
|
+
const o = new A(M.from(r.start), M.from(r.end));
|
|
2693
|
+
o.userData = {
|
|
2694
|
+
doorDirectConnection: !0,
|
|
2695
|
+
isDoor: !0
|
|
2696
|
+
}, this.dxf.doorLineSegment.push(o);
|
|
2697
|
+
} else if (r.drawDoorData) {
|
|
2675
2698
|
const o = M.from(r.drawDoorData.start), a = M.from(r.drawDoorData.n), c = n.queryPoint(o).filter((l) => {
|
|
2676
2699
|
if (l.userData === i) return !1;
|
|
2677
2700
|
const h = l.userData, u = h.direction();
|
|
@@ -2682,15 +2705,8 @@ class me {
|
|
|
2682
2705
|
c.length && t.push({
|
|
2683
2706
|
line: c[0].userData,
|
|
2684
2707
|
point: o,
|
|
2685
|
-
uuid:
|
|
2708
|
+
uuid: at()
|
|
2686
2709
|
});
|
|
2687
|
-
} else if (r.doorDirectConnection) {
|
|
2688
|
-
this.continueFind = !1;
|
|
2689
|
-
const o = new L(M.from(r.start), M.from(r.end));
|
|
2690
|
-
o.userData = {
|
|
2691
|
-
doorDirectConnection: !0,
|
|
2692
|
-
isDoor: !0
|
|
2693
|
-
}, this.dxf.doorLineSegment.push(o);
|
|
2694
2710
|
} else
|
|
2695
2711
|
console.warn(`门的线段顺序${s[4]} 没有drawDoorData属性`);
|
|
2696
2712
|
}), t;
|
|
@@ -2716,83 +2732,83 @@ class me {
|
|
|
2716
2732
|
*/
|
|
2717
2733
|
searchNearby(t, e = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
|
|
2718
2734
|
const i = this.findPointVirtualGrid, r = this.quadtree;
|
|
2719
|
-
function o({ point: x, line:
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
const S = i.queryCircle(x, n).filter((
|
|
2723
|
-
for (let
|
|
2724
|
-
const
|
|
2725
|
-
if (
|
|
2726
|
-
|
|
2727
|
-
const
|
|
2728
|
-
if (C.direction().angleBetween(
|
|
2729
|
-
const
|
|
2730
|
-
|
|
2731
|
-
findData: S[
|
|
2732
|
-
findUuid:
|
|
2735
|
+
function o({ point: x, line: m }, E, w) {
|
|
2736
|
+
const g = m.direction();
|
|
2737
|
+
m.start === x && g.multiplyScalar(-1);
|
|
2738
|
+
const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), D = [];
|
|
2739
|
+
for (let L = 0; L < S.length; L++) {
|
|
2740
|
+
const b = e.findIndex((O) => O.point === S[L].point), R = t[E].uuid, P = e[b].uuid;
|
|
2741
|
+
if (w.has(`${R}.${P}`)) continue;
|
|
2742
|
+
w.add(`${R}.${P}`), w.add(`${P}.${R}`);
|
|
2743
|
+
const B = S[L].point, C = new A(x.clone(), B.clone());
|
|
2744
|
+
if (C.direction().angleBetween(g, "angle") < s) {
|
|
2745
|
+
const O = t[E].line.direction(), v = S[L].userData;
|
|
2746
|
+
v.start.equal(S[L].point) && O.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(O, "angle") < s && (r.queryLineSegment(C).filter((W) => !(W.line.start.equal(x) || W.line.end.equal(x) || W.line === v)).length || D.push({
|
|
2747
|
+
findData: S[L],
|
|
2748
|
+
findUuid: P,
|
|
2733
2749
|
doorLine: C,
|
|
2734
|
-
doorUuid:
|
|
2750
|
+
doorUuid: R
|
|
2735
2751
|
}));
|
|
2736
2752
|
}
|
|
2737
2753
|
}
|
|
2738
|
-
return
|
|
2754
|
+
return D;
|
|
2739
2755
|
}
|
|
2740
|
-
function a(x,
|
|
2741
|
-
|
|
2756
|
+
function a(x, m, E, w, g) {
|
|
2757
|
+
w.add(x);
|
|
2742
2758
|
const S = [];
|
|
2743
|
-
|
|
2744
|
-
for (let
|
|
2745
|
-
const
|
|
2746
|
-
if (
|
|
2747
|
-
const
|
|
2748
|
-
a(
|
|
2749
|
-
} else S.push(
|
|
2759
|
+
g && S.push(g);
|
|
2760
|
+
for (let D = 0; D < E.length; D++) {
|
|
2761
|
+
const L = E[D];
|
|
2762
|
+
if (m.has(L.findUuid)) {
|
|
2763
|
+
const b = m.get(L.findUuid);
|
|
2764
|
+
a(L.findUuid, m, b, w, L) && S.push(L);
|
|
2765
|
+
} else S.push(L);
|
|
2750
2766
|
}
|
|
2751
|
-
return S.sort((
|
|
2767
|
+
return S.sort((D, L) => D.doorLine.length() - L.doorLine.length()), g && S[0] === g ? (E.splice(0), !0) : (E.splice(1), !1);
|
|
2752
2768
|
}
|
|
2753
2769
|
const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
2754
|
-
t.map((x,
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2770
|
+
t.map((x, m) => {
|
|
2771
|
+
const E = o(x, m, c);
|
|
2772
|
+
E.length && l.set(x.uuid, E);
|
|
2757
2773
|
}), c.clear();
|
|
2758
2774
|
const h = /* @__PURE__ */ new Map();
|
|
2759
|
-
l.forEach((x,
|
|
2760
|
-
if (!c.has(
|
|
2761
|
-
const
|
|
2762
|
-
h.has(
|
|
2775
|
+
l.forEach((x, m) => {
|
|
2776
|
+
if (!c.has(m) && x.length && a(m, l, x, c), x.length) {
|
|
2777
|
+
const E = x[0];
|
|
2778
|
+
h.has(E.doorUuid) || h.set(E.doorUuid, []), h.get(E.doorUuid)?.push(E), h.has(E.findUuid) || h.set(E.findUuid, []), h.get(E.findUuid)?.push(E);
|
|
2763
2779
|
}
|
|
2764
2780
|
});
|
|
2765
2781
|
const u = /* @__PURE__ */ new Set();
|
|
2766
2782
|
h.forEach((x) => {
|
|
2767
2783
|
if (x.length > 1) {
|
|
2768
|
-
x.sort((
|
|
2769
|
-
for (let
|
|
2784
|
+
x.sort((m, E) => m.doorLine.length() - E.doorLine.length());
|
|
2785
|
+
for (let m = 1; m < x.length; m++) u.add(x[m]);
|
|
2770
2786
|
}
|
|
2771
2787
|
});
|
|
2772
2788
|
const f = [], p = [];
|
|
2773
2789
|
l.forEach((x) => {
|
|
2774
2790
|
if (x.length) {
|
|
2775
|
-
const
|
|
2776
|
-
u.has(
|
|
2791
|
+
const m = x[0];
|
|
2792
|
+
u.has(m) || (f.push(m), p.push(m.doorUuid, m.findUuid));
|
|
2777
2793
|
}
|
|
2778
2794
|
});
|
|
2779
2795
|
const y = [];
|
|
2780
2796
|
return f.forEach((x) => {
|
|
2781
|
-
const
|
|
2782
|
-
if (
|
|
2783
|
-
|
|
2784
|
-
const
|
|
2785
|
-
(
|
|
2786
|
-
start:
|
|
2787
|
-
end:
|
|
2797
|
+
const m = t.findIndex((b) => b.uuid === x.doorUuid), E = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[E].point.clone(), S = this.findLongLineSegment(t[m].line), D = this.findLongLineSegment(e[E].line), L = S.projectPoint(g);
|
|
2798
|
+
if (L) {
|
|
2799
|
+
w.copy(L);
|
|
2800
|
+
const b = new A(w, g), R = D.includedAngle(b);
|
|
2801
|
+
(R < 10 || R > 170 || Math.abs(90 - R) < 10) && y.push({
|
|
2802
|
+
start: w,
|
|
2803
|
+
end: g
|
|
2788
2804
|
});
|
|
2789
2805
|
} else {
|
|
2790
|
-
const
|
|
2791
|
-
|
|
2792
|
-
const
|
|
2793
|
-
(
|
|
2794
|
-
start:
|
|
2795
|
-
end:
|
|
2806
|
+
const b = D.projectPoint(w);
|
|
2807
|
+
b && g.copy(b);
|
|
2808
|
+
const R = new A(w, g), P = S.includedAngle(R);
|
|
2809
|
+
(P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
|
|
2810
|
+
start: w,
|
|
2811
|
+
end: g
|
|
2796
2812
|
});
|
|
2797
2813
|
}
|
|
2798
2814
|
}), e.splice(
|
|
@@ -2813,7 +2829,7 @@ class me {
|
|
|
2813
2829
|
searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
|
|
2814
2830
|
const s = this.quadtree, i = e.direction();
|
|
2815
2831
|
e.start === t && i.multiplyScalar(-1);
|
|
2816
|
-
const r = t.clone().add(i.clone().multiplyScalar(n)), o = new
|
|
2832
|
+
const r = t.clone().add(i.clone().multiplyScalar(n)), o = new A(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
|
|
2817
2833
|
point: c.line.getIntersection(o),
|
|
2818
2834
|
line: c.line
|
|
2819
2835
|
})).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
|
|
@@ -2840,7 +2856,7 @@ class me {
|
|
|
2840
2856
|
break;
|
|
2841
2857
|
}
|
|
2842
2858
|
}
|
|
2843
|
-
const l = new
|
|
2859
|
+
const l = new A(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((u) => ({
|
|
2844
2860
|
point: u.line.getIntersection(l),
|
|
2845
2861
|
line: u.line
|
|
2846
2862
|
})).filter((u) => u.point).sort((u, f) => t.distance(u.point) - t.distance(f.point));
|
|
@@ -2874,7 +2890,7 @@ class me {
|
|
|
2874
2890
|
return e;
|
|
2875
2891
|
}
|
|
2876
2892
|
}
|
|
2877
|
-
class
|
|
2893
|
+
class Me extends q {
|
|
2878
2894
|
static name = "LineAnalysis";
|
|
2879
2895
|
Dxf = null;
|
|
2880
2896
|
Variable = null;
|
|
@@ -2888,7 +2904,7 @@ class we extends q {
|
|
|
2888
2904
|
* @param parent
|
|
2889
2905
|
*/
|
|
2890
2906
|
onAddFromParent(t) {
|
|
2891
|
-
this.Dxf = t.findComponentByType(k), this.Variable = this.parent?.findComponentByType(
|
|
2907
|
+
this.Dxf = t.findComponentByType(k), this.Variable = this.parent?.findComponentByType(Rt), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
|
|
2892
2908
|
}
|
|
2893
2909
|
/**
|
|
2894
2910
|
*
|
|
@@ -2920,7 +2936,7 @@ class we extends q {
|
|
|
2920
2936
|
*/
|
|
2921
2937
|
addData(t, e) {
|
|
2922
2938
|
const n = this.Dxf;
|
|
2923
|
-
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new
|
|
2939
|
+
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new A(t.clone(), e.clone()));
|
|
2924
2940
|
}
|
|
2925
2941
|
/** 结果分析创建矩形
|
|
2926
2942
|
* @param result
|
|
@@ -2930,12 +2946,12 @@ class we extends q {
|
|
|
2930
2946
|
n.includedAngle(s) > 135 && (s.points = [s.points[1], s.points[0]]), this.addData(n.points[0], s.points[0]), this.addData(n.points[1], s.points[1]);
|
|
2931
2947
|
const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / e.width), a = i / o, c = r / o, l = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), u = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(u);
|
|
2932
2948
|
p.multiplyScalar(e.width * 0.5);
|
|
2933
|
-
const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)),
|
|
2934
|
-
if (!(
|
|
2949
|
+
const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), E = y.direction(x);
|
|
2950
|
+
if (!(m.x > 0 && E.x < 0 || m.x < 0 && E.x > 0 || m.y > 0 && E.y < 0 || m.y < 0 && E.y > 0)) {
|
|
2935
2951
|
u.set(y.x, y.y), f.set(x.x, x.y);
|
|
2936
|
-
for (let
|
|
2937
|
-
const
|
|
2938
|
-
this.addData(
|
|
2952
|
+
for (let w = 1; w < o; w++) {
|
|
2953
|
+
const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), D = u.clone().add(g), L = f.clone().add(S);
|
|
2954
|
+
this.addData(D, L);
|
|
2939
2955
|
}
|
|
2940
2956
|
}
|
|
2941
2957
|
}
|
|
@@ -2962,7 +2978,7 @@ class we extends q {
|
|
|
2962
2978
|
this.buildQuadtree();
|
|
2963
2979
|
const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
|
|
2964
2980
|
e.forEach((i, r) => {
|
|
2965
|
-
const o = e[r], a =
|
|
2981
|
+
const o = e[r], a = et.fromByLineSegment(o, this.width * 2, !1, -0.01);
|
|
2966
2982
|
t.queryRect(a).map((l) => l.userData).filter((l) => l !== r).forEach((l) => {
|
|
2967
2983
|
try {
|
|
2968
2984
|
if (n.has(`${r}-${l}`) || n.has(`${l}-${r}`)) return;
|
|
@@ -3006,12 +3022,12 @@ class we extends q {
|
|
|
3006
3022
|
doors = [];
|
|
3007
3023
|
DoorsAnalysis;
|
|
3008
3024
|
doorsAnalysis() {
|
|
3009
|
-
this.DoorsAnalysis = new
|
|
3025
|
+
this.DoorsAnalysis = new we(this), this.dispatchEvent({
|
|
3010
3026
|
type: "analysisCompleted"
|
|
3011
3027
|
});
|
|
3012
3028
|
}
|
|
3013
3029
|
}
|
|
3014
|
-
class
|
|
3030
|
+
class Se extends q {
|
|
3015
3031
|
static name = "ThreeVJia";
|
|
3016
3032
|
lineSegments = [];
|
|
3017
3033
|
onAddFromParent() {
|
|
@@ -3023,8 +3039,8 @@ class Me extends q {
|
|
|
3023
3039
|
t.resultList.forEach((l) => {
|
|
3024
3040
|
const h = s.get(l.target) ?? [], u = s.get(l.source) ?? [], f = l.project.clone(), p = l.project2.clone();
|
|
3025
3041
|
f.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...f.points), u.push(...p.points), s.set(l.target, h), s.set(l.source, u);
|
|
3026
|
-
const y = new
|
|
3027
|
-
|
|
3042
|
+
const y = new A(f.start, p.start), x = new A(f.end, p.end), m = new A(y.center, x.center);
|
|
3043
|
+
m.userData.wallWidth = Math.max(y.length(), x.length()), r.push(m);
|
|
3028
3044
|
});
|
|
3029
3045
|
const a = [];
|
|
3030
3046
|
i = i.filter((l) => {
|
|
@@ -3040,7 +3056,7 @@ class Me extends q {
|
|
|
3040
3056
|
const f = [];
|
|
3041
3057
|
for (let p = 0; p < h.length; p++) {
|
|
3042
3058
|
const y = h[p];
|
|
3043
|
-
y.userData.type === "start" ? (f.length === 0 && (a.push(new
|
|
3059
|
+
y.userData.type === "start" ? (f.length === 0 && (a.push(new A(u.start.clone(), y.clone())), u.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && u.start.copy(y));
|
|
3044
3060
|
}
|
|
3045
3061
|
a.push(u);
|
|
3046
3062
|
}
|
|
@@ -3134,7 +3150,7 @@ class Me extends q {
|
|
|
3134
3150
|
} else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
|
|
3135
3151
|
}
|
|
3136
3152
|
}
|
|
3137
|
-
class
|
|
3153
|
+
class ht extends se {
|
|
3138
3154
|
Dxf;
|
|
3139
3155
|
AngleCorrectionDxf;
|
|
3140
3156
|
Variable;
|
|
@@ -3146,7 +3162,7 @@ class ct extends ne {
|
|
|
3146
3162
|
* @param scale 原始数据缩放比例
|
|
3147
3163
|
*/
|
|
3148
3164
|
constructor(t = 0.1, e = 1) {
|
|
3149
|
-
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new
|
|
3165
|
+
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new me(), this.Variable = new Rt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Me()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Se()), ht.finalInstance = this;
|
|
3150
3166
|
}
|
|
3151
3167
|
usePlugin(t) {
|
|
3152
3168
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -3159,32 +3175,19 @@ class ct extends ne {
|
|
|
3159
3175
|
});
|
|
3160
3176
|
}
|
|
3161
3177
|
}
|
|
3162
|
-
|
|
3163
|
-
d.forEach((t) => {
|
|
3164
|
-
const e = t.direction();
|
|
3165
|
-
t.userData.drawWindow?.forEach((n) => {
|
|
3166
|
-
const s = M.from(n.p), i = t.projectPoint(
|
|
3167
|
-
s.clone().add(e.clone().multiplyScalar(n.width * 0.5))
|
|
3168
|
-
), r = t.projectPoint(
|
|
3169
|
-
s.clone().add(e.clone().multiplyScalar(n.width * -0.5))
|
|
3170
|
-
), o = new L(i, r), a = o.center;
|
|
3171
|
-
n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
|
|
3172
|
-
});
|
|
3173
|
-
});
|
|
3174
|
-
}
|
|
3175
|
-
class lt {
|
|
3178
|
+
class ut {
|
|
3176
3179
|
/** 通过轨迹点查找外墙
|
|
3177
3180
|
* @param lines
|
|
3178
3181
|
* @param trajectoryPoints
|
|
3179
3182
|
* @returns
|
|
3180
3183
|
*/
|
|
3181
3184
|
static findExtWallByTraj(t, e, n = 0.4) {
|
|
3182
|
-
const s = new F(
|
|
3185
|
+
const s = new F(N.fromByLineSegment(...t));
|
|
3183
3186
|
return t.forEach((i) => s.insert({ line: i, userData: void 0 })), t = t.filter((i) => {
|
|
3184
3187
|
const r = i.center, o = /* @__PURE__ */ new Set();
|
|
3185
3188
|
for (const a of e) {
|
|
3186
3189
|
if (o.size === 2) break;
|
|
3187
|
-
const c = new
|
|
3190
|
+
const c = new A(r, a);
|
|
3188
3191
|
if (!s.queryLineSegment(c).filter((h) => !(h.line === i || h.line.parallel(i) && i.getMinLength(h.line) < n && h.line.projectLineSegment(i).length() / i.length() > 0.6)).length) {
|
|
3189
3192
|
const h = i.pointPosition(a);
|
|
3190
3193
|
h !== "on" && o.add(h);
|
|
@@ -3198,87 +3201,89 @@ class lt {
|
|
|
3198
3201
|
* @param trajectoryPoints
|
|
3199
3202
|
*/
|
|
3200
3203
|
static boundExtbyTraj(t, e, n = 0.12) {
|
|
3201
|
-
function s(
|
|
3202
|
-
return
|
|
3203
|
-
const
|
|
3204
|
-
|
|
3205
|
-
const
|
|
3206
|
-
if (
|
|
3204
|
+
function s(w, g) {
|
|
3205
|
+
return g.queryLineSegment(w).filter((S) => S.line !== w).map(({ line: S }) => {
|
|
3206
|
+
const D = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
|
|
3207
|
+
w.sameEndpoint(S) && (D.type = "endpoint"), w.parallel(S) && (D.direction = "parallel");
|
|
3208
|
+
const L = w.getSameEndpoint(S);
|
|
3209
|
+
if (L) D.point = L[1];
|
|
3207
3210
|
else {
|
|
3208
|
-
const
|
|
3209
|
-
|
|
3211
|
+
const b = S.getIntersection(w);
|
|
3212
|
+
b && (D.point = S.start.equal(b) ? S.start : S.end);
|
|
3210
3213
|
}
|
|
3211
|
-
return
|
|
3214
|
+
return D;
|
|
3212
3215
|
});
|
|
3213
3216
|
}
|
|
3214
|
-
function i(
|
|
3215
|
-
const
|
|
3216
|
-
if (
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3219
|
-
} else if (
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3217
|
+
function i(w) {
|
|
3218
|
+
const g = w.userData.expandDirect;
|
|
3219
|
+
if (g === "left") {
|
|
3220
|
+
const S = w.getLeftDirection();
|
|
3221
|
+
w.directionMove(S, n * 0.5);
|
|
3222
|
+
} else if (g === "right") {
|
|
3223
|
+
const S = w.getRightDirection();
|
|
3224
|
+
w.directionMove(S, n * 0.5);
|
|
3222
3225
|
}
|
|
3223
3226
|
}
|
|
3224
|
-
function r({ resultLine:
|
|
3225
|
-
if (
|
|
3226
|
-
|
|
3227
|
-
else if (
|
|
3228
|
-
if (
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3227
|
+
function r({ resultLine: w, type: g, direction: S, point: D }, L, b, R) {
|
|
3228
|
+
if (g === "intersect")
|
|
3229
|
+
D && D.copy(L.projectPoint(D) ?? D);
|
|
3230
|
+
else if (S === "vertical") {
|
|
3231
|
+
if (D) {
|
|
3232
|
+
const P = L.projectPoint(D, !1);
|
|
3233
|
+
D.copy(P), L.isPointOnSegment(P) || (L.start.distance(P) < L.end.distance(P) ? R.push(new A(P.clone(), L.start.clone())) : R.push(new A(P.clone(), L.end.clone())));
|
|
3231
3234
|
}
|
|
3232
|
-
} else if (!u.includes(
|
|
3233
|
-
let
|
|
3234
|
-
if (
|
|
3235
|
-
|
|
3236
|
-
const
|
|
3237
|
-
|
|
3235
|
+
} else if (!u.includes(w) && D) {
|
|
3236
|
+
let P = L.projectPoint(D, !1), B;
|
|
3237
|
+
if (L.start.distance(D) < L.end.distance(D) ? B = L.start : B = L.end, P) {
|
|
3238
|
+
R.push(new A(D.clone(), P.clone()));
|
|
3239
|
+
const C = new A(P.clone(), B.clone());
|
|
3240
|
+
C.length() && R.push(C);
|
|
3238
3241
|
}
|
|
3239
3242
|
}
|
|
3240
|
-
|
|
3243
|
+
b.update(w);
|
|
3241
3244
|
}
|
|
3242
|
-
const o = Object.keys(e).map((
|
|
3243
|
-
let c = t.map(({ start:
|
|
3244
|
-
const
|
|
3245
|
-
return
|
|
3245
|
+
const o = Object.keys(e).map((w) => M.from(e[w])), a = [];
|
|
3246
|
+
let c = t.map(({ start: w, end: g, ...S }) => {
|
|
3247
|
+
const D = new A(M.from(w), M.from(g));
|
|
3248
|
+
return D.userData = S, a.push(w.z ?? 0, g.z ?? 0), D;
|
|
3246
3249
|
});
|
|
3247
|
-
const l = a.reduce((
|
|
3248
|
-
let u =
|
|
3249
|
-
c = c.filter((
|
|
3250
|
-
const
|
|
3251
|
-
|
|
3252
|
-
const y =
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3250
|
+
const l = a.reduce((w, g) => w + g, 0) / a.length;
|
|
3251
|
+
let u = ut.findExtWallByTraj(c, o).filter((w) => w.userData.expandDirect);
|
|
3252
|
+
c = c.filter((w) => !u.includes(w)), c.push(...u);
|
|
3253
|
+
const p = this.parent?.findComponentByName("Renderer");
|
|
3254
|
+
o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(u, 0, { color: 65280 }).position.z = l + 1e-3;
|
|
3255
|
+
const y = A.groupBySamePointAndParallel(u), x = new F(N.fromByLineSegment(...c));
|
|
3256
|
+
c.forEach((w) => w.userData.isDoor || x.insert(w));
|
|
3257
|
+
const m = y.map((w) => w.flatMap((g) => s(g, x))), E = [];
|
|
3258
|
+
return y.flatMap((w, g) => (w.forEach((D) => (i(D), x.update(D))), m[g].filter((D) => {
|
|
3259
|
+
if (!u.includes(D.resultLine)) {
|
|
3260
|
+
let L;
|
|
3261
|
+
return Object.defineProperty(D, "newLine", {
|
|
3257
3262
|
get() {
|
|
3258
|
-
return
|
|
3263
|
+
return L || (L = A.mergeLines(...w)), L;
|
|
3259
3264
|
}
|
|
3260
3265
|
}), !0;
|
|
3261
3266
|
}
|
|
3262
|
-
r(
|
|
3263
|
-
}))).reduce((
|
|
3264
|
-
|
|
3265
|
-
const
|
|
3266
|
-
for (let
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3267
|
+
r(D, A.mergeLines(...w), x, E);
|
|
3268
|
+
}))).reduce((w, g) => (w.has(g.resultLine) || w.set(g.resultLine, []), w.get(g.resultLine)?.push(g), w), /* @__PURE__ */ new Map()).forEach((w) => {
|
|
3269
|
+
w.reduce((g, S) => (g.has(S.point) || g.set(S.point, []), g.get(S.point)?.push(S), g), /* @__PURE__ */ new Map()).forEach((g) => {
|
|
3270
|
+
const S = /* @__PURE__ */ new Set();
|
|
3271
|
+
for (let D = 0; D < g.length; D++) {
|
|
3272
|
+
const L = g[D];
|
|
3273
|
+
S.has(L.point) || (r(L, L.newLine, x, E), S.add(L.point));
|
|
3269
3274
|
}
|
|
3270
3275
|
});
|
|
3271
|
-
}), c.push(...
|
|
3276
|
+
}), c.push(...A.deduplication(E)), c.forEach((w) => w.userData.isWindow && Q(w)), c = lt(c), c = A.deduplication(c), Z(c, l);
|
|
3272
3277
|
}
|
|
3273
3278
|
}
|
|
3274
|
-
const
|
|
3279
|
+
const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3275
3280
|
__proto__: null,
|
|
3276
|
-
AxisAlignCorr:
|
|
3277
|
-
BoundExt:
|
|
3278
|
-
lineDataToOriginalData:
|
|
3279
|
-
lineSegmentClipping:
|
|
3280
|
-
recomputedWindow:
|
|
3281
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3281
|
+
AxisAlignCorr: Pt,
|
|
3282
|
+
BoundExt: ut,
|
|
3283
|
+
lineDataToOriginalData: Z,
|
|
3284
|
+
lineSegmentClipping: lt,
|
|
3285
|
+
recomputedWindow: Q
|
|
3286
|
+
}, Symbol.toStringTag, { value: "Module" })), St = {
|
|
3282
3287
|
POSITION: [
|
|
3283
3288
|
"byte",
|
|
3284
3289
|
"byte normalized",
|
|
@@ -3306,28 +3311,26 @@ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3306
3311
|
"unsigned short"
|
|
3307
3312
|
]
|
|
3308
3313
|
};
|
|
3309
|
-
class
|
|
3314
|
+
class tt {
|
|
3310
3315
|
constructor() {
|
|
3311
3316
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
3312
|
-
return new ve(t);
|
|
3313
|
-
}), this.register(function(t) {
|
|
3314
3317
|
return new Ne(t);
|
|
3315
3318
|
}), this.register(function(t) {
|
|
3316
|
-
return new
|
|
3317
|
-
}), this.register(function(t) {
|
|
3318
|
-
return new Ue(t);
|
|
3319
|
+
return new Ce(t);
|
|
3319
3320
|
}), this.register(function(t) {
|
|
3320
3321
|
return new Ge(t);
|
|
3322
|
+
}), this.register(function(t) {
|
|
3323
|
+
return new Ue(t);
|
|
3321
3324
|
}), this.register(function(t) {
|
|
3322
3325
|
return new ze(t);
|
|
3323
3326
|
}), this.register(function(t) {
|
|
3324
|
-
return new
|
|
3327
|
+
return new je(t);
|
|
3325
3328
|
}), this.register(function(t) {
|
|
3326
3329
|
return new Be(t);
|
|
3327
3330
|
}), this.register(function(t) {
|
|
3328
3331
|
return new Oe(t);
|
|
3329
3332
|
}), this.register(function(t) {
|
|
3330
|
-
return new
|
|
3333
|
+
return new Fe(t);
|
|
3331
3334
|
}), this.register(function(t) {
|
|
3332
3335
|
return new _e(t);
|
|
3333
3336
|
}), this.register(function(t) {
|
|
@@ -3336,6 +3339,8 @@ class Z {
|
|
|
3336
3339
|
return new Ye(t);
|
|
3337
3340
|
}), this.register(function(t) {
|
|
3338
3341
|
return new ke(t);
|
|
3342
|
+
}), this.register(function(t) {
|
|
3343
|
+
return new Ve(t);
|
|
3339
3344
|
});
|
|
3340
3345
|
}
|
|
3341
3346
|
register(t) {
|
|
@@ -3348,7 +3353,7 @@ class Z {
|
|
|
3348
3353
|
return this.textureUtils = t, this;
|
|
3349
3354
|
}
|
|
3350
3355
|
parse(t, e, n, s) {
|
|
3351
|
-
const i = new
|
|
3356
|
+
const i = new ve(), r = [];
|
|
3352
3357
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
3353
3358
|
r.push(this.pluginCallbacks[o](i));
|
|
3354
3359
|
i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
|
|
@@ -3360,7 +3365,7 @@ class Z {
|
|
|
3360
3365
|
});
|
|
3361
3366
|
}
|
|
3362
3367
|
}
|
|
3363
|
-
const
|
|
3368
|
+
const T = {
|
|
3364
3369
|
POINTS: 0,
|
|
3365
3370
|
LINES: 1,
|
|
3366
3371
|
LINE_LOOP: 2,
|
|
@@ -3384,34 +3389,34 @@ const b = {
|
|
|
3384
3389
|
CLAMP_TO_EDGE: 33071,
|
|
3385
3390
|
MIRRORED_REPEAT: 33648,
|
|
3386
3391
|
REPEAT: 10497
|
|
3387
|
-
},
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
const
|
|
3392
|
+
}, st = "KHR_mesh_quantization", G = {};
|
|
3393
|
+
G[Xt] = T.NEAREST;
|
|
3394
|
+
G[Wt] = T.NEAREST_MIPMAP_NEAREST;
|
|
3395
|
+
G[Ht] = T.NEAREST_MIPMAP_LINEAR;
|
|
3396
|
+
G[Jt] = T.LINEAR;
|
|
3397
|
+
G[$t] = T.LINEAR_MIPMAP_NEAREST;
|
|
3398
|
+
G[Kt] = T.LINEAR_MIPMAP_LINEAR;
|
|
3399
|
+
G[Zt] = T.CLAMP_TO_EDGE;
|
|
3400
|
+
G[Qt] = T.REPEAT;
|
|
3401
|
+
G[te] = T.MIRRORED_REPEAT;
|
|
3402
|
+
const Et = {
|
|
3398
3403
|
scale: "scale",
|
|
3399
3404
|
position: "translation",
|
|
3400
3405
|
quaternion: "rotation",
|
|
3401
3406
|
morphTargetInfluences: "weights"
|
|
3402
|
-
},
|
|
3403
|
-
function
|
|
3407
|
+
}, Ee = new Ft(), Lt = 12, Le = 1179937895, De = 2, Dt = 8, Ae = 1313821514, Te = 5130562;
|
|
3408
|
+
function H(d, t) {
|
|
3404
3409
|
return d.length === t.length && d.every(function(e, n) {
|
|
3405
3410
|
return e === t[n];
|
|
3406
3411
|
});
|
|
3407
3412
|
}
|
|
3408
|
-
function
|
|
3413
|
+
function be(d) {
|
|
3409
3414
|
return new TextEncoder().encode(d).buffer;
|
|
3410
3415
|
}
|
|
3411
|
-
function
|
|
3412
|
-
return
|
|
3416
|
+
function Ie(d) {
|
|
3417
|
+
return H(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
3413
3418
|
}
|
|
3414
|
-
function
|
|
3419
|
+
function Pe(d, t, e) {
|
|
3415
3420
|
const n = {
|
|
3416
3421
|
min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
3417
3422
|
max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -3419,15 +3424,15 @@ function Ie(d, t, e) {
|
|
|
3419
3424
|
for (let s = t; s < t + e; s++)
|
|
3420
3425
|
for (let i = 0; i < d.itemSize; i++) {
|
|
3421
3426
|
let r;
|
|
3422
|
-
d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r =
|
|
3427
|
+
d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r = ot.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
|
|
3423
3428
|
}
|
|
3424
3429
|
return n;
|
|
3425
3430
|
}
|
|
3426
|
-
function
|
|
3431
|
+
function vt(d) {
|
|
3427
3432
|
return Math.ceil(d / 4) * 4;
|
|
3428
3433
|
}
|
|
3429
|
-
function
|
|
3430
|
-
const e =
|
|
3434
|
+
function it(d, t = 0) {
|
|
3435
|
+
const e = vt(d.byteLength);
|
|
3431
3436
|
if (e !== d.byteLength) {
|
|
3432
3437
|
const n = new Uint8Array(e);
|
|
3433
3438
|
if (n.set(new Uint8Array(d)), t !== 0)
|
|
@@ -3437,10 +3442,10 @@ function nt(d, t = 0) {
|
|
|
3437
3442
|
}
|
|
3438
3443
|
return d;
|
|
3439
3444
|
}
|
|
3440
|
-
function
|
|
3445
|
+
function At() {
|
|
3441
3446
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
3442
3447
|
}
|
|
3443
|
-
function
|
|
3448
|
+
function Re(d, t) {
|
|
3444
3449
|
if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
|
|
3445
3450
|
let e;
|
|
3446
3451
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
|
|
@@ -3450,7 +3455,7 @@ function Pe(d, t) {
|
|
|
3450
3455
|
} else
|
|
3451
3456
|
return new Promise((e) => d.toBlob(e, t));
|
|
3452
3457
|
}
|
|
3453
|
-
class
|
|
3458
|
+
class ve {
|
|
3454
3459
|
constructor() {
|
|
3455
3460
|
this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
|
|
3456
3461
|
asset: {
|
|
@@ -3492,23 +3497,23 @@ class Re {
|
|
|
3492
3497
|
const s = this, i = s.buffers, r = s.json;
|
|
3493
3498
|
n = s.options;
|
|
3494
3499
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
3495
|
-
l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ?
|
|
3496
|
-
const f =
|
|
3497
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
3498
|
-
const y =
|
|
3499
|
-
x.setUint32(0, y.byteLength, !0), x.setUint32(4,
|
|
3500
|
-
const
|
|
3501
|
-
|
|
3502
|
-
const
|
|
3503
|
-
|
|
3504
|
-
const
|
|
3505
|
-
|
|
3500
|
+
l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? rt(c).then(function(u) {
|
|
3501
|
+
const f = it(u), p = new DataView(new ArrayBuffer(Dt));
|
|
3502
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Te, !0);
|
|
3503
|
+
const y = it(be(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Dt));
|
|
3504
|
+
x.setUint32(0, y.byteLength, !0), x.setUint32(4, Ae, !0);
|
|
3505
|
+
const m = new ArrayBuffer(Lt), E = new DataView(m);
|
|
3506
|
+
E.setUint32(0, Le, !0), E.setUint32(4, De, !0);
|
|
3507
|
+
const w = Lt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
|
|
3508
|
+
E.setUint32(8, w, !0);
|
|
3509
|
+
const g = new Blob([
|
|
3510
|
+
m,
|
|
3506
3511
|
x,
|
|
3507
3512
|
y,
|
|
3508
3513
|
p,
|
|
3509
3514
|
f
|
|
3510
3515
|
], { type: "application/octet-stream" });
|
|
3511
|
-
|
|
3516
|
+
rt(g).then((S) => {
|
|
3512
3517
|
e(S);
|
|
3513
3518
|
});
|
|
3514
3519
|
}) : r.buffers && r.buffers.length > 0 ? Xe(c).then((u) => {
|
|
@@ -3559,7 +3564,7 @@ class Re {
|
|
|
3559
3564
|
*/
|
|
3560
3565
|
isNormalizedNormalAttribute(t) {
|
|
3561
3566
|
if (this.cache.attributesNormalized.has(t)) return !1;
|
|
3562
|
-
const n = new
|
|
3567
|
+
const n = new $();
|
|
3563
3568
|
for (let s = 0, i = t.count; s < i; s++)
|
|
3564
3569
|
if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
|
|
3565
3570
|
return !0;
|
|
@@ -3574,7 +3579,7 @@ class Re {
|
|
|
3574
3579
|
createNormalizedNormalAttribute(t) {
|
|
3575
3580
|
const e = this.cache;
|
|
3576
3581
|
if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
|
|
3577
|
-
const n = t.clone(), s = new
|
|
3582
|
+
const n = t.clone(), s = new $();
|
|
3578
3583
|
for (let i = 0, r = n.count; i < r; i++)
|
|
3579
3584
|
s.fromBufferAttribute(n, i), s.x === 0 && s.y === 0 && s.z === 0 ? s.setX(1) : s.normalize(), n.setXYZ(i, s.x, s.y, s.z);
|
|
3580
3585
|
return e.attributesNormalized.set(t, n), n;
|
|
@@ -3594,14 +3599,14 @@ class Re {
|
|
|
3594
3599
|
async buildMetalRoughTextureAsync(t, e) {
|
|
3595
3600
|
if (t === e) return t;
|
|
3596
3601
|
function n(f) {
|
|
3597
|
-
return f.colorSpace ===
|
|
3602
|
+
return f.colorSpace === Vt ? function(y) {
|
|
3598
3603
|
return y < 0.04045 ? y * 0.0773993808 : Math.pow(y * 0.9478672986 + 0.0521327014, 2.4);
|
|
3599
3604
|
} : function(y) {
|
|
3600
3605
|
return y;
|
|
3601
3606
|
};
|
|
3602
3607
|
}
|
|
3603
|
-
t instanceof
|
|
3604
|
-
const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a =
|
|
3608
|
+
t instanceof nt && (t = await this.decompressTextureAsync(t)), e instanceof nt && (e = await this.decompressTextureAsync(e));
|
|
3609
|
+
const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = At();
|
|
3605
3610
|
a.width = r, a.height = o;
|
|
3606
3611
|
const c = a.getContext("2d", {
|
|
3607
3612
|
willReadFrequently: !0
|
|
@@ -3622,7 +3627,7 @@ class Re {
|
|
|
3622
3627
|
}
|
|
3623
3628
|
c.putImageData(l, 0, 0);
|
|
3624
3629
|
const u = (t || e).clone();
|
|
3625
|
-
return u.source = new
|
|
3630
|
+
return u.source = new zt(a), u.colorSpace = jt, u.channel = (t || e).channel, t && e && t.channel !== e.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), u;
|
|
3626
3631
|
}
|
|
3627
3632
|
async decompressTextureAsync(t, e = 1 / 0) {
|
|
3628
3633
|
if (this.textureUtils === null)
|
|
@@ -3652,25 +3657,25 @@ class Re {
|
|
|
3652
3657
|
r.bufferViews || (r.bufferViews = []);
|
|
3653
3658
|
let o;
|
|
3654
3659
|
switch (e) {
|
|
3655
|
-
case
|
|
3656
|
-
case
|
|
3660
|
+
case T.BYTE:
|
|
3661
|
+
case T.UNSIGNED_BYTE:
|
|
3657
3662
|
o = 1;
|
|
3658
3663
|
break;
|
|
3659
|
-
case
|
|
3660
|
-
case
|
|
3664
|
+
case T.SHORT:
|
|
3665
|
+
case T.UNSIGNED_SHORT:
|
|
3661
3666
|
o = 2;
|
|
3662
3667
|
break;
|
|
3663
3668
|
default:
|
|
3664
3669
|
o = 4;
|
|
3665
3670
|
}
|
|
3666
3671
|
let a = t.itemSize * o;
|
|
3667
|
-
i ===
|
|
3668
|
-
const c =
|
|
3672
|
+
i === T.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
|
|
3673
|
+
const c = vt(s * a), l = new DataView(new ArrayBuffer(c));
|
|
3669
3674
|
let h = 0;
|
|
3670
3675
|
for (let p = n; p < n + s; p++) {
|
|
3671
3676
|
for (let y = 0; y < t.itemSize; y++) {
|
|
3672
3677
|
let x;
|
|
3673
|
-
t.itemSize > 4 ? x = t.array[p * t.itemSize + y] : (y === 0 ? x = t.getX(p) : y === 1 ? x = t.getY(p) : y === 2 ? x = t.getZ(p) : y === 3 && (x = t.getW(p)), t.normalized === !0 && (x =
|
|
3678
|
+
t.itemSize > 4 ? x = t.array[p * t.itemSize + y] : (y === 0 ? x = t.getX(p) : y === 1 ? x = t.getY(p) : y === 2 ? x = t.getZ(p) : y === 3 && (x = t.getW(p)), t.normalized === !0 && (x = ot.normalize(x, t.array))), e === T.FLOAT ? l.setFloat32(h, x, !0) : e === T.INT ? l.setInt32(h, x, !0) : e === T.UNSIGNED_INT ? l.setUint32(h, x, !0) : e === T.SHORT ? l.setInt16(h, x, !0) : e === T.UNSIGNED_SHORT ? l.setUint16(h, x, !0) : e === T.BYTE ? l.setInt8(h, x) : e === T.UNSIGNED_BYTE && l.setUint8(h, x), h += o;
|
|
3674
3679
|
}
|
|
3675
3680
|
h % a !== 0 && (h += a - h % a);
|
|
3676
3681
|
}
|
|
@@ -3679,7 +3684,7 @@ class Re {
|
|
|
3679
3684
|
byteOffset: this.byteOffset,
|
|
3680
3685
|
byteLength: c
|
|
3681
3686
|
};
|
|
3682
|
-
return i !== void 0 && (u.target = i), i ===
|
|
3687
|
+
return i !== void 0 && (u.target = i), i === T.ARRAY_BUFFER && (u.byteStride = a), this.byteOffset += c, r.bufferViews.push(u), {
|
|
3683
3688
|
id: r.bufferViews.length - 1,
|
|
3684
3689
|
byteLength: 0
|
|
3685
3690
|
};
|
|
@@ -3692,8 +3697,8 @@ class Re {
|
|
|
3692
3697
|
processBufferViewImage(t) {
|
|
3693
3698
|
const e = this, n = e.json;
|
|
3694
3699
|
return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
|
|
3695
|
-
|
|
3696
|
-
const r =
|
|
3700
|
+
rt(t).then((i) => {
|
|
3701
|
+
const r = it(i), o = {
|
|
3697
3702
|
buffer: e.processBuffer(r),
|
|
3698
3703
|
byteOffset: e.byteOffset,
|
|
3699
3704
|
byteLength: r.byteLength
|
|
@@ -3721,25 +3726,25 @@ class Re {
|
|
|
3721
3726
|
};
|
|
3722
3727
|
let o;
|
|
3723
3728
|
if (t.array.constructor === Float32Array)
|
|
3724
|
-
o =
|
|
3729
|
+
o = T.FLOAT;
|
|
3725
3730
|
else if (t.array.constructor === Int32Array)
|
|
3726
|
-
o =
|
|
3731
|
+
o = T.INT;
|
|
3727
3732
|
else if (t.array.constructor === Uint32Array)
|
|
3728
|
-
o =
|
|
3733
|
+
o = T.UNSIGNED_INT;
|
|
3729
3734
|
else if (t.array.constructor === Int16Array)
|
|
3730
|
-
o =
|
|
3735
|
+
o = T.SHORT;
|
|
3731
3736
|
else if (t.array.constructor === Uint16Array)
|
|
3732
|
-
o =
|
|
3737
|
+
o = T.UNSIGNED_SHORT;
|
|
3733
3738
|
else if (t.array.constructor === Int8Array)
|
|
3734
|
-
o =
|
|
3739
|
+
o = T.BYTE;
|
|
3735
3740
|
else if (t.array.constructor === Uint8Array)
|
|
3736
|
-
o =
|
|
3741
|
+
o = T.UNSIGNED_BYTE;
|
|
3737
3742
|
else
|
|
3738
3743
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
3739
3744
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
3740
|
-
const a =
|
|
3745
|
+
const a = Pe(t, n, s);
|
|
3741
3746
|
let c;
|
|
3742
|
-
e !== void 0 && (c = t === e.index ?
|
|
3747
|
+
e !== void 0 && (c = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
|
|
3743
3748
|
const l = this.processBufferView(t, o, n, s, c), h = {
|
|
3744
3749
|
bufferView: l.id,
|
|
3745
3750
|
byteOffset: l.byteOffset,
|
|
@@ -3766,26 +3771,26 @@ class Re {
|
|
|
3766
3771
|
const l = r.images.get(t), h = s + ":flipY/" + n.toString();
|
|
3767
3772
|
if (l[h] !== void 0) return l[h];
|
|
3768
3773
|
o.images || (o.images = []);
|
|
3769
|
-
const u = { mimeType: s }, f =
|
|
3774
|
+
const u = { mimeType: s }, f = At();
|
|
3770
3775
|
f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
|
|
3771
3776
|
const p = f.getContext("2d", {
|
|
3772
3777
|
willReadFrequently: !0
|
|
3773
3778
|
});
|
|
3774
3779
|
if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
|
|
3775
|
-
e !==
|
|
3780
|
+
e !== _t && console.error("GLTFExporter: Only RGBAFormat is supported.", e), (t.width > a.maxTextureSize || t.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", t);
|
|
3776
3781
|
const x = new Uint8ClampedArray(t.height * t.width * 4);
|
|
3777
|
-
for (let
|
|
3778
|
-
x[
|
|
3782
|
+
for (let m = 0; m < x.length; m += 4)
|
|
3783
|
+
x[m + 0] = t.data[m + 0], x[m + 1] = t.data[m + 1], x[m + 2] = t.data[m + 2], x[m + 3] = t.data[m + 3];
|
|
3779
3784
|
p.putImageData(new ImageData(x, t.width, t.height), 0, 0);
|
|
3780
3785
|
} else if (typeof HTMLImageElement < "u" && t instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && t instanceof ImageBitmap || typeof OffscreenCanvas < "u" && t instanceof OffscreenCanvas)
|
|
3781
3786
|
p.drawImage(t, 0, 0, f.width, f.height);
|
|
3782
3787
|
else
|
|
3783
3788
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
3784
3789
|
a.binary === !0 ? c.push(
|
|
3785
|
-
|
|
3790
|
+
Re(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
|
|
3786
3791
|
u.bufferView = x;
|
|
3787
3792
|
})
|
|
3788
|
-
) : u.uri =
|
|
3793
|
+
) : u.uri = qt.getDataURL(f, s);
|
|
3789
3794
|
const y = o.images.push(u) - 1;
|
|
3790
3795
|
return l[h] = y, y;
|
|
3791
3796
|
} else
|
|
@@ -3800,10 +3805,10 @@ class Re {
|
|
|
3800
3805
|
const e = this.json;
|
|
3801
3806
|
e.samplers || (e.samplers = []);
|
|
3802
3807
|
const n = {
|
|
3803
|
-
magFilter:
|
|
3804
|
-
minFilter:
|
|
3805
|
-
wrapS:
|
|
3806
|
-
wrapT:
|
|
3808
|
+
magFilter: G[t.magFilter],
|
|
3809
|
+
minFilter: G[t.minFilter],
|
|
3810
|
+
wrapS: G[t.wrapS],
|
|
3811
|
+
wrapT: G[t.wrapT]
|
|
3807
3812
|
};
|
|
3808
3813
|
return e.samplers.push(n) - 1;
|
|
3809
3814
|
}
|
|
@@ -3815,7 +3820,7 @@ class Re {
|
|
|
3815
3820
|
async processTextureAsync(t) {
|
|
3816
3821
|
const n = this.options, s = this.cache, i = this.json;
|
|
3817
3822
|
if (s.textures.has(t)) return s.textures.get(t);
|
|
3818
|
-
i.textures || (i.textures = []), t instanceof
|
|
3823
|
+
i.textures || (i.textures = []), t instanceof nt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
|
|
3819
3824
|
let r = t.userData.mimeType;
|
|
3820
3825
|
r === "image/webp" && (r = "image/png");
|
|
3821
3826
|
const o = {
|
|
@@ -3842,7 +3847,7 @@ class Re {
|
|
|
3842
3847
|
const s = { pbrMetallicRoughness: {} };
|
|
3843
3848
|
t.isMeshStandardMaterial !== !0 && t.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
3844
3849
|
const i = t.color.toArray().concat([t.opacity]);
|
|
3845
|
-
if (
|
|
3850
|
+
if (H(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), t.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = t.metalness, s.pbrMetallicRoughness.roughnessFactor = t.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), t.metalnessMap || t.roughnessMap) {
|
|
3846
3851
|
const o = await this.buildMetalRoughTextureAsync(t.metalnessMap, t.roughnessMap), a = {
|
|
3847
3852
|
index: await this.processTextureAsync(o),
|
|
3848
3853
|
texCoord: o.channel
|
|
@@ -3880,7 +3885,7 @@ class Re {
|
|
|
3880
3885
|
};
|
|
3881
3886
|
t.aoMapIntensity !== 1 && (o.strength = t.aoMapIntensity), this.applyTextureTransform(o, t.aoMap), s.occlusionTexture = o;
|
|
3882
3887
|
}
|
|
3883
|
-
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side ===
|
|
3888
|
+
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === Yt && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
|
|
3884
3889
|
o.writeMaterialAsync && await o.writeMaterialAsync(t, s);
|
|
3885
3890
|
});
|
|
3886
3891
|
const r = n.materials.push(s) - 1;
|
|
@@ -3894,15 +3899,15 @@ class Re {
|
|
|
3894
3899
|
async processMeshAsync(t) {
|
|
3895
3900
|
const e = this.cache, n = this.json, s = [t.geometry.uuid];
|
|
3896
3901
|
if (Array.isArray(t.material))
|
|
3897
|
-
for (let
|
|
3898
|
-
s.push(t.material[
|
|
3902
|
+
for (let g = 0, S = t.material.length; g < S; g++)
|
|
3903
|
+
s.push(t.material[g].uuid);
|
|
3899
3904
|
else
|
|
3900
3905
|
s.push(t.material.uuid);
|
|
3901
3906
|
const i = s.join(":");
|
|
3902
3907
|
if (e.meshes.has(i)) return e.meshes.get(i);
|
|
3903
3908
|
const r = t.geometry;
|
|
3904
3909
|
let o;
|
|
3905
|
-
t.isLineSegments ? o =
|
|
3910
|
+
t.isLineSegments ? o = T.LINES : t.isLineLoop ? o = T.LINE_LOOP : t.isLine ? o = T.LINE_STRIP : t.isPoints ? o = T.POINTS : o = t.material.wireframe ? T.LINES : T.TRIANGLES;
|
|
3906
3911
|
const a = {}, c = {}, l = [], h = [], u = {
|
|
3907
3912
|
uv: "TEXCOORD_0",
|
|
3908
3913
|
uv1: "TEXCOORD_1",
|
|
@@ -3914,76 +3919,76 @@ class Re {
|
|
|
3914
3919
|
}, f = r.getAttribute("normal");
|
|
3915
3920
|
f !== void 0 && !this.isNormalizedNormalAttribute(f) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), r.setAttribute("normal", this.createNormalizedNormalAttribute(f)));
|
|
3916
3921
|
let p = null;
|
|
3917
|
-
for (let
|
|
3918
|
-
if (
|
|
3919
|
-
const S = r.attributes[
|
|
3920
|
-
if (
|
|
3921
|
-
c[
|
|
3922
|
+
for (let g in r.attributes) {
|
|
3923
|
+
if (g.slice(0, 5) === "morph") continue;
|
|
3924
|
+
const S = r.attributes[g];
|
|
3925
|
+
if (g = u[g] || g.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g) || (g = "_" + g), e.attributes.has(this.getUID(S))) {
|
|
3926
|
+
c[g] = e.attributes.get(this.getUID(S));
|
|
3922
3927
|
continue;
|
|
3923
3928
|
}
|
|
3924
3929
|
p = null;
|
|
3925
|
-
const
|
|
3926
|
-
|
|
3927
|
-
const
|
|
3928
|
-
|
|
3930
|
+
const L = S.array;
|
|
3931
|
+
g === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(L), S.itemSize, S.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !g.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${g}" converted to type FLOAT.`), p = tt.Utils.toFloat32BufferAttribute(S));
|
|
3932
|
+
const b = this.processAccessor(p || S, r);
|
|
3933
|
+
b !== null && (g.startsWith("_") || this.detectMeshQuantization(g, S), c[g] = b, e.attributes.set(this.getUID(S), b));
|
|
3929
3934
|
}
|
|
3930
3935
|
if (f !== void 0 && r.setAttribute("normal", f), Object.keys(c).length === 0) return null;
|
|
3931
3936
|
if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
|
|
3932
|
-
const
|
|
3937
|
+
const g = [], S = [], D = {};
|
|
3933
3938
|
if (t.morphTargetDictionary !== void 0)
|
|
3934
|
-
for (const
|
|
3935
|
-
|
|
3936
|
-
for (let
|
|
3937
|
-
const
|
|
3938
|
-
let
|
|
3939
|
-
for (const
|
|
3940
|
-
if (
|
|
3941
|
-
|
|
3939
|
+
for (const L in t.morphTargetDictionary)
|
|
3940
|
+
D[t.morphTargetDictionary[L]] = L;
|
|
3941
|
+
for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
|
|
3942
|
+
const b = {};
|
|
3943
|
+
let R = !1;
|
|
3944
|
+
for (const P in r.morphAttributes) {
|
|
3945
|
+
if (P !== "position" && P !== "normal") {
|
|
3946
|
+
R || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), R = !0);
|
|
3942
3947
|
continue;
|
|
3943
3948
|
}
|
|
3944
|
-
const
|
|
3945
|
-
if (e.attributes.has(this.getUID(
|
|
3946
|
-
|
|
3949
|
+
const B = r.morphAttributes[P][L], C = P.toUpperCase(), U = r.attributes[P];
|
|
3950
|
+
if (e.attributes.has(this.getUID(B, !0))) {
|
|
3951
|
+
b[C] = e.attributes.get(this.getUID(B, !0));
|
|
3947
3952
|
continue;
|
|
3948
3953
|
}
|
|
3949
|
-
const
|
|
3954
|
+
const O = B.clone();
|
|
3950
3955
|
if (!r.morphTargetsRelative)
|
|
3951
|
-
for (let v = 0,
|
|
3952
|
-
for (let z = 0; z <
|
|
3953
|
-
z === 0 &&
|
|
3954
|
-
|
|
3956
|
+
for (let v = 0, V = B.count; v < V; v++)
|
|
3957
|
+
for (let z = 0; z < B.itemSize; z++)
|
|
3958
|
+
z === 0 && O.setX(v, B.getX(v) - U.getX(v)), z === 1 && O.setY(v, B.getY(v) - U.getY(v)), z === 2 && O.setZ(v, B.getZ(v) - U.getZ(v)), z === 3 && O.setW(v, B.getW(v) - U.getW(v));
|
|
3959
|
+
b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(U, !0), b[C]);
|
|
3955
3960
|
}
|
|
3956
|
-
h.push(
|
|
3961
|
+
h.push(b), g.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(D[L]);
|
|
3957
3962
|
}
|
|
3958
|
-
a.weights =
|
|
3963
|
+
a.weights = g, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
|
|
3959
3964
|
}
|
|
3960
3965
|
const y = Array.isArray(t.material);
|
|
3961
3966
|
if (y && r.groups.length === 0) return null;
|
|
3962
3967
|
let x = !1;
|
|
3963
3968
|
if (y && r.index === null) {
|
|
3964
|
-
const
|
|
3965
|
-
for (let S = 0,
|
|
3966
|
-
|
|
3967
|
-
r.setIndex(
|
|
3969
|
+
const g = [];
|
|
3970
|
+
for (let S = 0, D = r.attributes.position.count; S < D; S++)
|
|
3971
|
+
g[S] = S;
|
|
3972
|
+
r.setIndex(g), x = !0;
|
|
3968
3973
|
}
|
|
3969
|
-
const
|
|
3970
|
-
for (let
|
|
3971
|
-
const
|
|
3974
|
+
const m = y ? t.material : [t.material], E = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
|
|
3975
|
+
for (let g = 0, S = E.length; g < S; g++) {
|
|
3976
|
+
const D = {
|
|
3972
3977
|
mode: o,
|
|
3973
3978
|
attributes: c
|
|
3974
3979
|
};
|
|
3975
|
-
if (this.serializeUserData(r,
|
|
3976
|
-
let
|
|
3977
|
-
(
|
|
3980
|
+
if (this.serializeUserData(r, D), h.length > 0 && (D.targets = h), r.index !== null) {
|
|
3981
|
+
let b = this.getUID(r.index);
|
|
3982
|
+
(E[g].start !== void 0 || E[g].count !== void 0) && (b += ":" + E[g].start + ":" + E[g].count), e.attributes.has(b) ? D.indices = e.attributes.get(b) : (D.indices = this.processAccessor(r.index, r, E[g].start, E[g].count), e.attributes.set(b, D.indices)), D.indices === null && delete D.indices;
|
|
3978
3983
|
}
|
|
3979
|
-
const
|
|
3980
|
-
|
|
3984
|
+
const L = await this.processMaterialAsync(m[E[g].materialIndex]);
|
|
3985
|
+
L !== null && (D.material = L), l.push(D);
|
|
3981
3986
|
}
|
|
3982
|
-
x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(
|
|
3983
|
-
|
|
3987
|
+
x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(g) {
|
|
3988
|
+
g.writeMesh && g.writeMesh(t, a);
|
|
3984
3989
|
});
|
|
3985
|
-
const
|
|
3986
|
-
return e.meshes.set(i,
|
|
3990
|
+
const w = n.meshes.push(a) - 1;
|
|
3991
|
+
return e.meshes.set(i, w), w;
|
|
3987
3992
|
}
|
|
3988
3993
|
/**
|
|
3989
3994
|
* If a vertex attribute with a
|
|
@@ -3997,7 +4002,7 @@ class Re {
|
|
|
3997
4002
|
* @param {THREE.BufferAttribute} attribute
|
|
3998
4003
|
*/
|
|
3999
4004
|
detectMeshQuantization(t, e) {
|
|
4000
|
-
if (this.extensionsUsed[
|
|
4005
|
+
if (this.extensionsUsed[st]) return;
|
|
4001
4006
|
let n;
|
|
4002
4007
|
switch (e.array.constructor) {
|
|
4003
4008
|
case Int8Array:
|
|
@@ -4017,7 +4022,7 @@ class Re {
|
|
|
4017
4022
|
}
|
|
4018
4023
|
e.normalized && (n += " normalized");
|
|
4019
4024
|
const s = t.split("_", 1)[0];
|
|
4020
|
-
|
|
4025
|
+
St[s] && St[s].includes(n) && (this.extensionsUsed[st] = !0, this.extensionsRequired[st] = !0);
|
|
4021
4026
|
}
|
|
4022
4027
|
/**
|
|
4023
4028
|
* Process camera
|
|
@@ -4037,7 +4042,7 @@ class Re {
|
|
|
4037
4042
|
znear: t.near < 0 ? 0 : t.near
|
|
4038
4043
|
} : s.perspective = {
|
|
4039
4044
|
aspectRatio: t.aspect,
|
|
4040
|
-
yfov:
|
|
4045
|
+
yfov: ot.degToRad(t.fov),
|
|
4041
4046
|
zfar: t.far <= 0 ? 1e-3 : t.far,
|
|
4042
4047
|
znear: t.near < 0 ? 0 : t.near
|
|
4043
4048
|
}, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
|
|
@@ -4054,21 +4059,21 @@ class Re {
|
|
|
4054
4059
|
*/
|
|
4055
4060
|
processAnimation(t, e) {
|
|
4056
4061
|
const n = this.json, s = this.nodeMap;
|
|
4057
|
-
n.animations || (n.animations = []), t =
|
|
4062
|
+
n.animations || (n.animations = []), t = tt.Utils.mergeMorphTargetTracks(t.clone(), e);
|
|
4058
4063
|
const i = t.tracks, r = [], o = [];
|
|
4059
4064
|
for (let c = 0; c < i.length; ++c) {
|
|
4060
|
-
const l = i[c], h =
|
|
4061
|
-
let u =
|
|
4062
|
-
const f =
|
|
4065
|
+
const l = i[c], h = K.parseTrackName(l.name);
|
|
4066
|
+
let u = K.findNode(e, h.nodeName);
|
|
4067
|
+
const f = Et[h.propertyName];
|
|
4063
4068
|
if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !f) {
|
|
4064
4069
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
|
|
4065
4070
|
continue;
|
|
4066
4071
|
}
|
|
4067
4072
|
const p = 1;
|
|
4068
4073
|
let y = l.values.length / l.times.length;
|
|
4069
|
-
f ===
|
|
4074
|
+
f === Et.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
|
|
4070
4075
|
let x;
|
|
4071
|
-
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() ===
|
|
4076
|
+
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
|
|
4072
4077
|
input: this.processAccessor(new _(l.times, p)),
|
|
4073
4078
|
output: this.processAccessor(new _(l.values, y)),
|
|
4074
4079
|
interpolation: x
|
|
@@ -4096,7 +4101,7 @@ class Re {
|
|
|
4096
4101
|
if (i === void 0) return null;
|
|
4097
4102
|
const r = t.skeleton.bones[0];
|
|
4098
4103
|
if (r === void 0) return null;
|
|
4099
|
-
const o = [], a = new Float32Array(i.bones.length * 16), c = new
|
|
4104
|
+
const o = [], a = new Float32Array(i.bones.length * 16), c = new bt();
|
|
4100
4105
|
for (let h = 0; h < i.bones.length; ++h)
|
|
4101
4106
|
o.push(n.get(i.bones[h])), c.copy(i.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
|
|
4102
4107
|
return e.skins === void 0 && (e.skins = []), e.skins.push({
|
|
@@ -4116,9 +4121,9 @@ class Re {
|
|
|
4116
4121
|
const i = {};
|
|
4117
4122
|
if (n.trs) {
|
|
4118
4123
|
const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
|
|
4119
|
-
|
|
4124
|
+
H(o, [0, 0, 0, 1]) || (i.rotation = o), H(a, [0, 0, 0]) || (i.translation = a), H(c, [1, 1, 1]) || (i.scale = c);
|
|
4120
4125
|
} else
|
|
4121
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
4126
|
+
t.matrixAutoUpdate && t.updateMatrix(), Ie(t.matrix) === !1 && (i.matrix = t.matrix.elements);
|
|
4122
4127
|
if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
|
|
4123
4128
|
const o = await this.processMeshAsync(t);
|
|
4124
4129
|
o !== null && (i.mesh = o);
|
|
@@ -4164,7 +4169,7 @@ class Re {
|
|
|
4164
4169
|
* @param {Array<THREE.Object3D>} objects List of objects to process
|
|
4165
4170
|
*/
|
|
4166
4171
|
async processObjectsAsync(t) {
|
|
4167
|
-
const e = new
|
|
4172
|
+
const e = new ft();
|
|
4168
4173
|
e.name = "AuxScene";
|
|
4169
4174
|
for (let n = 0; n < t.length; n++)
|
|
4170
4175
|
e.children.push(t[n]);
|
|
@@ -4180,7 +4185,7 @@ class Re {
|
|
|
4180
4185
|
});
|
|
4181
4186
|
const n = [];
|
|
4182
4187
|
for (let s = 0; s < t.length; s++)
|
|
4183
|
-
t[s] instanceof
|
|
4188
|
+
t[s] instanceof ft ? await this.processSceneAsync(t[s]) : n.push(t[s]);
|
|
4184
4189
|
n.length > 0 && await this.processObjectsAsync(n);
|
|
4185
4190
|
for (let s = 0; s < this.skins.length; ++s)
|
|
4186
4191
|
this.processSkin(this.skins[s]);
|
|
@@ -4195,7 +4200,7 @@ class Re {
|
|
|
4195
4200
|
await t(this.plugins[e]);
|
|
4196
4201
|
}
|
|
4197
4202
|
}
|
|
4198
|
-
class
|
|
4203
|
+
class Ne {
|
|
4199
4204
|
constructor(t) {
|
|
4200
4205
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
4201
4206
|
}
|
|
@@ -4211,7 +4216,7 @@ class ve {
|
|
|
4211
4216
|
o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
|
|
4212
4217
|
}
|
|
4213
4218
|
}
|
|
4214
|
-
class
|
|
4219
|
+
class Ce {
|
|
4215
4220
|
constructor(t) {
|
|
4216
4221
|
this.writer = t, this.name = "KHR_materials_unlit";
|
|
4217
4222
|
}
|
|
@@ -4221,7 +4226,7 @@ class Ne {
|
|
|
4221
4226
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
4222
4227
|
}
|
|
4223
4228
|
}
|
|
4224
|
-
class
|
|
4229
|
+
class Be {
|
|
4225
4230
|
constructor(t) {
|
|
4226
4231
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
4227
4232
|
}
|
|
@@ -4252,7 +4257,7 @@ class Ce {
|
|
|
4252
4257
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4253
4258
|
}
|
|
4254
4259
|
}
|
|
4255
|
-
class
|
|
4260
|
+
class Oe {
|
|
4256
4261
|
constructor(t) {
|
|
4257
4262
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
4258
4263
|
}
|
|
@@ -4262,7 +4267,7 @@ class Be {
|
|
|
4262
4267
|
i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4263
4268
|
}
|
|
4264
4269
|
}
|
|
4265
|
-
class
|
|
4270
|
+
class Fe {
|
|
4266
4271
|
constructor(t) {
|
|
4267
4272
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
4268
4273
|
}
|
|
@@ -4286,7 +4291,7 @@ class Oe {
|
|
|
4286
4291
|
e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4287
4292
|
}
|
|
4288
4293
|
}
|
|
4289
|
-
class
|
|
4294
|
+
class Ge {
|
|
4290
4295
|
constructor(t) {
|
|
4291
4296
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
4292
4297
|
}
|
|
@@ -4320,7 +4325,7 @@ class Ue {
|
|
|
4320
4325
|
t.attenuationDistance !== 1 / 0 && (i.attenuationDistance = t.attenuationDistance), i.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4321
4326
|
}
|
|
4322
4327
|
}
|
|
4323
|
-
class
|
|
4328
|
+
class ze {
|
|
4324
4329
|
constructor(t) {
|
|
4325
4330
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
4326
4331
|
}
|
|
@@ -4330,12 +4335,12 @@ class Ge {
|
|
|
4330
4335
|
i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4331
4336
|
}
|
|
4332
4337
|
}
|
|
4333
|
-
class
|
|
4338
|
+
class je {
|
|
4334
4339
|
constructor(t) {
|
|
4335
4340
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
4336
4341
|
}
|
|
4337
4342
|
async writeMaterialAsync(t, e) {
|
|
4338
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
4343
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Ee) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
4339
4344
|
const n = this.writer, s = n.extensionsUsed, i = {};
|
|
4340
4345
|
if (t.specularIntensityMap) {
|
|
4341
4346
|
const r = {
|
|
@@ -4354,7 +4359,7 @@ class ze {
|
|
|
4354
4359
|
i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4355
4360
|
}
|
|
4356
4361
|
}
|
|
4357
|
-
class
|
|
4362
|
+
class _e {
|
|
4358
4363
|
constructor(t) {
|
|
4359
4364
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
4360
4365
|
}
|
|
@@ -4378,7 +4383,7 @@ class je {
|
|
|
4378
4383
|
i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4379
4384
|
}
|
|
4380
4385
|
}
|
|
4381
|
-
class
|
|
4386
|
+
class qe {
|
|
4382
4387
|
constructor(t) {
|
|
4383
4388
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
4384
4389
|
}
|
|
@@ -4392,7 +4397,7 @@ class _e {
|
|
|
4392
4397
|
i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4393
4398
|
}
|
|
4394
4399
|
}
|
|
4395
|
-
class
|
|
4400
|
+
class Ye {
|
|
4396
4401
|
constructor(t) {
|
|
4397
4402
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
4398
4403
|
}
|
|
@@ -4402,7 +4407,7 @@ class qe {
|
|
|
4402
4407
|
i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4403
4408
|
}
|
|
4404
4409
|
}
|
|
4405
|
-
class
|
|
4410
|
+
class ke {
|
|
4406
4411
|
constructor(t) {
|
|
4407
4412
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
4408
4413
|
}
|
|
@@ -4419,13 +4424,13 @@ class Ye {
|
|
|
4419
4424
|
i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
|
|
4420
4425
|
}
|
|
4421
4426
|
}
|
|
4422
|
-
class
|
|
4427
|
+
class Ve {
|
|
4423
4428
|
constructor(t) {
|
|
4424
4429
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
4425
4430
|
}
|
|
4426
4431
|
writeNode(t, e) {
|
|
4427
4432
|
if (!t.isInstancedMesh) return;
|
|
4428
|
-
const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new
|
|
4433
|
+
const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new bt(), c = new $(), l = new Gt(), h = new $();
|
|
4429
4434
|
for (let f = 0; f < s.count; f++)
|
|
4430
4435
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
|
|
4431
4436
|
const u = {
|
|
@@ -4436,7 +4441,7 @@ class ke {
|
|
|
4436
4441
|
s.instanceColor && (u._COLOR_0 = n.processAccessor(s.instanceColor)), e.extensions = e.extensions || {}, e.extensions[this.name] = { attributes: u }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
|
|
4437
4442
|
}
|
|
4438
4443
|
}
|
|
4439
|
-
|
|
4444
|
+
tt.Utils = {
|
|
4440
4445
|
insertKeyframe: function(d, t) {
|
|
4441
4446
|
const n = d.getValueSize(), s = new d.TimeBufferType(d.times.length + 1), i = new d.ValueBufferType(d.values.length + n), r = d.createInterpolant(new d.ValueBufferType(n));
|
|
4442
4447
|
let o;
|
|
@@ -4466,7 +4471,7 @@ Z.Utils = {
|
|
|
4466
4471
|
const e = [], n = {}, s = d.tracks;
|
|
4467
4472
|
for (let i = 0; i < s.length; ++i) {
|
|
4468
4473
|
let r = s[i];
|
|
4469
|
-
const o =
|
|
4474
|
+
const o = K.parseTrackName(r.name), a = K.findNode(t, o.nodeName);
|
|
4470
4475
|
if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
|
|
4471
4476
|
e.push(r);
|
|
4472
4477
|
continue;
|
|
@@ -4474,7 +4479,7 @@ Z.Utils = {
|
|
|
4474
4479
|
if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
|
|
4475
4480
|
if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
|
|
4476
4481
|
throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
|
|
4477
|
-
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(
|
|
4482
|
+
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(ee);
|
|
4478
4483
|
}
|
|
4479
4484
|
const c = a.morphTargetInfluences.length, l = a.morphTargetDictionary[o.propertyIndex];
|
|
4480
4485
|
if (l === void 0)
|
|
@@ -4519,7 +4524,7 @@ async function Xe(d) {
|
|
|
4519
4524
|
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(d);
|
|
4520
4525
|
});
|
|
4521
4526
|
}
|
|
4522
|
-
async function
|
|
4527
|
+
async function rt(d) {
|
|
4523
4528
|
if (typeof d.arrayBuffer == "function")
|
|
4524
4529
|
return await d.arrayBuffer();
|
|
4525
4530
|
if (typeof FileReader < "u")
|
|
@@ -4532,8 +4537,8 @@ async function st(d) {
|
|
|
4532
4537
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
4533
4538
|
}
|
|
4534
4539
|
}
|
|
4535
|
-
const
|
|
4536
|
-
function
|
|
4540
|
+
const We = new ne(), He = new tt();
|
|
4541
|
+
function Je(d, t, e = 0.1) {
|
|
4537
4542
|
const n = t.normal(d), s = t.direction(d).mutiplyScalar(e * 0.5), i = d.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
|
|
4538
4543
|
return {
|
|
4539
4544
|
points: [
|
|
@@ -4548,7 +4553,7 @@ function He(d, t, e = 0.1) {
|
|
|
4548
4553
|
rectIndices: [0, 1, 3, 2, 0]
|
|
4549
4554
|
};
|
|
4550
4555
|
}
|
|
4551
|
-
class
|
|
4556
|
+
class Nt extends q {
|
|
4552
4557
|
static name = "WhiteModel";
|
|
4553
4558
|
Dxf = null;
|
|
4554
4559
|
Variable = null;
|
|
@@ -4578,7 +4583,7 @@ class Rt extends q {
|
|
|
4578
4583
|
new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
|
|
4579
4584
|
);
|
|
4580
4585
|
}), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
|
|
4581
|
-
const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } =
|
|
4586
|
+
const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = Je(r, o, t.width);
|
|
4582
4587
|
return {
|
|
4583
4588
|
points: a,
|
|
4584
4589
|
indices: c,
|
|
@@ -4611,7 +4616,7 @@ class Rt extends q {
|
|
|
4611
4616
|
toOBJ() {
|
|
4612
4617
|
return new Promise((t) => {
|
|
4613
4618
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
4614
|
-
t(
|
|
4619
|
+
t(We.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
4615
4620
|
}, 20);
|
|
4616
4621
|
});
|
|
4617
4622
|
}
|
|
@@ -4623,7 +4628,7 @@ class Rt extends q {
|
|
|
4623
4628
|
toGltf(t = !0) {
|
|
4624
4629
|
return new Promise((e) => {
|
|
4625
4630
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
4626
|
-
|
|
4631
|
+
He.parse(this.whiteModelGroup.children, (n) => {
|
|
4627
4632
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
4628
4633
|
}, () => {
|
|
4629
4634
|
e(void 0);
|
|
@@ -4684,7 +4689,7 @@ class Rt extends q {
|
|
|
4684
4689
|
}
|
|
4685
4690
|
}
|
|
4686
4691
|
}
|
|
4687
|
-
class
|
|
4692
|
+
class Ct extends q {
|
|
4688
4693
|
static name = "DetailsPoint";
|
|
4689
4694
|
Dxf = null;
|
|
4690
4695
|
WhiteModel = null;
|
|
@@ -4761,7 +4766,7 @@ class vt extends q {
|
|
|
4761
4766
|
}, 50);
|
|
4762
4767
|
}
|
|
4763
4768
|
}
|
|
4764
|
-
class
|
|
4769
|
+
class Bt extends q {
|
|
4765
4770
|
static name = "DxfLineModel";
|
|
4766
4771
|
dxfLineModel = new I.LineSegments();
|
|
4767
4772
|
dxfDoorsLineModel = new I.LineSegments();
|
|
@@ -4784,38 +4789,38 @@ class Nt extends q {
|
|
|
4784
4789
|
});
|
|
4785
4790
|
}
|
|
4786
4791
|
}
|
|
4787
|
-
const
|
|
4792
|
+
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4788
4793
|
__proto__: null,
|
|
4789
|
-
DetailsPoint:
|
|
4790
|
-
DxfLineModel:
|
|
4791
|
-
WhiteModel:
|
|
4794
|
+
DetailsPoint: Ct,
|
|
4795
|
+
DxfLineModel: Bt,
|
|
4796
|
+
WhiteModel: Nt
|
|
4792
4797
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4793
|
-
function
|
|
4798
|
+
function Tt(d, t = {}) {
|
|
4794
4799
|
const {
|
|
4795
4800
|
detailsPoint: e = !0,
|
|
4796
4801
|
whiteModel: n = !0,
|
|
4797
4802
|
dxfLineModel: s = !0
|
|
4798
4803
|
} = t;
|
|
4799
|
-
s && d.addComponent(new
|
|
4804
|
+
s && d.addComponent(new Bt()), n && d.addComponent(new Nt()), e && d.addComponent(new Ct());
|
|
4800
4805
|
}
|
|
4801
|
-
const
|
|
4806
|
+
const Ke = Object.assign(Tt, {
|
|
4802
4807
|
create(d = {}) {
|
|
4803
|
-
return (t) =>
|
|
4808
|
+
return (t) => Tt(t, d);
|
|
4804
4809
|
}
|
|
4805
|
-
}),
|
|
4810
|
+
}), Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4806
4811
|
__proto__: null,
|
|
4807
|
-
ModelDataPlugin:
|
|
4808
|
-
components:
|
|
4812
|
+
ModelDataPlugin: Ke,
|
|
4813
|
+
components: $e
|
|
4809
4814
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4810
|
-
function
|
|
4815
|
+
function Qe() {
|
|
4811
4816
|
return import("./index2.js");
|
|
4812
4817
|
}
|
|
4813
|
-
function
|
|
4818
|
+
function tn() {
|
|
4814
4819
|
return import("./index3.js");
|
|
4815
4820
|
}
|
|
4816
|
-
let
|
|
4817
|
-
async function
|
|
4818
|
-
const s = await Promise.resolve().then(() =>
|
|
4821
|
+
let dt = null;
|
|
4822
|
+
async function cn(d, t, e = !1, n) {
|
|
4823
|
+
const s = await Promise.resolve().then(() => Ze), i = await Qe(), r = await tn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
|
|
4819
4824
|
detailsPoint: !1,
|
|
4820
4825
|
whiteModel: !0
|
|
4821
4826
|
})).usePlugin(i.RenderPlugin.create({
|
|
@@ -4825,12 +4830,12 @@ async function an(d, t, e = !1, n) {
|
|
|
4825
4830
|
orbitControls: e,
|
|
4826
4831
|
camera: t
|
|
4827
4832
|
})).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
|
|
4828
|
-
return a && d.appendChild(a.domElement),
|
|
4833
|
+
return a && d.appendChild(a.domElement), dt = o, {
|
|
4829
4834
|
dxfSystem: o,
|
|
4830
|
-
getFileAll: () =>
|
|
4835
|
+
getFileAll: () => en(o)
|
|
4831
4836
|
};
|
|
4832
4837
|
}
|
|
4833
|
-
async function
|
|
4838
|
+
async function en(d = dt) {
|
|
4834
4839
|
const t = d.findComponentByName("WhiteModel"), e = new File([await d.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([d.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([d.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(d.Dxf.originalData)], "json.json", { type: "application/json" });
|
|
4835
4840
|
return {
|
|
4836
4841
|
dxf: n,
|
|
@@ -4842,30 +4847,30 @@ async function tn(d = ht) {
|
|
|
4842
4847
|
correctionDxf: s
|
|
4843
4848
|
};
|
|
4844
4849
|
}
|
|
4845
|
-
function
|
|
4846
|
-
return
|
|
4850
|
+
function ln() {
|
|
4851
|
+
return dt;
|
|
4847
4852
|
}
|
|
4848
4853
|
export {
|
|
4849
|
-
|
|
4850
|
-
|
|
4854
|
+
Pt as A,
|
|
4855
|
+
N as B,
|
|
4851
4856
|
q as C,
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
L,
|
|
4855
|
-
|
|
4857
|
+
ht as D,
|
|
4858
|
+
It as E,
|
|
4859
|
+
A as L,
|
|
4860
|
+
Ke as M,
|
|
4856
4861
|
M as P,
|
|
4857
4862
|
F as Q,
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4863
|
+
Se as T,
|
|
4864
|
+
Rt as V,
|
|
4865
|
+
Nt as W,
|
|
4866
|
+
Ct as a,
|
|
4867
|
+
X as b,
|
|
4868
|
+
cn as c,
|
|
4869
|
+
ln as d,
|
|
4865
4870
|
k as e,
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
+
an as f,
|
|
4872
|
+
en as g,
|
|
4873
|
+
$e as i,
|
|
4874
|
+
Q as r,
|
|
4875
|
+
at as u
|
|
4871
4876
|
};
|