rm-graphical-computing 1.0.37 → 1.0.38
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/dist/index.cjs +1 -1
- package/dist/index.js +742 -581
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112,18 +112,23 @@ var E = class extends s {
|
|
|
112
112
|
new d(), new o(), new o(), new d(), new d();
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/utils/utils.mjs
|
|
115
|
-
var D = (t, n, r
|
|
115
|
+
var D = (t, n, r) => {
|
|
116
|
+
let i = new e.LineBasicMaterial({ color: "#0011ff" }), a = [];
|
|
117
|
+
a.push(t), a.push(n);
|
|
118
|
+
let o = new e.BufferGeometry();
|
|
119
|
+
o.setFromPoints(a), o.rotateX(-Math.PI / 2), r.add(new e.Line(o, i));
|
|
120
|
+
}, O = (t, n, r, i, a = 1e-8) => {
|
|
116
121
|
let o = n.x - t.x, s = n.y - t.y, c = i.x - r.x, l = i.y - r.y, u = o * l - s * c;
|
|
117
122
|
if (Math.abs(u) < a) return null;
|
|
118
123
|
let d = ((r.x - t.x) * l - (r.y - t.y) * c) / u, f = ((r.x - t.x) * s - (r.y - t.y) * o) / u;
|
|
119
124
|
return d < -a || d > 1 + a || f < -a || f > 1 + a ? null : { point: new e.Vector3(t.x + d * o, t.y + d * s, t.z) };
|
|
120
|
-
},
|
|
125
|
+
}, k = (t, n, r = {}) => {
|
|
121
126
|
let { fontSize: i = 36, fontFamily: a = "sans-serif", backgroundColor: o = "rgba(0,0,0,0)", textColor: s = "#ffffff", padding: c = 10, maxWidth: l = 256 } = r, u = document.createElement("canvas").getContext("2d");
|
|
122
127
|
u.font = `bold ${i}px ${a}`;
|
|
123
128
|
let d = u.measureText(t).width, f = Math.min(d + c * 2, l), p = i + c * 2, m = document.createElement("canvas");
|
|
124
129
|
m.width = f, m.height = p;
|
|
125
130
|
let h = m.getContext("2d");
|
|
126
|
-
h.fillStyle = o, h.fillRect(0, 0, f, p), h.fillStyle = s, h.font = `bold ${i}px ${a}`, h.textAlign = "center", h.textBaseline = "middle", d > l - c * 2 ?
|
|
131
|
+
h.fillStyle = o, h.fillRect(0, 0, f, p), h.fillStyle = s, h.font = `bold ${i}px ${a}`, h.textAlign = "center", h.textBaseline = "middle", d > l - c * 2 ? A(h, t, f / 2, p / 2, l, i) : h.fillText(t, f / 2, p / 2);
|
|
127
132
|
let g = new e.CanvasTexture(m), _ = new e.SpriteMaterial({
|
|
128
133
|
map: g,
|
|
129
134
|
depthTest: !1,
|
|
@@ -133,7 +138,7 @@ var D = (t, n, r, i, a = 1e-8) => {
|
|
|
133
138
|
let y = .005;
|
|
134
139
|
return v.scale.set(f * y, p * y, 1), v;
|
|
135
140
|
};
|
|
136
|
-
function
|
|
141
|
+
function A(e, t, n, r, i, a) {
|
|
137
142
|
let o = t.split(""), s = "", c = a * 1.2, l = r;
|
|
138
143
|
for (let t = 0; t < o.length; t++) {
|
|
139
144
|
let r = s + o[t];
|
|
@@ -141,7 +146,7 @@ function k(e, t, n, r, i, a) {
|
|
|
141
146
|
}
|
|
142
147
|
e.fillText(s, n, l);
|
|
143
148
|
}
|
|
144
|
-
var
|
|
149
|
+
var j = (e, t, n = .01) => {
|
|
145
150
|
let r = Math.sqrt(e.x * e.x + e.y * e.y + e.z * e.z), i = Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z);
|
|
146
151
|
if (r < 1e-10 || i < 1e-10) return {
|
|
147
152
|
parallel: !1,
|
|
@@ -165,7 +170,7 @@ var A = (e, t, n = .01) => {
|
|
|
165
170
|
angle: c
|
|
166
171
|
};
|
|
167
172
|
};
|
|
168
|
-
function
|
|
173
|
+
function M(t, n, r) {
|
|
169
174
|
let i = new e.BufferGeometry(), a = [], o = [];
|
|
170
175
|
t.forEach((e) => a.push(e.x, e.y, e.z)), n.forEach((e) => a.push(e.x, e.y, e.z)), o.push(0, 2, 1, 0, 3, 2), o.push(4, 5, 6, 4, 6, 7), o.push(0, 1, 5, 0, 5, 4), o.push(1, 2, 6, 1, 6, 5), o.push(2, 3, 7, 2, 7, 6), o.push(3, 0, 4, 3, 4, 7), i.setAttribute("position", new e.Float32BufferAttribute(a, 3)), i.setIndex(o), i.computeVertexNormals();
|
|
171
176
|
let s = new e.MeshBasicMaterial({
|
|
@@ -176,7 +181,7 @@ function j(t, n, r) {
|
|
|
176
181
|
});
|
|
177
182
|
return new e.Mesh(i, s);
|
|
178
183
|
}
|
|
179
|
-
var
|
|
184
|
+
var N = class {
|
|
180
185
|
constructor(t = {}) {
|
|
181
186
|
this.config = {
|
|
182
187
|
value: t.value || "0.0000m",
|
|
@@ -218,14 +223,14 @@ var M = class {
|
|
|
218
223
|
dispose() {
|
|
219
224
|
this.labelElement && this.labelElement.parentNode && this.labelElement.parentNode.removeChild(this.labelElement), this.label = null, this.labelElement = null;
|
|
220
225
|
}
|
|
221
|
-
},
|
|
226
|
+
}, P = (t) => {
|
|
222
227
|
let n = new e.Group(), r = new e.Group();
|
|
223
228
|
if (t && t.length) {
|
|
224
229
|
let i = /* @__PURE__ */ "green.red.pink.white.azure.yellow.bisque.grey.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkgrey.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkslategrey.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dimgrey.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.aliceblue.greenyellow.black.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightgrey.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightslategrey.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.yellow.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.slategrey.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen".split(".");
|
|
225
230
|
t.forEach((t, a) => {
|
|
226
231
|
let o = i[a], s = new e.Group(), { pcdPoints: c, category: l, name: u, center: d, box: f, obbBox: p, contour: m, nline: h, coordinatesByWidth: g, coordinatesByArea: _ } = t, v = c.length, y = new e.Box3(new e.Vector3(f.min.x, f.min.y, f.min.z), new e.Vector3(f.max.x, f.max.y, f.max.z)), b = new e.Box3Helper(y, o);
|
|
227
232
|
s.add(b);
|
|
228
|
-
let x = new
|
|
233
|
+
let x = new N({
|
|
229
234
|
value: u,
|
|
230
235
|
position: new e.Vector3(d.x, d.y, d.z)
|
|
231
236
|
}).getLabel();
|
|
@@ -274,15 +279,15 @@ var M = class {
|
|
|
274
279
|
depthWrite: !1
|
|
275
280
|
}), s = new e.Line(a, o);
|
|
276
281
|
l == "door" ? n.add(s) : r.add(s);
|
|
277
|
-
let c =
|
|
282
|
+
let c = M(i.map((t) => new e.Vector3(t.x, t.y, _.heightData.minZ)), i.map((t) => new e.Vector3(t.x, t.y, t.z)), l);
|
|
278
283
|
l == "door" ? n.add(c) : r.add(c);
|
|
279
284
|
let [u, d, f] = t, p = u.distanceTo(d), m = new e.Vector3().copy(u).add(d).multiplyScalar(.5);
|
|
280
|
-
new
|
|
285
|
+
new N({
|
|
281
286
|
value: String(p.toFixed(3)),
|
|
282
287
|
position: m
|
|
283
288
|
}).getLabel();
|
|
284
289
|
let h = d.distanceTo(f), g = new e.Vector3().copy(d).add(f).multiplyScalar(.5);
|
|
285
|
-
new
|
|
290
|
+
new N({
|
|
286
291
|
value: String(h.toFixed(3)),
|
|
287
292
|
position: g
|
|
288
293
|
}).getLabel();
|
|
@@ -300,7 +305,7 @@ var M = class {
|
|
|
300
305
|
AiProjectionGroup: n,
|
|
301
306
|
AiProjectionGroup2: r
|
|
302
307
|
};
|
|
303
|
-
},
|
|
308
|
+
}, F = (t, n, r, i) => {
|
|
304
309
|
let a = t, o = [];
|
|
305
310
|
if (i && i.length && (o = i.map((e) => e.clone())), !a || a.length < 4) return {};
|
|
306
311
|
let s = new e.Vector3().subVectors(a[1], a[0]).normalize(), c = new e.Vector3().subVectors(a[3], a[0]).normalize(), l = s.clone().cross(c).normalize(), u = Infinity, d = -Infinity, f = Infinity, p = -Infinity;
|
|
@@ -313,7 +318,7 @@ var M = class {
|
|
|
313
318
|
g,
|
|
314
319
|
_,
|
|
315
320
|
v
|
|
316
|
-
], b =
|
|
321
|
+
], b = j(new e.Vector3().subVectors(h, g), new e.Vector3(0, 0, 1));
|
|
317
322
|
b && b.parallel && (y = [
|
|
318
323
|
h,
|
|
319
324
|
v,
|
|
@@ -371,7 +376,7 @@ var M = class {
|
|
|
371
376
|
boxArea: S,
|
|
372
377
|
totalInPlaneNum: x
|
|
373
378
|
};
|
|
374
|
-
},
|
|
379
|
+
}, I = (t, n, r, i, a = e.MathUtils.degToRad(8)) => {
|
|
375
380
|
let o = new e.Vector3(), s = new e.Vector3();
|
|
376
381
|
o.subVectors(new e.Vector3(n.x, n.y, 0), new e.Vector3(t.x, t.y, 0)).normalize(), s.subVectors(new e.Vector3(i.x, i.y, 0), new e.Vector3(r.x, r.y, 0)).normalize();
|
|
377
382
|
let c = o.dot(s), l = Math.acos(Math.min(Math.abs(c), 1)), u = 1 - Math.min(l / a, 1), d = c > 0 ? "same" : "opposite";
|
|
@@ -386,7 +391,7 @@ var M = class {
|
|
|
386
391
|
v2: s
|
|
387
392
|
}
|
|
388
393
|
};
|
|
389
|
-
},
|
|
394
|
+
}, L = (t, n, r, i) => {
|
|
390
395
|
let a = new e.Vector3().subVectors(n, t), o = new e.Vector3().subVectors(i, r), s = a.length(), c = o.length();
|
|
391
396
|
if (s === 0 || c === 0) return {
|
|
392
397
|
rate: NaN,
|
|
@@ -403,7 +408,7 @@ var M = class {
|
|
|
403
408
|
isPerpendicular: Math.abs(f - 90) < .01,
|
|
404
409
|
isParallel: f < .01
|
|
405
410
|
};
|
|
406
|
-
},
|
|
411
|
+
}, R = (t, n, r = !1) => new e.Vector3((t.x + n.x) / 2, (t.y + n.y) / 2, r ? 0 : (t.z + n.z) / 2), z = (t, n, r, i, a = {}) => {
|
|
407
412
|
let { parallelAngleMax: o = e.MathUtils.degToRad(10), collinearAngleMax: s = e.MathUtils.degToRad(7), distanceThreshold: c = 2, overlapThreshold: l = .01 } = a, u = new e.Vector3().subVectors(n, t), d = new e.Vector3().subVectors(i, r), f = u.clone().normalize(), p = d.clone().normalize(), m = e.MathUtils.clamp(f.dot(p), -1, 1), h = Math.acos(Math.abs(m)), g = e.MathUtils.radToDeg(h);
|
|
408
413
|
if (h > o) return {
|
|
409
414
|
type: "not_parallel",
|
|
@@ -436,7 +441,7 @@ function te(t, n, r, i) {
|
|
|
436
441
|
let g = t.clone().add(a.clone().multiplyScalar(m)), _ = r.clone().add(o.clone().multiplyScalar(h));
|
|
437
442
|
return g.distanceTo(_);
|
|
438
443
|
}
|
|
439
|
-
var
|
|
444
|
+
var ne = (t, n, r, i = .05, a = .02) => {
|
|
440
445
|
let [o, s, c, l] = t, u = new e.Vector3().subVectors(s, o), d = new e.Vector3().subVectors(l, o), f = new e.Vector3().crossVectors(u, d).normalize(), p = u.length(), m = d.length(), h = u.clone().normalize(), g = d.clone().normalize(), _ = r - i, v = r + i, y = new e.Vector3(), b = [], x = Math.ceil(p / a), S = Math.ceil(m / a), C = p / x, w = m / S, T = new Uint8Array(x * S);
|
|
441
446
|
for (let t = 0; t < n.length; t++) {
|
|
442
447
|
y.subVectors(n[t], o);
|
|
@@ -457,8 +462,8 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
457
462
|
quadArea: O,
|
|
458
463
|
coveredArea: k
|
|
459
464
|
};
|
|
460
|
-
},
|
|
461
|
-
let n = new e.Vector3(t.start.x, t.start.y, t.start.z), r = new e.Vector3(t.end.x, t.end.y, t.end.z), i = n.distanceTo(r), a = t.rooftopPz - t.start.z, o =
|
|
465
|
+
}, re = (e, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(e)))), ie = (t) => {
|
|
466
|
+
let n = new e.Vector3(t.start.x, t.start.y, t.start.z), r = new e.Vector3(t.end.x, t.end.y, t.end.z), i = n.distanceTo(r), a = t.rooftopPz - t.start.z, o = re(i, 100), s = re(a, 70), c = a / s, l = /* @__PURE__ */ new Map();
|
|
462
467
|
for (let e = 0; e < s; e++) l.set((e + 1) * c, {
|
|
463
468
|
count: 0,
|
|
464
469
|
minZ: Infinity,
|
|
@@ -485,7 +490,7 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
485
490
|
minZ: p,
|
|
486
491
|
maxZ: m
|
|
487
492
|
};
|
|
488
|
-
},
|
|
493
|
+
}, ae = (t, n, r) => {
|
|
489
494
|
let i = new e.Plane(), a = new e.Vector3(t.x, t.y, t.z), o = new e.Vector3(n.x, n.y, n.z), s = new e.Vector3(n.x, n.y, n.z + 5);
|
|
490
495
|
i.setFromCoplanarPoints(a, o, s);
|
|
491
496
|
let c = [], l = [];
|
|
@@ -503,7 +508,7 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
503
508
|
newProjectPoints: h,
|
|
504
509
|
newOnLinePoints: m
|
|
505
510
|
};
|
|
506
|
-
},
|
|
511
|
+
}, oe = (t) => {
|
|
507
512
|
function n(t, n, r, i, a, o, s, c, l) {
|
|
508
513
|
let u = new e.Line3(t, n), d = /* @__PURE__ */ new Map(), f = new e.Vector3(), p = t.clone(), m = n.clone(), h = 0;
|
|
509
514
|
for (;;) {
|
|
@@ -545,7 +550,7 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
545
550
|
if (i.checkResults[0].originalVertices && i.checkResults[0].originalVertices.length > 0) {
|
|
546
551
|
let [t, n, r, s] = i.checkResults[0].originalVertices[0];
|
|
547
552
|
t = new e.Vector3(t.x, t.y, t.z), n = new e.Vector3(n.x, n.y, n.z), r = new e.Vector3(r.x, r.y, r.z), s = new e.Vector3(s.x, s.y, s.z), a = t.distanceTo(n), o = t.distanceTo(s);
|
|
548
|
-
let c =
|
|
553
|
+
let c = j(new e.Vector3().subVectors(t, n).normalize(), new e.Vector3(0, 0, 1));
|
|
549
554
|
c && c.parallel && ([o, a] = [a, o]);
|
|
550
555
|
}
|
|
551
556
|
if (a < 0 || o < 0) continue;
|
|
@@ -555,35 +560,35 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
555
560
|
o / 2;
|
|
556
561
|
let b = l * u / (a * o);
|
|
557
562
|
n(p, g, _, a, y, f, d, b, i), n(m, h, v, a, y, f, d, b, i), i.start = p, i.end = m;
|
|
558
|
-
let { newOriginalPoints: x } =
|
|
563
|
+
let { newOriginalPoints: x } = ae(p, m, i.originalPoints);
|
|
559
564
|
i.originalPoints = x;
|
|
560
565
|
}
|
|
561
|
-
}, B = (t, n) => new e.Vector3(t.x, t.y, 0).distanceTo(new e.Vector3(n.x, n.y, 0)),
|
|
566
|
+
}, B = (t, n) => new e.Vector3(t.x, t.y, 0).distanceTo(new e.Vector3(n.x, n.y, 0)), se = (t, n, r = 1e-6) => {
|
|
562
567
|
let i = new e.Vector3();
|
|
563
568
|
return t.closestPointToPoint(n, !0, i), i.distanceTo(n) < r;
|
|
564
|
-
},
|
|
569
|
+
}, ce = (e) => {
|
|
565
570
|
let t = 0, n = [];
|
|
566
571
|
for (let r = 0; r < e.length; r++) for (let i = r + 1; i < e.length; i++) {
|
|
567
572
|
let a = e[r].distanceTo(e[i]);
|
|
568
573
|
a > t && (t = a, n = [e[r], e[i]]);
|
|
569
574
|
}
|
|
570
575
|
return n;
|
|
571
|
-
}, V = (e, t, n = .03) => Math.abs(e.x - t.x) < n && Math.abs(e.y - t.y) < n && Math.abs(e.z - t.z) < n,
|
|
576
|
+
}, V = (e, t, n = .03) => Math.abs(e.x - t.x) < n && Math.abs(e.y - t.y) < n && Math.abs(e.z - t.z) < n, le = (e) => {
|
|
572
577
|
let t = [];
|
|
573
578
|
e.children.forEach((e) => {
|
|
574
579
|
e.type == "GridHelper" || e.type == "DirectionalLight" || e.type == "AmbientLight" || t.push(e);
|
|
575
580
|
}), t.forEach((t) => {
|
|
576
|
-
e.remove(t),
|
|
581
|
+
e.remove(t), de(t);
|
|
577
582
|
});
|
|
578
|
-
},
|
|
579
|
-
function
|
|
583
|
+
}, ue = () => `#${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}`;
|
|
584
|
+
function de(e) {
|
|
580
585
|
for (; e.children && e.children.length > 0;) {
|
|
581
586
|
let t = e.children[0];
|
|
582
|
-
e.remove(t),
|
|
587
|
+
e.remove(t), de(t);
|
|
583
588
|
}
|
|
584
|
-
e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) =>
|
|
589
|
+
e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) => fe(e)) : fe(e.material));
|
|
585
590
|
}
|
|
586
|
-
function
|
|
591
|
+
function fe(e) {
|
|
587
592
|
for (let t of Object.keys(e)) {
|
|
588
593
|
let n = e[t];
|
|
589
594
|
n && typeof n == "object" && typeof n.dispose == "function" && n.dispose();
|
|
@@ -592,7 +597,7 @@ function de(e) {
|
|
|
592
597
|
}
|
|
593
598
|
//#endregion
|
|
594
599
|
//#region src/geometry/handleWallSegment.mjs
|
|
595
|
-
var
|
|
600
|
+
var pe = class {
|
|
596
601
|
results;
|
|
597
602
|
clusterResults;
|
|
598
603
|
constructor() {
|
|
@@ -1024,12 +1029,12 @@ var fe = class {
|
|
|
1024
1029
|
return console.error("合并网格时出错:", e), null;
|
|
1025
1030
|
}
|
|
1026
1031
|
}
|
|
1027
|
-
},
|
|
1032
|
+
}, me = (e) => {
|
|
1028
1033
|
let t = {}, n = [], r = [], i = [];
|
|
1029
1034
|
return e[0].width, e[0].height, e.forEach((e) => {
|
|
1030
1035
|
r.push(...e.vertices), i.push(e.center), n.push(e.vertices);
|
|
1031
1036
|
}), t.originalVertices = n, t.allCenterPoints = i, t;
|
|
1032
|
-
},
|
|
1037
|
+
}, he = (e) => {
|
|
1033
1038
|
let t = new d().copy(e.start).add(e.end).multiplyScalar(.5), n = new d().subVectors(new d(t.x, t.y, t.z + 1), t).normalize(), r = new d(e.direction.x, e.direction.y, 0);
|
|
1034
1039
|
r.applyAxisAngle(n, Math.PI / 2);
|
|
1035
1040
|
let i = new d().copy(t).add(r.clone().multiplyScalar(e.length)), a = new d().copy(t).sub(r.clone().multiplyScalar(e.length));
|
|
@@ -1039,7 +1044,7 @@ var fe = class {
|
|
|
1039
1044
|
center: t,
|
|
1040
1045
|
direction: r
|
|
1041
1046
|
};
|
|
1042
|
-
},
|
|
1047
|
+
}, ge = (t, n, r = !0) => {
|
|
1043
1048
|
let i = [];
|
|
1044
1049
|
if (!t) return [];
|
|
1045
1050
|
for (let a = 0; a < t.length; a++) {
|
|
@@ -1048,7 +1053,7 @@ var fe = class {
|
|
|
1048
1053
|
let s = new e.Vector3(o.start.x, o.start.y, o.start.z);
|
|
1049
1054
|
s.applyEuler(new e.Euler(-Math.PI / 2, 0, 0));
|
|
1050
1055
|
let l = new e.Vector3(o.end.x, o.end.y, o.end.z);
|
|
1051
|
-
if (l.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), n.add(
|
|
1056
|
+
if (l.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), n.add(k(String(a), new e.Vector3((s.x + l.x) / 2, (s.y + l.y) / 2, (s.z + l.z) / 2))), (o.isBayWindow || o.isWindow) && r) continue;
|
|
1052
1057
|
let u = new c().setFromCoplanarPoints(new d(o.start.x, o.start.y, o.start.z), new d(o.end.x, o.end.y, o.end.z), new d(o.start.x, o.start.y, o.rooftopPz)), f = [];
|
|
1053
1058
|
o.originalPoints.forEach((e, t) => {
|
|
1054
1059
|
let n = new d();
|
|
@@ -1060,7 +1065,7 @@ var fe = class {
|
|
|
1060
1065
|
wireframe: !1,
|
|
1061
1066
|
transparent: !0,
|
|
1062
1067
|
opacity: .5
|
|
1063
|
-
}), g = new e.Group(), _ = new
|
|
1068
|
+
}), g = new e.Group(), _ = new pe(), { horizontalSubdivisions: v, verticalSubdivisions: y } = _.initLimits4(p, m), b = _.createSubdividedWallPlane(o, y, v, h, g);
|
|
1064
1069
|
_.analyzePointDistribution(b, f, .01);
|
|
1065
1070
|
let x = new e.MeshBasicMaterial({
|
|
1066
1071
|
color: "black",
|
|
@@ -1069,15 +1074,170 @@ var fe = class {
|
|
|
1069
1074
|
side: e.DoubleSide
|
|
1070
1075
|
}), S = _.highlightEmptySegments(b, x, g), C = [];
|
|
1071
1076
|
for (let e of S.clusters) {
|
|
1072
|
-
let t =
|
|
1077
|
+
let t = me(e);
|
|
1073
1078
|
t && C.push(t);
|
|
1074
1079
|
}
|
|
1075
|
-
let w =
|
|
1080
|
+
let w = he(o).direction;
|
|
1076
1081
|
o.checkResults = C, o.verticalDirection = w, o.originaIndex = a, i.push(o);
|
|
1077
1082
|
}
|
|
1078
1083
|
return i;
|
|
1079
|
-
},
|
|
1080
|
-
|
|
1084
|
+
}, _e = (t, n) => {
|
|
1085
|
+
console.log("lines", t);
|
|
1086
|
+
for (let r = 0; r < t.length; r++) {
|
|
1087
|
+
let i = t[r], a = [];
|
|
1088
|
+
i.originalPoints.forEach((t) => {
|
|
1089
|
+
let n = new e.Vector3(t.x, t.y, 0), r = !1;
|
|
1090
|
+
for (let e = 0; e < a.length; e++) if (V(n, a[e], .01)) {
|
|
1091
|
+
r = !0;
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
1094
|
+
r || a.push(n);
|
|
1095
|
+
});
|
|
1096
|
+
let o = Math.round(Math.max(5, Math.min(350, 20 * Math.sqrt(i.length)))), s = new e.Vector3(i.start.x, i.start.y, i.start.z), c = new e.Vector3(i.end.x, i.end.y, i.end.z), l = new e.Vector3().subVectors(c, s).normalize(), u = l.clone().cross(new e.Vector3(0, 0, 1)).normalize(), d = u.clone().negate(), f = [], p = [], m = i.length / o;
|
|
1097
|
+
console.log(m);
|
|
1098
|
+
for (let e = 0; e < o; e++) {
|
|
1099
|
+
let e = [];
|
|
1100
|
+
e.push(s.clone().addScaledVector(u, 1)), e.push(e[0].clone().addScaledVector(l, m)), e.push(e[1].clone().addScaledVector(d, 2)), e.push(s.clone().addScaledVector(d, m));
|
|
1101
|
+
let t = [];
|
|
1102
|
+
for (let n = 0; n < a.length; n++) f.includes(n) || be(a[n], e) && (f.push(n), t.push(a[n]));
|
|
1103
|
+
t.length > 0 && p.push(xe(t)), s = s.addScaledVector(l, m);
|
|
1104
|
+
}
|
|
1105
|
+
let h = new Float32Array(a.length * 3);
|
|
1106
|
+
a.forEach((e, t) => {
|
|
1107
|
+
h[t * 3] = e.x, h[t * 3 + 1] = e.y, h[t * 3 + 2] = e.z;
|
|
1108
|
+
});
|
|
1109
|
+
let g = new e.BufferGeometry();
|
|
1110
|
+
g.setAttribute("position", new e.BufferAttribute(h, 3)), g.rotateX(-Math.PI / 2), n.add(new e.Points(g, new e.PointsMaterial({
|
|
1111
|
+
color: ue(),
|
|
1112
|
+
size: .02
|
|
1113
|
+
})));
|
|
1114
|
+
let [_, v] = Ee(p, {
|
|
1115
|
+
plane: "xy",
|
|
1116
|
+
trimRatio: 0
|
|
1117
|
+
});
|
|
1118
|
+
D(_, v, n);
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
function ve(e, t = "xy") {
|
|
1122
|
+
if (t === "xy") return {
|
|
1123
|
+
x: e.x,
|
|
1124
|
+
y: e.y
|
|
1125
|
+
};
|
|
1126
|
+
if (t === "xz") return {
|
|
1127
|
+
x: e.x,
|
|
1128
|
+
y: e.z
|
|
1129
|
+
};
|
|
1130
|
+
if (t === "yz") return {
|
|
1131
|
+
x: e.y,
|
|
1132
|
+
y: e.z
|
|
1133
|
+
};
|
|
1134
|
+
throw Error(`Unsupported plane: ${t}`);
|
|
1135
|
+
}
|
|
1136
|
+
function ye(e, t, n) {
|
|
1137
|
+
let r = t.x - e.x, i = t.y - e.y, a = n.x - e.x;
|
|
1138
|
+
return r * (n.y - e.y) - i * a;
|
|
1139
|
+
}
|
|
1140
|
+
function be(e, t, n = "xy") {
|
|
1141
|
+
if (!t || t.length !== 4) throw Error("rectPoints must contain 4 points");
|
|
1142
|
+
let r = ve(e, n), i = t.map((e) => ve(e, n)), a = !1, o = !1;
|
|
1143
|
+
for (let e = 0; e < 4; e++) {
|
|
1144
|
+
let t = i[e], n = i[(e + 1) % 4], s = ye(t, n, r);
|
|
1145
|
+
if (s > 1e-9 && (a = !0), s < -1e-9 && (o = !0), a && o) return !1;
|
|
1146
|
+
}
|
|
1147
|
+
return !0;
|
|
1148
|
+
}
|
|
1149
|
+
function xe(t) {
|
|
1150
|
+
if (!t || t.length === 0) return null;
|
|
1151
|
+
let n = new e.Vector3(0, 0, 0);
|
|
1152
|
+
for (let e of t) Array.isArray(e) ? (n.x += e[0], n.y += e[1], n.z += e[2]) : (n.x += e.x, n.y += e.y, n.z += e.z);
|
|
1153
|
+
return n.divideScalar(t.length), n;
|
|
1154
|
+
}
|
|
1155
|
+
function Se(t) {
|
|
1156
|
+
return t instanceof e.Vector3 ? t.clone() : Array.isArray(t) ? new e.Vector3(t[0], t[1], t[2]) : new e.Vector3(t.x, t.y, t.z);
|
|
1157
|
+
}
|
|
1158
|
+
function Ce(e, t = "xy") {
|
|
1159
|
+
let n = Se(e);
|
|
1160
|
+
if (t === "xy") return {
|
|
1161
|
+
x: n.x,
|
|
1162
|
+
y: n.y,
|
|
1163
|
+
up: n.z
|
|
1164
|
+
};
|
|
1165
|
+
if (t === "xz") return {
|
|
1166
|
+
x: n.x,
|
|
1167
|
+
y: n.z,
|
|
1168
|
+
up: n.y
|
|
1169
|
+
};
|
|
1170
|
+
if (t === "yz") return {
|
|
1171
|
+
x: n.y,
|
|
1172
|
+
y: n.z,
|
|
1173
|
+
up: n.x
|
|
1174
|
+
};
|
|
1175
|
+
throw Error(`Unsupported plane: ${t}`);
|
|
1176
|
+
}
|
|
1177
|
+
function we(t, n, r, i = "xy") {
|
|
1178
|
+
if (i === "xy") return new e.Vector3(t, n, r);
|
|
1179
|
+
if (i === "xz") return new e.Vector3(t, r, n);
|
|
1180
|
+
if (i === "yz") return new e.Vector3(r, t, n);
|
|
1181
|
+
throw Error(`Unsupported plane: ${i}`);
|
|
1182
|
+
}
|
|
1183
|
+
function Te(e, t, n) {
|
|
1184
|
+
let r = 1e-12;
|
|
1185
|
+
if (Math.abs(t) < r) return e >= n ? {
|
|
1186
|
+
x: 1,
|
|
1187
|
+
y: 0
|
|
1188
|
+
} : {
|
|
1189
|
+
x: 0,
|
|
1190
|
+
y: 1
|
|
1191
|
+
};
|
|
1192
|
+
let i = e + n, a = e * n - t * t, o = Math.sqrt(Math.max(0, i * i * .25 - a)), s = i * .5 + o, c = t, l = s - e, u = Math.hypot(c, l);
|
|
1193
|
+
return u < r ? {
|
|
1194
|
+
x: 1,
|
|
1195
|
+
y: 0
|
|
1196
|
+
} : {
|
|
1197
|
+
x: c / u,
|
|
1198
|
+
y: l / u
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
function Ee(e, t = {}) {
|
|
1202
|
+
let { plane: n = "xy", trimRatio: r = 0 } = t;
|
|
1203
|
+
if (!e || e.length < 2) return null;
|
|
1204
|
+
let i = e.map((e) => Ce(e, n)), a = 0, o = 0, s = 0;
|
|
1205
|
+
for (let e of i) a += e.x, o += e.y, s += e.up;
|
|
1206
|
+
a /= i.length, o /= i.length, s /= i.length;
|
|
1207
|
+
let c = 0, l = 0, u = 0;
|
|
1208
|
+
for (let e of i) {
|
|
1209
|
+
let t = e.x - a, n = e.y - o;
|
|
1210
|
+
c += t * t, l += t * n, u += n * n;
|
|
1211
|
+
}
|
|
1212
|
+
c /= i.length, l /= i.length, u /= i.length;
|
|
1213
|
+
let d = Te(c, l, u), f = {
|
|
1214
|
+
x: -d.y,
|
|
1215
|
+
y: d.x
|
|
1216
|
+
}, p = [];
|
|
1217
|
+
for (let e of i) {
|
|
1218
|
+
let t = e.x - a, n = e.y - o, r = t * d.x + n * d.y, i = t * f.x + n * f.y;
|
|
1219
|
+
p.push({
|
|
1220
|
+
s: r,
|
|
1221
|
+
t: i,
|
|
1222
|
+
up: e.up
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
p.sort((e, t) => e.s - t.s);
|
|
1226
|
+
let m = p.length, h = Math.floor(m * r), g = Math.ceil(m * (1 - r)) - 1;
|
|
1227
|
+
h = Math.max(0, Math.min(m - 1, h)), g = Math.max(0, Math.min(m - 1, g));
|
|
1228
|
+
let _ = p[h], v = p[g], y = (() => {
|
|
1229
|
+
let e = p.map((e) => e.t).sort((e, t) => e - t), t = Math.floor(e.length / 2);
|
|
1230
|
+
return e.length % 2 == 0 ? (e[t - 1] + e[t]) * .5 : e[t];
|
|
1231
|
+
})(), b = (() => {
|
|
1232
|
+
let e = p.map((e) => e.up).sort((e, t) => e - t), t = Math.floor(e.length / 2);
|
|
1233
|
+
return e.length % 2 == 0 ? (e[t - 1] + e[t]) * .5 : e[t];
|
|
1234
|
+
})(), x = _.s, S = v.s, C = y, w = y, T = b, E = b, D = a + d.x * x + f.x * C, O = o + d.y * x + f.y * C, k = a + d.x * S + f.x * w, A = o + d.y * S + f.y * w;
|
|
1235
|
+
return [we(D, O, T, n), we(k, A, E, n)];
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1238
|
+
//#region src/geometry/beamLine.mjs
|
|
1239
|
+
var De = async (t, n, r, i) => {
|
|
1240
|
+
le(i);
|
|
1081
1241
|
let a = await fetch(t);
|
|
1082
1242
|
if (!a) return;
|
|
1083
1243
|
let o = await a.json(), s = new e.Group(), c = new e.Group(), l = new e.Group(), u = new e.Group(), d = new e.Group(), f = new e.Group(), p = new e.Group(), m = new e.Group();
|
|
@@ -1087,7 +1247,7 @@ var fe = class {
|
|
|
1087
1247
|
let r = new e.Vector3(n.start.x, n.start.y, n.start.z);
|
|
1088
1248
|
r.applyEuler(new e.Euler(-Math.PI / 2, 0, 0));
|
|
1089
1249
|
let i = new e.Vector3(n.end.x, n.end.y, n.end.z);
|
|
1090
|
-
i.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(
|
|
1250
|
+
i.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(k(String(t), new e.Vector3((r.x + i.x) / 2, (r.y + i.y) / 2, (r.z + i.z) / 2)));
|
|
1091
1251
|
}
|
|
1092
1252
|
o.sort((e, t) => e.originalIndex - t.originalIndex), console.log("lins", o);
|
|
1093
1253
|
let h = await fetch(n);
|
|
@@ -1099,11 +1259,11 @@ var fe = class {
|
|
|
1099
1259
|
let n = y[t];
|
|
1100
1260
|
if (n.isFindBeam = !1, n.category == "door") {
|
|
1101
1261
|
let t = new e.Vector3(n.center.x, n.center.y, n.center.z);
|
|
1102
|
-
t.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(
|
|
1262
|
+
t.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(k(`door:${b}`, t)), b++;
|
|
1103
1263
|
}
|
|
1104
1264
|
}
|
|
1105
1265
|
i.add(m), console.time();
|
|
1106
|
-
let { beamGroup: x } = await
|
|
1266
|
+
let { beamGroup: x } = await Oe(o, _, y, i);
|
|
1107
1267
|
console.timeEnd(), console.log("beamGroup", x);
|
|
1108
1268
|
let S = new e.MeshBasicMaterial({
|
|
1109
1269
|
color: "#cffd00",
|
|
@@ -1125,7 +1285,7 @@ var fe = class {
|
|
|
1125
1285
|
transparent: !0,
|
|
1126
1286
|
opacity: .4,
|
|
1127
1287
|
side: e.DoubleSide
|
|
1128
|
-
}), D = new e.LineBasicMaterial({ color: "#cffd00" }),
|
|
1288
|
+
}), D = new e.LineBasicMaterial({ color: "#cffd00" }), O = [];
|
|
1129
1289
|
for (let t = 0; t < o.length; t++) {
|
|
1130
1290
|
let n = o[t];
|
|
1131
1291
|
if (n.checkResults) for (let t of n.checkResults) for (let n of t.originalVertices) {
|
|
@@ -1152,12 +1312,12 @@ var fe = class {
|
|
|
1152
1312
|
3
|
|
1153
1313
|
]), o.computeVertexNormals();
|
|
1154
1314
|
let c = new e.EdgesGeometry(o, 1);
|
|
1155
|
-
|
|
1315
|
+
O.push(c);
|
|
1156
1316
|
}
|
|
1157
1317
|
}
|
|
1158
|
-
if (
|
|
1159
|
-
let t = w(
|
|
1160
|
-
t.rotateX(-Math.PI / 2), s.add(new e.LineSegments(t, D)), s.visible = !1, i.add(s),
|
|
1318
|
+
if (O.length > 0) {
|
|
1319
|
+
let t = w(O, !1);
|
|
1320
|
+
t.rotateX(-Math.PI / 2), s.add(new e.LineSegments(t, D)), s.visible = !1, i.add(s), O.forEach((e) => e.dispose());
|
|
1161
1321
|
}
|
|
1162
1322
|
new e.PointsMaterial({
|
|
1163
1323
|
color: 65535,
|
|
@@ -1171,7 +1331,7 @@ var fe = class {
|
|
|
1171
1331
|
});
|
|
1172
1332
|
let r = new e.BufferGeometry();
|
|
1173
1333
|
r.setAttribute("position", new e.BufferAttribute(n, 3)), r.rotateX(-Math.PI / 2), c.add(new e.Points(r, new e.PointsMaterial({
|
|
1174
|
-
color:
|
|
1334
|
+
color: ue(),
|
|
1175
1335
|
size: .02
|
|
1176
1336
|
})));
|
|
1177
1337
|
let i = [];
|
|
@@ -1180,7 +1340,7 @@ var fe = class {
|
|
|
1180
1340
|
a.setFromPoints(i), a.rotateX(-Math.PI / 2), f.add(new e.Line(a, D));
|
|
1181
1341
|
}
|
|
1182
1342
|
f.visible = !1, i.add(c), i.add(f);
|
|
1183
|
-
let A = [], j = [], M = new e.LineBasicMaterial({ color: "#f30606" }),
|
|
1343
|
+
let A = [], j = [], M = new e.LineBasicMaterial({ color: "#f30606" }), N = new e.MeshBasicMaterial({ color: "#071ac4" });
|
|
1184
1344
|
for (let t = 0; t < _.length; t++) {
|
|
1185
1345
|
let n = new e.SphereGeometry(.05);
|
|
1186
1346
|
n.translate(_[t].x, _[t].y, _[t].z);
|
|
@@ -1191,14 +1351,14 @@ var fe = class {
|
|
|
1191
1351
|
}
|
|
1192
1352
|
if (A.length > 0) {
|
|
1193
1353
|
let t = w(A, !1);
|
|
1194
|
-
t.rotateX(-Math.PI / 2), l.add(new e.Mesh(t,
|
|
1354
|
+
t.rotateX(-Math.PI / 2), l.add(new e.Mesh(t, N)), A.forEach((e) => e.dispose());
|
|
1195
1355
|
}
|
|
1196
1356
|
if (j.length > 0) {
|
|
1197
1357
|
let t = w(j, !1);
|
|
1198
1358
|
t.rotateX(-Math.PI / 2), l.add(new e.Line(t, M)), j.forEach((e) => e.dispose());
|
|
1199
1359
|
}
|
|
1200
1360
|
i.add(l);
|
|
1201
|
-
let { AiProjectionGroup: F, AiProjectionGroup2: I } =
|
|
1361
|
+
let { AiProjectionGroup: F, AiProjectionGroup2: I } = P(y);
|
|
1202
1362
|
return u.add(F), u.rotateX(-Math.PI / 2), i.add(u), d.add(I), d.visible = !1, d.rotateX(-Math.PI / 2), i.add(d), console.log("jsonpcdData", y), o.forEach((t) => {
|
|
1203
1363
|
t.doorAndBeamData && t.doorAndBeamData.length > 0 && (t.doorAndBeamData.forEach((t) => {
|
|
1204
1364
|
if (t.beamStart) {
|
|
@@ -1248,7 +1408,7 @@ var fe = class {
|
|
|
1248
1408
|
3
|
|
1249
1409
|
]), n.computeVertexNormals(), n.rotateX(-Math.PI / 2), t.isDoor ? p.add(new e.Mesh(n, E)) : t.type == "beam" ? p.add(new e.Mesh(n, T)) : p.add(new e.Mesh(n, C));
|
|
1250
1410
|
let i = `id:${t.id},Nid:${t.nearId}`, a = new e.Vector3((t.doorStart.x + t.doorEnd.x) / 2, (t.doorStart.y + t.doorEnd.y) / 2, t.doorStart.z + t.doorHeight);
|
|
1251
|
-
a.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), p.add(
|
|
1411
|
+
a.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), p.add(k(i, a));
|
|
1252
1412
|
}), i.add(p));
|
|
1253
1413
|
}), {
|
|
1254
1414
|
checkResultGroup: s,
|
|
@@ -1260,8 +1420,8 @@ var fe = class {
|
|
|
1260
1420
|
beamDoorGroup: p,
|
|
1261
1421
|
lineIndexGroup: m
|
|
1262
1422
|
};
|
|
1263
|
-
},
|
|
1264
|
-
if (
|
|
1423
|
+
}, Oe = async (t, n, r, i) => {
|
|
1424
|
+
if (oe(t, i), t.length <= 0 || n.length <= 0) return t;
|
|
1265
1425
|
r ||= [];
|
|
1266
1426
|
for (let n of t) {
|
|
1267
1427
|
let t = [];
|
|
@@ -1304,7 +1464,7 @@ var fe = class {
|
|
|
1304
1464
|
if (i.points.push(...a[t]), i.area += o.distanceTo(s) * o.distanceTo(p), i.originalVertices.push(a[t]), i.index = r, i.centerPts.push(m), u == -1 || d == -1) {
|
|
1305
1465
|
let t = new e.Vector3().subVectors(o, s).normalize();
|
|
1306
1466
|
d = o.distanceTo(p), u = o.distanceTo(s);
|
|
1307
|
-
let n =
|
|
1467
|
+
let n = j(t, new e.Vector3(0, 0, 1));
|
|
1308
1468
|
n && n.parallel && ([d, u] = [u, d]);
|
|
1309
1469
|
}
|
|
1310
1470
|
i.gridWidth = u, i.gridHeight = d;
|
|
@@ -1326,9 +1486,9 @@ var fe = class {
|
|
|
1326
1486
|
totalHeight: t
|
|
1327
1487
|
});
|
|
1328
1488
|
}
|
|
1329
|
-
let o = [...a.entries()].reduce((e, t) => t[1].num > e[1].num ? t : e)
|
|
1330
|
-
o[1].totalHeight / o[1].num;
|
|
1331
|
-
let
|
|
1489
|
+
let o = [...a.entries()].reduce((e, t) => t[1].num > e[1].num ? t : e);
|
|
1490
|
+
o[0], o[1].totalHeight / o[1].num;
|
|
1491
|
+
let s = [];
|
|
1332
1492
|
for (let t = 0; t < r.length; t++) {
|
|
1333
1493
|
let n = r[t];
|
|
1334
1494
|
if (n.isFindBeam = !1, n.category == "door") {
|
|
@@ -1343,10 +1503,10 @@ var fe = class {
|
|
|
1343
1503
|
r[2],
|
|
1344
1504
|
r[1]
|
|
1345
1505
|
]);
|
|
1346
|
-
let o =
|
|
1347
|
-
|
|
1506
|
+
let o = R(r[0], r[3], !0), c = R(r[1], r[2], !0);
|
|
1507
|
+
s.push({
|
|
1348
1508
|
doorStartPt: o,
|
|
1349
|
-
doorEndPt:
|
|
1509
|
+
doorEndPt: c,
|
|
1350
1510
|
boxPoints: r,
|
|
1351
1511
|
minZ: n.coordinatesByArea.heightData.minZ,
|
|
1352
1512
|
maxZ: n.coordinatesByArea.heightData.maxZ,
|
|
@@ -1356,12 +1516,12 @@ var fe = class {
|
|
|
1356
1516
|
});
|
|
1357
1517
|
}
|
|
1358
1518
|
}
|
|
1359
|
-
for (let n = 0; n <
|
|
1360
|
-
let r =
|
|
1519
|
+
for (let n = 0; n < s.length; n++) {
|
|
1520
|
+
let r = s[n];
|
|
1361
1521
|
for (let n = 0; n < t.length; n++) {
|
|
1362
1522
|
if (t[n].length < .5) continue;
|
|
1363
|
-
let i = [], a =
|
|
1364
|
-
i.push(a), i.push(
|
|
1523
|
+
let i = [], a = R(t[n].start, t[n].end, !0);
|
|
1524
|
+
i.push(a), i.push(R(a, t[n].start, !0)), i.push(R(a, t[n].end, !0));
|
|
1365
1525
|
let o = !1, s = r.boxPoints.length;
|
|
1366
1526
|
for (let e = 0; e < i.length; e++) {
|
|
1367
1527
|
let t = i[e].x, n = i[e].y;
|
|
@@ -1372,12 +1532,12 @@ var fe = class {
|
|
|
1372
1532
|
if (o) break;
|
|
1373
1533
|
}
|
|
1374
1534
|
if (o) {
|
|
1375
|
-
let i = new e.Vector3(t[n].start.x, t[n].start.y, 0), a = new e.Vector3(t[n].end.x, t[n].end.y, 0), o = r.doorStartPt.distanceTo(r.doorEndPt), s = i.distanceTo(a), c =
|
|
1535
|
+
let i = new e.Vector3(t[n].start.x, t[n].start.y, 0), a = new e.Vector3(t[n].end.x, t[n].end.y, 0), o = r.doorStartPt.distanceTo(r.doorEndPt), s = i.distanceTo(a), c = I(r.doorStartPt, r.doorEndPt, i, a);
|
|
1376
1536
|
if (Math.abs(s - o) < .5 && c && c.angleDeg < 15) {
|
|
1377
1537
|
r.doorStartPt = new e.Vector3(t[n].start.x, t[n].start.y, 0), r.doorEndPt = new e.Vector3(t[n].end.x, t[n].end.y, 0);
|
|
1378
1538
|
break;
|
|
1379
1539
|
} else if (Math.abs(s - o) > 1.3 && c && c.angleDeg < 15) {
|
|
1380
|
-
let t =
|
|
1540
|
+
let t = z(r.doorStartPt, r.doorEndPt, i, a, { parallelAngleMax: e.MathUtils.degToRad(15) }), n = r.doorStartPt.distanceTo(i), o = r.doorStartPt.distanceTo(a), s = r.doorEndPt.distanceTo(i), c = r.doorEndPt.distanceTo(a), l = n < .2 || o < .2 || s < .2 || c < .2;
|
|
1381
1541
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .1 && !l) {
|
|
1382
1542
|
r.inWall = !0;
|
|
1383
1543
|
break;
|
|
@@ -1392,23 +1552,21 @@ var fe = class {
|
|
|
1392
1552
|
} else continue;
|
|
1393
1553
|
}
|
|
1394
1554
|
}
|
|
1395
|
-
let
|
|
1555
|
+
let c = 0, l = [], u = [], d = [], f = [], p = .2;
|
|
1396
1556
|
for (let i = 0; i < t.length; i++) {
|
|
1397
1557
|
let a = t[i];
|
|
1398
1558
|
if (!a.mergeCheckRegion || a.mergeCheckRegion.length == 0) continue;
|
|
1399
1559
|
a.doorAndBeamData = [], a.completePointAreaPercentage = -1;
|
|
1400
1560
|
let o = new e.Box3();
|
|
1401
1561
|
o.setFromPoints(a.originalPoints);
|
|
1402
|
-
let
|
|
1403
|
-
if (y < s - .5 || y > s + 2) continue;
|
|
1404
|
-
let b = 0;
|
|
1562
|
+
let m = o.max.z, h = o.min.z, g = new e.Vector3(a.start.x, a.start.y, a.start.z), _ = new e.Vector3(a.end.x, a.end.y, a.end.z), v = a.rooftopPz - a.start.z, y = 0;
|
|
1405
1563
|
for (let o of a.mergeCheckRegion) {
|
|
1406
|
-
let { facePoints:
|
|
1407
|
-
if (!
|
|
1408
|
-
|
|
1409
|
-
let C =
|
|
1564
|
+
let { facePoints: b, boxArea: x, totalInPlaneNum: S } = F(o.points, o.gridWidth, o.gridHeight, o.centerPts);
|
|
1565
|
+
if (!b || b.length <= 0) continue;
|
|
1566
|
+
b[0].distanceTo(b[1]);
|
|
1567
|
+
let C = b[0].distanceTo(b[3]), w = o.gridHeight * (C / o.gridHeight / 3 * 2) + o.gridHeight / 2, T = new e.Vector3(b[0].x, b[0].y, b[0].z + w), E = new e.Vector3(b[1].x, b[1].y, b[1].z + w), D = new e.Line3(T, E), k = [], A = new e.Vector3();
|
|
1410
1568
|
o.points.forEach((e) => {
|
|
1411
|
-
|
|
1569
|
+
D.closestPointToPoint(e, !0, A).distanceTo(e) < o.gridHeight + .01 && k.push(e);
|
|
1412
1570
|
});
|
|
1413
1571
|
let M = [], N = [];
|
|
1414
1572
|
for (;;) {
|
|
@@ -1423,35 +1581,35 @@ var fe = class {
|
|
|
1423
1581
|
if (e.length == 0) break;
|
|
1424
1582
|
M.push(e);
|
|
1425
1583
|
}
|
|
1426
|
-
let
|
|
1584
|
+
let P = [];
|
|
1427
1585
|
for (let t = 0; t < M.length; t++) {
|
|
1428
1586
|
let n = {
|
|
1429
1587
|
lineSt: new e.Vector3(),
|
|
1430
1588
|
lineEd: new e.Vector3(),
|
|
1431
1589
|
facePoints: []
|
|
1432
|
-
}, r =
|
|
1433
|
-
Array.isArray(r) && r.length == 2 && (n.lineSt = r[0], n.lineEd = r[1], n.facePoints.push(new e.Vector3(r[0].x, r[0].y,
|
|
1590
|
+
}, r = ce(M[t]);
|
|
1591
|
+
Array.isArray(r) && r.length == 2 && (n.lineSt = r[0], n.lineEd = r[1], n.facePoints.push(new e.Vector3(r[0].x, r[0].y, b[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, b[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, b[2].z)), n.facePoints.push(new e.Vector3(r[0].x, r[0].y, b[2].z)), P.push(n));
|
|
1434
1592
|
}
|
|
1435
|
-
|
|
1436
|
-
let
|
|
1437
|
-
if (S != 0 && (
|
|
1438
|
-
let b =
|
|
1439
|
-
if (S < 1.5 ||
|
|
1440
|
-
let T = !1, E = !1,
|
|
1593
|
+
y += o.area;
|
|
1594
|
+
let ee = 0;
|
|
1595
|
+
if (S != 0 && (ee = o.gridHeight * o.gridWidth * S), (o.area - ee) / x * 100 > 70 && P.length == 1 || P.length > 1) for (let y = 0; y < P.length; y++) {
|
|
1596
|
+
let b = P[y], x = b.facePoints[0].distanceTo(b.facePoints[1]), S = b.facePoints[0].distanceTo(b.facePoints[3]), C = x / a.length * 100, w = a.rooftopPz - b.facePoints[2].z;
|
|
1597
|
+
if (S < 1.5 || m < b.facePoints[2].z || w > v / 3 * 2) continue;
|
|
1598
|
+
let T = !1, E = !1, D = !1, k = [], A = b.facePoints[2].clone(), M = b.facePoints[3].clone(), N = b.facePoints[0].clone(), F = b.facePoints[1].clone(), ee = !1, te = -1;
|
|
1441
1599
|
if (Math.abs(b.facePoints[0].z - a.start.z) < .25) {
|
|
1442
1600
|
if (x > .17 && a.length > .5) {
|
|
1443
|
-
let n = B(
|
|
1601
|
+
let n = B(g, N), r = B(g, F), o = B(_, N), s = B(_, F), c = .1;
|
|
1444
1602
|
if (n < c || r < c) {
|
|
1445
|
-
let { newOriginalPoints: r } =
|
|
1603
|
+
let { newOriginalPoints: r } = ae(N, F, a.originalPoints), o = [], s = [];
|
|
1446
1604
|
if (r.forEach((e) => {
|
|
1447
|
-
e.z >=
|
|
1605
|
+
e.z >= A.z ? o.push(e) : e.z <= N.z && s.push(e);
|
|
1448
1606
|
}), o.length > 10) {
|
|
1449
1607
|
let r = new e.Vector3(a.start.x, a.start.y, 0), o = new e.Vector3(a.end.x, a.end.y, 0), s = new e.Vector3().subVectors(r, o).normalize(), l = new e.Vector3(), u = Infinity, d = -1, f = !1;
|
|
1450
1608
|
for (let n = 0; n < t.length; n++) {
|
|
1451
1609
|
if (n == i) continue;
|
|
1452
|
-
let a = new e.Vector3(t[n].start.x, t[n].start.y, 0), c = new e.Vector3(t[n].end.x, t[n].end.y, 0), p =
|
|
1610
|
+
let a = new e.Vector3(t[n].start.x, t[n].start.y, 0), c = new e.Vector3(t[n].end.x, t[n].end.y, 0), p = O(r, o, a, c), m = L(r, o, a, c);
|
|
1453
1611
|
if (p != null) {
|
|
1454
|
-
if (m && m.angle >
|
|
1612
|
+
if (m && m.angle > 85) {
|
|
1455
1613
|
let e = p.point.distanceTo(r);
|
|
1456
1614
|
if (p.point.distanceTo(o), e < .3) {
|
|
1457
1615
|
u = Infinity, d = -1;
|
|
@@ -1460,353 +1618,352 @@ var fe = class {
|
|
|
1460
1618
|
}
|
|
1461
1619
|
continue;
|
|
1462
1620
|
}
|
|
1463
|
-
if (m && m.angle >
|
|
1464
|
-
let t =
|
|
1621
|
+
if (m && m.angle > 85) {
|
|
1622
|
+
let t = I(r, o, new e.Line3(a, c).closestPointToPoint(r, !0, l), r);
|
|
1465
1623
|
if (!t || t.direction != "same") continue;
|
|
1466
|
-
let i = r.clone().addScaledVector(s, 10), f = o.clone().addScaledVector(s.clone().negate(), 10), p = new e.Vector3().subVectors(c, a).normalize(), m =
|
|
1624
|
+
let i = r.clone().addScaledVector(s, 10), f = o.clone().addScaledVector(s.clone().negate(), 10), p = new e.Vector3().subVectors(c, a).normalize(), m = O(i, f, a.clone().addScaledVector(p.clone().negate(), .03), c.clone().addScaledVector(p, .03));
|
|
1467
1625
|
if (m == null) continue;
|
|
1468
1626
|
let h = r.distanceTo(m.point);
|
|
1469
1627
|
h < u && (u = h, d = n);
|
|
1470
1628
|
} else if (m && m.angle < 5) {
|
|
1471
|
-
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(
|
|
1629
|
+
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(F.x, F.y, 0), r = B(t, a), i = B(t, c), o = B(n, a), s = B(n, c);
|
|
1472
1630
|
if (r < .08 || i < .08 || o < .08 || s < .08) {
|
|
1473
1631
|
f = !0, u = Infinity, d = -1;
|
|
1474
1632
|
break;
|
|
1475
1633
|
}
|
|
1476
1634
|
}
|
|
1477
1635
|
}
|
|
1478
|
-
if (u != Infinity && u < 2) t[d].length > .25 && x + u > .5 && (
|
|
1636
|
+
if (u != Infinity && u < 2 && a.length - x > .5) t[d].length > .25 && x + u > .5 && (ee = !0, n < c ? (M = M.addScaledVector(s, u), N = N.addScaledVector(s, u)) : (A = A.addScaledVector(s, u), F = F.addScaledVector(s, u)));
|
|
1479
1637
|
else if (!f) {
|
|
1480
|
-
let r = .05, a =
|
|
1638
|
+
let r = .05, a = g.clone().addScaledVector(s, r), o = g.clone().addScaledVector(s.clone().negate(), r);
|
|
1481
1639
|
a.z = o.z = 0;
|
|
1482
1640
|
let l = !1;
|
|
1483
|
-
for (let
|
|
1484
|
-
if (
|
|
1485
|
-
let
|
|
1486
|
-
|
|
1487
|
-
let
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1490
|
-
let e =
|
|
1491
|
-
if (
|
|
1641
|
+
for (let n = 0; n < t.length; n++) {
|
|
1642
|
+
if (n == i) continue;
|
|
1643
|
+
let s = new e.Vector3(t[n].start.x, t[n].start.y, 0), c = new e.Vector3(t[n].end.x, t[n].end.y, 0), d = new e.Vector3().subVectors(c, s).normalize();
|
|
1644
|
+
s = s.clone().addScaledVector(d.clone().negate(), r), c = c.clone().addScaledVector(d, r);
|
|
1645
|
+
let f = O(a, o, s, c);
|
|
1646
|
+
if (f) {
|
|
1647
|
+
f.point.z = g.z;
|
|
1648
|
+
let e = f.point.distanceTo(g);
|
|
1649
|
+
if (f.point.distanceTo(_) < e) continue;
|
|
1492
1650
|
u > e && (u = e), l = !0;
|
|
1493
1651
|
}
|
|
1494
|
-
if (l) break;
|
|
1495
|
-
u != Infinity && u < 2 && (n < c ? (M = M.addScaledVector(s.clone().negate(), u), N = N.addScaledVector(s.clone().negate(), u)) : (j = j.addScaledVector(s.clone().negate(), u), P = P.addScaledVector(s.clone().negate(), u)));
|
|
1496
1652
|
}
|
|
1497
1653
|
if (!l) continue;
|
|
1654
|
+
u != Infinity && u < 2 && (n < c ? (M = M.addScaledVector(s.clone().negate(), u), N = N.addScaledVector(s.clone().negate(), u)) : (A = A.addScaledVector(s.clone().negate(), u), F = F.addScaledVector(s.clone().negate(), u)));
|
|
1498
1655
|
}
|
|
1499
1656
|
} else continue;
|
|
1500
1657
|
} else if (o < c || s < c) {
|
|
1501
|
-
let { newOriginalPoints: n } =
|
|
1658
|
+
let { newOriginalPoints: n } = ae(N, F, a.originalPoints), r = [], s = [];
|
|
1502
1659
|
if (n.forEach((e) => {
|
|
1503
|
-
e.z >=
|
|
1660
|
+
e.z >= A.z ? r.push(e) : e.z <= N.z && s.push(e);
|
|
1504
1661
|
}), r.length > 10) {
|
|
1505
1662
|
let n = new e.Vector3(a.start.x, a.start.y, 0), r = new e.Vector3(a.end.x, a.end.y, 0), s = new e.Vector3().subVectors(r, n).normalize(), l = new e.Vector3(), u = Infinity, d = -1, f = !1;
|
|
1506
1663
|
for (let a = 0; a < t.length; a++) {
|
|
1507
1664
|
if (a == i) continue;
|
|
1508
|
-
let o = new e.Vector3(t[a].start.x, t[a].start.y, 0), c = new e.Vector3(t[a].end.x, t[a].end.y, 0), p =
|
|
1665
|
+
let o = new e.Vector3(t[a].start.x, t[a].start.y, 0), c = new e.Vector3(t[a].end.x, t[a].end.y, 0), p = O(n, r, o, c), m = L(n, r, o, c);
|
|
1509
1666
|
if (p != null) {
|
|
1510
|
-
if (m && m.angle >
|
|
1667
|
+
if (m && m.angle > 85 && (p.point.distanceTo(n), p.point.distanceTo(r) < .3)) {
|
|
1511
1668
|
u = Infinity, d = -1;
|
|
1512
1669
|
break;
|
|
1513
1670
|
}
|
|
1514
1671
|
continue;
|
|
1515
1672
|
}
|
|
1516
|
-
if (m && m.angle >
|
|
1517
|
-
let t =
|
|
1673
|
+
if (m && m.angle > 85) {
|
|
1674
|
+
let t = I(r, n, new e.Line3(o, c).closestPointToPoint(r, !0, l), r);
|
|
1518
1675
|
if (!t || t.direction != "same") continue;
|
|
1519
|
-
let i = n.clone().addScaledVector(s.clone().negate(), 10), f = r.clone().addScaledVector(s, 10), p = new e.Vector3().subVectors(c, o).normalize(), m =
|
|
1676
|
+
let i = n.clone().addScaledVector(s.clone().negate(), 10), f = r.clone().addScaledVector(s, 10), p = new e.Vector3().subVectors(c, o).normalize(), m = O(i, f, o.clone().addScaledVector(p.clone().negate(), .03), c.clone().addScaledVector(p, .03));
|
|
1520
1677
|
if (m == null) continue;
|
|
1521
1678
|
let h = r.distanceTo(m.point);
|
|
1522
1679
|
h < u && (u = h, d = a);
|
|
1523
1680
|
} else if (m && m.angle < 5) {
|
|
1524
|
-
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(
|
|
1681
|
+
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(F.x, F.y, 0), r = B(t, o), i = B(t, c), a = B(n, o), s = B(n, c);
|
|
1525
1682
|
if (r < .08 || i < .08 || a < .08 || s < .08) {
|
|
1526
1683
|
f = !0, u = Infinity, d = -1;
|
|
1527
1684
|
break;
|
|
1528
1685
|
}
|
|
1529
1686
|
}
|
|
1530
1687
|
}
|
|
1531
|
-
if (u != Infinity && u < 2) t[d].length > .25 && x + u > .5 && (
|
|
1688
|
+
if (u != Infinity && u < 2 && a.length - x > .5) t[d].length > .25 && x + u > .5 && (ee = !0, o < c ? (M = M.addScaledVector(s, u), N = N.addScaledVector(s, u)) : (A = A.addScaledVector(s, u), F = F.addScaledVector(s, u)));
|
|
1532
1689
|
else if (!f) {
|
|
1533
|
-
let n = .05, r =
|
|
1690
|
+
let n = .05, r = _.clone().addScaledVector(s, n), a = g.clone();
|
|
1534
1691
|
r.z = a.z = 0;
|
|
1535
1692
|
let l = !1;
|
|
1536
1693
|
for (let o = 0; o < t.length; o++) {
|
|
1537
1694
|
if (o == i) continue;
|
|
1538
1695
|
let s = new e.Vector3(t[o].start.x, t[o].start.y, 0), c = new e.Vector3(t[o].end.x, t[o].end.y, 0), d = new e.Vector3().subVectors(c, s).normalize();
|
|
1539
1696
|
s = s.clone().addScaledVector(d.clone().negate(), n), c = c.clone().addScaledVector(d, n);
|
|
1540
|
-
let f =
|
|
1697
|
+
let f = O(r, a, s, c);
|
|
1541
1698
|
if (f) {
|
|
1542
|
-
f.point.z =
|
|
1543
|
-
let e = f.point.distanceTo(
|
|
1544
|
-
if (f.point.distanceTo(
|
|
1699
|
+
f.point.z = _.z;
|
|
1700
|
+
let e = f.point.distanceTo(_);
|
|
1701
|
+
if (f.point.distanceTo(g) < e) continue;
|
|
1545
1702
|
u > e && (u = e), l = !0;
|
|
1546
1703
|
}
|
|
1547
1704
|
}
|
|
1548
1705
|
if (!l) continue;
|
|
1549
|
-
u != Infinity && u < 2 && (o < c ? (M = M.addScaledVector(s.clone().negate(), u), N = N.addScaledVector(s.clone().negate(), u)) : (
|
|
1706
|
+
u != Infinity && u < 2 && (o < c ? (M = M.addScaledVector(s.clone().negate(), u), N = N.addScaledVector(s.clone().negate(), u)) : (A = A.addScaledVector(s.clone().negate(), u), F = F.addScaledVector(s.clone().negate(), u)));
|
|
1550
1707
|
}
|
|
1551
1708
|
} else continue;
|
|
1552
1709
|
}
|
|
1553
|
-
x = M.distanceTo(
|
|
1710
|
+
x = M.distanceTo(A);
|
|
1554
1711
|
}
|
|
1555
|
-
if (C < 85 && x > .
|
|
1712
|
+
if (C < 85 && x > .31 || x > .7 && S > v - v / 3) {
|
|
1556
1713
|
let t = !1;
|
|
1557
1714
|
for (let r = 0; r < n.length; r++) {
|
|
1558
1715
|
let i = r + 1;
|
|
1559
1716
|
if (i >= n.length) continue;
|
|
1560
1717
|
let a = new e.Vector3(n[r].x, n[r].y, n[r].z), o = new e.Vector3(n[i].x, n[i].y, n[i].z);
|
|
1561
|
-
if (
|
|
1718
|
+
if (O(new e.Vector3(a.x, a.y, 0), new e.Vector3(o.x, o.y, 0), new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), .1) != null) {
|
|
1562
1719
|
t = !0;
|
|
1563
1720
|
break;
|
|
1564
1721
|
}
|
|
1565
1722
|
}
|
|
1566
|
-
for (let t = 0; t <
|
|
1567
|
-
let n = new e.Vector3(
|
|
1568
|
-
if (Math.abs(b.facePoints[2].z -
|
|
1569
|
-
let l =
|
|
1723
|
+
for (let t = 0; t < s.length; t++) {
|
|
1724
|
+
let n = new e.Vector3(s[t].doorStartPt.x, s[t].doorStartPt.y, 0), i = new e.Vector3(s[t].doorEndPt.x, s[t].doorEndPt.y, 0), o = new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), c = new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), l = b.facePoints[2].z < s[t].maxZ || Math.abs(b.facePoints[2].z - s[t].maxZ) < .3;
|
|
1725
|
+
if (Math.abs(b.facePoints[2].z - s[t].maxZ), l) {
|
|
1726
|
+
let l = z(n.clone(), i.clone(), o.clone(), c.clone(), { distanceThreshold: 2 });
|
|
1570
1727
|
if (l && l.type == "collinear_gap") {
|
|
1571
|
-
let u =
|
|
1728
|
+
let u = R(n, i), d = new e.Line3(new e.Vector3(a.start.x, a.start.y, 0), new e.Vector3(a.end.x, a.end.y, 0)), f = new e.Vector3(), p = d.closestPointToPoint(u, !0, f);
|
|
1572
1729
|
if (u.distanceTo(p) < .15) {
|
|
1573
|
-
let a = o.distanceTo(n), u =
|
|
1730
|
+
let a = o.distanceTo(n), u = c.distanceTo(n);
|
|
1574
1731
|
if (a > .25 && u > .25) {
|
|
1575
|
-
let e = o.distanceTo(i), t =
|
|
1732
|
+
let e = o.distanceTo(i), t = c.distanceTo(i);
|
|
1576
1733
|
if (e > .2 && t > .2) continue;
|
|
1577
1734
|
}
|
|
1578
|
-
E = !0,
|
|
1579
|
-
let d = new e.Vector3().subVectors(o,
|
|
1580
|
-
u < a && d.negate(), a > u ? (
|
|
1735
|
+
E = !0, D = !0, k.push(s[t].index), s[t].isFind = !0, te = t, r[s[t].index].isFindBeam = !0;
|
|
1736
|
+
let d = new e.Vector3().subVectors(o, c).normalize(), f = n.distanceTo(i) - l.overlap;
|
|
1737
|
+
u < a && d.negate(), a > u ? (A = b.facePoints[2].clone().addScaledVector(d, f), M = b.facePoints[3].clone(), N = M.clone(), F = A.clone(), N.z = F.z = b.facePoints[0].z) : (A = b.facePoints[2].clone(), M = b.facePoints[3].clone().addScaledVector(d, f), N = M.clone(), F = A.clone(), N.z = F.z = b.facePoints[0].z);
|
|
1581
1738
|
}
|
|
1582
1739
|
} else if (l && l.type == "collinear_overlap" && l.maxPerpendicularDistance < .35) {
|
|
1583
|
-
let a = o.distanceTo(
|
|
1740
|
+
let a = o.distanceTo(c), u = i.distanceTo(n);
|
|
1584
1741
|
if (Math.abs(a - l.overlap) < .25 || Math.abs(u - l.overlap) < .25) {
|
|
1585
1742
|
if (u > a && Math.abs(u - l.overlap) > 1) {
|
|
1586
|
-
let t = o.distanceTo(n), r = o.distanceTo(i), a =
|
|
1587
|
-
d < f ? (p.negate(),
|
|
1743
|
+
let t = o.distanceTo(n), r = o.distanceTo(i), a = c.distanceTo(n), s = c.distanceTo(i), d = t < r ? t : r, f = a < s ? a : s, p = new e.Vector3().subVectors(o, c).normalize(), m = u - l.overlap;
|
|
1744
|
+
d < f ? (p.negate(), A = b.facePoints[2].clone().addScaledVector(p, m), M = b.facePoints[3].clone(), N = M.clone(), F = A.clone(), N.z = F.z = b.facePoints[0].z) : (A = b.facePoints[2].clone(), M = b.facePoints[3].clone().addScaledVector(p, m), N = M.clone(), F = A.clone(), N.z = F.z = b.facePoints[0].z);
|
|
1588
1745
|
}
|
|
1589
|
-
E = !0,
|
|
1746
|
+
E = !0, D = !0, k.push(s[t].index), s[t].isFind = !0, r[s[t].index].isFindBeam = !0, te = t;
|
|
1590
1747
|
}
|
|
1591
1748
|
}
|
|
1592
1749
|
}
|
|
1593
1750
|
}
|
|
1594
|
-
if (!
|
|
1595
|
-
if (
|
|
1596
|
-
let n = new e.Vector3(
|
|
1597
|
-
(
|
|
1751
|
+
if (!D) for (let t = 0; t < s.length; t++) {
|
|
1752
|
+
if (s[t].inWall) continue;
|
|
1753
|
+
let n = new e.Vector3(s[t].doorStartPt.x, s[t].doorStartPt.y, 0), i = new e.Vector3(s[t].doorEndPt.x, s[t].doorEndPt.y, 0), a = new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), o = new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), c = new e.Vector3().subVectors(n, i).normalize(), l = new e.Vector3().subVectors(a, o).normalize(), u = .25, d = O(n.clone().addScaledVector(c, u), i.clone().addScaledVector(c.clone().negate(), u), a.clone().addScaledVector(l, u), o.clone().addScaledVector(l.clone().negate(), u)), f = n.distanceTo(a), m = n.distanceTo(o), h = i.distanceTo(a), g = i.distanceTo(o);
|
|
1754
|
+
(f < p || m < p || h < p || g < p || d) && (r[s[t].index].isFindBeam = !0, E = !0, s[t].isFind = !0, te = t);
|
|
1598
1755
|
}
|
|
1599
|
-
(E || t || Math.abs(S -
|
|
1756
|
+
(E || t || Math.abs(S - v) > .1 && S > v / 2 && x > .3 && Math.abs(h - a.start.z) < .4) && (T = !0);
|
|
1600
1757
|
}
|
|
1601
1758
|
}
|
|
1602
1759
|
if (T) {
|
|
1603
1760
|
let n = !1;
|
|
1604
|
-
for (let e = 0; e <
|
|
1605
|
-
let t =
|
|
1761
|
+
for (let e = 0; e < d.length; e++) {
|
|
1762
|
+
let t = z(d[e].start, d[e].end, N, F);
|
|
1606
1763
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .01) {
|
|
1607
1764
|
n = !0;
|
|
1608
1765
|
break;
|
|
1609
1766
|
}
|
|
1610
1767
|
}
|
|
1611
1768
|
if (n) {
|
|
1612
|
-
|
|
1769
|
+
te != -1 && (r[s[te].index].isFindBeam = !1, s[te].isFind = !1);
|
|
1613
1770
|
continue;
|
|
1614
1771
|
}
|
|
1615
|
-
|
|
1772
|
+
d.push({
|
|
1616
1773
|
start: N,
|
|
1617
|
-
end:
|
|
1774
|
+
end: F
|
|
1618
1775
|
});
|
|
1619
1776
|
{
|
|
1620
1777
|
new e.PointsMaterial({
|
|
1621
1778
|
color: 65535,
|
|
1622
1779
|
size: .01
|
|
1623
1780
|
});
|
|
1624
|
-
let t = new e.Vector3().subVectors(N,
|
|
1781
|
+
let t = new e.Vector3().subVectors(N, F), n = new e.Vector3().subVectors(F, N), r = Infinity, i = Infinity, o = N.clone(), s = F.clone(), c = [], l = [], u = new e.Line3(A, M), d = new e.Vector3(), f = 999999;
|
|
1625
1782
|
if (a.originalPoints.forEach((r) => {
|
|
1626
|
-
if (r.z - N.z < S / 2 + .1 && r.z - N.z > S / 2 - .1 && c.push(r), r.z >
|
|
1627
|
-
let i = u.closestPointToPoint(r, !0, d), a = new e.Vector3().subVectors(i,
|
|
1783
|
+
if (r.z - N.z < S / 2 + .1 && r.z - N.z > S / 2 - .1 && c.push(r), r.z > A.z) {
|
|
1784
|
+
let i = u.closestPointToPoint(r, !0, d), a = new e.Vector3().subVectors(i, A), o = j(t, new e.Vector3().subVectors(i, M)), s = j(n, a);
|
|
1628
1785
|
o && o.parallel && !o.sameDirection && s && s.parallel && !s.sameDirection && l.push(r);
|
|
1629
1786
|
}
|
|
1630
1787
|
}), c.length > 0) {
|
|
1631
|
-
let { newProjectPoints: a } =
|
|
1788
|
+
let { newProjectPoints: a } = ae(N, F, c);
|
|
1632
1789
|
for (let e of a) e.z = N.z;
|
|
1633
1790
|
a.forEach((a) => {
|
|
1634
|
-
let c = new e.Vector3(a.x, a.y, N.z), l = new e.Vector3().subVectors(c,
|
|
1791
|
+
let c = new e.Vector3(a.x, a.y, N.z), l = new e.Vector3().subVectors(c, F), u = j(t, new e.Vector3().subVectors(c, N)), d = j(n, l);
|
|
1635
1792
|
if (u && u.parallel && u.sameDirection) {
|
|
1636
1793
|
let e = c.distanceTo(N);
|
|
1637
1794
|
e < r && (r = e, o = c);
|
|
1638
1795
|
} else if (d && d.parallel && d.sameDirection) {
|
|
1639
|
-
let e = c.distanceTo(
|
|
1796
|
+
let e = c.distanceTo(F);
|
|
1640
1797
|
e < i && (i = e, s = c);
|
|
1641
1798
|
}
|
|
1642
1799
|
});
|
|
1643
1800
|
}
|
|
1644
|
-
if (o.equals(N) || (N = o, M = new e.Vector3(N.x, N.y, M.z)), s.equals(
|
|
1645
|
-
let { newOnLinePoints: e } =
|
|
1801
|
+
if (o.equals(N) || (N = o, M = new e.Vector3(N.x, N.y, M.z)), s.equals(F) || (F = s, A = new e.Vector3(F.x, F.y, A.z)), l.length > 10) {
|
|
1802
|
+
let { newOnLinePoints: e } = ae(M, A, l);
|
|
1646
1803
|
for (let t = 0; t < e.length; t++) {
|
|
1647
1804
|
let n = u.closestPointToPoint(e[t], !0, d).distanceTo(e[t]);
|
|
1648
1805
|
n > .02 && f > n && (f = n);
|
|
1649
1806
|
}
|
|
1650
|
-
|
|
1807
|
+
A.z += f, M.z += f, S += f;
|
|
1651
1808
|
}
|
|
1652
1809
|
}
|
|
1653
|
-
let
|
|
1654
|
-
if (
|
|
1655
|
-
|
|
1810
|
+
let p = F.distanceTo(N);
|
|
1811
|
+
if (p < .4 && !E || p < .3 && E) continue;
|
|
1812
|
+
u.includes(i) || u.push(i), a.checkResults[o.index].isDoor = !0;
|
|
1656
1813
|
let m = "", h = {
|
|
1657
|
-
id:
|
|
1658
|
-
beamStart:
|
|
1814
|
+
id: c,
|
|
1815
|
+
beamStart: A,
|
|
1659
1816
|
beamEnd: M,
|
|
1660
|
-
beamHeight: a.rooftopPz -
|
|
1817
|
+
beamHeight: a.rooftopPz - A.z,
|
|
1661
1818
|
doorStart: N,
|
|
1662
|
-
doorEnd:
|
|
1819
|
+
doorEnd: F,
|
|
1663
1820
|
doorHeight: S,
|
|
1664
1821
|
nearId: -1,
|
|
1665
1822
|
type: m,
|
|
1666
|
-
isExtend:
|
|
1823
|
+
isExtend: ee,
|
|
1667
1824
|
isDoor: E,
|
|
1668
|
-
isPullOutDoor:
|
|
1825
|
+
isPullOutDoor: D,
|
|
1669
1826
|
pcbDoorIndexs: k
|
|
1670
1827
|
}, g = !1, _ = new e.Vector3(), v = new e.Vector3(), y = -1;
|
|
1671
|
-
for (let n = 0; n <
|
|
1672
|
-
let r = t[
|
|
1828
|
+
for (let n = 0; n < l.length; n++) {
|
|
1829
|
+
let r = t[l[n].linesIndex].doorAndBeamData[l[n].doorIndex];
|
|
1673
1830
|
if (r.nearId != -1) continue;
|
|
1674
|
-
let i =
|
|
1831
|
+
let i = I(A.clone(), M.clone(), r.beamStart.clone(), r.beamEnd.clone());
|
|
1675
1832
|
if (i && i.isParallel) {
|
|
1676
|
-
let t =
|
|
1833
|
+
let t = A.distanceTo(M), n = r.beamStart.distanceTo(r.beamEnd), i = new e.Line3(A.clone(), M.clone());
|
|
1677
1834
|
i.start.z = 0, i.end.z = 0;
|
|
1678
|
-
let a =
|
|
1679
|
-
n > t && (i.start = new e.Vector3(r.beamStart.x, r.beamStart.y, 0), i.end = new e.Vector3(r.beamEnd.x, r.beamEnd.y, 0), a =
|
|
1680
|
-
let o = new e.Vector3(), s = i.closestPointToPoint(a, !0, o),
|
|
1681
|
-
if (
|
|
1682
|
-
r.nearId =
|
|
1835
|
+
let a = R(r.beamStart, r.beamEnd, !0);
|
|
1836
|
+
n > t && (i.start = new e.Vector3(r.beamStart.x, r.beamStart.y, 0), i.end = new e.Vector3(r.beamEnd.x, r.beamEnd.y, 0), a = R(A, M, !0));
|
|
1837
|
+
let o = new e.Vector3(), s = i.closestPointToPoint(a, !0, o), l = s.distanceTo(a), u = new e.Vector3().subVectors(a, s).normalize(), d = u.clone().negate(), f = a.clone().addScaledVector(d, l + .1), p = O(i.start, i.end, a, f), m = !E && !r.isDoor && (t > n * 2 || n > t * 2);
|
|
1838
|
+
if (l < .4 && p != null && !m) {
|
|
1839
|
+
r.nearId = c, h.nearId = r.id;
|
|
1683
1840
|
let e = .8;
|
|
1684
1841
|
(r.isDoor || h.isDoor) && (r.isDoor = !0, h.isDoor = !0);
|
|
1685
1842
|
let i = k.some((e) => r.pcbDoorIndexs.includes(e));
|
|
1686
|
-
t < n ? t > e && !r.isPullOutDoor ? (r.beamStart =
|
|
1843
|
+
t < n ? t > e && !r.isPullOutDoor ? (r.beamStart = A.clone().addScaledVector(d, l), r.beamEnd = M.clone().addScaledVector(d, l), r.doorStart = N.clone().addScaledVector(d, l), r.doorEnd = F.clone().addScaledVector(d, l), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : !D || D && r.isPullOutDoor && i ? (h.beamStart = r.beamStart.clone().addScaledVector(u, l), h.beamEnd = r.beamEnd.clone().addScaledVector(u, l), h.doorStart = r.doorStart.clone().addScaledVector(u, l), h.doorEnd = r.doorEnd.clone().addScaledVector(u, l), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : (r.beamStart = A.clone().addScaledVector(d, l), r.beamEnd = M.clone().addScaledVector(d, l), r.doorStart = N.clone().addScaledVector(d, l), r.doorEnd = F.clone().addScaledVector(d, l), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : t > n && (n > e && !D ? (h.beamStart = r.beamStart.clone().addScaledVector(d, l), h.beamEnd = r.beamEnd.clone().addScaledVector(d, l), h.doorStart = r.doorStart.clone().addScaledVector(d, l), h.doorEnd = r.doorEnd.clone().addScaledVector(d, l), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : !r.isPullOutDoor || D && r.isPullOutDoor && i ? (r.beamStart = A.clone().addScaledVector(u, l), r.beamEnd = M.clone().addScaledVector(u, l), r.doorStart = N.clone().addScaledVector(u, l), r.doorEnd = F.clone().addScaledVector(u, l), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : (h.beamStart = r.beamStart.clone().addScaledVector(d, l), h.beamEnd = r.beamEnd.clone().addScaledVector(d, l), h.doorStart = r.doorStart.clone().addScaledVector(d, l), h.doorEnd = r.doorEnd.clone().addScaledVector(d, l), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight)), y = h.nearId, _ = r.beamStart.clone(), v = r.beamEnd.clone(), g = !0;
|
|
1687
1844
|
break;
|
|
1688
1845
|
}
|
|
1689
1846
|
}
|
|
1690
1847
|
}
|
|
1691
1848
|
let b = !1;
|
|
1692
1849
|
if (!g) {
|
|
1693
|
-
let a = new e.Line3(N.clone(),
|
|
1850
|
+
let a = new e.Line3(N.clone(), F.clone());
|
|
1694
1851
|
for (let o = 0; o < t.length; o++) {
|
|
1695
1852
|
if (t[o].length < .5 || o == i || !t[o].checkResults) continue;
|
|
1696
|
-
let
|
|
1697
|
-
if (
|
|
1853
|
+
let c = z(new e.Vector3(t[o].start.x, t[o].start.y, t[o].start.z), new e.Vector3(t[o].end.x, t[o].end.y, t[o].end.z), N, F);
|
|
1854
|
+
if (c && c.maxPerpendicularDistance < .3) {
|
|
1698
1855
|
for (let i = 0; i < t[o].checkResults.length; i++) {
|
|
1699
1856
|
let i = [];
|
|
1700
1857
|
t[o].originalPoints.forEach((t) => {
|
|
1701
1858
|
t.z > N.z && t.z < N.z + S / 2 && i.push(new e.Vector3(t.x, t.y, N.z));
|
|
1702
1859
|
});
|
|
1703
|
-
let
|
|
1860
|
+
let c = new e.Vector3(), l = [], u = [];
|
|
1704
1861
|
for (let e = 0; e < i.length; e++) {
|
|
1705
|
-
let t = a.closestPointToPoint(i[e], !0,
|
|
1862
|
+
let t = a.closestPointToPoint(i[e], !0, c);
|
|
1706
1863
|
t.distanceTo(i[e]) < .15 && (l.push(i[e]), u.push(t.clone()));
|
|
1707
1864
|
}
|
|
1708
|
-
for (let e = 0; e < u.length; e++)
|
|
1865
|
+
for (let e = 0; e < u.length; e++) se(a, u[e]) && l.push(u[e]);
|
|
1709
1866
|
if (l = u, l.length < 500) continue;
|
|
1710
|
-
let d =
|
|
1867
|
+
let d = ce(l);
|
|
1711
1868
|
if (d.length == 2) {
|
|
1712
1869
|
let e = d[0].distanceTo(d[1]);
|
|
1713
1870
|
if (Math.abs(e - a.distance()) < .3) {
|
|
1714
|
-
n = !0,
|
|
1871
|
+
n = !0, te != -1 && (r[s[te].index].isFindBeam = !1, s[te].isFind = !1);
|
|
1715
1872
|
break;
|
|
1716
1873
|
}
|
|
1717
1874
|
}
|
|
1718
1875
|
}
|
|
1719
1876
|
if (n) break;
|
|
1720
|
-
} else
|
|
1877
|
+
} else c && c.type == "collinear_overlap" && c.maxPerpendicularDistance > .3 && c.maxPerpendicularDistance < .7 && (b = !0);
|
|
1721
1878
|
}
|
|
1722
1879
|
if (n) continue;
|
|
1723
1880
|
}
|
|
1724
1881
|
let C = !1;
|
|
1725
|
-
if (y != -1) for (let e = 0; e <
|
|
1882
|
+
if (y != -1) for (let e = 0; e < f.length && !(f[e].length == 1 && (f[e][0].id == c ? (f[e].push({
|
|
1726
1883
|
id: y,
|
|
1727
1884
|
beamStart: _,
|
|
1728
1885
|
beamEnd: v
|
|
1729
|
-
}), C = !0) :
|
|
1730
|
-
id:
|
|
1731
|
-
beamStart:
|
|
1886
|
+
}), C = !0) : f[e][0].id == y && (f[e].push({
|
|
1887
|
+
id: c,
|
|
1888
|
+
beamStart: A,
|
|
1732
1889
|
beamEnd: M
|
|
1733
1890
|
}), C = !0), C)); e++);
|
|
1734
|
-
C ||
|
|
1735
|
-
id:
|
|
1736
|
-
beamStart:
|
|
1891
|
+
C || f.push([{
|
|
1892
|
+
id: c,
|
|
1893
|
+
beamStart: A,
|
|
1737
1894
|
beamEnd: M
|
|
1738
1895
|
}]);
|
|
1739
1896
|
let w = h.doorStart.distanceTo(h.doorEnd);
|
|
1740
|
-
if (m = E ? "door" : w > 1.8 || b && w > 1 ? "beam" : "hole", h.type = m, h.nearId != -1 && m == "hole") {
|
|
1897
|
+
if (console.log("id:", c, i, w), m = E ? "door" : w > 1.8 || b && w > 1 ? "beam" : "hole", h.type = m, h.nearId != -1 && m == "hole") {
|
|
1741
1898
|
let e = !1;
|
|
1742
1899
|
for (let n = 0; n < t.length; n++) if (t[n].doorAndBeamData) {
|
|
1743
|
-
for (let r = 0; r < t[n].doorAndBeamData.length; r++) if (t[n].doorAndBeamData[r].nearId ==
|
|
1900
|
+
for (let r = 0; r < t[n].doorAndBeamData.length; r++) if (t[n].doorAndBeamData[r].nearId == c && t[n].doorAndBeamData[r].type == "beam") {
|
|
1744
1901
|
t[n].doorAndBeamData[r].type = m, e = !0;
|
|
1745
1902
|
break;
|
|
1746
1903
|
}
|
|
1747
1904
|
if (e) break;
|
|
1748
1905
|
}
|
|
1749
1906
|
}
|
|
1750
|
-
if (a.doorAndBeamData.push(h),
|
|
1907
|
+
if (a.doorAndBeamData.push(h), l.push({
|
|
1751
1908
|
linesIndex: i,
|
|
1752
1909
|
doorIndex: a.doorAndBeamData.length - 1
|
|
1753
|
-
}),
|
|
1910
|
+
}), c++, D && x < 2) break;
|
|
1754
1911
|
}
|
|
1755
1912
|
}
|
|
1756
1913
|
}
|
|
1757
|
-
let
|
|
1758
|
-
a.completePointAreaPercentage =
|
|
1914
|
+
let b = a.length * (a.rooftopPz - a.start.z);
|
|
1915
|
+
a.completePointAreaPercentage = y / b * 100;
|
|
1759
1916
|
}
|
|
1760
|
-
if (
|
|
1917
|
+
if (u.length > 1) for (let n = 0; n < u.length; n++) {
|
|
1761
1918
|
let r = [];
|
|
1762
|
-
for (let i = 0; i < t[
|
|
1763
|
-
let a = t[
|
|
1919
|
+
for (let i = 0; i < t[u[n]].doorAndBeamData.length; i++) {
|
|
1920
|
+
let a = t[u[n]].doorAndBeamData[i].doorStart.clone(), o = t[u[n]].doorAndBeamData[i].doorEnd.clone();
|
|
1764
1921
|
a.z = o.z = 0;
|
|
1765
1922
|
let s = a.distanceTo(o), c = !1;
|
|
1766
|
-
for (let r = 0; r <
|
|
1767
|
-
let i = t[
|
|
1923
|
+
for (let r = 0; r < u.length; r++) if (n != r) for (let n = 0; n < t[u[r]].doorAndBeamData.length; n++) {
|
|
1924
|
+
let i = t[u[r]].doorAndBeamData[n].doorStart.clone(), l = t[u[r]].doorAndBeamData[n].doorEnd.clone();
|
|
1768
1925
|
i.z = l.z = 0, i.distanceTo(l);
|
|
1769
|
-
let
|
|
1770
|
-
if (
|
|
1771
|
-
let t = new e.Line3(i, l), n =
|
|
1772
|
-
if (Math.abs(s -
|
|
1926
|
+
let d = z(a, o, i, l);
|
|
1927
|
+
if (d.type == "collinear_overlap" && d.maxPerpendicularDistance < .2) {
|
|
1928
|
+
let t = new e.Line3(i, l), n = R(a, o), r = t.closestPointToPoint(n, !0, new e.Vector3()), u = n.distanceTo(r);
|
|
1929
|
+
if (Math.abs(s - d.overlap) < .1 && u < .04) {
|
|
1773
1930
|
c = !0;
|
|
1774
1931
|
break;
|
|
1775
1932
|
}
|
|
1776
1933
|
}
|
|
1777
1934
|
}
|
|
1778
|
-
c || r.push(t[
|
|
1935
|
+
c || r.push(t[u[n]].doorAndBeamData[i]);
|
|
1779
1936
|
}
|
|
1780
|
-
r.length != t[
|
|
1781
|
-
}
|
|
1782
|
-
let
|
|
1783
|
-
for (let n = 0; n <
|
|
1784
|
-
if (
|
|
1785
|
-
let i = new e.Vector3(
|
|
1786
|
-
for (let
|
|
1787
|
-
if (t[
|
|
1788
|
-
let u = new e.Vector3(t[
|
|
1789
|
-
|
|
1790
|
-
let C =
|
|
1791
|
-
if ((T <
|
|
1792
|
-
let o = i.distanceTo(u) < i.distanceTo(d) ? u : d,
|
|
1937
|
+
r.length != t[u[n]].doorAndBeamData.length && (t[u[n]].doorAndBeamData = r);
|
|
1938
|
+
}
|
|
1939
|
+
let m = .65, h = [], g = [];
|
|
1940
|
+
for (let n = 0; n < s.length; n++) {
|
|
1941
|
+
if (s[n].isFind || s[n].inWall) continue;
|
|
1942
|
+
let i = new e.Vector3(s[n].doorStartPt.x, s[n].doorStartPt.y, 0), a = new e.Vector3(s[n].doorEndPt.x, s[n].doorEndPt.y, 0), o = new e.Vector3().subVectors(i, a).normalize();
|
|
1943
|
+
for (let l = 0; l < t.length; l++) {
|
|
1944
|
+
if (t[l].length < .7 || t[l].completePointAreaPercentage > 60) continue;
|
|
1945
|
+
let u = new e.Vector3(t[l].start.x, t[l].start.y, 0), d = new e.Vector3(t[l].end.x, t[l].end.y, 0), _ = new e.Vector3().subVectors(u, d).normalize(), v = .3, y = i.clone().addScaledVector(o, v), b = a.clone().addScaledVector(o.clone().negate(), v), x = u.clone().addScaledVector(_, v), S = d.clone().addScaledVector(_.clone().negate(), v);
|
|
1946
|
+
O(y, b, x, S);
|
|
1947
|
+
let C = I(y, b, x, S), w = i.distanceTo(u) > a.distanceTo(u) ? a : i, T = w.distanceTo(u), E = w.distanceTo(d);
|
|
1948
|
+
if ((T < p || E < p) && C && !C.isParallel) {
|
|
1949
|
+
let o = i.distanceTo(u) < i.distanceTo(d) ? u : d, _ = !1;
|
|
1793
1950
|
for (let v = 0; v < t.length; v++) {
|
|
1794
|
-
if (v ==
|
|
1795
|
-
let y = new e.Vector3(t[v].start.x, t[v].start.y, 0), b = new e.Vector3(t[v].end.x, t[v].end.y, 0), x = new e.Vector3().subVectors(y, b).normalize(), S = x.clone().negate(), C = y.clone().addScaledVector(x, 5), w = b.clone().addScaledVector(S, 5), T =
|
|
1796
|
-
if (
|
|
1797
|
-
let
|
|
1798
|
-
if (w > T && T >
|
|
1799
|
-
else if (w < T && w >
|
|
1951
|
+
if (v == l || h.includes(v) || t[v].length < .7) continue;
|
|
1952
|
+
let y = new e.Vector3(t[v].start.x, t[v].start.y, 0), b = new e.Vector3(t[v].end.x, t[v].end.y, 0), x = new e.Vector3().subVectors(y, b).normalize(), S = x.clone().negate(), C = y.clone().addScaledVector(x, 5), w = b.clone().addScaledVector(S, 5), T = L(u, d, y, b), E = z(u, d, y, b), D = O(u, d, C, w), k = !0;
|
|
1953
|
+
if (D != null && (k = D.point.distanceTo(u) < p || D.point.distanceTo(d) < p), (T && T.angle > 85 || E && E.type == "collinear_gap") && k) {
|
|
1954
|
+
let p = new e.Line3(u, d), x = new e.Vector3(), S = p.closestPointToPoint(y, !0, x), C = p.closestPointToPoint(b, !0, x), w = S.distanceTo(y), T = C.distanceTo(b), E, D;
|
|
1955
|
+
if (w > T && T > m) E = b, D = C;
|
|
1956
|
+
else if (w < T && w > m) E = y, D = S;
|
|
1800
1957
|
else continue;
|
|
1801
1958
|
if (w = o.distanceTo(y), T = o.distanceTo(b), w > 2 && T > 2) continue;
|
|
1802
|
-
let O =
|
|
1959
|
+
let O = I(E, D, y, b);
|
|
1803
1960
|
if (!O || !O.isParallel) continue;
|
|
1804
|
-
let k =
|
|
1961
|
+
let k = z(i, a, E, D);
|
|
1805
1962
|
if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < .2) continue;
|
|
1806
1963
|
E.z = D.z = t[v].start.z;
|
|
1807
1964
|
let A = !1;
|
|
1808
|
-
for (let e = 0; e <
|
|
1809
|
-
let t =
|
|
1965
|
+
for (let e = 0; e < g.length; e++) {
|
|
1966
|
+
let t = z(g[e].start, g[e].end, E, D);
|
|
1810
1967
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .2) {
|
|
1811
1968
|
A = !0;
|
|
1812
1969
|
break;
|
|
@@ -1815,20 +1972,20 @@ var fe = class {
|
|
|
1815
1972
|
if (A) continue;
|
|
1816
1973
|
for (let n = 0; n < t.length; n++) {
|
|
1817
1974
|
if (t[n].length < .5) continue;
|
|
1818
|
-
let r =
|
|
1975
|
+
let r = z(new e.Vector3(t[n].start.x, t[n].start.y, t[n].start.z), new e.Vector3(t[n].end.x, t[n].end.y, t[n].end.z), E, D);
|
|
1819
1976
|
if (r && r.type == "collinear_overlap" && r.maxPerpendicularDistance < .1) {
|
|
1820
1977
|
A = !0;
|
|
1821
1978
|
break;
|
|
1822
1979
|
}
|
|
1823
1980
|
}
|
|
1824
1981
|
if (A) continue;
|
|
1825
|
-
|
|
1982
|
+
g.push({
|
|
1826
1983
|
start: E,
|
|
1827
1984
|
end: D
|
|
1828
|
-
}),
|
|
1829
|
-
let j = t[v].rooftopPz - t[v].start.z, M = t[
|
|
1985
|
+
}), h.push(v);
|
|
1986
|
+
let j = t[v].rooftopPz - t[v].start.z, M = t[l].rooftopPz - t[l].start.z, N = j < M ? j : M;
|
|
1830
1987
|
t[v].doorAndBeamData || (t[v].doorAndBeamData = []), t[v].doorAndBeamData.push({
|
|
1831
|
-
id:
|
|
1988
|
+
id: c,
|
|
1832
1989
|
beamStart: E,
|
|
1833
1990
|
beamEnd: D,
|
|
1834
1991
|
beamHeight: N,
|
|
@@ -1838,23 +1995,23 @@ var fe = class {
|
|
|
1838
1995
|
nearId: -1,
|
|
1839
1996
|
type: "onlyDoor",
|
|
1840
1997
|
isDoor: !0
|
|
1841
|
-
}), r[
|
|
1842
|
-
id:
|
|
1998
|
+
}), r[s[n].index].isFindBeam = !0, r[s[n].index].isFindOnlyDoor = !0, f.push([{
|
|
1999
|
+
id: c,
|
|
1843
2000
|
beamStart: E,
|
|
1844
2001
|
beamEnd: D
|
|
1845
|
-
}]),
|
|
2002
|
+
}]), c++, _ = !0;
|
|
1846
2003
|
break;
|
|
1847
2004
|
}
|
|
1848
2005
|
}
|
|
1849
|
-
if (
|
|
2006
|
+
if (_) break;
|
|
1850
2007
|
}
|
|
1851
2008
|
}
|
|
1852
2009
|
}
|
|
1853
2010
|
return {
|
|
1854
2011
|
lines: t,
|
|
1855
|
-
beamGroup:
|
|
2012
|
+
beamGroup: f
|
|
1856
2013
|
};
|
|
1857
|
-
},
|
|
2014
|
+
}, ke = (t, n) => {
|
|
1858
2015
|
if (t.length <= 0) return t;
|
|
1859
2016
|
for (let n of t) {
|
|
1860
2017
|
let t = [];
|
|
@@ -1896,7 +2053,7 @@ var fe = class {
|
|
|
1896
2053
|
if (i.points.push(...a[t]), i.area += o.distanceTo(s) * o.distanceTo(p), i.originalVertices.push(a[t]), i.index = r, i.centerPts.push(m), u == -1 || d == -1) {
|
|
1897
2054
|
let t = new e.Vector3().subVectors(o, s).normalize();
|
|
1898
2055
|
d = o.distanceTo(p), u = o.distanceTo(s);
|
|
1899
|
-
let n =
|
|
2056
|
+
let n = j(t, new e.Vector3(0, 0, 1));
|
|
1900
2057
|
n && n.parallel && ([d, u] = [u, d]);
|
|
1901
2058
|
}
|
|
1902
2059
|
i.gridWidth = u, i.gridHeight = d;
|
|
@@ -1927,7 +2084,7 @@ var fe = class {
|
|
|
1927
2084
|
size: .01
|
|
1928
2085
|
});
|
|
1929
2086
|
for (let r = 0; r < t.length; r++) {
|
|
1930
|
-
let i = t[r], { minZ: o, maxZ: s } =
|
|
2087
|
+
let i = t[r], { minZ: o, maxZ: s } = ie(i);
|
|
1931
2088
|
if (o == null || s == null) continue;
|
|
1932
2089
|
i.doorAndBeamData = [], i.completePointAreaPercentage = -1, s - o;
|
|
1933
2090
|
let c = i.rooftopPz - i.start.z;
|
|
@@ -1935,17 +2092,17 @@ var fe = class {
|
|
|
1935
2092
|
let l = new e.Vector3(i.start.x, i.start.y, 0), u = new e.Vector3(i.end.x, i.end.y, 0);
|
|
1936
2093
|
for (let i = 0; i < t.length; i++) {
|
|
1937
2094
|
if (i == r || t[i].length < 1) continue;
|
|
1938
|
-
let a = t[i], o = new e.Vector3(a.start.x, a.start.y, 0), c = new e.Vector3(a.end.x, a.end.y, 0), d =
|
|
2095
|
+
let a = t[i], o = new e.Vector3(a.start.x, a.start.y, 0), c = new e.Vector3(a.end.x, a.end.y, 0), d = I(l, u, o, c), f = R(l, u), p = new e.Line3(o, c).closestPointToPoint(f, !0, new e.Vector3()), m = f.distanceTo(p), h = ie(a);
|
|
1939
2096
|
if (!(h.minZ === void 0 || h.maxZ === void 0) && !(h.maxZ - h.minZ > 1) && d && d.isParallel && m < .25 && Math.abs(s - h.minZ) < .1) {
|
|
1940
|
-
let a =
|
|
2097
|
+
let a = R(l, u), s = R(o, c);
|
|
1941
2098
|
a.z = s.z = 1, a.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), s.applyEuler(new e.Euler(-Math.PI / 2, 0, 0));
|
|
1942
2099
|
let d = `w:${t[r].originaIndex},b:${t[i].originaIndex}`, f = `b:${t[i].originaIndex},w:${t[r].originaIndex}`;
|
|
1943
|
-
n.add(
|
|
2100
|
+
n.add(k(d, a, { textColor: "#fd0000" })), n.add(k(f, s, { textColor: "#fd0000" }));
|
|
1944
2101
|
}
|
|
1945
2102
|
}
|
|
1946
2103
|
}
|
|
1947
2104
|
return t;
|
|
1948
|
-
},
|
|
2105
|
+
}, Ae = (t, n) => {
|
|
1949
2106
|
let r = {
|
|
1950
2107
|
rectangles: [],
|
|
1951
2108
|
threeEdgeRect: []
|
|
@@ -1958,7 +2115,7 @@ var fe = class {
|
|
|
1958
2115
|
for (let r = 0; r < t.length; r++) {
|
|
1959
2116
|
let i = t[r].length;
|
|
1960
2117
|
if (r == n || i < a || i > o) continue;
|
|
1961
|
-
let g = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), _ = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), v =
|
|
2118
|
+
let g = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), _ = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), v = L(u, d, g, _);
|
|
1962
2119
|
if (!v || v.angle < 85) continue;
|
|
1963
2120
|
let y = V(g, u), b = V(g, d), x = V(_, u), S = V(_, d);
|
|
1964
2121
|
if (!(!y && !b && !x && !S)) {
|
|
@@ -1966,19 +2123,19 @@ var fe = class {
|
|
|
1966
2123
|
for (let p = 0; p < t.length; p++) {
|
|
1967
2124
|
let h = t[p].length;
|
|
1968
2125
|
if (p == n || p == r || h < a || h > o) continue;
|
|
1969
|
-
let v = new e.Vector3(t[p].start.x, t[p].start.y, t[p].start.z), y = new e.Vector3(t[p].end.x, t[p].end.y, t[p].end.z), b =
|
|
2126
|
+
let v = new e.Vector3(t[p].start.x, t[p].start.y, t[p].start.z), y = new e.Vector3(t[p].end.x, t[p].end.y, t[p].end.z), b = L(g, _, v, y);
|
|
1970
2127
|
if (!b || b.angle < 85) continue;
|
|
1971
2128
|
let x = V(v, m), S = V(y, m);
|
|
1972
2129
|
if (!x && !S) continue;
|
|
1973
2130
|
new e.Vector3();
|
|
1974
2131
|
let C = new e.Vector3(), w = new e.Vector3();
|
|
1975
2132
|
x ? (w = new e.Vector3().subVectors(y, v).normalize(), v.clone(), C = y.clone()) : (w = new e.Vector3().subVectors(v, y).normalize(), y.clone(), C = v.clone());
|
|
1976
|
-
let T =
|
|
2133
|
+
let T = j(f, w, .1);
|
|
1977
2134
|
if (!(!T || !T.parallel || !T.sameDirection)) {
|
|
1978
2135
|
for (let f = 0; f < t.length; f++) {
|
|
1979
2136
|
let m = t[f].length;
|
|
1980
2137
|
if (f == n || f == r || f == p || m < a || m > o) continue;
|
|
1981
|
-
let h = new e.Vector3(t[f].start.x, t[f].start.y, t[f].start.z), g = new e.Vector3(t[f].end.x, t[f].end.y, t[f].end.z), _ =
|
|
2138
|
+
let h = new e.Vector3(t[f].start.x, t[f].start.y, t[f].start.z), g = new e.Vector3(t[f].end.x, t[f].end.y, t[f].end.z), _ = L(h, g, v, y);
|
|
1982
2139
|
if (!_ || _.angle < 85) continue;
|
|
1983
2140
|
let b = V(h, C), x = V(g, C);
|
|
1984
2141
|
if (!b && !x) continue;
|
|
@@ -2028,7 +2185,7 @@ var fe = class {
|
|
|
2028
2185
|
for (let r = 0; r < t.length; r++) {
|
|
2029
2186
|
let f = t[r].length;
|
|
2030
2187
|
if (r == n || i.has(r) || f < a || f > o) continue;
|
|
2031
|
-
let p = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), m = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), g =
|
|
2188
|
+
let p = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), m = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), g = L(u, d, p, m);
|
|
2032
2189
|
if (!g || g.angle < 85) continue;
|
|
2033
2190
|
let _ = V(p, d), v = V(m, d);
|
|
2034
2191
|
if (!_ && !v) continue;
|
|
@@ -2038,13 +2195,13 @@ var fe = class {
|
|
|
2038
2195
|
for (let d = 0; d < t.length; d++) {
|
|
2039
2196
|
let g = t[d].length;
|
|
2040
2197
|
if (d == n || d == r || i.has(d) || g < a || g > o) continue;
|
|
2041
|
-
let _ = new e.Vector3(t[d].start.x, t[d].start.y, t[d].start.z), v = new e.Vector3(t[d].end.x, t[d].end.y, t[d].end.z), b =
|
|
2198
|
+
let _ = new e.Vector3(t[d].start.x, t[d].start.y, t[d].start.z), v = new e.Vector3(t[d].end.x, t[d].end.y, t[d].end.z), b = L(p, m, _, v);
|
|
2042
2199
|
if (!b || b.angle < 85) continue;
|
|
2043
2200
|
let x = V(_, y), S = V(v, y);
|
|
2044
2201
|
if (!x && !S) continue;
|
|
2045
2202
|
let C = new e.Vector3(), w = new e.Vector3();
|
|
2046
2203
|
x ? (C = _.clone(), w = v.clone()) : (C = v.clone(), w = _.clone());
|
|
2047
|
-
let T =
|
|
2204
|
+
let T = j(h, new e.Vector3().subVectors(w, C).normalize(), .1);
|
|
2048
2205
|
if (!T || !T.parallel || !T.sameDirection) continue;
|
|
2049
2206
|
let E = !0, D = !0;
|
|
2050
2207
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2068,8 +2225,8 @@ var fe = class {
|
|
|
2068
2225
|
l.indexs.length == 3 && (l.indexs.forEach((e) => i.add(e)), r.threeEdgeRect.push(l));
|
|
2069
2226
|
}
|
|
2070
2227
|
return r;
|
|
2071
|
-
}, H = 11102230246251565e-32, U = 134217729,
|
|
2072
|
-
function
|
|
2228
|
+
}, H = 11102230246251565e-32, U = 134217729, je = (3 + 8 * H) * H;
|
|
2229
|
+
function Me(e, t, n, r, i) {
|
|
2073
2230
|
let a, o, s, c, l = t[0], u = r[0], d = 0, f = 0;
|
|
2074
2231
|
u > l == u > -l ? (a = l, l = t[++d]) : (a = u, u = r[++f]);
|
|
2075
2232
|
let p = 0;
|
|
@@ -2078,7 +2235,7 @@ function xe(e, t, n, r, i) {
|
|
|
2078
2235
|
for (; f < n;) o = a + u, c = o - a, s = a - (o - c) + (u - c), u = r[++f], a = o, s !== 0 && (i[p++] = s);
|
|
2079
2236
|
return (a !== 0 || p === 0) && (i[p++] = a), p;
|
|
2080
2237
|
}
|
|
2081
|
-
function
|
|
2238
|
+
function Ne(e, t) {
|
|
2082
2239
|
let n = t[0];
|
|
2083
2240
|
for (let r = 1; r < e; r++) n += t[r];
|
|
2084
2241
|
return n;
|
|
@@ -2088,27 +2245,27 @@ function W(e) {
|
|
|
2088
2245
|
}
|
|
2089
2246
|
//#endregion
|
|
2090
2247
|
//#region node_modules/robust-predicates/esm/orient2d.js
|
|
2091
|
-
var
|
|
2092
|
-
function
|
|
2248
|
+
var Pe = (3 + 16 * H) * H, Fe = (2 + 12 * H) * H, Ie = (9 + 64 * H) * H * H, Le = W(4), Re = W(8), ze = W(12), Be = W(16), G = W(4);
|
|
2249
|
+
function Ve(e, t, n, r, i, a, o) {
|
|
2093
2250
|
let s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T = e - i, E = n - i, D = t - a, O = r - a;
|
|
2094
|
-
b = T * O, f = U * T, p = f - (f - T), m = T - p, f = U * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = D * E, f = U * D, p = f - (f - D), m = D - p, f = U * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _,
|
|
2095
|
-
let k =
|
|
2096
|
-
if (k >= A || -k >= A || (d = e - T, s = e - (T + d) + (d - i), d = n - E, l = n - (E + d) + (d - i), d = t - D, c = t - (D + d) + (d - a), d = r - O, u = r - (O + d) + (d - a), s === 0 && c === 0 && l === 0 && u === 0) || (A =
|
|
2251
|
+
b = T * O, f = U * T, p = f - (f - T), m = T - p, f = U * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = D * E, f = U * D, p = f - (f - D), m = D - p, f = U * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Le[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Le[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Le[2] = v - (w - d) + (_ - d), Le[3] = w;
|
|
2252
|
+
let k = Ne(4, Le), A = Fe * o;
|
|
2253
|
+
if (k >= A || -k >= A || (d = e - T, s = e - (T + d) + (d - i), d = n - E, l = n - (E + d) + (d - i), d = t - D, c = t - (D + d) + (d - a), d = r - O, u = r - (O + d) + (d - a), s === 0 && c === 0 && l === 0 && u === 0) || (A = Ie * o + je * Math.abs(k), k += T * u + O * s - (D * l + E * c), k >= A || -k >= A)) return k;
|
|
2097
2254
|
b = s * O, f = U * s, p = f - (f - s), m = s - p, f = U * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = c * E, f = U * c, p = f - (f - c), m = c - p, f = U * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w;
|
|
2098
|
-
let j =
|
|
2255
|
+
let j = Me(4, Le, 4, G, Re);
|
|
2099
2256
|
b = T * u, f = U * T, p = f - (f - T), m = T - p, f = U * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = D * l, f = U * D, p = f - (f - D), m = D - p, f = U * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w;
|
|
2100
|
-
let M =
|
|
2101
|
-
return b = s * u, f = U * s, p = f - (f - s), m = s - p, f = U * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = c * l, f = U * c, p = f - (f - c), m = c - p, f = U * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w,
|
|
2257
|
+
let M = Me(j, Re, 4, G, ze);
|
|
2258
|
+
return b = s * u, f = U * s, p = f - (f - s), m = s - p, f = U * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = c * l, f = U * c, p = f - (f - c), m = c - p, f = U * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w, Be[Me(M, ze, 4, G, Be) - 1];
|
|
2102
2259
|
}
|
|
2103
|
-
function
|
|
2260
|
+
function He(e, t, n, r, i, a) {
|
|
2104
2261
|
let o = (t - a) * (n - i), s = (e - i) * (r - a), c = o - s, l = Math.abs(o + s);
|
|
2105
|
-
return Math.abs(c) >=
|
|
2262
|
+
return Math.abs(c) >= Pe * l ? c : -Ve(e, t, n, r, i, a, l);
|
|
2106
2263
|
}
|
|
2107
2264
|
(7 + 56 * H) * H, (3 + 28 * H) * H, (26 + 288 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(8), W(8), W(8), W(4), W(8), W(8), W(16), W(12), W(192), W(192), (10 + 96 * H) * H, (4 + 48 * H) * H, (44 + 576 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(4), W(4), W(4), W(8), W(16), W(16), W(16), W(32), W(32), W(48), W(64), W(1152), W(1152), (16 + 224 * H) * H, (5 + 72 * H) * H, (71 + 1408 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(1152), W(1152), W(1152), W(1152), W(1152), W(2304), W(2304), W(3456), W(5760), W(8), W(8), W(8), W(16), W(24), W(48), W(48), W(96), W(192), W(384), W(384), W(384), W(768), W(96), W(96), W(96), W(1152);
|
|
2108
2265
|
//#endregion
|
|
2109
2266
|
//#region node_modules/delaunator/index.js
|
|
2110
|
-
var
|
|
2111
|
-
static from(t, n =
|
|
2267
|
+
var Ue = 2 ** -52, We = new Uint32Array(512), Ge = class e {
|
|
2268
|
+
static from(t, n = $e, r = et) {
|
|
2112
2269
|
let i = t.length, a = new Float64Array(i * 2);
|
|
2113
2270
|
for (let e = 0; e < i; e++) {
|
|
2114
2271
|
let i = t[e];
|
|
@@ -2131,25 +2288,25 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2131
2288
|
}
|
|
2132
2289
|
let u = (o + c) / 2, d = (s + l) / 2, f = 0, p = 0, m = 0;
|
|
2133
2290
|
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2134
|
-
let r =
|
|
2291
|
+
let r = qe(u, d, e[2 * t], e[2 * t + 1]);
|
|
2135
2292
|
r < n && (f = t, n = r);
|
|
2136
2293
|
}
|
|
2137
2294
|
let h = e[2 * f], g = e[2 * f + 1];
|
|
2138
2295
|
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2139
2296
|
if (t === f) continue;
|
|
2140
|
-
let r =
|
|
2297
|
+
let r = qe(h, g, e[2 * t], e[2 * t + 1]);
|
|
2141
2298
|
r < n && r > 0 && (p = t, n = r);
|
|
2142
2299
|
}
|
|
2143
2300
|
let _ = e[2 * p], v = e[2 * p + 1], y = Infinity;
|
|
2144
2301
|
for (let t = 0; t < a; t++) {
|
|
2145
2302
|
if (t === f || t === p) continue;
|
|
2146
|
-
let n =
|
|
2303
|
+
let n = Ye(h, g, _, v, e[2 * t], e[2 * t + 1]);
|
|
2147
2304
|
n < y && (m = t, y = n);
|
|
2148
2305
|
}
|
|
2149
2306
|
let b = e[2 * m], x = e[2 * m + 1];
|
|
2150
2307
|
if (y === Infinity) {
|
|
2151
2308
|
for (let t = 0; t < a; t++) this._dists[t] = e[2 * t] - e[0] || e[2 * t + 1] - e[1];
|
|
2152
|
-
|
|
2309
|
+
Ze(this._ids, this._dists, 0, a - 1);
|
|
2153
2310
|
let t = new Uint32Array(a), n = 0;
|
|
2154
2311
|
for (let e = 0, r = -Infinity; e < a; e++) {
|
|
2155
2312
|
let i = this._ids[e], a = this._dists[i];
|
|
@@ -2158,24 +2315,24 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2158
2315
|
this.hull = t.subarray(0, n), this.triangles = new Uint32Array(), this.halfedges = new Int32Array();
|
|
2159
2316
|
return;
|
|
2160
2317
|
}
|
|
2161
|
-
if (
|
|
2318
|
+
if (He(h, g, _, v, b, x) < 0) {
|
|
2162
2319
|
let e = p, t = _, n = v;
|
|
2163
2320
|
p = m, _ = b, v = x, m = e, b = t, x = n;
|
|
2164
2321
|
}
|
|
2165
|
-
let S =
|
|
2322
|
+
let S = Xe(h, g, _, v, b, x);
|
|
2166
2323
|
this._cx = S.x, this._cy = S.y;
|
|
2167
|
-
for (let t = 0; t < a; t++) this._dists[t] =
|
|
2168
|
-
|
|
2324
|
+
for (let t = 0; t < a; t++) this._dists[t] = qe(e[2 * t], e[2 * t + 1], S.x, S.y);
|
|
2325
|
+
Ze(this._ids, this._dists, 0, a - 1), this._hullStart = f;
|
|
2169
2326
|
let C = 3;
|
|
2170
2327
|
n[f] = t[m] = p, n[p] = t[f] = m, n[m] = t[p] = f, r[f] = 0, r[p] = 1, r[m] = 2, i.fill(-1), i[this._hashKey(h, g)] = f, i[this._hashKey(_, v)] = p, i[this._hashKey(b, x)] = m, this.trianglesLen = 0, this._addTriangle(f, p, m, -1, -1, -1);
|
|
2171
2328
|
for (let a = 0, o = 0, s = 0; a < this._ids.length; a++) {
|
|
2172
2329
|
let c = this._ids[a], l = e[2 * c], u = e[2 * c + 1];
|
|
2173
|
-
if (a > 0 && Math.abs(l - o) <=
|
|
2330
|
+
if (a > 0 && Math.abs(l - o) <= Ue && Math.abs(u - s) <= Ue || (o = l, s = u, c === f || c === p || c === m)) continue;
|
|
2174
2331
|
let d = 0;
|
|
2175
2332
|
for (let e = 0, t = this._hashKey(l, u); e < this._hashSize && (d = i[(t + e) % this._hashSize], !(d !== -1 && d !== n[d])); e++);
|
|
2176
2333
|
d = t[d];
|
|
2177
2334
|
let h = d, g;
|
|
2178
|
-
for (; g = n[h],
|
|
2335
|
+
for (; g = n[h], He(l, u, e[2 * h], e[2 * h + 1], e[2 * g], e[2 * g + 1]) >= 0;) if (h = g, h === d) {
|
|
2179
2336
|
h = -1;
|
|
2180
2337
|
break;
|
|
2181
2338
|
}
|
|
@@ -2183,8 +2340,8 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2183
2340
|
let _ = this._addTriangle(h, c, n[h], -1, -1, r[h]);
|
|
2184
2341
|
r[c] = this._legalize(_ + 2), r[h] = _, C++;
|
|
2185
2342
|
let v = n[h];
|
|
2186
|
-
for (; g = n[v],
|
|
2187
|
-
if (h === d) for (; g = t[h],
|
|
2343
|
+
for (; g = n[v], He(l, u, e[2 * v], e[2 * v + 1], e[2 * g], e[2 * g + 1]) < 0;) _ = this._addTriangle(v, c, g, r[c], -1, r[v]), r[c] = this._legalize(_ + 2), n[v] = v, C--, v = g;
|
|
2344
|
+
if (h === d) for (; g = t[h], He(l, u, e[2 * g], e[2 * g + 1], e[2 * h], e[2 * h + 1]) < 0;) _ = this._addTriangle(g, c, h, -1, r[h], r[g]), this._legalize(_ + 2), r[g] = _, n[h] = h, C--, h = g;
|
|
2188
2345
|
this._hullStart = t[c] = h, n[h] = t[v] = c, n[c] = v, i[this._hashKey(l, u)] = c, i[this._hashKey(e[2 * h], e[2 * h + 1])] = h;
|
|
2189
2346
|
}
|
|
2190
2347
|
this.hull = new Uint32Array(C);
|
|
@@ -2192,7 +2349,7 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2192
2349
|
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
2193
2350
|
}
|
|
2194
2351
|
_hashKey(e, t) {
|
|
2195
|
-
return Math.floor(
|
|
2352
|
+
return Math.floor(Ke(e - this._cx, t - this._cy) * this._hashSize) % this._hashSize;
|
|
2196
2353
|
}
|
|
2197
2354
|
_legalize(e) {
|
|
2198
2355
|
let { _triangles: t, _halfedges: n, coords: r } = this, i = 0, a = 0;
|
|
@@ -2200,11 +2357,11 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2200
2357
|
let o = n[e], s = e - e % 3;
|
|
2201
2358
|
if (a = s + (e + 2) % 3, o === -1) {
|
|
2202
2359
|
if (i === 0) break;
|
|
2203
|
-
e =
|
|
2360
|
+
e = We[--i];
|
|
2204
2361
|
continue;
|
|
2205
2362
|
}
|
|
2206
2363
|
let c = o - o % 3, l = s + (e + 1) % 3, u = c + (o + 2) % 3, d = t[a], f = t[e], p = t[l], m = t[u];
|
|
2207
|
-
if (
|
|
2364
|
+
if (Je(r[2 * d], r[2 * d + 1], r[2 * f], r[2 * f + 1], r[2 * p], r[2 * p + 1], r[2 * m], r[2 * m + 1])) {
|
|
2208
2365
|
t[e] = m, t[o] = d;
|
|
2209
2366
|
let r = n[u];
|
|
2210
2367
|
if (r === -1) {
|
|
@@ -2219,10 +2376,10 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2219
2376
|
}
|
|
2220
2377
|
this._link(e, r), this._link(o, n[a]), this._link(a, u);
|
|
2221
2378
|
let s = c + (o + 1) % 3;
|
|
2222
|
-
i <
|
|
2379
|
+
i < We.length && (We[i++] = s);
|
|
2223
2380
|
} else {
|
|
2224
2381
|
if (i === 0) break;
|
|
2225
|
-
e =
|
|
2382
|
+
e = We[--i];
|
|
2226
2383
|
}
|
|
2227
2384
|
}
|
|
2228
2385
|
return a;
|
|
@@ -2235,30 +2392,30 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2235
2392
|
return this._triangles[o] = e, this._triangles[o + 1] = t, this._triangles[o + 2] = n, this._link(o, r), this._link(o + 1, i), this._link(o + 2, a), this.trianglesLen += 3, o;
|
|
2236
2393
|
}
|
|
2237
2394
|
};
|
|
2238
|
-
function
|
|
2395
|
+
function Ke(e, t) {
|
|
2239
2396
|
let n = e / (Math.abs(e) + Math.abs(t));
|
|
2240
2397
|
return (t > 0 ? 3 - n : 1 + n) / 4;
|
|
2241
2398
|
}
|
|
2242
|
-
function
|
|
2399
|
+
function qe(e, t, n, r) {
|
|
2243
2400
|
let i = e - n, a = t - r;
|
|
2244
2401
|
return i * i + a * a;
|
|
2245
2402
|
}
|
|
2246
|
-
function
|
|
2403
|
+
function Je(e, t, n, r, i, a, o, s) {
|
|
2247
2404
|
let c = e - o, l = t - s, u = n - o, d = r - s, f = i - o, p = a - s, m = c * c + l * l, h = u * u + d * d, g = f * f + p * p;
|
|
2248
2405
|
return c * (d * g - h * p) - l * (u * g - h * f) + m * (u * p - d * f) < 0;
|
|
2249
2406
|
}
|
|
2250
|
-
function
|
|
2407
|
+
function Ye(e, t, n, r, i, a) {
|
|
2251
2408
|
let o = n - e, s = r - t, c = i - e, l = a - t, u = o * o + s * s, d = c * c + l * l, f = .5 / (o * l - s * c), p = (l * u - s * d) * f, m = (o * d - c * u) * f;
|
|
2252
2409
|
return p * p + m * m;
|
|
2253
2410
|
}
|
|
2254
|
-
function
|
|
2411
|
+
function Xe(e, t, n, r, i, a) {
|
|
2255
2412
|
let o = n - e, s = r - t, c = i - e, l = a - t, u = o * o + s * s, d = c * c + l * l, f = .5 / (o * l - s * c);
|
|
2256
2413
|
return {
|
|
2257
2414
|
x: e + (l * u - s * d) * f,
|
|
2258
2415
|
y: t + (o * d - c * u) * f
|
|
2259
2416
|
};
|
|
2260
2417
|
}
|
|
2261
|
-
function
|
|
2418
|
+
function Ze(e, t, n, r) {
|
|
2262
2419
|
if (r - n <= 20) for (let i = n + 1; i <= r; i++) {
|
|
2263
2420
|
let r = e[i], a = t[r], o = i - 1;
|
|
2264
2421
|
for (; o >= n && t[e[o]] > a;) e[o + 1] = e[o--];
|
|
@@ -2266,7 +2423,7 @@ function Be(e, t, n, r) {
|
|
|
2266
2423
|
}
|
|
2267
2424
|
else {
|
|
2268
2425
|
let i = n + r >> 1, a = n + 1, o = r;
|
|
2269
|
-
|
|
2426
|
+
Qe(e, i, a), t[e[n]] > t[e[r]] && Qe(e, n, r), t[e[a]] > t[e[r]] && Qe(e, a, r), t[e[n]] > t[e[a]] && Qe(e, n, a);
|
|
2270
2427
|
let s = e[a], c = t[s];
|
|
2271
2428
|
for (;;) {
|
|
2272
2429
|
do
|
|
@@ -2276,24 +2433,24 @@ function Be(e, t, n, r) {
|
|
|
2276
2433
|
o--;
|
|
2277
2434
|
while (t[e[o]] > c);
|
|
2278
2435
|
if (o < a) break;
|
|
2279
|
-
|
|
2436
|
+
Qe(e, a, o);
|
|
2280
2437
|
}
|
|
2281
|
-
e[n + 1] = e[o], e[o] = s, r - a + 1 >= o - n ? (
|
|
2438
|
+
e[n + 1] = e[o], e[o] = s, r - a + 1 >= o - n ? (Ze(e, t, a, r), Ze(e, t, n, o - 1)) : (Ze(e, t, n, o - 1), Ze(e, t, a, r));
|
|
2282
2439
|
}
|
|
2283
2440
|
}
|
|
2284
|
-
function
|
|
2441
|
+
function Qe(e, t, n) {
|
|
2285
2442
|
let r = e[t];
|
|
2286
2443
|
e[t] = e[n], e[n] = r;
|
|
2287
2444
|
}
|
|
2288
|
-
function
|
|
2445
|
+
function $e(e) {
|
|
2289
2446
|
return e[0];
|
|
2290
2447
|
}
|
|
2291
|
-
function
|
|
2448
|
+
function et(e) {
|
|
2292
2449
|
return e[1];
|
|
2293
2450
|
}
|
|
2294
2451
|
//#endregion
|
|
2295
2452
|
//#region node_modules/d3-delaunay/src/path.js
|
|
2296
|
-
var
|
|
2453
|
+
var tt = 1e-6, nt = class {
|
|
2297
2454
|
constructor() {
|
|
2298
2455
|
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
|
|
2299
2456
|
}
|
|
@@ -2310,7 +2467,7 @@ var We = 1e-6, Ge = class {
|
|
|
2310
2467
|
e = +e, t = +t, n = +n;
|
|
2311
2468
|
let r = e + n, i = t;
|
|
2312
2469
|
if (n < 0) throw Error("negative radius");
|
|
2313
|
-
this._x1 === null ? this._ += `M${r},${i}` : (Math.abs(this._x1 - r) >
|
|
2470
|
+
this._x1 === null ? this._ += `M${r},${i}` : (Math.abs(this._x1 - r) > tt || Math.abs(this._y1 - i) > tt) && (this._ += "L" + r + "," + i), n && (this._ += `A${n},${n},0,1,1,${e - n},${t}A${n},${n},0,1,1,${this._x1 = r},${this._y1 = i}`);
|
|
2314
2471
|
}
|
|
2315
2472
|
rect(e, t, n, r) {
|
|
2316
2473
|
this._ += `M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${+n}v${+r}h${-n}Z`;
|
|
@@ -2318,7 +2475,7 @@ var We = 1e-6, Ge = class {
|
|
|
2318
2475
|
value() {
|
|
2319
2476
|
return this._ || null;
|
|
2320
2477
|
}
|
|
2321
|
-
},
|
|
2478
|
+
}, rt = class {
|
|
2322
2479
|
constructor() {
|
|
2323
2480
|
this._ = [];
|
|
2324
2481
|
}
|
|
@@ -2334,7 +2491,7 @@ var We = 1e-6, Ge = class {
|
|
|
2334
2491
|
value() {
|
|
2335
2492
|
return this._.length ? this._ : null;
|
|
2336
2493
|
}
|
|
2337
|
-
},
|
|
2494
|
+
}, it = class {
|
|
2338
2495
|
constructor(e, [t, n, r, i] = [
|
|
2339
2496
|
0,
|
|
2340
2497
|
0,
|
|
@@ -2370,7 +2527,7 @@ var We = 1e-6, Ge = class {
|
|
|
2370
2527
|
for (let n = 0; n < t.length; ++n) s = t[n], c = l, u = d, f = p, l = s * 4, d = e[2 * s], p = e[2 * s + 1], r[c + 2] = r[l] = f - p, r[c + 3] = r[l + 1] = d - u;
|
|
2371
2528
|
}
|
|
2372
2529
|
render(e) {
|
|
2373
|
-
let t = e == null ? e = new
|
|
2530
|
+
let t = e == null ? e = new nt() : void 0, { delaunay: { halfedges: n, inedges: r, hull: i }, circumcenters: a, vectors: o } = this;
|
|
2374
2531
|
if (i.length <= 1) return null;
|
|
2375
2532
|
for (let t = 0, r = n.length; t < r; ++t) {
|
|
2376
2533
|
let r = n[t];
|
|
@@ -2387,11 +2544,11 @@ var We = 1e-6, Ge = class {
|
|
|
2387
2544
|
return t && t.value();
|
|
2388
2545
|
}
|
|
2389
2546
|
renderBounds(e) {
|
|
2390
|
-
let t = e == null ? e = new
|
|
2547
|
+
let t = e == null ? e = new nt() : void 0;
|
|
2391
2548
|
return e.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), t && t.value();
|
|
2392
2549
|
}
|
|
2393
2550
|
renderCell(e, t) {
|
|
2394
|
-
let n = t == null ? t = new
|
|
2551
|
+
let n = t == null ? t = new nt() : void 0, r = this._clip(e);
|
|
2395
2552
|
if (r === null || !r.length) return;
|
|
2396
2553
|
t.moveTo(r[0], r[1]);
|
|
2397
2554
|
let i = r.length;
|
|
@@ -2407,7 +2564,7 @@ var We = 1e-6, Ge = class {
|
|
|
2407
2564
|
}
|
|
2408
2565
|
}
|
|
2409
2566
|
cellPolygon(e) {
|
|
2410
|
-
let t = new
|
|
2567
|
+
let t = new rt();
|
|
2411
2568
|
return this.renderCell(e, t), t.value();
|
|
2412
2569
|
}
|
|
2413
2570
|
_renderSegment(e, t, n, r, i) {
|
|
@@ -2591,14 +2748,14 @@ var We = 1e-6, Ge = class {
|
|
|
2591
2748
|
}
|
|
2592
2749
|
return e;
|
|
2593
2750
|
}
|
|
2594
|
-
},
|
|
2595
|
-
function
|
|
2751
|
+
}, at = 2 * Math.PI, ot = Math.pow;
|
|
2752
|
+
function st(e) {
|
|
2596
2753
|
return e[0];
|
|
2597
2754
|
}
|
|
2598
|
-
function
|
|
2755
|
+
function ct(e) {
|
|
2599
2756
|
return e[1];
|
|
2600
2757
|
}
|
|
2601
|
-
function
|
|
2758
|
+
function lt(e) {
|
|
2602
2759
|
let { triangles: t, coords: n } = e;
|
|
2603
2760
|
for (let e = 0; e < t.length; e += 3) {
|
|
2604
2761
|
let r = 2 * t[e], i = 2 * t[e + 1], a = 2 * t[e + 2];
|
|
@@ -2606,22 +2763,22 @@ function Qe(e) {
|
|
|
2606
2763
|
}
|
|
2607
2764
|
return !0;
|
|
2608
2765
|
}
|
|
2609
|
-
function
|
|
2766
|
+
function ut(e, t, n) {
|
|
2610
2767
|
return [e + Math.sin(e + t) * n, t + Math.cos(e - t) * n];
|
|
2611
2768
|
}
|
|
2612
|
-
var
|
|
2613
|
-
static from(t, n =
|
|
2614
|
-
return new e("length" in t ?
|
|
2769
|
+
var dt = class e {
|
|
2770
|
+
static from(t, n = st, r = ct, i) {
|
|
2771
|
+
return new e("length" in t ? ft(t, n, r, i) : Float64Array.from(pt(t, n, r, i)));
|
|
2615
2772
|
}
|
|
2616
2773
|
constructor(e) {
|
|
2617
|
-
this._delaunator = new
|
|
2774
|
+
this._delaunator = new Ge(e), this.inedges = new Int32Array(e.length / 2), this._hullIndex = new Int32Array(e.length / 2), this.points = this._delaunator.coords, this._init();
|
|
2618
2775
|
}
|
|
2619
2776
|
update() {
|
|
2620
2777
|
return this._delaunator.update(), this._init(), this;
|
|
2621
2778
|
}
|
|
2622
2779
|
_init() {
|
|
2623
2780
|
let e = this._delaunator, t = this.points;
|
|
2624
|
-
if (e.hull && e.hull.length > 2 &&
|
|
2781
|
+
if (e.hull && e.hull.length > 2 && lt(e)) {
|
|
2625
2782
|
this.collinear = Int32Array.from({ length: t.length / 2 }, (e, t) => t).sort((e, n) => t[2 * e] - t[2 * n] || t[2 * e + 1] - t[2 * n + 1]);
|
|
2626
2783
|
let e = this.collinear[0], n = this.collinear[this.collinear.length - 1], r = [
|
|
2627
2784
|
t[2 * e],
|
|
@@ -2630,10 +2787,10 @@ var et = class e {
|
|
|
2630
2787
|
t[2 * n + 1]
|
|
2631
2788
|
], i = 1e-8 * Math.hypot(r[3] - r[1], r[2] - r[0]);
|
|
2632
2789
|
for (let e = 0, n = t.length / 2; e < n; ++e) {
|
|
2633
|
-
let n =
|
|
2790
|
+
let n = ut(t[2 * e], t[2 * e + 1], i);
|
|
2634
2791
|
t[2 * e] = n[0], t[2 * e + 1] = n[1];
|
|
2635
2792
|
}
|
|
2636
|
-
this._delaunator = new
|
|
2793
|
+
this._delaunator = new Ge(t);
|
|
2637
2794
|
} else delete this.collinear;
|
|
2638
2795
|
let n = this.halfedges = this._delaunator.halfedges, r = this.hull = this._delaunator.hull, i = this.triangles = this._delaunator.triangles, a = this.inedges.fill(-1), o = this._hullIndex.fill(-1);
|
|
2639
2796
|
for (let e = 0, t = n.length; e < t; ++e) {
|
|
@@ -2644,7 +2801,7 @@ var et = class e {
|
|
|
2644
2801
|
r.length <= 2 && r.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = r[0], a[r[0]] = 1, r.length === 2 && (a[r[1]] = 0, this.triangles[1] = r[1], this.triangles[2] = r[1]));
|
|
2645
2802
|
}
|
|
2646
2803
|
voronoi(e) {
|
|
2647
|
-
return new
|
|
2804
|
+
return new it(this, e);
|
|
2648
2805
|
}
|
|
2649
2806
|
*neighbors(e) {
|
|
2650
2807
|
let { inedges: t, hull: n, _hullIndex: r, halfedges: i, triangles: a, collinear: o } = this;
|
|
@@ -2674,19 +2831,19 @@ var et = class e {
|
|
|
2674
2831
|
_step(e, t, n) {
|
|
2675
2832
|
let { inedges: r, hull: i, _hullIndex: a, halfedges: o, triangles: s, points: c } = this;
|
|
2676
2833
|
if (r[e] === -1 || !c.length) return (e + 1) % (c.length >> 1);
|
|
2677
|
-
let l = e, u =
|
|
2834
|
+
let l = e, u = ot(t - c[e * 2], 2) + ot(n - c[e * 2 + 1], 2), d = r[e], f = d;
|
|
2678
2835
|
do {
|
|
2679
|
-
let r = s[f], d =
|
|
2836
|
+
let r = s[f], d = ot(t - c[r * 2], 2) + ot(n - c[r * 2 + 1], 2);
|
|
2680
2837
|
if (d < u && (u = d, l = r), f = f % 3 == 2 ? f - 2 : f + 1, s[f] !== e) break;
|
|
2681
2838
|
if (f = o[f], f === -1) {
|
|
2682
|
-
if (f = i[(a[e] + 1) % i.length], f !== r &&
|
|
2839
|
+
if (f = i[(a[e] + 1) % i.length], f !== r && ot(t - c[f * 2], 2) + ot(n - c[f * 2 + 1], 2) < u) return f;
|
|
2683
2840
|
break;
|
|
2684
2841
|
}
|
|
2685
2842
|
} while (f !== d);
|
|
2686
2843
|
return l;
|
|
2687
2844
|
}
|
|
2688
2845
|
render(e) {
|
|
2689
|
-
let t = e == null ? e = new
|
|
2846
|
+
let t = e == null ? e = new nt() : void 0, { points: n, halfedges: r, triangles: i } = this;
|
|
2690
2847
|
for (let t = 0, a = r.length; t < a; ++t) {
|
|
2691
2848
|
let a = r[t];
|
|
2692
2849
|
if (a < t) continue;
|
|
@@ -2697,15 +2854,15 @@ var et = class e {
|
|
|
2697
2854
|
}
|
|
2698
2855
|
renderPoints(e, t) {
|
|
2699
2856
|
t === void 0 && (!e || typeof e.moveTo != "function") && (t = e, e = null), t = t == null ? 2 : +t;
|
|
2700
|
-
let n = e == null ? e = new
|
|
2857
|
+
let n = e == null ? e = new nt() : void 0, { points: r } = this;
|
|
2701
2858
|
for (let n = 0, i = r.length; n < i; n += 2) {
|
|
2702
2859
|
let i = r[n], a = r[n + 1];
|
|
2703
|
-
e.moveTo(i + t, a), e.arc(i, a, t, 0,
|
|
2860
|
+
e.moveTo(i + t, a), e.arc(i, a, t, 0, at);
|
|
2704
2861
|
}
|
|
2705
2862
|
return n && n.value();
|
|
2706
2863
|
}
|
|
2707
2864
|
renderHull(e) {
|
|
2708
|
-
let t = e == null ? e = new
|
|
2865
|
+
let t = e == null ? e = new nt() : void 0, { hull: n, points: r } = this, i = n[0] * 2, a = n.length;
|
|
2709
2866
|
e.moveTo(r[i], r[i + 1]);
|
|
2710
2867
|
for (let t = 1; t < a; ++t) {
|
|
2711
2868
|
let i = 2 * n[t];
|
|
@@ -2714,11 +2871,11 @@ var et = class e {
|
|
|
2714
2871
|
return e.closePath(), t && t.value();
|
|
2715
2872
|
}
|
|
2716
2873
|
hullPolygon() {
|
|
2717
|
-
let e = new
|
|
2874
|
+
let e = new rt();
|
|
2718
2875
|
return this.renderHull(e), e.value();
|
|
2719
2876
|
}
|
|
2720
2877
|
renderTriangle(e, t) {
|
|
2721
|
-
let n = t == null ? t = new
|
|
2878
|
+
let n = t == null ? t = new nt() : void 0, { points: r, triangles: i } = this, a = i[e *= 3] * 2, o = i[e + 1] * 2, s = i[e + 2] * 2;
|
|
2722
2879
|
return t.moveTo(r[a], r[a + 1]), t.lineTo(r[o], r[o + 1]), t.lineTo(r[s], r[s + 1]), t.closePath(), n && n.value();
|
|
2723
2880
|
}
|
|
2724
2881
|
*trianglePolygons() {
|
|
@@ -2726,11 +2883,11 @@ var et = class e {
|
|
|
2726
2883
|
for (let t = 0, n = e.length / 3; t < n; ++t) yield this.trianglePolygon(t);
|
|
2727
2884
|
}
|
|
2728
2885
|
trianglePolygon(e) {
|
|
2729
|
-
let t = new
|
|
2886
|
+
let t = new rt();
|
|
2730
2887
|
return this.renderTriangle(e, t), t.value();
|
|
2731
2888
|
}
|
|
2732
2889
|
};
|
|
2733
|
-
function
|
|
2890
|
+
function ft(e, t, n, r) {
|
|
2734
2891
|
let i = e.length, a = new Float64Array(i * 2);
|
|
2735
2892
|
for (let o = 0; o < i; ++o) {
|
|
2736
2893
|
let i = e[o];
|
|
@@ -2738,20 +2895,20 @@ function tt(e, t, n, r) {
|
|
|
2738
2895
|
}
|
|
2739
2896
|
return a;
|
|
2740
2897
|
}
|
|
2741
|
-
function*
|
|
2898
|
+
function* pt(e, t, n, r) {
|
|
2742
2899
|
let i = 0;
|
|
2743
2900
|
for (let a of e) yield t.call(r, a, i, e), yield n.call(r, a, i, e), ++i;
|
|
2744
2901
|
}
|
|
2745
2902
|
//#endregion
|
|
2746
2903
|
//#region src/utils/clusert.mjs
|
|
2747
|
-
function
|
|
2904
|
+
function mt(e, t, n, r) {
|
|
2748
2905
|
return 1 + (e[t][0] === 0 || e[n][0] === 0 || e[r][0] === 0 ? 1 : 0);
|
|
2749
2906
|
}
|
|
2750
|
-
function
|
|
2907
|
+
function ht(e, t, n, r, i, a) {
|
|
2751
2908
|
let o = Math.hypot(n - i, r - a), s = Math.hypot(e - i, t - a), c = Math.hypot(e - n, t - r), l = Math.abs((n - e) * (a - t) - (i - e) * (r - t)) / 2;
|
|
2752
2909
|
return l === 0 ? Infinity : o * s * c / (4 * l);
|
|
2753
2910
|
}
|
|
2754
|
-
function
|
|
2911
|
+
function gt(e) {
|
|
2755
2912
|
if (!e || e.length < 3) return [];
|
|
2756
2913
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2757
2914
|
for (let r of e) {
|
|
@@ -2759,12 +2916,12 @@ function at(e) {
|
|
|
2759
2916
|
t.has(e) || (t.add(e), n.push(r));
|
|
2760
2917
|
}
|
|
2761
2918
|
if (n.length < 3) return [];
|
|
2762
|
-
let { triangles: r } = new
|
|
2919
|
+
let { triangles: r } = new dt(Float64Array.from(n.flat()));
|
|
2763
2920
|
if (!r.length) return [];
|
|
2764
2921
|
let i = /* @__PURE__ */ new Map(), a = (e, t) => e < t ? `${e}_${t}` : `${t}_${e}`;
|
|
2765
2922
|
for (let e = 0; e < r.length; e += 3) {
|
|
2766
2923
|
let t = r[e], o = r[e + 1], s = r[e + 2], [c, l] = n[t], [u, d] = n[o], [f, p] = n[s];
|
|
2767
|
-
if (
|
|
2924
|
+
if (ht(c, l, u, d, f, p) <= 1 / mt(n, t, o, s)) for (let [e, n] of [
|
|
2768
2925
|
[t, o],
|
|
2769
2926
|
[o, s],
|
|
2770
2927
|
[s, t]
|
|
@@ -2813,7 +2970,7 @@ var K = {
|
|
|
2813
2970
|
[],
|
|
2814
2971
|
[],
|
|
2815
2972
|
[]
|
|
2816
|
-
], X = [],
|
|
2973
|
+
], X = [], _t = new d(), vt = new d(), yt = new d(), Z = new d(), bt = new d(), xt = new d(), Q = new a(), St = new t(), Ct = new o(), wt = new o(), Tt = new l(), Et = class {
|
|
2817
2974
|
constructor(e = new d(), t = new d(), n = new a()) {
|
|
2818
2975
|
this.center = e, this.halfSize = t, this.rotation = n;
|
|
2819
2976
|
}
|
|
@@ -2831,22 +2988,22 @@ var K = {
|
|
|
2831
2988
|
}
|
|
2832
2989
|
clampPoint(e, t) {
|
|
2833
2990
|
let n = this.halfSize;
|
|
2834
|
-
Z.subVectors(e, this.center), this.rotation.extractBasis(
|
|
2835
|
-
let r = i.clamp(Z.dot(
|
|
2836
|
-
t.add(
|
|
2837
|
-
let a = i.clamp(Z.dot(
|
|
2838
|
-
t.add(
|
|
2839
|
-
let o = i.clamp(Z.dot(
|
|
2840
|
-
return t.add(
|
|
2991
|
+
Z.subVectors(e, this.center), this.rotation.extractBasis(_t, vt, yt), t.copy(this.center);
|
|
2992
|
+
let r = i.clamp(Z.dot(_t), -n.x, n.x);
|
|
2993
|
+
t.add(_t.multiplyScalar(r));
|
|
2994
|
+
let a = i.clamp(Z.dot(vt), -n.y, n.y);
|
|
2995
|
+
t.add(vt.multiplyScalar(a));
|
|
2996
|
+
let o = i.clamp(Z.dot(yt), -n.z, n.z);
|
|
2997
|
+
return t.add(yt.multiplyScalar(o)), t;
|
|
2841
2998
|
}
|
|
2842
2999
|
containsPoint(e) {
|
|
2843
|
-
return Z.subVectors(e, this.center), this.rotation.extractBasis(
|
|
3000
|
+
return Z.subVectors(e, this.center), this.rotation.extractBasis(_t, vt, yt), Math.abs(Z.dot(_t)) <= this.halfSize.x && Math.abs(Z.dot(vt)) <= this.halfSize.y && Math.abs(Z.dot(yt)) <= this.halfSize.z;
|
|
2844
3001
|
}
|
|
2845
3002
|
intersectsBox3(e) {
|
|
2846
|
-
return this.intersectsOBB(
|
|
3003
|
+
return this.intersectsOBB(Dt.fromBox3(e));
|
|
2847
3004
|
}
|
|
2848
3005
|
intersectsSphere(e) {
|
|
2849
|
-
return this.clampPoint(e.center,
|
|
3006
|
+
return this.clampPoint(e.center, xt), xt.distanceToSquared(e.center) <= e.radius * e.radius;
|
|
2850
3007
|
}
|
|
2851
3008
|
intersectsOBB(e, t = 2 ** -52) {
|
|
2852
3009
|
K.c = this.center, K.e[0] = this.halfSize.x, K.e[1] = this.halfSize.y, K.e[2] = this.halfSize.z, this.rotation.extractBasis(K.u[0], K.u[1], K.u[2]), q.c = e.center, q.e[0] = e.halfSize.x, q.e[1] = e.halfSize.y, q.e[2] = e.halfSize.z, e.rotation.extractBasis(q.u[0], q.u[1], q.u[2]);
|
|
@@ -2859,12 +3016,12 @@ var K = {
|
|
|
2859
3016
|
return n = K.e[1] * Y[2][0] + K.e[2] * Y[1][0], r = q.e[1] * Y[0][2] + q.e[2] * Y[0][1], !(Math.abs(X[2] * J[1][0] - X[1] * J[2][0]) > n + r || (n = K.e[1] * Y[2][1] + K.e[2] * Y[1][1], r = q.e[0] * Y[0][2] + q.e[2] * Y[0][0], Math.abs(X[2] * J[1][1] - X[1] * J[2][1]) > n + r) || (n = K.e[1] * Y[2][2] + K.e[2] * Y[1][2], r = q.e[0] * Y[0][1] + q.e[1] * Y[0][0], Math.abs(X[2] * J[1][2] - X[1] * J[2][2]) > n + r) || (n = K.e[0] * Y[2][0] + K.e[2] * Y[0][0], r = q.e[1] * Y[1][2] + q.e[2] * Y[1][1], Math.abs(X[0] * J[2][0] - X[2] * J[0][0]) > n + r) || (n = K.e[0] * Y[2][1] + K.e[2] * Y[0][1], r = q.e[0] * Y[1][2] + q.e[2] * Y[1][0], Math.abs(X[0] * J[2][1] - X[2] * J[0][1]) > n + r) || (n = K.e[0] * Y[2][2] + K.e[2] * Y[0][2], r = q.e[0] * Y[1][1] + q.e[1] * Y[1][0], Math.abs(X[0] * J[2][2] - X[2] * J[0][2]) > n + r) || (n = K.e[0] * Y[1][0] + K.e[1] * Y[0][0], r = q.e[1] * Y[2][2] + q.e[2] * Y[2][1], Math.abs(X[1] * J[0][0] - X[0] * J[1][0]) > n + r) || (n = K.e[0] * Y[1][1] + K.e[1] * Y[0][1], r = q.e[0] * Y[2][2] + q.e[2] * Y[2][0], Math.abs(X[1] * J[0][1] - X[0] * J[1][1]) > n + r) || (n = K.e[0] * Y[1][2] + K.e[1] * Y[0][2], r = q.e[0] * Y[2][1] + q.e[1] * Y[2][0], Math.abs(X[1] * J[0][2] - X[0] * J[1][2]) > n + r));
|
|
2860
3017
|
}
|
|
2861
3018
|
intersectsPlane(e) {
|
|
2862
|
-
this.rotation.extractBasis(
|
|
2863
|
-
let t = this.halfSize.x * Math.abs(e.normal.dot(
|
|
3019
|
+
this.rotation.extractBasis(_t, vt, yt);
|
|
3020
|
+
let t = this.halfSize.x * Math.abs(e.normal.dot(_t)) + this.halfSize.y * Math.abs(e.normal.dot(vt)) + this.halfSize.z * Math.abs(e.normal.dot(yt)), n = e.normal.dot(this.center) - e.constant;
|
|
2864
3021
|
return Math.abs(n) <= t;
|
|
2865
3022
|
}
|
|
2866
3023
|
intersectRay(e, t) {
|
|
2867
|
-
return this.getSize(
|
|
3024
|
+
return this.getSize(bt), St.setFromCenterAndSize(Z.set(0, 0, 0), bt), Ct.setFromMatrix3(this.rotation), Ct.setPosition(this.center), wt.copy(Ct).invert(), Tt.copy(e).applyMatrix4(wt), Tt.intersectBox(St, t) ? t.applyMatrix4(Ct) : null;
|
|
2868
3025
|
}
|
|
2869
3026
|
intersectsRay(e) {
|
|
2870
3027
|
return this.intersectRay(e, Z) !== null;
|
|
@@ -2881,7 +3038,7 @@ var K = {
|
|
|
2881
3038
|
let a = 1 / n, o = 1 / r, s = 1 / i;
|
|
2882
3039
|
return Q.elements[0] *= a, Q.elements[1] *= a, Q.elements[2] *= a, Q.elements[3] *= o, Q.elements[4] *= o, Q.elements[5] *= o, Q.elements[6] *= s, Q.elements[7] *= s, Q.elements[8] *= s, this.rotation.multiply(Q), this.halfSize.x *= n, this.halfSize.y *= r, this.halfSize.z *= i, Z.setFromMatrixPosition(e), this.center.add(Z), this;
|
|
2883
3040
|
}
|
|
2884
|
-
},
|
|
3041
|
+
}, Dt = new Et(), $ = 6371008.8, Ot = {
|
|
2885
3042
|
centimeters: $ * 100,
|
|
2886
3043
|
centimetres: $ * 100,
|
|
2887
3044
|
degrees: 360 / (2 * Math.PI),
|
|
@@ -2898,60 +3055,60 @@ var K = {
|
|
|
2898
3055
|
radians: 1,
|
|
2899
3056
|
yards: $ * 1.0936
|
|
2900
3057
|
};
|
|
2901
|
-
function
|
|
3058
|
+
function kt(e, t, n = {}) {
|
|
2902
3059
|
let r = { type: "Feature" };
|
|
2903
3060
|
return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
|
|
2904
3061
|
}
|
|
2905
|
-
function
|
|
3062
|
+
function At(e, t, n = {}) {
|
|
2906
3063
|
if (!e) throw Error("coordinates is required");
|
|
2907
3064
|
if (!Array.isArray(e)) throw Error("coordinates must be an Array");
|
|
2908
3065
|
if (e.length < 2) throw Error("coordinates must be at least 2 numbers long");
|
|
2909
|
-
if (!
|
|
2910
|
-
return
|
|
3066
|
+
if (!Lt(e[0]) || !Lt(e[1])) throw Error("coordinates must contain numbers");
|
|
3067
|
+
return kt({
|
|
2911
3068
|
type: "Point",
|
|
2912
3069
|
coordinates: e
|
|
2913
3070
|
}, t, n);
|
|
2914
3071
|
}
|
|
2915
|
-
function
|
|
3072
|
+
function jt(e, t, n = {}) {
|
|
2916
3073
|
for (let t of e) {
|
|
2917
3074
|
if (t.length < 4) throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");
|
|
2918
3075
|
if (t[t.length - 1].length !== t[0].length) throw Error("First and last Position are not equivalent.");
|
|
2919
3076
|
for (let e = 0; e < t[t.length - 1].length; e++) if (t[t.length - 1][e] !== t[0][e]) throw Error("First and last Position are not equivalent.");
|
|
2920
3077
|
}
|
|
2921
|
-
return
|
|
3078
|
+
return kt({
|
|
2922
3079
|
type: "Polygon",
|
|
2923
3080
|
coordinates: e
|
|
2924
3081
|
}, t, n);
|
|
2925
3082
|
}
|
|
2926
|
-
function
|
|
2927
|
-
let n =
|
|
3083
|
+
function Mt(e, t = "kilometers") {
|
|
3084
|
+
let n = Ot[t];
|
|
2928
3085
|
if (!n) throw Error(t + " units is invalid");
|
|
2929
3086
|
return e * n;
|
|
2930
3087
|
}
|
|
2931
|
-
function
|
|
2932
|
-
let n =
|
|
3088
|
+
function Nt(e, t = "kilometers") {
|
|
3089
|
+
let n = Ot[t];
|
|
2933
3090
|
if (!n) throw Error(t + " units is invalid");
|
|
2934
3091
|
return e / n;
|
|
2935
3092
|
}
|
|
2936
|
-
function
|
|
3093
|
+
function Pt(e) {
|
|
2937
3094
|
return e % (2 * Math.PI) * 180 / Math.PI;
|
|
2938
3095
|
}
|
|
2939
|
-
function
|
|
3096
|
+
function Ft(e) {
|
|
2940
3097
|
return e % 360 * Math.PI / 180;
|
|
2941
3098
|
}
|
|
2942
|
-
function
|
|
3099
|
+
function It(e, t = "kilometers", n = "kilometers") {
|
|
2943
3100
|
if (!(e >= 0)) throw Error("length must be a positive number");
|
|
2944
|
-
return
|
|
3101
|
+
return Mt(Nt(e, t), n);
|
|
2945
3102
|
}
|
|
2946
|
-
function
|
|
3103
|
+
function Lt(e) {
|
|
2947
3104
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
2948
3105
|
}
|
|
2949
|
-
function
|
|
3106
|
+
function Rt(e) {
|
|
2950
3107
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2951
3108
|
}
|
|
2952
3109
|
//#endregion
|
|
2953
3110
|
//#region node_modules/@turf/meta/dist/esm/index.js
|
|
2954
|
-
function
|
|
3111
|
+
function zt(e, t, n) {
|
|
2955
3112
|
if (e !== null) for (var r, i, a, o, s, c, l, u = 0, d = 0, f, p = e.type, m = p === "FeatureCollection", h = p === "Feature", g = m ? e.features.length : 1, _ = 0; _ < g; _++) {
|
|
2956
3113
|
l = m ? e.features[_].geometry : h ? e.geometry : e, f = l ? l.type === "GeometryCollection" : !1, s = f ? l.geometries.length : 1;
|
|
2957
3114
|
for (var v = 0; v < s; v++) {
|
|
@@ -2997,7 +3154,7 @@ function Ot(e, t, n) {
|
|
|
2997
3154
|
}
|
|
2998
3155
|
break;
|
|
2999
3156
|
case "GeometryCollection":
|
|
3000
|
-
for (r = 0; r < o.geometries.length; r++) if (
|
|
3157
|
+
for (r = 0; r < o.geometries.length; r++) if (zt(o.geometries[r], t, n) === !1) return !1;
|
|
3001
3158
|
break;
|
|
3002
3159
|
default: throw Error("Unknown Geometry Type");
|
|
3003
3160
|
}
|
|
@@ -3005,13 +3162,13 @@ function Ot(e, t, n) {
|
|
|
3005
3162
|
}
|
|
3006
3163
|
}
|
|
3007
3164
|
}
|
|
3008
|
-
function
|
|
3165
|
+
function Bt(e) {
|
|
3009
3166
|
var t = [];
|
|
3010
|
-
return
|
|
3167
|
+
return zt(e, function(e) {
|
|
3011
3168
|
t.push(e);
|
|
3012
3169
|
}), t;
|
|
3013
3170
|
}
|
|
3014
|
-
function
|
|
3171
|
+
function Vt(e, t) {
|
|
3015
3172
|
var n, r, i, a, o, s, c, l, u, d, f = 0, p = e.type === "FeatureCollection", m = e.type === "Feature", h = p ? e.features.length : 1;
|
|
3016
3173
|
for (n = 0; n < h; n++) {
|
|
3017
3174
|
for (s = p ? e.features[n].geometry : m ? e.geometry : e, l = p ? e.features[n].properties : m ? e.properties : {}, u = p ? e.features[n].bbox : m ? e.bbox : void 0, d = p ? e.features[n].id : m ? e.id : void 0, c = s ? s.type === "GeometryCollection" : !1, o = c ? s.geometries.length : 1, i = 0; i < o; i++) {
|
|
@@ -3037,15 +3194,15 @@ function At(e, t) {
|
|
|
3037
3194
|
f++;
|
|
3038
3195
|
}
|
|
3039
3196
|
}
|
|
3040
|
-
function
|
|
3197
|
+
function Ht(e, t, n) {
|
|
3041
3198
|
var r = n;
|
|
3042
|
-
return
|
|
3199
|
+
return Vt(e, function(e, i, a, o, s) {
|
|
3043
3200
|
r = i === 0 && n === void 0 ? e : t(r, e, i, a, o, s);
|
|
3044
3201
|
}), r;
|
|
3045
3202
|
}
|
|
3046
3203
|
//#endregion
|
|
3047
3204
|
//#region node_modules/rbush/rbush.min.js
|
|
3048
|
-
var
|
|
3205
|
+
var Ut = /* @__PURE__ */ y(((e, t) => {
|
|
3049
3206
|
(function(n, r) {
|
|
3050
3207
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n ||= self).RBush = r();
|
|
3051
3208
|
})(e, function() {
|
|
@@ -3262,13 +3419,13 @@ var Mt = /* @__PURE__ */ y(((e, t) => {
|
|
|
3262
3419
|
for (var t = e.length - 1, n = void 0; t >= 0; t--) e[t].children.length === 0 ? t > 0 ? (n = e[t - 1].children).splice(n.indexOf(e[t]), 1) : this.clear() : a(e[t], this.toBBox);
|
|
3263
3420
|
}, r;
|
|
3264
3421
|
});
|
|
3265
|
-
})),
|
|
3266
|
-
function
|
|
3422
|
+
})), Wt = /* @__PURE__ */ b({ default: () => Kt });
|
|
3423
|
+
function Gt(e, t) {
|
|
3267
3424
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
3268
3425
|
}
|
|
3269
|
-
var
|
|
3270
|
-
|
|
3271
|
-
constructor(e = [], t =
|
|
3426
|
+
var Kt, qt = v((() => {
|
|
3427
|
+
Kt = class {
|
|
3428
|
+
constructor(e = [], t = Gt) {
|
|
3272
3429
|
if (this.data = e, this.length = this.data.length, this.compare = t, this.length > 0) for (let e = (this.length >> 1) - 1; e >= 0; e--) this._down(e);
|
|
3273
3430
|
}
|
|
3274
3431
|
push(e) {
|
|
@@ -3301,7 +3458,7 @@ var Ft, It = v((() => {
|
|
|
3301
3458
|
t[e] = i;
|
|
3302
3459
|
}
|
|
3303
3460
|
};
|
|
3304
|
-
})),
|
|
3461
|
+
})), Jt = /* @__PURE__ */ y(((e, t) => {
|
|
3305
3462
|
t.exports = function(e, t, n, r) {
|
|
3306
3463
|
var i = e[0], a = e[1], o = !1;
|
|
3307
3464
|
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
@@ -3311,7 +3468,7 @@ var Ft, It = v((() => {
|
|
|
3311
3468
|
}
|
|
3312
3469
|
return o;
|
|
3313
3470
|
};
|
|
3314
|
-
})),
|
|
3471
|
+
})), Yt = /* @__PURE__ */ y(((e, t) => {
|
|
3315
3472
|
t.exports = function(e, t, n, r) {
|
|
3316
3473
|
var i = e[0], a = e[1], o = !1;
|
|
3317
3474
|
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
@@ -3321,12 +3478,12 @@ var Ft, It = v((() => {
|
|
|
3321
3478
|
}
|
|
3322
3479
|
return o;
|
|
3323
3480
|
};
|
|
3324
|
-
})),
|
|
3325
|
-
var n =
|
|
3481
|
+
})), Xt = /* @__PURE__ */ y(((e, t) => {
|
|
3482
|
+
var n = Jt(), r = Yt();
|
|
3326
3483
|
t.exports = function(e, t, i, a) {
|
|
3327
3484
|
return t.length > 0 && Array.isArray(t[0]) ? r(e, t, i, a) : n(e, t, i, a);
|
|
3328
3485
|
}, t.exports.nested = r, t.exports.flat = n;
|
|
3329
|
-
})),
|
|
3486
|
+
})), Zt = /* @__PURE__ */ y(((e, t) => {
|
|
3330
3487
|
(function(n, r) {
|
|
3331
3488
|
typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n ||= self).predicates = {});
|
|
3332
3489
|
})(e, function(e) {
|
|
@@ -3360,15 +3517,15 @@ var Ft, It = v((() => {
|
|
|
3360
3517
|
v = (O = (x = m - (b = (y = t * m) - (y - m))) * (C = F - (S = (y = t * F) - (y - F))) - ((D = m * F) - b * S - x * S - b * C)) - (w = O - (A = (x = h - (b = (y = t * h) - (y - h))) * (C = N - (S = (y = t * N) - (y - N))) - ((k = h * N) - b * S - x * S - b * C))), c[0] = O - (w + v) + (v - A), v = (E = D - ((T = D + w) - (v = T - D)) + (w - v)) - (w = E - k), c[1] = E - (w + v) + (v - k), v = (j = T + w) - T, c[2] = T - (j - v) + (w - v), c[3] = j;
|
|
3361
3518
|
let R = n(4, i, 4, c, a);
|
|
3362
3519
|
v = (O = (x = M - (b = (y = t * M) - (y - M))) * (C = _ - (S = (y = t * _) - (y - _))) - ((D = M * _) - b * S - x * S - b * C)) - (w = O - (A = (x = P - (b = (y = t * P) - (y - P))) * (C = g - (S = (y = t * g) - (y - g))) - ((k = P * g) - b * S - x * S - b * C))), c[0] = O - (w + v) + (v - A), v = (E = D - ((T = D + w) - (v = T - D)) + (w - v)) - (w = E - k), c[1] = E - (w + v) + (v - k), v = (j = T + w) - T, c[2] = T - (j - v) + (w - v), c[3] = j;
|
|
3363
|
-
let
|
|
3364
|
-
return v = (O = (x = m - (b = (y = t * m) - (y - m))) * (C = _ - (S = (y = t * _) - (y - _))) - ((D = m * _) - b * S - x * S - b * C)) - (w = O - (A = (x = h - (b = (y = t * h) - (y - h))) * (C = g - (S = (y = t * g) - (y - g))) - ((k = h * g) - b * S - x * S - b * C))), c[0] = O - (w + v) + (v - A), v = (E = D - ((T = D + w) - (v = T - D)) + (w - v)) - (w = E - k), c[1] = E - (w + v) + (v - k), v = (j = T + w) - T, c[2] = T - (j - v) + (w - v), c[3] = j, s[n(
|
|
3520
|
+
let z = n(R, a, 4, c, o);
|
|
3521
|
+
return v = (O = (x = m - (b = (y = t * m) - (y - m))) * (C = _ - (S = (y = t * _) - (y - _))) - ((D = m * _) - b * S - x * S - b * C)) - (w = O - (A = (x = h - (b = (y = t * h) - (y - h))) * (C = g - (S = (y = t * g) - (y - g))) - ((k = h * g) - b * S - x * S - b * C))), c[0] = O - (w + v) + (v - A), v = (E = D - ((T = D + w) - (v = T - D)) + (w - v)) - (w = E - k), c[1] = E - (w + v) + (v - k), v = (j = T + w) - T, c[2] = T - (j - v) + (w - v), c[3] = j, s[n(z, o, 4, c, s) - 1];
|
|
3365
3522
|
}(e, r, l, u, d, f, g);
|
|
3366
3523
|
}, e.orient2dfast = function(e, t, n, r, i, a) {
|
|
3367
3524
|
return (t - a) * (n - i) - (e - i) * (r - a);
|
|
3368
3525
|
}, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3369
3526
|
});
|
|
3370
|
-
})),
|
|
3371
|
-
var n =
|
|
3527
|
+
})), Qt = /* @__PURE__ */ S((/* @__PURE__ */ y(((e, t) => {
|
|
3528
|
+
var n = Ut(), r = (qt(), C(Wt)), i = Xt(), a = Zt().orient2d;
|
|
3372
3529
|
r.default && (r = r.default), t.exports = o, t.exports.default = o;
|
|
3373
3530
|
function o(e, t, r) {
|
|
3374
3531
|
t = Math.max(0, t === void 0 ? 2 : t), r ||= 0;
|
|
@@ -3518,26 +3675,26 @@ var Ft, It = v((() => {
|
|
|
3518
3675
|
return r.pop(), t.pop(), t.concat(r);
|
|
3519
3676
|
}
|
|
3520
3677
|
})))(), 1);
|
|
3521
|
-
function
|
|
3678
|
+
function $t(e, t = {}) {
|
|
3522
3679
|
t.concavity = t.concavity || Infinity;
|
|
3523
3680
|
let n = [];
|
|
3524
|
-
if (
|
|
3681
|
+
if (zt(e, (e) => {
|
|
3525
3682
|
n.push([e[0], e[1]]);
|
|
3526
3683
|
}), !n.length) return null;
|
|
3527
|
-
let r = (0,
|
|
3528
|
-
return r.length > 3 ?
|
|
3684
|
+
let r = (0, Qt.default)(n, t.concavity);
|
|
3685
|
+
return r.length > 3 ? jt([r]) : null;
|
|
3529
3686
|
}
|
|
3530
3687
|
//#endregion
|
|
3531
3688
|
//#region node_modules/@turf/centroid/dist/esm/index.js
|
|
3532
|
-
function
|
|
3689
|
+
function en(e, t = {}) {
|
|
3533
3690
|
let n = 0, r = 0, i = 0;
|
|
3534
|
-
return
|
|
3691
|
+
return zt(e, function(e) {
|
|
3535
3692
|
n += e[0], r += e[1], i++;
|
|
3536
|
-
}, !0),
|
|
3693
|
+
}, !0), At([n / i, r / i], t.properties);
|
|
3537
3694
|
}
|
|
3538
3695
|
//#endregion
|
|
3539
3696
|
//#region node_modules/@turf/invariant/dist/esm/index.js
|
|
3540
|
-
function
|
|
3697
|
+
function tn(e) {
|
|
3541
3698
|
if (!e) throw Error("coord is required");
|
|
3542
3699
|
if (!Array.isArray(e)) {
|
|
3543
3700
|
if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point") return [...e.geometry.coordinates];
|
|
@@ -3546,7 +3703,7 @@ function Wt(e) {
|
|
|
3546
3703
|
if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1])) return [...e];
|
|
3547
3704
|
throw Error("coord must be GeoJSON Point or an Array of numbers");
|
|
3548
3705
|
}
|
|
3549
|
-
function
|
|
3706
|
+
function nn(e) {
|
|
3550
3707
|
if (Array.isArray(e)) return e;
|
|
3551
3708
|
if (e.type === "Feature") {
|
|
3552
3709
|
if (e.geometry !== null) return e.geometry.coordinates;
|
|
@@ -3555,23 +3712,23 @@ function Gt(e) {
|
|
|
3555
3712
|
}
|
|
3556
3713
|
//#endregion
|
|
3557
3714
|
//#region node_modules/@turf/rhumb-bearing/dist/esm/index.js
|
|
3558
|
-
function
|
|
3715
|
+
function rn(e, t, n = {}) {
|
|
3559
3716
|
let r;
|
|
3560
|
-
return r = n.final ?
|
|
3717
|
+
return r = n.final ? an(tn(t), tn(e)) : an(tn(e), tn(t)), r > 180 ? -(360 - r) : r;
|
|
3561
3718
|
}
|
|
3562
|
-
function
|
|
3563
|
-
let n =
|
|
3719
|
+
function an(e, t) {
|
|
3720
|
+
let n = Ft(e[1]), r = Ft(t[1]), i = Ft(t[0] - e[0]);
|
|
3564
3721
|
i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
|
|
3565
3722
|
let a = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4));
|
|
3566
|
-
return (
|
|
3723
|
+
return (Pt(Math.atan2(i, a)) + 360) % 360;
|
|
3567
3724
|
}
|
|
3568
3725
|
//#endregion
|
|
3569
3726
|
//#region node_modules/@turf/rhumb-distance/dist/esm/index.js
|
|
3570
|
-
function
|
|
3571
|
-
let r =
|
|
3572
|
-
return i[0] += i[0] - r[0] > 180 ? -360 : r[0] - i[0] > 180 ? 360 : 0,
|
|
3727
|
+
function on(e, t, n = {}) {
|
|
3728
|
+
let r = tn(e), i = tn(t);
|
|
3729
|
+
return i[0] += i[0] - r[0] > 180 ? -360 : r[0] - i[0] > 180 ? 360 : 0, It(sn(r, i), "meters", n.units);
|
|
3573
3730
|
}
|
|
3574
|
-
function
|
|
3731
|
+
function sn(e, t, n) {
|
|
3575
3732
|
n = n === void 0 ? $ : Number(n);
|
|
3576
3733
|
let r = n, i = e[1] * Math.PI / 180, a = t[1] * Math.PI / 180, o = a - i, s = Math.abs(t[0] - e[0]) * Math.PI / 180;
|
|
3577
3734
|
s > Math.PI && (s -= 2 * Math.PI);
|
|
@@ -3580,37 +3737,37 @@ function Yt(e, t, n) {
|
|
|
3580
3737
|
}
|
|
3581
3738
|
//#endregion
|
|
3582
3739
|
//#region node_modules/@turf/rhumb-destination/dist/esm/index.js
|
|
3583
|
-
function
|
|
3584
|
-
let i = t < 0, a =
|
|
3740
|
+
function cn(e, t, n, r = {}) {
|
|
3741
|
+
let i = t < 0, a = It(Math.abs(t), r.units, "meters");
|
|
3585
3742
|
i && (a = -Math.abs(a));
|
|
3586
|
-
let o =
|
|
3587
|
-
return s[0] += s[0] - o[0] > 180 ? -360 : o[0] - s[0] > 180 ? 360 : 0,
|
|
3743
|
+
let o = tn(e), s = ln(o, a, n);
|
|
3744
|
+
return s[0] += s[0] - o[0] > 180 ? -360 : o[0] - s[0] > 180 ? 360 : 0, At(s, r.properties);
|
|
3588
3745
|
}
|
|
3589
|
-
function
|
|
3746
|
+
function ln(e, t, n, r) {
|
|
3590
3747
|
r = r === void 0 ? $ : Number(r);
|
|
3591
|
-
let i = t / r, a = e[0] * Math.PI / 180, o =
|
|
3748
|
+
let i = t / r, a = e[0] * Math.PI / 180, o = Ft(e[1]), s = Ft(n), c = i * Math.cos(s), l = o + c;
|
|
3592
3749
|
Math.abs(l) > Math.PI / 2 && (l = l > 0 ? Math.PI - l : -Math.PI - l);
|
|
3593
3750
|
let u = Math.log(Math.tan(l / 2 + Math.PI / 4) / Math.tan(o / 2 + Math.PI / 4)), d = Math.abs(u) > 1e-11 ? c / u : Math.cos(o);
|
|
3594
3751
|
return [((a + i * Math.sin(s) / d) * 180 / Math.PI + 540) % 360 - 180, l * 180 / Math.PI];
|
|
3595
3752
|
}
|
|
3596
3753
|
//#endregion
|
|
3597
3754
|
//#region node_modules/@turf/clone/dist/esm/index.js
|
|
3598
|
-
function
|
|
3755
|
+
function un(e) {
|
|
3599
3756
|
if (!e) throw Error("geojson is required");
|
|
3600
3757
|
switch (e.type) {
|
|
3601
|
-
case "Feature": return
|
|
3602
|
-
case "FeatureCollection": return
|
|
3758
|
+
case "Feature": return dn(e);
|
|
3759
|
+
case "FeatureCollection": return pn(e);
|
|
3603
3760
|
case "Point":
|
|
3604
3761
|
case "LineString":
|
|
3605
3762
|
case "Polygon":
|
|
3606
3763
|
case "MultiPoint":
|
|
3607
3764
|
case "MultiLineString":
|
|
3608
3765
|
case "MultiPolygon":
|
|
3609
|
-
case "GeometryCollection": return
|
|
3766
|
+
case "GeometryCollection": return mn(e);
|
|
3610
3767
|
default: throw Error("unknown GeoJSON type");
|
|
3611
3768
|
}
|
|
3612
3769
|
}
|
|
3613
|
-
function
|
|
3770
|
+
function dn(e) {
|
|
3614
3771
|
let t = { type: "Feature" };
|
|
3615
3772
|
return Object.keys(e).forEach((n) => {
|
|
3616
3773
|
switch (n) {
|
|
@@ -3619,16 +3776,16 @@ function $t(e) {
|
|
|
3619
3776
|
case "geometry": return;
|
|
3620
3777
|
default: t[n] = e[n];
|
|
3621
3778
|
}
|
|
3622
|
-
}), t.properties =
|
|
3779
|
+
}), t.properties = fn(e.properties), e.geometry == null ? t.geometry = null : t.geometry = mn(e.geometry), t;
|
|
3623
3780
|
}
|
|
3624
|
-
function
|
|
3781
|
+
function fn(e) {
|
|
3625
3782
|
let t = {};
|
|
3626
3783
|
return e && Object.keys(e).forEach((n) => {
|
|
3627
3784
|
let r = e[n];
|
|
3628
|
-
typeof r == "object" ? r === null ? t[n] = null : Array.isArray(r) ? t[n] = r.map((e) => e) : t[n] =
|
|
3785
|
+
typeof r == "object" ? r === null ? t[n] = null : Array.isArray(r) ? t[n] = r.map((e) => e) : t[n] = fn(r) : t[n] = r;
|
|
3629
3786
|
}), t;
|
|
3630
3787
|
}
|
|
3631
|
-
function
|
|
3788
|
+
function pn(e) {
|
|
3632
3789
|
let t = { type: "FeatureCollection" };
|
|
3633
3790
|
return Object.keys(e).forEach((n) => {
|
|
3634
3791
|
switch (n) {
|
|
@@ -3636,44 +3793,44 @@ function tn(e) {
|
|
|
3636
3793
|
case "features": return;
|
|
3637
3794
|
default: t[n] = e[n];
|
|
3638
3795
|
}
|
|
3639
|
-
}), t.features = e.features.map((e) =>
|
|
3796
|
+
}), t.features = e.features.map((e) => dn(e)), t;
|
|
3640
3797
|
}
|
|
3641
|
-
function
|
|
3798
|
+
function mn(e) {
|
|
3642
3799
|
let t = { type: e.type };
|
|
3643
|
-
return e.bbox && (t.bbox = e.bbox), e.type === "GeometryCollection" ? (t.geometries = e.geometries.map((e) =>
|
|
3800
|
+
return e.bbox && (t.bbox = e.bbox), e.type === "GeometryCollection" ? (t.geometries = e.geometries.map((e) => mn(e)), t) : (t.coordinates = hn(e.coordinates), t);
|
|
3644
3801
|
}
|
|
3645
|
-
function
|
|
3802
|
+
function hn(e) {
|
|
3646
3803
|
let t = e;
|
|
3647
|
-
return typeof t[0] == "object" ? t.map((e) =>
|
|
3804
|
+
return typeof t[0] == "object" ? t.map((e) => hn(e)) : t.slice();
|
|
3648
3805
|
}
|
|
3649
3806
|
//#endregion
|
|
3650
3807
|
//#region node_modules/@turf/transform-rotate/dist/esm/index.js
|
|
3651
|
-
function
|
|
3652
|
-
if (n ||= {}, !
|
|
3808
|
+
function gn(e, t, n) {
|
|
3809
|
+
if (n ||= {}, !Rt(n)) throw Error("options is invalid");
|
|
3653
3810
|
let r = n.pivot, i = n.mutate;
|
|
3654
3811
|
if (!e) throw Error("geojson is required");
|
|
3655
3812
|
if (t == null || isNaN(t)) throw Error("angle is required");
|
|
3656
3813
|
if (t === 0) return e;
|
|
3657
|
-
let a = r ??
|
|
3658
|
-
return (i === !1 || i === void 0) && (e =
|
|
3659
|
-
let n =
|
|
3814
|
+
let a = r ?? en(e);
|
|
3815
|
+
return (i === !1 || i === void 0) && (e = un(e)), zt(e, function(e) {
|
|
3816
|
+
let n = rn(a, e) + t, r = nn(cn(a, on(a, e), n));
|
|
3660
3817
|
e[0] = r[0], e[1] = r[1];
|
|
3661
3818
|
}), e;
|
|
3662
3819
|
}
|
|
3663
3820
|
//#endregion
|
|
3664
3821
|
//#region node_modules/@turf/bearing/dist/esm/index.js
|
|
3665
|
-
function
|
|
3666
|
-
if (n.final === !0) return
|
|
3667
|
-
let r =
|
|
3668
|
-
return
|
|
3822
|
+
function _n(e, t, n = {}) {
|
|
3823
|
+
if (n.final === !0) return vn(e, t);
|
|
3824
|
+
let r = tn(e), i = tn(t), a = Ft(r[0]), o = Ft(i[0]), s = Ft(r[1]), c = Ft(i[1]), l = Math.sin(o - a) * Math.cos(c), u = Math.cos(s) * Math.sin(c) - Math.sin(s) * Math.cos(c) * Math.cos(o - a);
|
|
3825
|
+
return Pt(Math.atan2(l, u));
|
|
3669
3826
|
}
|
|
3670
|
-
function
|
|
3671
|
-
let n =
|
|
3827
|
+
function vn(e, t) {
|
|
3828
|
+
let n = _n(t, e);
|
|
3672
3829
|
return n = (n + 180) % 360, n;
|
|
3673
3830
|
}
|
|
3674
3831
|
//#endregion
|
|
3675
3832
|
//#region node_modules/@turf/bbox/dist/esm/index.js
|
|
3676
|
-
function
|
|
3833
|
+
function yn(e, t = {}) {
|
|
3677
3834
|
if (e.bbox != null && !0 !== t.recompute) return e.bbox;
|
|
3678
3835
|
let n = [
|
|
3679
3836
|
Infinity,
|
|
@@ -3681,17 +3838,17 @@ function cn(e, t = {}) {
|
|
|
3681
3838
|
-Infinity,
|
|
3682
3839
|
-Infinity
|
|
3683
3840
|
];
|
|
3684
|
-
return
|
|
3841
|
+
return zt(e, (e) => {
|
|
3685
3842
|
n[0] > e[0] && (n[0] = e[0]), n[1] > e[1] && (n[1] = e[1]), n[2] < e[0] && (n[2] = e[0]), n[3] < e[1] && (n[3] = e[1]);
|
|
3686
3843
|
}), n;
|
|
3687
3844
|
}
|
|
3688
3845
|
//#endregion
|
|
3689
3846
|
//#region node_modules/@turf/bbox-polygon/dist/esm/index.js
|
|
3690
|
-
function
|
|
3847
|
+
function bn(e, t = {}) {
|
|
3691
3848
|
let n = Number(e[0]), r = Number(e[1]), i = Number(e[2]), a = Number(e[3]);
|
|
3692
3849
|
if (e.length === 6) throw Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
3693
3850
|
let o = [n, r];
|
|
3694
|
-
return
|
|
3851
|
+
return jt([[
|
|
3695
3852
|
o,
|
|
3696
3853
|
[i, r],
|
|
3697
3854
|
[i, a],
|
|
@@ -3704,20 +3861,20 @@ function ln(e, t = {}) {
|
|
|
3704
3861
|
}
|
|
3705
3862
|
//#endregion
|
|
3706
3863
|
//#region node_modules/@turf/envelope/dist/esm/index.js
|
|
3707
|
-
function
|
|
3708
|
-
return
|
|
3864
|
+
function xn(e) {
|
|
3865
|
+
return bn(yn(e));
|
|
3709
3866
|
}
|
|
3710
3867
|
//#endregion
|
|
3711
3868
|
//#region node_modules/@turf/area/dist/esm/index.js
|
|
3712
|
-
function
|
|
3713
|
-
return
|
|
3869
|
+
function Sn(e) {
|
|
3870
|
+
return Ht(e, (e, t) => e + Cn(t), 0);
|
|
3714
3871
|
}
|
|
3715
|
-
function
|
|
3872
|
+
function Cn(e) {
|
|
3716
3873
|
let t = 0, n;
|
|
3717
3874
|
switch (e.type) {
|
|
3718
|
-
case "Polygon": return
|
|
3875
|
+
case "Polygon": return wn(e.coordinates);
|
|
3719
3876
|
case "MultiPolygon":
|
|
3720
|
-
for (n = 0; n < e.coordinates.length; n++) t +=
|
|
3877
|
+
for (n = 0; n < e.coordinates.length; n++) t += wn(e.coordinates[n]);
|
|
3721
3878
|
return t;
|
|
3722
3879
|
case "Point":
|
|
3723
3880
|
case "MultiPoint":
|
|
@@ -3726,57 +3883,57 @@ function fn(e) {
|
|
|
3726
3883
|
}
|
|
3727
3884
|
return 0;
|
|
3728
3885
|
}
|
|
3729
|
-
function
|
|
3886
|
+
function wn(e) {
|
|
3730
3887
|
let t = 0;
|
|
3731
3888
|
if (e && e.length > 0) {
|
|
3732
|
-
t += Math.abs(
|
|
3733
|
-
for (let n = 1; n < e.length; n++) t -= Math.abs(
|
|
3889
|
+
t += Math.abs(Dn(e[0]));
|
|
3890
|
+
for (let n = 1; n < e.length; n++) t -= Math.abs(Dn(e[n]));
|
|
3734
3891
|
}
|
|
3735
3892
|
return t;
|
|
3736
3893
|
}
|
|
3737
|
-
var
|
|
3738
|
-
function
|
|
3894
|
+
var Tn = $ * $ / 2, En = Math.PI / 180;
|
|
3895
|
+
function Dn(e) {
|
|
3739
3896
|
let t = e.length - 1;
|
|
3740
3897
|
if (t <= 2) return 0;
|
|
3741
3898
|
let n = 0, r = 0;
|
|
3742
3899
|
for (; r < t;) {
|
|
3743
|
-
let i = e[r], a = e[r + 1 === t ? 0 : r + 1], o = e[r + 2 >= t ? (r + 2) % t : r + 2], s = i[0] *
|
|
3900
|
+
let i = e[r], a = e[r + 1 === t ? 0 : r + 1], o = e[r + 2 >= t ? (r + 2) % t : r + 2], s = i[0] * En, c = a[1] * En, l = o[0] * En;
|
|
3744
3901
|
n += (l - s) * Math.sin(c), r++;
|
|
3745
3902
|
}
|
|
3746
|
-
return n *
|
|
3903
|
+
return n * Tn;
|
|
3747
3904
|
}
|
|
3748
3905
|
//#endregion
|
|
3749
3906
|
//#region node_modules/geojson-minimum-bounding-rectangle/dist/index.js
|
|
3750
|
-
function
|
|
3751
|
-
let t =
|
|
3907
|
+
function On(e) {
|
|
3908
|
+
let t = $t(e);
|
|
3752
3909
|
if (!t) throw Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
|
|
3753
|
-
let n =
|
|
3910
|
+
let n = en(t), r = Bt(t), i = 2 ** 53 - 1, a = null;
|
|
3754
3911
|
for (let e = 0; e < r.length - 1; e++) {
|
|
3755
|
-
let o =
|
|
3756
|
-
c < i && (i = c, a =
|
|
3912
|
+
let o = _n(r[e], r[e + 1]), s = xn(gn(t, -1 * o, { pivot: n })), c = Sn(s);
|
|
3913
|
+
c < i && (i = c, a = gn(s, o, { pivot: n }));
|
|
3757
3914
|
}
|
|
3758
3915
|
return a;
|
|
3759
3916
|
}
|
|
3760
3917
|
//#endregion
|
|
3761
3918
|
//#region src/utils/OBB.mjs
|
|
3762
|
-
function
|
|
3919
|
+
function kn(e, t) {
|
|
3763
3920
|
let n = t[0] - e[0], r = t[1] - e[1];
|
|
3764
3921
|
return Math.sqrt(n * n + r * r);
|
|
3765
3922
|
}
|
|
3766
|
-
function
|
|
3923
|
+
function An(e) {
|
|
3767
3924
|
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
|
|
3768
3925
|
for (let [a, o] of e) a < t && (t = a), a > n && (n = a), o < r && (r = o), o > i && (i = o);
|
|
3769
3926
|
return [(n + t) * .5, (i + r) * .5];
|
|
3770
3927
|
}
|
|
3771
|
-
var
|
|
3928
|
+
var jn = class t extends Et {
|
|
3772
3929
|
getBoxMesh() {
|
|
3773
|
-
|
|
3930
|
+
Mn.identity(), Mn.setFromMatrix3(this.rotation), Mn.decompose(In, Nn, new e.Vector3());
|
|
3774
3931
|
let t = this.halfSize.clone().multiplyScalar(2), n = new e.Mesh(new e.BoxGeometry(t.x, t.y, t.z));
|
|
3775
|
-
return n.position.copy(this.center), n.rotation.setFromQuaternion(
|
|
3932
|
+
return n.position.copy(this.center), n.rotation.setFromQuaternion(Nn), n;
|
|
3776
3933
|
}
|
|
3777
3934
|
getBoxEdge(t = 16776960) {
|
|
3778
3935
|
let n = this.getBoxMesh();
|
|
3779
|
-
|
|
3936
|
+
Ln.setFromObject(n);
|
|
3780
3937
|
let r = new e.EdgesGeometry(n.geometry.clone().applyMatrix4(n.matrixWorld));
|
|
3781
3938
|
return new e.LineSegments(r, new e.LineBasicMaterial({
|
|
3782
3939
|
color: t,
|
|
@@ -3784,33 +3941,33 @@ var bn = class t extends ht {
|
|
|
3784
3941
|
}));
|
|
3785
3942
|
}
|
|
3786
3943
|
toJson() {
|
|
3787
|
-
return
|
|
3944
|
+
return Mn.identity(), Mn.setFromMatrix3(this.rotation), Mn.decompose(In, Nn, new e.Vector3()), {
|
|
3788
3945
|
size: this.halfSize.toArray(),
|
|
3789
3946
|
center: this.center.toArray(),
|
|
3790
|
-
quaternion:
|
|
3947
|
+
quaternion: Nn.toArray()
|
|
3791
3948
|
};
|
|
3792
3949
|
}
|
|
3793
3950
|
static from(n, r, i, a = new t()) {
|
|
3794
|
-
if (i instanceof e.Euler)
|
|
3795
|
-
else if (i instanceof e.Quaternion)
|
|
3951
|
+
if (i instanceof e.Euler) Nn.setFromEuler(i);
|
|
3952
|
+
else if (i instanceof e.Quaternion) Nn.copy(i);
|
|
3796
3953
|
else throw Error("传入的旋转不是欧拉角或者四元数");
|
|
3797
|
-
return
|
|
3954
|
+
return Mn.compose(r, Nn, Fn), a.center.copy(r), a.halfSize.copy(n.multiplyScalar(.5)), a.rotation.setFromMatrix4(Mn), a;
|
|
3798
3955
|
}
|
|
3799
3956
|
static fromByPath2D(e, n, r, i = new t()) {
|
|
3800
|
-
let a =
|
|
3957
|
+
let a = On({
|
|
3801
3958
|
type: "Polygon",
|
|
3802
3959
|
coordinates: [e.map((e) => [e.x, e.y])]
|
|
3803
3960
|
});
|
|
3804
3961
|
if (!a) throw Error("2d obb 获取失败");
|
|
3805
|
-
let o = a.geometry.coordinates[0], s =
|
|
3806
|
-
|
|
3807
|
-
let [u, d] =
|
|
3808
|
-
return n.x = u, n.y = d, this.from(
|
|
3962
|
+
let o = a.geometry.coordinates[0], s = kn(o[0], o[1]), c = kn(o[1], o[2]), l = Math.atan2(o[1][1] - o[0][1], o[1][0] - o[0][0]);
|
|
3963
|
+
In.set(s, c, r), Pn.set(0, 0, l);
|
|
3964
|
+
let [u, d] = An(o);
|
|
3965
|
+
return n.x = u, n.y = d, this.from(In, n, Pn, i);
|
|
3809
3966
|
}
|
|
3810
|
-
},
|
|
3967
|
+
}, Mn = new e.Matrix4(), Nn = new e.Quaternion(), Pn = new e.Euler(), Fn = new e.Vector3(1, 1, 1), In = new e.Vector3(), Ln = new e.Box3();
|
|
3811
3968
|
//#endregion
|
|
3812
3969
|
//#region src/pointCloudProcessing/mergeMeaning.mjs
|
|
3813
|
-
function
|
|
3970
|
+
function Rn(e, t, n = .005, r = .2) {
|
|
3814
3971
|
if (!e.length || !t.length) return 0;
|
|
3815
3972
|
let i = Math.max(n * 3, .05), a = n * n, o = /* @__PURE__ */ new Map(), s = (e, t, n) => `${Math.floor(e / i)},${Math.floor(t / i)},${Math.floor(n / i)}`;
|
|
3816
3973
|
for (let e of t) {
|
|
@@ -3839,26 +3996,26 @@ function Dn(e, t, n = .005, r = .2) {
|
|
|
3839
3996
|
}
|
|
3840
3997
|
return c / e.length;
|
|
3841
3998
|
}
|
|
3842
|
-
function
|
|
3999
|
+
function zn(e, t, n = .5) {
|
|
3843
4000
|
let r = 0, i = 0;
|
|
3844
4001
|
for (let a of e) if (t.containsPoint(a) && (r++, i = r / e.length, i > n)) break;
|
|
3845
4002
|
return i;
|
|
3846
4003
|
}
|
|
3847
|
-
function
|
|
4004
|
+
function Bn(e, t, n, r) {
|
|
3848
4005
|
if (e.intersectsOBB(t)) return !0;
|
|
3849
4006
|
{
|
|
3850
|
-
let i =
|
|
4007
|
+
let i = Hn(e, r), a = Hn(t, n);
|
|
3851
4008
|
if (i || a) return !0;
|
|
3852
4009
|
}
|
|
3853
4010
|
return !1;
|
|
3854
4011
|
}
|
|
3855
|
-
function
|
|
4012
|
+
function Vn(t, n) {
|
|
3856
4013
|
let r = new e.Vector3(), i = new e.Vector3();
|
|
3857
4014
|
t.getSize(r), n.getSize(i);
|
|
3858
4015
|
let a = r.x * r.y * r.z, o = i.x * i.y * i.z;
|
|
3859
4016
|
return a > o ? 1 : a < o ? -1 : 0;
|
|
3860
4017
|
}
|
|
3861
|
-
function
|
|
4018
|
+
function Hn(e, t) {
|
|
3862
4019
|
let n = !0;
|
|
3863
4020
|
for (let r = 0; r < t.length; r++) if (!e.containsPoint(t[r])) {
|
|
3864
4021
|
n = !1;
|
|
@@ -3866,7 +4023,7 @@ function jn(e, t) {
|
|
|
3866
4023
|
}
|
|
3867
4024
|
return n;
|
|
3868
4025
|
}
|
|
3869
|
-
function
|
|
4026
|
+
function Un(e) {
|
|
3870
4027
|
if (e.length === 0) return {
|
|
3871
4028
|
x: 0,
|
|
3872
4029
|
y: 0,
|
|
@@ -3884,52 +4041,85 @@ function Mn(e) {
|
|
|
3884
4041
|
h: r - i
|
|
3885
4042
|
};
|
|
3886
4043
|
}
|
|
3887
|
-
function
|
|
4044
|
+
function Wn(t, n, r, i) {
|
|
3888
4045
|
let a = [];
|
|
3889
4046
|
for (let n = 0; n < t.length; n++) a.push(new e.Vector3(t[n][0], t[n][1], 0));
|
|
3890
4047
|
if (a.length == 0) return null;
|
|
3891
|
-
let o =
|
|
4048
|
+
let o = jn.fromByPath2D(a, n, r);
|
|
3892
4049
|
return o.center.z = i, o;
|
|
3893
4050
|
}
|
|
3894
|
-
var
|
|
4051
|
+
var Gn = (t) => {
|
|
3895
4052
|
if (t.length == 0) return [];
|
|
3896
|
-
let n = [];
|
|
3897
|
-
for (let
|
|
3898
|
-
let
|
|
3899
|
-
|
|
3900
|
-
let
|
|
3901
|
-
if (
|
|
3902
|
-
let
|
|
3903
|
-
for (let n = 0; n < t[
|
|
3904
|
-
let
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
4053
|
+
let n = [], r = /* @__PURE__ */ new Map();
|
|
4054
|
+
for (let i = 0; i < t.length; i++) {
|
|
4055
|
+
let a = t[i].points.map((e) => [e.x, e.y]), o = Un(t[i].points), s = t[i].obj_id;
|
|
4056
|
+
s = s.replace(/calcony railing/g, "balcony railing").replace(/glass balcony railing/g, "balcony railing").replace(/metal balcony railing/g, "balcony railing").replace(/temporary construction guardrail/g, "balcony railing"), s.split("_").slice(1, 3).join("_").split(".")[0].split("_")[0];
|
|
4057
|
+
let c = s.indexOf("_") + 1, l = s.lastIndexOf("_"), u = s.substring(c, l);
|
|
4058
|
+
if (u !== "floor") continue;
|
|
4059
|
+
let d = [];
|
|
4060
|
+
for (let n = 0; n < t[i].points.length; n++) d.push(new e.Vector3(t[i].points[n].x, t[i].points[n].y, t[i].points[n].z));
|
|
4061
|
+
let f = -99999;
|
|
4062
|
+
if (u === "floor") {
|
|
4063
|
+
let n = /* @__PURE__ */ new Map();
|
|
4064
|
+
for (let e = 0; e < t[i].points.length; e++) {
|
|
4065
|
+
let r = t[i].points[e].z;
|
|
4066
|
+
if (r = Math.floor(r * 10) / 10, n.has(r)) {
|
|
4067
|
+
let a = n.get(r);
|
|
4068
|
+
a.num += 1, a.points.push(t[i].points[e]), n.set(r, a);
|
|
4069
|
+
} else n.set(r, {
|
|
4070
|
+
num: 1,
|
|
4071
|
+
points: [t[i].points[e]]
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
let r = [...n.entries()].reduce((e, t) => t[1].num > e[1].num ? t : e);
|
|
4075
|
+
a = [], a = r[1].points.map((e) => [e.x, e.y]), d = [], d = r[1].points.map((t) => new e.Vector3(t.x, t.y, t.z)), f = r[0];
|
|
4076
|
+
}
|
|
4077
|
+
let p = {
|
|
4078
|
+
points: d,
|
|
4079
|
+
path: gt(a),
|
|
4080
|
+
h: o.h,
|
|
4081
|
+
minz: o.minz,
|
|
4082
|
+
maxz: o.maxz,
|
|
3910
4083
|
center: {
|
|
3911
|
-
x:
|
|
3912
|
-
y:
|
|
3913
|
-
z:
|
|
4084
|
+
x: o.x,
|
|
4085
|
+
y: o.y,
|
|
4086
|
+
z: o.z
|
|
3914
4087
|
},
|
|
3915
|
-
obj_id: t[
|
|
3916
|
-
type:
|
|
3917
|
-
averagePz: t[
|
|
4088
|
+
obj_id: t[i].obj_id,
|
|
4089
|
+
type: u,
|
|
4090
|
+
averagePz: t[i].averagePz,
|
|
3918
4091
|
obb: null,
|
|
3919
4092
|
isDel: !1,
|
|
3920
|
-
obj_id:
|
|
3921
|
-
positionArr: [t[
|
|
4093
|
+
obj_id: s,
|
|
4094
|
+
positionArr: [t[i].position]
|
|
3922
4095
|
};
|
|
3923
|
-
if (
|
|
3924
|
-
let
|
|
3925
|
-
for (let e = 0; e < n.length; e++) if (n[e].type ==
|
|
3926
|
-
|
|
4096
|
+
if (p.obb = Wn(p.path, p.center, p.h, (p.maxz + p.minz) / 2), p.obb == null) continue;
|
|
4097
|
+
let m = -1;
|
|
4098
|
+
for (let e = 0; e < n.length; e++) if (n[e].type == u) {
|
|
4099
|
+
m = e;
|
|
4100
|
+
break;
|
|
4101
|
+
}
|
|
4102
|
+
if (m == -1 ? n.push({
|
|
4103
|
+
type: u,
|
|
4104
|
+
array: [p]
|
|
4105
|
+
}) : n[m].array.push(p), u == "floor" && f != -99999) if (r.has(f)) {
|
|
4106
|
+
let e = r.get(f);
|
|
4107
|
+
e.num += p.points.length, e.datas.push(p), r.set(f, e);
|
|
4108
|
+
} else r.set(f, {
|
|
4109
|
+
num: p.points.length,
|
|
4110
|
+
datas: [p]
|
|
4111
|
+
});
|
|
4112
|
+
}
|
|
4113
|
+
if (r.size > 0) {
|
|
4114
|
+
let e = [];
|
|
4115
|
+
for (let [t, n] of r.entries()) {
|
|
4116
|
+
let { num: t, datas: r } = n;
|
|
4117
|
+
t > 3e3 && e.push(...r);
|
|
4118
|
+
}
|
|
4119
|
+
for (let t = 0; t < n.length; t++) if (n[t].type == "floor") {
|
|
4120
|
+
n[t].array = e;
|
|
3927
4121
|
break;
|
|
3928
4122
|
}
|
|
3929
|
-
f == -1 ? n.push({
|
|
3930
|
-
type: l,
|
|
3931
|
-
array: [d]
|
|
3932
|
-
}) : n[f].array.push(d);
|
|
3933
4123
|
}
|
|
3934
4124
|
for (let e = 0; e < n.length; e++) {
|
|
3935
4125
|
let t = n[e].array, r = [], i = [];
|
|
@@ -3940,13 +4130,13 @@ var Pn = (t) => {
|
|
|
3940
4130
|
obb: t[e].obb.clone()
|
|
3941
4131
|
};
|
|
3942
4132
|
for (let i = e + 1; i < t.length; i++) if (!(t[i].obb == null || r.includes(i)) && n.obb.intersectsOBB(t[i].obb)) {
|
|
3943
|
-
r.push(i), n.points.push(...t[i].points), n.path =
|
|
3944
|
-
let a =
|
|
4133
|
+
r.push(i), n.points.push(...t[i].points), n.path = gt(n.points.map((e) => [e.x, e.y]));
|
|
4134
|
+
let a = Un(n.points);
|
|
3945
4135
|
n.h = a.h, n.minz = a.minz, n.maxz = a.maxz, n.center = {
|
|
3946
4136
|
x: a.x,
|
|
3947
4137
|
y: a.y,
|
|
3948
4138
|
z: a.z
|
|
3949
|
-
}, n.obb =
|
|
4139
|
+
}, n.obb = Wn(n.path, n.center, n.h, (n.maxz + n.minz) / 2), n.positionArr.push(...t[i].positionArr), i = e;
|
|
3950
4140
|
}
|
|
3951
4141
|
n.path.length > t[e].path.length && (r.push(e), i.push(n));
|
|
3952
4142
|
}
|
|
@@ -3955,7 +4145,9 @@ var Pn = (t) => {
|
|
|
3955
4145
|
a.push(...i), n[e].array = a;
|
|
3956
4146
|
}
|
|
3957
4147
|
for (let t = 0; t < n.length; t++) {
|
|
3958
|
-
let r = n[t].type
|
|
4148
|
+
let r = n[t].type;
|
|
4149
|
+
if (r === "people" || r === "floor") continue;
|
|
4150
|
+
let i = n[t].array;
|
|
3959
4151
|
for (let a = 0; a < i.length; a++) {
|
|
3960
4152
|
let o = i[a].obb, s = i[a].minz;
|
|
3961
4153
|
i[a].maxz;
|
|
@@ -3974,74 +4166,61 @@ var Pn = (t) => {
|
|
|
3974
4166
|
}
|
|
3975
4167
|
}
|
|
3976
4168
|
if (!i[a].isDel) for (let e = t + 1; e < n.length; e++) {
|
|
3977
|
-
let t = n[e].type
|
|
4169
|
+
let t = n[e].type;
|
|
4170
|
+
if (t === "people" || t === "floor") continue;
|
|
4171
|
+
let l = n[e].array;
|
|
3978
4172
|
for (let e = 0; e < l.length; e++) {
|
|
3979
4173
|
if (l[e].isDel) continue;
|
|
3980
4174
|
let n = l[e].obb, u = l[e].minz;
|
|
3981
4175
|
if (l[e].maxz, o.intersectsOBB(n)) {
|
|
3982
|
-
|
|
3983
|
-
let d =
|
|
4176
|
+
zn(l[e].points, o);
|
|
4177
|
+
let d = zn(i[a].points, n), f = Vn(o, n);
|
|
3984
4178
|
if (d >= .3 && f == -1) {
|
|
3985
4179
|
i[a].isDel = !0;
|
|
3986
4180
|
break;
|
|
3987
4181
|
}
|
|
3988
4182
|
if (r !== "wall" && r !== "floor" && r !== "roof") {
|
|
3989
4183
|
if (r === "window") {
|
|
3990
|
-
if (t === "balcony railing" &&
|
|
4184
|
+
if (t === "balcony railing" && Hn(o, l[e].points)) {
|
|
3991
4185
|
l[e].isDel = !0;
|
|
3992
4186
|
continue;
|
|
3993
4187
|
}
|
|
3994
|
-
if (t === "balcony railing" &&
|
|
4188
|
+
if (t === "balcony railing" && Hn(n, i[a].points)) {
|
|
3995
4189
|
i[a].isDel = !0;
|
|
3996
4190
|
break;
|
|
3997
4191
|
}
|
|
3998
|
-
if (t === "balcony railing" &&
|
|
4192
|
+
if (t === "balcony railing" && Bn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(u - c) > .3)) {
|
|
3999
4193
|
l[e].isDel = !0;
|
|
4000
4194
|
continue;
|
|
4001
4195
|
}
|
|
4002
4196
|
} else if (r === "balcony railing") {
|
|
4003
|
-
if (t === "window" &&
|
|
4197
|
+
if (t === "window" && Hn(o, l[e].points)) {
|
|
4004
4198
|
l[e].isDel = !0;
|
|
4005
4199
|
continue;
|
|
4006
4200
|
}
|
|
4007
|
-
if (t === "window" &&
|
|
4201
|
+
if (t === "window" && Hn(n, i[a].points)) {
|
|
4008
4202
|
i[a].isDel = !0;
|
|
4009
4203
|
break;
|
|
4010
4204
|
}
|
|
4011
|
-
if (t === "window" &&
|
|
4205
|
+
if (t === "window" && Bn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(s - c) > .3)) {
|
|
4012
4206
|
i[a].isDel = !0;
|
|
4013
4207
|
break;
|
|
4014
4208
|
}
|
|
4015
4209
|
}
|
|
4016
4210
|
let d = !1, f = [], p = [], m = i[a].points, h = l[e].points;
|
|
4017
|
-
if (m.length > h.length ? (d = !0, f = m, p = h) : (f = h, p = m),
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
}
|
|
4025
|
-
if (d) l[e].isDel = !0;
|
|
4026
|
-
else {
|
|
4027
|
-
i[a].isDel = !0;
|
|
4028
|
-
break;
|
|
4029
|
-
}
|
|
4030
|
-
} else if (kn(o, n)) {
|
|
4031
|
-
if (t === "people") {
|
|
4032
|
-
l[e].isDel = !0;
|
|
4033
|
-
continue;
|
|
4034
|
-
} else if (r === "people") {
|
|
4035
|
-
i[a].isDel = !0;
|
|
4036
|
-
break;
|
|
4037
|
-
}
|
|
4038
|
-
let s = An(o, n);
|
|
4211
|
+
if (m.length > h.length ? (d = !0, f = m, p = h) : (f = h, p = m), Rn(p, f, .03, .5) > .5) if (d) l[e].isDel = !0;
|
|
4212
|
+
else {
|
|
4213
|
+
i[a].isDel = !0;
|
|
4214
|
+
break;
|
|
4215
|
+
}
|
|
4216
|
+
else if (Bn(o, n)) {
|
|
4217
|
+
let s = Vn(o, n);
|
|
4039
4218
|
if (s === 1 || s === 0) {
|
|
4040
4219
|
if (t === "switch") continue;
|
|
4041
|
-
|
|
4220
|
+
zn(p, o) >= .5 && (l[e].isDel = !0);
|
|
4042
4221
|
} else {
|
|
4043
4222
|
if (r === "switch") continue;
|
|
4044
|
-
if (
|
|
4223
|
+
if (zn(p, n) >= .5) {
|
|
4045
4224
|
i[a].isDel = !0;
|
|
4046
4225
|
break;
|
|
4047
4226
|
}
|
|
@@ -4074,25 +4253,7 @@ var Pn = (t) => {
|
|
|
4074
4253
|
}
|
|
4075
4254
|
}
|
|
4076
4255
|
for (let e = 0; e < n.length; e++) n[e].array = n[e].array.filter((e) => !e.isDel);
|
|
4077
|
-
|
|
4078
|
-
for (let t = 0; t < n.length; t++) {
|
|
4079
|
-
let i = n[t].array;
|
|
4080
|
-
for (let t = 0; t < i.length; t++) r.push({
|
|
4081
|
-
obbBox: i[t].obb,
|
|
4082
|
-
box: new e.Box3().setFromPoints(i[t].points),
|
|
4083
|
-
category: i[t].type,
|
|
4084
|
-
center: {
|
|
4085
|
-
x: i[t].center.x,
|
|
4086
|
-
y: i[t].center.y,
|
|
4087
|
-
z: (i[t].minz + i[t].maxz) / 2
|
|
4088
|
-
},
|
|
4089
|
-
name: i[t].obj_id,
|
|
4090
|
-
obj_id: i[t].obj_id,
|
|
4091
|
-
pcdPoints: i[t].points,
|
|
4092
|
-
positionArr: i[t].positionArr
|
|
4093
|
-
});
|
|
4094
|
-
}
|
|
4095
|
-
return r;
|
|
4256
|
+
return n;
|
|
4096
4257
|
};
|
|
4097
4258
|
//#endregion
|
|
4098
|
-
export {
|
|
4259
|
+
export { z as classifySegments, ge as getAllGeometry, Oe as getBeamLine, Ae as getColLine, ke as getMainBeamLine, Gn as getMergeMeaning, I as getParallelism, ie as getPointCloudMinMax, ne as getPointCoverageOnQuad, j as isParallel, L as perpendicularInfo, oe as removeNoisePoints, O as segmentsIntersect2D, _e as updateStEdPoint, De as usegetBeamLine };
|