rm-graphical-computing 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +799 -649
- 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",
|
|
@@ -415,9 +420,9 @@ var M = class {
|
|
|
415
420
|
closestDistance: null
|
|
416
421
|
};
|
|
417
422
|
m < 0 && p.negate();
|
|
418
|
-
let _ = new e.Vector3().addVectors(f, p).normalize(), v = new e.Vector3().addVectors(t, n).multiplyScalar(.5), y =
|
|
419
|
-
return z ?
|
|
420
|
-
type:
|
|
423
|
+
let _ = new e.Vector3().addVectors(f, p).normalize(), v = new e.Vector3().addVectors(t, n).multiplyScalar(.5), y = B(r, v, f), b = B(i, v, f), x = (y + b) / 2, S = Math.max(y, b), C = t.dot(_), w = n.dot(_), T = r.dot(_), E = i.dot(_), D = Math.min(C, w), O = Math.max(C, w), k = Math.min(T, E), A = Math.max(T, E), j = O - D, M = A - k, N = Math.min(j, M), P = Math.min(O, A) - Math.max(D, k), F = P < 0 ? -P : 0, I = P > 0 ? P : 0, L = N > 0 ? I / N : 0, R = ee(t, n, r, i), z = h <= s && x < c, te;
|
|
424
|
+
return z ? te = L > .5 ? "collinear_overlap" : "collinear_gap" : h <= o && (te = "parallel_offset"), {
|
|
425
|
+
type: te,
|
|
421
426
|
angleDeg: g,
|
|
422
427
|
avgPerpendicularDistance: x,
|
|
423
428
|
maxPerpendicularDistance: S,
|
|
@@ -426,17 +431,17 @@ var M = class {
|
|
|
426
431
|
closestDistance: R
|
|
427
432
|
};
|
|
428
433
|
};
|
|
429
|
-
function
|
|
434
|
+
function B(t, n, r) {
|
|
430
435
|
let i = new e.Vector3().subVectors(t, n), a = i.dot(r), o = r.clone().multiplyScalar(a);
|
|
431
436
|
return new e.Vector3().subVectors(i, o).length();
|
|
432
437
|
}
|
|
433
|
-
function
|
|
438
|
+
function ee(t, n, r, i) {
|
|
434
439
|
let a = new e.Vector3().subVectors(n, t), o = new e.Vector3().subVectors(i, r), s = new e.Vector3().subVectors(r, t), c = a.dot(a), l = a.dot(o), u = o.dot(o), d = a.dot(s), f = o.dot(s), p = c * u - l * l, m, h;
|
|
435
440
|
p < 1e-10 ? (m = 0, h = u === 0 ? 0 : f / u) : (m = (l * f - u * d) / p, h = (c * f - l * d) / p), m = e.MathUtils.clamp(m, 0, 1), h = u === 0 ? 0 : e.MathUtils.clamp((l * m + f) / u, 0, 1), m = c === 0 ? 0 : e.MathUtils.clamp((l * h - d) / c, 0, 1);
|
|
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 te = (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);
|
|
@@ -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;
|
|
@@ -558,7 +563,7 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
558
563
|
let { newOriginalPoints: x } = ie(p, m, i.originalPoints);
|
|
559
564
|
i.originalPoints = x;
|
|
560
565
|
}
|
|
561
|
-
},
|
|
566
|
+
}, V = (t, n) => new e.Vector3(t.x, t.y, 0).distanceTo(new e.Vector3(n.x, n.y, 0)), oe = (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
|
}, se = (e) => {
|
|
@@ -568,7 +573,7 @@ var z = (t, n, r, i = .05, a = .02) => {
|
|
|
568
573
|
a > t && (t = a, n = [e[r], e[i]]);
|
|
569
574
|
}
|
|
570
575
|
return n;
|
|
571
|
-
},
|
|
576
|
+
}, H = (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, ce = (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);
|
|
@@ -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();
|
|
@@ -1076,7 +1081,162 @@ var fe = class {
|
|
|
1076
1081
|
o.checkResults = C, o.verticalDirection = w, o.originaIndex = a, i.push(o);
|
|
1077
1082
|
}
|
|
1078
1083
|
return i;
|
|
1079
|
-
}, ge =
|
|
1084
|
+
}, ge = (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 (H(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) || ye(a[n], e) && (f.push(n), t.push(a[n]));
|
|
1103
|
+
t.length > 0 && p.push(be(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: le(),
|
|
1112
|
+
size: .02
|
|
1113
|
+
})));
|
|
1114
|
+
let [_, v] = Te(p, {
|
|
1115
|
+
plane: "xy",
|
|
1116
|
+
trimRatio: 0
|
|
1117
|
+
});
|
|
1118
|
+
D(_, v, n);
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
function _e(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 ve(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 ye(e, t, n = "xy") {
|
|
1141
|
+
if (!t || t.length !== 4) throw Error("rectPoints must contain 4 points");
|
|
1142
|
+
let r = _e(e, n), i = t.map((e) => _e(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 = ve(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 be(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 xe(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 Se(e, t = "xy") {
|
|
1159
|
+
let n = xe(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 Ce(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 we(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 Te(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) => Se(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 = we(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 [Ce(D, O, T, n), Ce(k, A, E, n)];
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1238
|
+
//#region src/geometry/beamLine.mjs
|
|
1239
|
+
var Ee = async (t, n, r, i) => {
|
|
1080
1240
|
ce(i);
|
|
1081
1241
|
let a = await fetch(t);
|
|
1082
1242
|
if (!a) return;
|
|
@@ -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 De(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,
|
|
@@ -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,7 +1420,7 @@ var fe = class {
|
|
|
1260
1420
|
beamDoorGroup: p,
|
|
1261
1421
|
lineIndexGroup: m
|
|
1262
1422
|
};
|
|
1263
|
-
},
|
|
1423
|
+
}, De = async (t, n, r, i) => {
|
|
1264
1424
|
if (ae(t, i), t.length <= 0 || n.length <= 0) return t;
|
|
1265
1425
|
r ||= [];
|
|
1266
1426
|
for (let n of 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,228 +1552,192 @@ 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
|
-
|
|
1404
|
-
let
|
|
1562
|
+
let m = o.max.z;
|
|
1563
|
+
o.min.z;
|
|
1564
|
+
let h = new e.Vector3(a.start.x, a.start.y, a.start.z), g = new e.Vector3(a.end.x, a.end.y, a.end.z), _ = a.rooftopPz - a.start.z, v = 0;
|
|
1405
1565
|
for (let o of a.mergeCheckRegion) {
|
|
1406
|
-
let { facePoints:
|
|
1407
|
-
if (!
|
|
1408
|
-
|
|
1409
|
-
let
|
|
1566
|
+
let { facePoints: y, boxArea: b, totalInPlaneNum: x } = F(o.points, o.gridWidth, o.gridHeight, o.centerPts);
|
|
1567
|
+
if (!y || y.length <= 0) continue;
|
|
1568
|
+
y[0].distanceTo(y[1]);
|
|
1569
|
+
let S = y[0].distanceTo(y[3]), C = o.gridHeight * (S / o.gridHeight / 3 * 2) + o.gridHeight / 2, w = new e.Vector3(y[0].x, y[0].y, y[0].z + C), T = new e.Vector3(y[1].x, y[1].y, y[1].z + C), E = new e.Line3(w, T), D = [], k = new e.Vector3();
|
|
1410
1570
|
o.points.forEach((e) => {
|
|
1411
|
-
|
|
1571
|
+
E.closestPointToPoint(e, !0, k).distanceTo(e) < o.gridHeight + .01 && D.push(e);
|
|
1412
1572
|
});
|
|
1413
|
-
let
|
|
1573
|
+
let A = [], M = [];
|
|
1414
1574
|
for (;;) {
|
|
1415
1575
|
let e = [];
|
|
1416
|
-
for (let t = 0; t <
|
|
1417
|
-
for (let t = 0; t <
|
|
1418
|
-
for (let n = 0; n < e.length; n++) if (
|
|
1419
|
-
e.push(
|
|
1576
|
+
for (let t = 0; t < D.length; t++) M.includes(t) || e.length == 0 && (e.push(D[t]), M.push(t));
|
|
1577
|
+
for (let t = 0; t < D.length; t++) if (!M.includes(t)) {
|
|
1578
|
+
for (let n = 0; n < e.length; n++) if (D[t].distanceTo(e[n]) < o.gridWidth + .01) {
|
|
1579
|
+
e.push(D[t]), M.push(t), t = -1;
|
|
1420
1580
|
break;
|
|
1421
1581
|
}
|
|
1422
1582
|
}
|
|
1423
1583
|
if (e.length == 0) break;
|
|
1424
|
-
|
|
1584
|
+
A.push(e);
|
|
1425
1585
|
}
|
|
1426
|
-
let
|
|
1427
|
-
for (let t = 0; t <
|
|
1586
|
+
let N = [];
|
|
1587
|
+
for (let t = 0; t < A.length; t++) {
|
|
1428
1588
|
let n = {
|
|
1429
1589
|
lineSt: new e.Vector3(),
|
|
1430
1590
|
lineEd: new e.Vector3(),
|
|
1431
1591
|
facePoints: []
|
|
1432
|
-
}, r = se(
|
|
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,
|
|
1592
|
+
}, r = se(A[t]);
|
|
1593
|
+
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, y[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, y[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, y[2].z)), n.facePoints.push(new e.Vector3(r[0].x, r[0].y, y[2].z)), N.push(n));
|
|
1434
1594
|
}
|
|
1435
|
-
|
|
1436
|
-
let
|
|
1437
|
-
if (
|
|
1438
|
-
let
|
|
1439
|
-
if (
|
|
1440
|
-
let
|
|
1441
|
-
if (Math.abs(
|
|
1442
|
-
if (
|
|
1443
|
-
let n =
|
|
1595
|
+
v += o.area;
|
|
1596
|
+
let P = 0;
|
|
1597
|
+
if (x != 0 && (P = o.gridHeight * o.gridWidth * x), (o.area - P) / b * 100 > 70 && N.length == 1 || N.length > 1) for (let v = 0; v < N.length; v++) {
|
|
1598
|
+
let y = N[v], b = y.facePoints[0].distanceTo(y.facePoints[1]), x = y.facePoints[0].distanceTo(y.facePoints[3]), S = b / a.length * 100, C = a.rooftopPz - y.facePoints[2].z;
|
|
1599
|
+
if (x < 1.5 || m < y.facePoints[2].z || C > _ / 3 * 2) continue;
|
|
1600
|
+
let w = !1, T = !1, E = !1, D = [], k = y.facePoints[2].clone(), A = y.facePoints[3].clone(), M = y.facePoints[0].clone(), P = y.facePoints[1].clone(), F = !1, B = -1;
|
|
1601
|
+
if (Math.abs(y.facePoints[0].z - a.start.z) < .25) {
|
|
1602
|
+
if (b > .17 && a.length > .5) {
|
|
1603
|
+
let n = V(h, M), r = V(h, P), o = V(g, M), s = V(g, P), c = .1;
|
|
1444
1604
|
if (n < c || r < c) {
|
|
1445
|
-
let { newOriginalPoints: r } = ie(
|
|
1605
|
+
let { newOriginalPoints: r } = ie(M, P, a.originalPoints), o = [], s = [];
|
|
1446
1606
|
if (r.forEach((e) => {
|
|
1447
|
-
e.z >=
|
|
1607
|
+
e.z >= k.z ? o.push(e) : e.z <= M.z && s.push(e);
|
|
1448
1608
|
}), o.length > 10) {
|
|
1449
|
-
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;
|
|
1609
|
+
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, p = !1;
|
|
1450
1610
|
for (let n = 0; n < t.length; n++) {
|
|
1451
1611
|
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),
|
|
1453
|
-
if (
|
|
1454
|
-
if (
|
|
1455
|
-
let e =
|
|
1456
|
-
if (
|
|
1457
|
-
u = Infinity, d = -1;
|
|
1612
|
+
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), m = O(r, o, a, c), h = L(r, o, a, c);
|
|
1613
|
+
if (m != null) {
|
|
1614
|
+
if (h && h.angle > 85) {
|
|
1615
|
+
let e = m.point.distanceTo(r);
|
|
1616
|
+
if (m.point.distanceTo(o), e < .3) {
|
|
1617
|
+
p = !0, u = Infinity, d = -1;
|
|
1458
1618
|
break;
|
|
1459
1619
|
}
|
|
1460
1620
|
}
|
|
1461
1621
|
continue;
|
|
1462
1622
|
}
|
|
1463
|
-
if (
|
|
1464
|
-
let t =
|
|
1623
|
+
if (h && h.angle > 85) {
|
|
1624
|
+
let t = I(r, o, new e.Line3(a, c).closestPointToPoint(r, !0, l), r);
|
|
1465
1625
|
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 =
|
|
1626
|
+
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
1627
|
if (m == null) continue;
|
|
1468
1628
|
let h = r.distanceTo(m.point);
|
|
1469
1629
|
h < u && (u = h, d = n);
|
|
1470
|
-
} else if (
|
|
1471
|
-
let t = new e.Vector3(
|
|
1630
|
+
} else if (h && h.angle < 5) {
|
|
1631
|
+
let t = new e.Vector3(M.x, M.y, 0), n = new e.Vector3(P.x, P.y, 0), r = V(t, a), i = V(t, c), o = V(n, a), s = V(n, c);
|
|
1472
1632
|
if (r < .08 || i < .08 || o < .08 || s < .08) {
|
|
1473
1633
|
f = !0, u = Infinity, d = -1;
|
|
1474
1634
|
break;
|
|
1475
1635
|
}
|
|
1476
1636
|
}
|
|
1477
1637
|
}
|
|
1478
|
-
if (u != Infinity && u < 2) t[d].length > .25 &&
|
|
1479
|
-
else if (!f)
|
|
1480
|
-
let r = .05, a = _.clone().addScaledVector(s, r), o = _.clone().addScaledVector(s.clone().negate(), r);
|
|
1481
|
-
a.z = o.z = 0;
|
|
1482
|
-
let l = !1;
|
|
1483
|
-
for (let d = 0; d < t.length; d++) {
|
|
1484
|
-
if (d == i) continue;
|
|
1485
|
-
let f = new e.Vector3(t[d].start.x, t[d].start.y, 0), p = new e.Vector3(t[d].end.x, t[d].end.y, 0), m = new e.Vector3().subVectors(p, f).normalize();
|
|
1486
|
-
f = f.clone().addScaledVector(m.clone().negate(), r), p = p.clone().addScaledVector(m, r);
|
|
1487
|
-
let h = D(a, o, f, p);
|
|
1488
|
-
if (h) {
|
|
1489
|
-
h.point.z = _.z;
|
|
1490
|
-
let e = h.point.distanceTo(_);
|
|
1491
|
-
if (h.point.distanceTo(v) < e) continue;
|
|
1492
|
-
u > e && (u = e), l = !0;
|
|
1493
|
-
}
|
|
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
|
-
}
|
|
1497
|
-
if (!l) continue;
|
|
1498
|
-
}
|
|
1638
|
+
if (u != Infinity && u < 2 && a.length - b > .5 && u < b * 3) t[d].length > .25 && b + u > .5 && (F = !0, n < c ? (A = A.addScaledVector(s, u), M = M.addScaledVector(s, u)) : (k = k.addScaledVector(s, u), P = P.addScaledVector(s, u)));
|
|
1639
|
+
else if (!f && !p) continue;
|
|
1499
1640
|
} else continue;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1641
|
+
}
|
|
1642
|
+
if (o < c || s < c) {
|
|
1643
|
+
let { newOriginalPoints: n } = ie(M, P, a.originalPoints), r = [], s = [];
|
|
1502
1644
|
if (n.forEach((e) => {
|
|
1503
|
-
e.z >=
|
|
1645
|
+
e.z >= k.z ? r.push(e) : e.z <= M.z && s.push(e);
|
|
1504
1646
|
}), r.length > 10) {
|
|
1505
|
-
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;
|
|
1647
|
+
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, p = !1;
|
|
1506
1648
|
for (let a = 0; a < t.length; a++) {
|
|
1507
1649
|
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),
|
|
1509
|
-
if (
|
|
1510
|
-
if (
|
|
1511
|
-
u = Infinity, d = -1;
|
|
1650
|
+
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), m = O(n, r, o, c), h = L(n, r, o, c);
|
|
1651
|
+
if (m != null) {
|
|
1652
|
+
if (h && h.angle > 85 && (m.point.distanceTo(n), m.point.distanceTo(r) < .3)) {
|
|
1653
|
+
p = !0, u = Infinity, d = -1;
|
|
1512
1654
|
break;
|
|
1513
1655
|
}
|
|
1514
1656
|
continue;
|
|
1515
1657
|
}
|
|
1516
|
-
if (
|
|
1517
|
-
let t =
|
|
1658
|
+
if (h && h.angle > 85) {
|
|
1659
|
+
let t = I(r, n, new e.Line3(o, c).closestPointToPoint(r, !0, l), r);
|
|
1518
1660
|
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 =
|
|
1661
|
+
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
1662
|
if (m == null) continue;
|
|
1521
1663
|
let h = r.distanceTo(m.point);
|
|
1522
1664
|
h < u && (u = h, d = a);
|
|
1523
|
-
} else if (
|
|
1524
|
-
let t = new e.Vector3(
|
|
1665
|
+
} else if (h && h.angle < 5) {
|
|
1666
|
+
let t = new e.Vector3(M.x, M.y, 0), n = new e.Vector3(P.x, P.y, 0), r = V(t, o), i = V(t, c), a = V(n, o), s = V(n, c);
|
|
1525
1667
|
if (r < .08 || i < .08 || a < .08 || s < .08) {
|
|
1526
1668
|
f = !0, u = Infinity, d = -1;
|
|
1527
1669
|
break;
|
|
1528
1670
|
}
|
|
1529
1671
|
}
|
|
1530
1672
|
}
|
|
1531
|
-
if (u != Infinity && u < 2) t[d].length > .25 &&
|
|
1532
|
-
else if (!f)
|
|
1533
|
-
let n = .05, r = v.clone().addScaledVector(s, n), a = _.clone();
|
|
1534
|
-
r.z = a.z = 0;
|
|
1535
|
-
let l = !1;
|
|
1536
|
-
for (let o = 0; o < t.length; o++) {
|
|
1537
|
-
if (o == i) continue;
|
|
1538
|
-
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
|
-
s = s.clone().addScaledVector(d.clone().negate(), n), c = c.clone().addScaledVector(d, n);
|
|
1540
|
-
let f = D(r, a, s, c);
|
|
1541
|
-
if (f) {
|
|
1542
|
-
f.point.z = v.z;
|
|
1543
|
-
let e = f.point.distanceTo(v);
|
|
1544
|
-
if (f.point.distanceTo(_) < e) continue;
|
|
1545
|
-
u > e && (u = e), l = !0;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
if (!l) continue;
|
|
1549
|
-
u != Infinity && u < 2 && (o < 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)));
|
|
1550
|
-
}
|
|
1673
|
+
if (u != Infinity && u < 2 && a.length - b > .5 && u < b * 3) t[d].length > .25 && b + u > .5 && (F = !0, o < c ? (A = A.addScaledVector(s, u), M = M.addScaledVector(s, u)) : (k = k.addScaledVector(s, u), P = P.addScaledVector(s, u)));
|
|
1674
|
+
else if (!f && !p) continue;
|
|
1551
1675
|
} else continue;
|
|
1552
1676
|
}
|
|
1553
|
-
|
|
1677
|
+
b = A.distanceTo(k);
|
|
1554
1678
|
}
|
|
1555
|
-
if (
|
|
1679
|
+
if (S < 85 && b > .3 || b > .7 && x > _ - _ / 3) {
|
|
1556
1680
|
let t = !1;
|
|
1557
1681
|
for (let r = 0; r < n.length; r++) {
|
|
1558
1682
|
let i = r + 1;
|
|
1559
1683
|
if (i >= n.length) continue;
|
|
1560
1684
|
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 (
|
|
1685
|
+
if (O(new e.Vector3(a.x, a.y, 0), new e.Vector3(o.x, o.y, 0), new e.Vector3(y.facePoints[0].x, y.facePoints[0].y, 0), new e.Vector3(y.facePoints[1].x, y.facePoints[1].y, 0), .1) != null) {
|
|
1562
1686
|
t = !0;
|
|
1563
1687
|
break;
|
|
1564
1688
|
}
|
|
1565
1689
|
}
|
|
1566
|
-
for (let t = 0; t <
|
|
1567
|
-
let n = new e.Vector3(
|
|
1568
|
-
if (Math.abs(
|
|
1569
|
-
let l =
|
|
1690
|
+
for (let t = 0; t < s.length; t++) {
|
|
1691
|
+
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(y.facePoints[0].x, y.facePoints[0].y, 0), c = new e.Vector3(y.facePoints[1].x, y.facePoints[1].y, 0), l = y.facePoints[2].z < s[t].maxZ || Math.abs(y.facePoints[2].z - s[t].maxZ) < .3;
|
|
1692
|
+
if (Math.abs(y.facePoints[2].z - s[t].maxZ), l) {
|
|
1693
|
+
let l = z(n.clone(), i.clone(), o.clone(), c.clone(), { distanceThreshold: 2 });
|
|
1570
1694
|
if (l && l.type == "collinear_gap") {
|
|
1571
|
-
let u =
|
|
1695
|
+
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
1696
|
if (u.distanceTo(p) < .15) {
|
|
1573
|
-
let a = o.distanceTo(n), u =
|
|
1697
|
+
let a = o.distanceTo(n), u = c.distanceTo(n);
|
|
1574
1698
|
if (a > .25 && u > .25) {
|
|
1575
|
-
let e = o.distanceTo(i), t =
|
|
1699
|
+
let e = o.distanceTo(i), t = c.distanceTo(i);
|
|
1576
1700
|
if (e > .2 && t > .2) continue;
|
|
1577
1701
|
}
|
|
1578
|
-
|
|
1579
|
-
let d = new e.Vector3().subVectors(o,
|
|
1580
|
-
u < a && d.negate(), a > u ? (
|
|
1702
|
+
T = !0, E = !0, D.push(s[t].index), s[t].isFind = !0, B = t, r[s[t].index].isFindBeam = !0;
|
|
1703
|
+
let d = new e.Vector3().subVectors(o, c).normalize(), f = n.distanceTo(i) - l.overlap;
|
|
1704
|
+
u < a && d.negate(), a > u ? (k = y.facePoints[2].clone().addScaledVector(d, f), A = y.facePoints[3].clone(), M = A.clone(), P = k.clone(), M.z = P.z = y.facePoints[0].z) : (k = y.facePoints[2].clone(), A = y.facePoints[3].clone().addScaledVector(d, f), M = A.clone(), P = k.clone(), M.z = P.z = y.facePoints[0].z);
|
|
1581
1705
|
}
|
|
1582
1706
|
} else if (l && l.type == "collinear_overlap" && l.maxPerpendicularDistance < .35) {
|
|
1583
|
-
let a = o.distanceTo(
|
|
1707
|
+
let a = o.distanceTo(c), u = i.distanceTo(n);
|
|
1584
1708
|
if (Math.abs(a - l.overlap) < .25 || Math.abs(u - l.overlap) < .25) {
|
|
1585
1709
|
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(),
|
|
1710
|
+
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;
|
|
1711
|
+
d < f ? (p.negate(), k = y.facePoints[2].clone().addScaledVector(p, m), A = y.facePoints[3].clone(), M = A.clone(), P = k.clone(), M.z = P.z = y.facePoints[0].z) : (k = y.facePoints[2].clone(), A = y.facePoints[3].clone().addScaledVector(p, m), M = A.clone(), P = k.clone(), M.z = P.z = y.facePoints[0].z);
|
|
1588
1712
|
}
|
|
1589
|
-
|
|
1713
|
+
T = !0, E = !0, D.push(s[t].index), s[t].isFind = !0, r[s[t].index].isFindBeam = !0, B = t;
|
|
1590
1714
|
}
|
|
1591
1715
|
}
|
|
1592
1716
|
}
|
|
1593
1717
|
}
|
|
1594
|
-
if (!
|
|
1595
|
-
if (
|
|
1596
|
-
let n = new e.Vector3(
|
|
1597
|
-
(
|
|
1718
|
+
if (!E) for (let t = 0; t < s.length; t++) {
|
|
1719
|
+
if (s[t].inWall) continue;
|
|
1720
|
+
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(y.facePoints[0].x, y.facePoints[0].y, 0), o = new e.Vector3(y.facePoints[1].x, y.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);
|
|
1721
|
+
(f < p || m < p || h < p || g < p || d) && (r[s[t].index].isFindBeam = !0, T = !0, s[t].isFind = !0, B = t);
|
|
1598
1722
|
}
|
|
1599
|
-
(
|
|
1723
|
+
(T || t || Math.abs(x - _) > .1 && x > _ / 2 && b > .3) && (w = !0);
|
|
1600
1724
|
}
|
|
1601
1725
|
}
|
|
1602
|
-
if (
|
|
1726
|
+
if (w) {
|
|
1603
1727
|
let n = !1;
|
|
1604
|
-
for (let e = 0; e <
|
|
1605
|
-
let t =
|
|
1728
|
+
for (let e = 0; e < d.length; e++) {
|
|
1729
|
+
let t = z(d[e].start, d[e].end, M, P);
|
|
1606
1730
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .01) {
|
|
1607
1731
|
n = !0;
|
|
1608
1732
|
break;
|
|
1609
1733
|
}
|
|
1610
1734
|
}
|
|
1611
1735
|
if (n) {
|
|
1612
|
-
|
|
1736
|
+
B != -1 && (r[s[B].index].isFindBeam = !1, s[B].isFind = !1);
|
|
1613
1737
|
continue;
|
|
1614
1738
|
}
|
|
1615
|
-
|
|
1616
|
-
start:
|
|
1739
|
+
d.push({
|
|
1740
|
+
start: M,
|
|
1617
1741
|
end: P
|
|
1618
1742
|
});
|
|
1619
1743
|
{
|
|
@@ -1621,19 +1745,19 @@ var fe = class {
|
|
|
1621
1745
|
color: 65535,
|
|
1622
1746
|
size: .01
|
|
1623
1747
|
});
|
|
1624
|
-
let t = new e.Vector3().subVectors(
|
|
1748
|
+
let t = new e.Vector3().subVectors(M, P), n = new e.Vector3().subVectors(P, M), r = Infinity, i = Infinity, o = M.clone(), s = P.clone(), c = [], l = [], u = new e.Line3(k, A), d = new e.Vector3(), f = 999999;
|
|
1625
1749
|
if (a.originalPoints.forEach((r) => {
|
|
1626
|
-
if (r.z -
|
|
1627
|
-
let i = u.closestPointToPoint(r, !0, d), a = new e.Vector3().subVectors(i,
|
|
1750
|
+
if (r.z - M.z < x / 2 + .1 && r.z - M.z > x / 2 - .1 && c.push(r), r.z > k.z) {
|
|
1751
|
+
let i = u.closestPointToPoint(r, !0, d), a = new e.Vector3().subVectors(i, k), o = j(t, new e.Vector3().subVectors(i, A)), s = j(n, a);
|
|
1628
1752
|
o && o.parallel && !o.sameDirection && s && s.parallel && !s.sameDirection && l.push(r);
|
|
1629
1753
|
}
|
|
1630
1754
|
}), c.length > 0) {
|
|
1631
|
-
let { newProjectPoints: a } = ie(
|
|
1632
|
-
for (let e of a) e.z =
|
|
1755
|
+
let { newProjectPoints: a } = ie(M, P, c);
|
|
1756
|
+
for (let e of a) e.z = M.z;
|
|
1633
1757
|
a.forEach((a) => {
|
|
1634
|
-
let c = new e.Vector3(a.x, a.y,
|
|
1758
|
+
let c = new e.Vector3(a.x, a.y, M.z), l = new e.Vector3().subVectors(c, P), u = j(t, new e.Vector3().subVectors(c, M)), d = j(n, l);
|
|
1635
1759
|
if (u && u.parallel && u.sameDirection) {
|
|
1636
|
-
let e = c.distanceTo(
|
|
1760
|
+
let e = c.distanceTo(M);
|
|
1637
1761
|
e < r && (r = e, o = c);
|
|
1638
1762
|
} else if (d && d.parallel && d.sameDirection) {
|
|
1639
1763
|
let e = c.distanceTo(P);
|
|
@@ -1641,172 +1765,176 @@ var fe = class {
|
|
|
1641
1765
|
}
|
|
1642
1766
|
});
|
|
1643
1767
|
}
|
|
1644
|
-
if (o.equals(
|
|
1645
|
-
let { newOnLinePoints: e } = ie(
|
|
1768
|
+
if (o.equals(M) || (M = o, A = new e.Vector3(M.x, M.y, A.z)), s.equals(P) || (P = s, k = new e.Vector3(P.x, P.y, k.z)), l.length > 10) {
|
|
1769
|
+
let { newOnLinePoints: e } = ie(A, k, l);
|
|
1646
1770
|
for (let t = 0; t < e.length; t++) {
|
|
1647
1771
|
let n = u.closestPointToPoint(e[t], !0, d).distanceTo(e[t]);
|
|
1648
1772
|
n > .02 && f > n && (f = n);
|
|
1649
1773
|
}
|
|
1650
|
-
|
|
1774
|
+
k.z += f, A.z += f, x += f;
|
|
1651
1775
|
}
|
|
1652
1776
|
}
|
|
1653
|
-
let
|
|
1654
|
-
if (
|
|
1655
|
-
|
|
1777
|
+
let p = P.distanceTo(M);
|
|
1778
|
+
if (p < .4 && !T || p < .3 && T) continue;
|
|
1779
|
+
u.includes(i) || u.push(i), a.checkResults[o.index].isDoor = !0;
|
|
1656
1780
|
let m = "", h = {
|
|
1657
|
-
id:
|
|
1658
|
-
beamStart:
|
|
1659
|
-
beamEnd:
|
|
1660
|
-
beamHeight: a.rooftopPz -
|
|
1661
|
-
doorStart:
|
|
1781
|
+
id: c,
|
|
1782
|
+
beamStart: k,
|
|
1783
|
+
beamEnd: A,
|
|
1784
|
+
beamHeight: a.rooftopPz - k.z,
|
|
1785
|
+
doorStart: M,
|
|
1662
1786
|
doorEnd: P,
|
|
1663
|
-
doorHeight:
|
|
1787
|
+
doorHeight: x,
|
|
1664
1788
|
nearId: -1,
|
|
1665
1789
|
type: m,
|
|
1666
|
-
isExtend:
|
|
1667
|
-
isDoor:
|
|
1668
|
-
isPullOutDoor:
|
|
1669
|
-
pcbDoorIndexs:
|
|
1670
|
-
}, g = !1, _ = new e.Vector3(), v = new e.Vector3(), y = -1;
|
|
1671
|
-
for (let n = 0; n <
|
|
1672
|
-
let r = t[
|
|
1790
|
+
isExtend: F,
|
|
1791
|
+
isDoor: T,
|
|
1792
|
+
isPullOutDoor: E,
|
|
1793
|
+
pcbDoorIndexs: D
|
|
1794
|
+
}, g = !1, _ = new e.Vector3(), v = new e.Vector3(), y = -1, S = -1, C = -1;
|
|
1795
|
+
for (let n = 0; n < l.length; n++) {
|
|
1796
|
+
let r = t[l[n].linesIndex].doorAndBeamData[l[n].doorIndex];
|
|
1673
1797
|
if (r.nearId != -1) continue;
|
|
1674
|
-
let i =
|
|
1798
|
+
let i = I(k.clone(), A.clone(), r.beamStart.clone(), r.beamEnd.clone());
|
|
1675
1799
|
if (i && i.isParallel) {
|
|
1676
|
-
let t =
|
|
1677
|
-
|
|
1678
|
-
let
|
|
1679
|
-
|
|
1680
|
-
let
|
|
1681
|
-
if (
|
|
1682
|
-
r.nearId =
|
|
1800
|
+
let t = k.distanceTo(A), i = r.beamStart.distanceTo(r.beamEnd), a = new e.Line3(k.clone(), A.clone());
|
|
1801
|
+
a.start.z = 0, a.end.z = 0;
|
|
1802
|
+
let o = R(r.beamStart, r.beamEnd, !0);
|
|
1803
|
+
i > t && (a.start = new e.Vector3(r.beamStart.x, r.beamStart.y, 0), a.end = new e.Vector3(r.beamEnd.x, r.beamEnd.y, 0), o = R(k, A, !0));
|
|
1804
|
+
let s = new e.Vector3(), u = a.closestPointToPoint(o, !0, s), d = u.distanceTo(o), f = new e.Vector3().subVectors(o, u).normalize(), p = f.clone().negate(), m = o.clone().addScaledVector(p, d + .1), b = O(a.start, a.end, o, m), x = !T && !r.isDoor && (t > i * 2 || i > t * 2);
|
|
1805
|
+
if (d < .4 && b != null && !x) {
|
|
1806
|
+
r.nearId = c, h.nearId = r.id;
|
|
1683
1807
|
let e = .8;
|
|
1684
1808
|
(r.isDoor || h.isDoor) && (r.isDoor = !0, h.isDoor = !0);
|
|
1685
|
-
let
|
|
1686
|
-
t <
|
|
1809
|
+
let a = D.some((e) => r.pcbDoorIndexs.includes(e));
|
|
1810
|
+
t < i ? t > e && !r.isPullOutDoor ? (r.beamStart = k.clone().addScaledVector(p, d), r.beamEnd = A.clone().addScaledVector(p, d), r.doorStart = M.clone().addScaledVector(p, d), r.doorEnd = P.clone().addScaledVector(p, d), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : !E || E && r.isPullOutDoor && a ? (h.beamStart = r.beamStart.clone().addScaledVector(f, d), h.beamEnd = r.beamEnd.clone().addScaledVector(f, d), h.doorStart = r.doorStart.clone().addScaledVector(f, d), h.doorEnd = r.doorEnd.clone().addScaledVector(f, d), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : (r.beamStart = k.clone().addScaledVector(p, d), r.beamEnd = A.clone().addScaledVector(p, d), r.doorStart = M.clone().addScaledVector(p, d), r.doorEnd = P.clone().addScaledVector(p, d), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : t > i && (i > e && !E ? (h.beamStart = r.beamStart.clone().addScaledVector(p, d), h.beamEnd = r.beamEnd.clone().addScaledVector(p, d), h.doorStart = r.doorStart.clone().addScaledVector(p, d), h.doorEnd = r.doorEnd.clone().addScaledVector(p, d), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : !r.isPullOutDoor || E && r.isPullOutDoor && a ? (r.beamStart = k.clone().addScaledVector(f, d), r.beamEnd = A.clone().addScaledVector(f, d), r.doorStart = M.clone().addScaledVector(f, d), r.doorEnd = P.clone().addScaledVector(f, d), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : (h.beamStart = r.beamStart.clone().addScaledVector(p, d), h.beamEnd = r.beamEnd.clone().addScaledVector(p, d), h.doorStart = r.doorStart.clone().addScaledVector(p, d), h.doorEnd = r.doorEnd.clone().addScaledVector(p, d), 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, S = l[n].linesIndex, C = l[n].doorIndex;
|
|
1687
1811
|
break;
|
|
1688
1812
|
}
|
|
1689
1813
|
}
|
|
1690
1814
|
}
|
|
1691
|
-
let
|
|
1815
|
+
let w = !1;
|
|
1692
1816
|
if (!g) {
|
|
1693
|
-
let a = new e.Line3(
|
|
1817
|
+
let a = new e.Line3(M.clone(), P.clone());
|
|
1694
1818
|
for (let o = 0; o < t.length; o++) {
|
|
1695
1819
|
if (t[o].length < .5 || o == i || !t[o].checkResults) continue;
|
|
1696
|
-
let
|
|
1697
|
-
if (
|
|
1820
|
+
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), M, P), l = re(t[o]);
|
|
1821
|
+
if (c && c.maxPerpendicularDistance < .3) {
|
|
1698
1822
|
for (let i = 0; i < t[o].checkResults.length; i++) {
|
|
1699
1823
|
let i = [];
|
|
1700
1824
|
t[o].originalPoints.forEach((t) => {
|
|
1701
|
-
t.z >
|
|
1825
|
+
t.z > M.z && t.z < M.z + x / 2 && i.push(new e.Vector3(t.x, t.y, M.z));
|
|
1702
1826
|
});
|
|
1703
|
-
let
|
|
1827
|
+
let c = new e.Vector3(), u = [], d = [];
|
|
1704
1828
|
for (let e = 0; e < i.length; e++) {
|
|
1705
|
-
let t = a.closestPointToPoint(i[e], !0,
|
|
1706
|
-
t.distanceTo(i[e]) < .15 && (
|
|
1829
|
+
let t = a.closestPointToPoint(i[e], !0, c);
|
|
1830
|
+
t.distanceTo(i[e]) < .15 && (u.push(i[e]), d.push(t.clone()));
|
|
1707
1831
|
}
|
|
1708
|
-
for (let e = 0; e <
|
|
1709
|
-
if (
|
|
1710
|
-
let
|
|
1711
|
-
if (
|
|
1712
|
-
let e =
|
|
1832
|
+
for (let e = 0; e < d.length; e++) oe(a, d[e]) && u.push(d[e]);
|
|
1833
|
+
if (u = d, u.length < 500) continue;
|
|
1834
|
+
let f = se(u);
|
|
1835
|
+
if (f.length == 2) {
|
|
1836
|
+
let e = f[0].distanceTo(f[1]);
|
|
1713
1837
|
if (Math.abs(e - a.distance()) < .3) {
|
|
1714
|
-
|
|
1838
|
+
if (h.beamStart.z > l.maxZ - .03 && b > 1) w = !0;
|
|
1839
|
+
else if (n = !0, B != -1 && (r[s[B].index].isFindBeam = !1, s[B].isFind = !1), S != -1 && C != -1) {
|
|
1840
|
+
let e = t[S].doorAndBeamData[C];
|
|
1841
|
+
e.nearId = -1;
|
|
1842
|
+
}
|
|
1715
1843
|
break;
|
|
1716
1844
|
}
|
|
1717
1845
|
}
|
|
1718
1846
|
}
|
|
1719
1847
|
if (n) break;
|
|
1720
|
-
} else
|
|
1848
|
+
} else c && c.type == "collinear_overlap" && c.maxPerpendicularDistance > .3 && c.maxPerpendicularDistance < .7 && (w = !0);
|
|
1721
1849
|
}
|
|
1722
1850
|
if (n) continue;
|
|
1723
1851
|
}
|
|
1724
|
-
let
|
|
1725
|
-
if (y != -1) for (let e = 0; e <
|
|
1852
|
+
let N = !1;
|
|
1853
|
+
if (y != -1) for (let e = 0; e < f.length && !(f[e].length == 1 && (f[e][0].id == c ? (f[e].push({
|
|
1726
1854
|
id: y,
|
|
1727
1855
|
beamStart: _,
|
|
1728
1856
|
beamEnd: v
|
|
1729
|
-
}),
|
|
1730
|
-
id:
|
|
1731
|
-
beamStart:
|
|
1732
|
-
beamEnd:
|
|
1733
|
-
}),
|
|
1734
|
-
|
|
1735
|
-
id:
|
|
1736
|
-
beamStart:
|
|
1737
|
-
beamEnd:
|
|
1857
|
+
}), N = !0) : f[e][0].id == y && (f[e].push({
|
|
1858
|
+
id: c,
|
|
1859
|
+
beamStart: k,
|
|
1860
|
+
beamEnd: A
|
|
1861
|
+
}), N = !0), N)); e++);
|
|
1862
|
+
N || f.push([{
|
|
1863
|
+
id: c,
|
|
1864
|
+
beamStart: k,
|
|
1865
|
+
beamEnd: A
|
|
1738
1866
|
}]);
|
|
1739
|
-
let
|
|
1740
|
-
if (m =
|
|
1867
|
+
let L = h.doorStart.distanceTo(h.doorEnd);
|
|
1868
|
+
if (m = T ? "door" : L > 1.8 || w && L > 1 ? "beam" : "hole", h.type = m, h.nearId != -1 && m == "hole") {
|
|
1741
1869
|
let e = !1;
|
|
1742
1870
|
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 ==
|
|
1871
|
+
for (let r = 0; r < t[n].doorAndBeamData.length; r++) if (t[n].doorAndBeamData[r].nearId == c && t[n].doorAndBeamData[r].type == "beam") {
|
|
1744
1872
|
t[n].doorAndBeamData[r].type = m, e = !0;
|
|
1745
1873
|
break;
|
|
1746
1874
|
}
|
|
1747
1875
|
if (e) break;
|
|
1748
1876
|
}
|
|
1749
1877
|
}
|
|
1750
|
-
if (a.doorAndBeamData.push(h),
|
|
1878
|
+
if (a.doorAndBeamData.push(h), l.push({
|
|
1751
1879
|
linesIndex: i,
|
|
1752
1880
|
doorIndex: a.doorAndBeamData.length - 1
|
|
1753
|
-
}),
|
|
1881
|
+
}), c++, E && b < 2) break;
|
|
1754
1882
|
}
|
|
1755
1883
|
}
|
|
1756
1884
|
}
|
|
1757
|
-
let
|
|
1758
|
-
a.completePointAreaPercentage =
|
|
1885
|
+
let y = a.length * (a.rooftopPz - a.start.z);
|
|
1886
|
+
a.completePointAreaPercentage = v / y * 100;
|
|
1759
1887
|
}
|
|
1760
|
-
if (
|
|
1888
|
+
if (u.length > 1) for (let n = 0; n < u.length; n++) {
|
|
1761
1889
|
let r = [];
|
|
1762
|
-
for (let i = 0; i < t[
|
|
1763
|
-
let a = t[
|
|
1890
|
+
for (let i = 0; i < t[u[n]].doorAndBeamData.length; i++) {
|
|
1891
|
+
let a = t[u[n]].doorAndBeamData[i].doorStart.clone(), o = t[u[n]].doorAndBeamData[i].doorEnd.clone();
|
|
1764
1892
|
a.z = o.z = 0;
|
|
1765
1893
|
let s = a.distanceTo(o), c = !1;
|
|
1766
|
-
for (let r = 0; r <
|
|
1767
|
-
let
|
|
1768
|
-
|
|
1769
|
-
let
|
|
1770
|
-
if (
|
|
1771
|
-
let
|
|
1772
|
-
if (Math.abs(s -
|
|
1773
|
-
c = !0;
|
|
1894
|
+
for (let r = 0; r < u.length; r++) if (n != r) for (let l = 0; l < t[u[r]].doorAndBeamData.length; l++) {
|
|
1895
|
+
let d = t[u[r]].doorAndBeamData[l].doorStart.clone(), f = t[u[r]].doorAndBeamData[l].doorEnd.clone();
|
|
1896
|
+
d.z = f.z = 0, d.distanceTo(f);
|
|
1897
|
+
let p = z(a, o, d, f);
|
|
1898
|
+
if (p.type == "collinear_overlap" && p.maxPerpendicularDistance < .2) {
|
|
1899
|
+
let m = new e.Line3(d, f), h = R(a, o), g = m.closestPointToPoint(h, !0, new e.Vector3()), _ = h.distanceTo(g);
|
|
1900
|
+
if (Math.abs(s - p.overlap) < .1 && _ < .04) {
|
|
1901
|
+
t[u[r]].doorAndBeamData[l].nearId == t[u[n]].doorAndBeamData[i].id && (t[u[r]].doorAndBeamData[l].nearId = -1), c = !0;
|
|
1774
1902
|
break;
|
|
1775
1903
|
}
|
|
1776
1904
|
}
|
|
1777
1905
|
}
|
|
1778
|
-
c || r.push(t[
|
|
1906
|
+
c || r.push(t[u[n]].doorAndBeamData[i]);
|
|
1779
1907
|
}
|
|
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,
|
|
1908
|
+
r.length != t[u[n]].doorAndBeamData.length && (t[u[n]].doorAndBeamData = r);
|
|
1909
|
+
}
|
|
1910
|
+
let m = .65, h = [], g = [];
|
|
1911
|
+
for (let n = 0; n < s.length; n++) {
|
|
1912
|
+
if (s[n].isFind || s[n].inWall) continue;
|
|
1913
|
+
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();
|
|
1914
|
+
for (let l = 0; l < t.length; l++) {
|
|
1915
|
+
if (t[l].length < .7 || t[l].completePointAreaPercentage > 60) continue;
|
|
1916
|
+
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);
|
|
1917
|
+
O(y, b, x, S);
|
|
1918
|
+
let C = I(y, b, x, S), w = i.distanceTo(u) > a.distanceTo(u) ? a : i, T = w.distanceTo(u), E = w.distanceTo(d);
|
|
1919
|
+
if ((T < p || E < p) && C && !C.isParallel) {
|
|
1920
|
+
let o = i.distanceTo(u) < i.distanceTo(d) ? u : d, _ = !1;
|
|
1793
1921
|
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 >
|
|
1922
|
+
if (v == l || h.includes(v) || t[v].length < .7) continue;
|
|
1923
|
+
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;
|
|
1924
|
+
if (D != null && (k = D.point.distanceTo(u) < p || D.point.distanceTo(d) < p), (T && T.angle > 85 || E && E.type == "collinear_gap") && k) {
|
|
1925
|
+
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;
|
|
1926
|
+
if (w > T && T > m) E = b, D = C;
|
|
1927
|
+
else if (w < T && w > m) E = y, D = S;
|
|
1800
1928
|
else continue;
|
|
1801
1929
|
if (w = o.distanceTo(y), T = o.distanceTo(b), w > 2 && T > 2) continue;
|
|
1802
|
-
let O =
|
|
1930
|
+
let O = I(E, D, y, b);
|
|
1803
1931
|
if (!O || !O.isParallel) continue;
|
|
1804
|
-
let k =
|
|
1932
|
+
let k = z(i, a, E, D);
|
|
1805
1933
|
if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < .2) continue;
|
|
1806
1934
|
E.z = D.z = t[v].start.z;
|
|
1807
1935
|
let A = !1;
|
|
1808
|
-
for (let e = 0; e <
|
|
1809
|
-
let t =
|
|
1936
|
+
for (let e = 0; e < g.length; e++) {
|
|
1937
|
+
let t = z(g[e].start, g[e].end, E, D);
|
|
1810
1938
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .2) {
|
|
1811
1939
|
A = !0;
|
|
1812
1940
|
break;
|
|
@@ -1815,20 +1943,20 @@ var fe = class {
|
|
|
1815
1943
|
if (A) continue;
|
|
1816
1944
|
for (let n = 0; n < t.length; n++) {
|
|
1817
1945
|
if (t[n].length < .5) continue;
|
|
1818
|
-
let r =
|
|
1946
|
+
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
1947
|
if (r && r.type == "collinear_overlap" && r.maxPerpendicularDistance < .1) {
|
|
1820
1948
|
A = !0;
|
|
1821
1949
|
break;
|
|
1822
1950
|
}
|
|
1823
1951
|
}
|
|
1824
1952
|
if (A) continue;
|
|
1825
|
-
|
|
1953
|
+
g.push({
|
|
1826
1954
|
start: E,
|
|
1827
1955
|
end: D
|
|
1828
|
-
}),
|
|
1829
|
-
let j = t[v].rooftopPz - t[v].start.z, M = t[
|
|
1956
|
+
}), h.push(v);
|
|
1957
|
+
let j = t[v].rooftopPz - t[v].start.z, M = t[l].rooftopPz - t[l].start.z, N = j < M ? j : M;
|
|
1830
1958
|
t[v].doorAndBeamData || (t[v].doorAndBeamData = []), t[v].doorAndBeamData.push({
|
|
1831
|
-
id:
|
|
1959
|
+
id: c,
|
|
1832
1960
|
beamStart: E,
|
|
1833
1961
|
beamEnd: D,
|
|
1834
1962
|
beamHeight: N,
|
|
@@ -1838,23 +1966,23 @@ var fe = class {
|
|
|
1838
1966
|
nearId: -1,
|
|
1839
1967
|
type: "onlyDoor",
|
|
1840
1968
|
isDoor: !0
|
|
1841
|
-
}), r[
|
|
1842
|
-
id:
|
|
1969
|
+
}), r[s[n].index].isFindBeam = !0, r[s[n].index].isFindOnlyDoor = !0, f.push([{
|
|
1970
|
+
id: c,
|
|
1843
1971
|
beamStart: E,
|
|
1844
1972
|
beamEnd: D
|
|
1845
|
-
}]),
|
|
1973
|
+
}]), c++, _ = !0;
|
|
1846
1974
|
break;
|
|
1847
1975
|
}
|
|
1848
1976
|
}
|
|
1849
|
-
if (
|
|
1977
|
+
if (_) break;
|
|
1850
1978
|
}
|
|
1851
1979
|
}
|
|
1852
1980
|
}
|
|
1853
1981
|
return {
|
|
1854
1982
|
lines: t,
|
|
1855
|
-
beamGroup:
|
|
1983
|
+
beamGroup: f
|
|
1856
1984
|
};
|
|
1857
|
-
},
|
|
1985
|
+
}, Oe = (t, n) => {
|
|
1858
1986
|
if (t.length <= 0) return t;
|
|
1859
1987
|
for (let n of t) {
|
|
1860
1988
|
let t = [];
|
|
@@ -1896,7 +2024,7 @@ var fe = class {
|
|
|
1896
2024
|
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
2025
|
let t = new e.Vector3().subVectors(o, s).normalize();
|
|
1898
2026
|
d = o.distanceTo(p), u = o.distanceTo(s);
|
|
1899
|
-
let n =
|
|
2027
|
+
let n = j(t, new e.Vector3(0, 0, 1));
|
|
1900
2028
|
n && n.parallel && ([d, u] = [u, d]);
|
|
1901
2029
|
}
|
|
1902
2030
|
i.gridWidth = u, i.gridHeight = d;
|
|
@@ -1935,17 +2063,17 @@ var fe = class {
|
|
|
1935
2063
|
let l = new e.Vector3(i.start.x, i.start.y, 0), u = new e.Vector3(i.end.x, i.end.y, 0);
|
|
1936
2064
|
for (let i = 0; i < t.length; i++) {
|
|
1937
2065
|
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 =
|
|
2066
|
+
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 = re(a);
|
|
1939
2067
|
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 =
|
|
2068
|
+
let a = R(l, u), s = R(o, c);
|
|
1941
2069
|
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
2070
|
let d = `w:${t[r].originaIndex},b:${t[i].originaIndex}`, f = `b:${t[i].originaIndex},w:${t[r].originaIndex}`;
|
|
1943
|
-
n.add(
|
|
2071
|
+
n.add(k(d, a, { textColor: "#fd0000" })), n.add(k(f, s, { textColor: "#fd0000" }));
|
|
1944
2072
|
}
|
|
1945
2073
|
}
|
|
1946
2074
|
}
|
|
1947
2075
|
return t;
|
|
1948
|
-
},
|
|
2076
|
+
}, ke = (t, n) => {
|
|
1949
2077
|
let r = {
|
|
1950
2078
|
rectangles: [],
|
|
1951
2079
|
threeEdgeRect: []
|
|
@@ -1958,34 +2086,34 @@ var fe = class {
|
|
|
1958
2086
|
for (let r = 0; r < t.length; r++) {
|
|
1959
2087
|
let i = t[r].length;
|
|
1960
2088
|
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 =
|
|
2089
|
+
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
2090
|
if (!v || v.angle < 85) continue;
|
|
1963
|
-
let y =
|
|
2091
|
+
let y = H(g, u), b = H(g, d), x = H(_, u), S = H(_, d);
|
|
1964
2092
|
if (!(!y && !b && !x && !S)) {
|
|
1965
2093
|
y || b ? (p = g.clone(), m = _.clone()) : (p = _.clone(), m = g.clone()), h = new e.Vector3().subVectors(m, p).normalize(), h.clone().negate();
|
|
1966
2094
|
for (let p = 0; p < t.length; p++) {
|
|
1967
2095
|
let h = t[p].length;
|
|
1968
2096
|
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 =
|
|
2097
|
+
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
2098
|
if (!b || b.angle < 85) continue;
|
|
1971
|
-
let x =
|
|
2099
|
+
let x = H(v, m), S = H(y, m);
|
|
1972
2100
|
if (!x && !S) continue;
|
|
1973
2101
|
new e.Vector3();
|
|
1974
2102
|
let C = new e.Vector3(), w = new e.Vector3();
|
|
1975
2103
|
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 =
|
|
2104
|
+
let T = j(f, w, .1);
|
|
1977
2105
|
if (!(!T || !T.parallel || !T.sameDirection)) {
|
|
1978
2106
|
for (let f = 0; f < t.length; f++) {
|
|
1979
2107
|
let m = t[f].length;
|
|
1980
2108
|
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), _ =
|
|
2109
|
+
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
2110
|
if (!_ || _.angle < 85) continue;
|
|
1983
|
-
let b =
|
|
2111
|
+
let b = H(h, C), x = H(g, C);
|
|
1984
2112
|
if (!b && !x) continue;
|
|
1985
2113
|
new e.Vector3();
|
|
1986
2114
|
let S = new e.Vector3();
|
|
1987
2115
|
b ? (h.clone(), S = g.clone()) : (g.clone(), S = h.clone());
|
|
1988
|
-
let w =
|
|
2116
|
+
let w = H(S, u), T = H(S, d);
|
|
1989
2117
|
if (!w && !T) continue;
|
|
1990
2118
|
let E = c * i;
|
|
1991
2119
|
if (!(E < s || E > 2)) {
|
|
@@ -2018,7 +2146,7 @@ var fe = class {
|
|
|
2018
2146
|
}, u = new e.Vector3(t[n].start.x, t[n].start.y, t[n].start.z), d = new e.Vector3(t[n].end.x, t[n].end.y, t[n].end.z), f = !0, p = !0;
|
|
2019
2147
|
for (let r = 0; r < t.length; r++) {
|
|
2020
2148
|
if (r == n) continue;
|
|
2021
|
-
let i = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), a = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), o =
|
|
2149
|
+
let i = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z), a = new e.Vector3(t[r].end.x, t[r].end.y, t[r].end.z), o = H(i, u), s = H(a, u), c = H(i, d), l = H(a, d);
|
|
2022
2150
|
if (o || s ? f = !1 : (c || l) && (p = !1), !f && !p) break;
|
|
2023
2151
|
}
|
|
2024
2152
|
if (!f && !p) continue;
|
|
@@ -2028,9 +2156,9 @@ var fe = class {
|
|
|
2028
2156
|
for (let r = 0; r < t.length; r++) {
|
|
2029
2157
|
let f = t[r].length;
|
|
2030
2158
|
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 =
|
|
2159
|
+
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
2160
|
if (!g || g.angle < 85) continue;
|
|
2033
|
-
let _ =
|
|
2161
|
+
let _ = H(p, d), v = H(m, d);
|
|
2034
2162
|
if (!_ && !v) continue;
|
|
2035
2163
|
new e.Vector3();
|
|
2036
2164
|
let y = new e.Vector3();
|
|
@@ -2038,18 +2166,18 @@ var fe = class {
|
|
|
2038
2166
|
for (let d = 0; d < t.length; d++) {
|
|
2039
2167
|
let g = t[d].length;
|
|
2040
2168
|
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 =
|
|
2169
|
+
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
2170
|
if (!b || b.angle < 85) continue;
|
|
2043
|
-
let x =
|
|
2171
|
+
let x = H(_, y), S = H(v, y);
|
|
2044
2172
|
if (!x && !S) continue;
|
|
2045
2173
|
let C = new e.Vector3(), w = new e.Vector3();
|
|
2046
2174
|
x ? (C = _.clone(), w = v.clone()) : (C = v.clone(), w = _.clone());
|
|
2047
|
-
let T =
|
|
2175
|
+
let T = j(h, new e.Vector3().subVectors(w, C).normalize(), .1);
|
|
2048
2176
|
if (!T || !T.parallel || !T.sameDirection) continue;
|
|
2049
2177
|
let E = !0, D = !0;
|
|
2050
2178
|
for (let n = 0; n < t.length; n++) {
|
|
2051
2179
|
if (n == d) continue;
|
|
2052
|
-
let r = new e.Vector3(t[n].start.x, t[n].start.y, t[n].start.z), i = new e.Vector3(t[n].end.x, t[n].end.y, t[n].end.z), a =
|
|
2180
|
+
let r = new e.Vector3(t[n].start.x, t[n].start.y, t[n].start.z), i = new e.Vector3(t[n].end.x, t[n].end.y, t[n].end.z), a = H(r, _), o = H(i, _), s = H(r, v), c = H(i, v);
|
|
2053
2181
|
if (a || o ? E = !1 : (s || c) && (D = !1), !E && !D) break;
|
|
2054
2182
|
}
|
|
2055
2183
|
if (!E && !D) continue;
|
|
@@ -2068,8 +2196,8 @@ var fe = class {
|
|
|
2068
2196
|
l.indexs.length == 3 && (l.indexs.forEach((e) => i.add(e)), r.threeEdgeRect.push(l));
|
|
2069
2197
|
}
|
|
2070
2198
|
return r;
|
|
2071
|
-
},
|
|
2072
|
-
function
|
|
2199
|
+
}, U = 11102230246251565e-32, W = 134217729, Ae = (3 + 8 * U) * U;
|
|
2200
|
+
function je(e, t, n, r, i) {
|
|
2073
2201
|
let a, o, s, c, l = t[0], u = r[0], d = 0, f = 0;
|
|
2074
2202
|
u > l == u > -l ? (a = l, l = t[++d]) : (a = u, u = r[++f]);
|
|
2075
2203
|
let p = 0;
|
|
@@ -2078,37 +2206,37 @@ function xe(e, t, n, r, i) {
|
|
|
2078
2206
|
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
2207
|
return (a !== 0 || p === 0) && (i[p++] = a), p;
|
|
2080
2208
|
}
|
|
2081
|
-
function
|
|
2209
|
+
function Me(e, t) {
|
|
2082
2210
|
let n = t[0];
|
|
2083
2211
|
for (let r = 1; r < e; r++) n += t[r];
|
|
2084
2212
|
return n;
|
|
2085
2213
|
}
|
|
2086
|
-
function
|
|
2214
|
+
function G(e) {
|
|
2087
2215
|
return new Float64Array(e);
|
|
2088
2216
|
}
|
|
2089
2217
|
//#endregion
|
|
2090
2218
|
//#region node_modules/robust-predicates/esm/orient2d.js
|
|
2091
|
-
var
|
|
2092
|
-
function
|
|
2219
|
+
var Ne = (3 + 16 * U) * U, Pe = (2 + 12 * U) * U, Fe = (9 + 64 * U) * U * U, Ie = G(4), Le = G(8), Re = G(12), ze = G(16), K = G(4);
|
|
2220
|
+
function Be(e, t, n, r, i, a, o) {
|
|
2093
2221
|
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 =
|
|
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 =
|
|
2097
|
-
b = s * O, f =
|
|
2098
|
-
let j =
|
|
2099
|
-
b = T * u, f =
|
|
2100
|
-
let M =
|
|
2101
|
-
return b = s * u, f =
|
|
2222
|
+
b = T * O, f = W * T, p = f - (f - T), m = T - p, f = W * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = D * E, f = W * D, p = f - (f - D), m = D - p, f = W * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Ie[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Ie[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Ie[2] = v - (w - d) + (_ - d), Ie[3] = w;
|
|
2223
|
+
let k = Me(4, Ie), A = Pe * o;
|
|
2224
|
+
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 = Fe * o + Ae * Math.abs(k), k += T * u + O * s - (D * l + E * c), k >= A || -k >= A)) return k;
|
|
2225
|
+
b = s * O, f = W * s, p = f - (f - s), m = s - p, f = W * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = c * E, f = W * c, p = f - (f - c), m = c - p, f = W * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, K[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, K[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, K[2] = v - (w - d) + (_ - d), K[3] = w;
|
|
2226
|
+
let j = je(4, Ie, 4, K, Le);
|
|
2227
|
+
b = T * u, f = W * T, p = f - (f - T), m = T - p, f = W * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = D * l, f = W * D, p = f - (f - D), m = D - p, f = W * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, K[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, K[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, K[2] = v - (w - d) + (_ - d), K[3] = w;
|
|
2228
|
+
let M = je(j, Le, 4, K, Re);
|
|
2229
|
+
return b = s * u, f = W * s, p = f - (f - s), m = s - p, f = W * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = c * l, f = W * c, p = f - (f - c), m = c - p, f = W * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, K[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, K[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, K[2] = v - (w - d) + (_ - d), K[3] = w, ze[je(M, Re, 4, K, ze) - 1];
|
|
2102
2230
|
}
|
|
2103
|
-
function
|
|
2231
|
+
function Ve(e, t, n, r, i, a) {
|
|
2104
2232
|
let o = (t - a) * (n - i), s = (e - i) * (r - a), c = o - s, l = Math.abs(o + s);
|
|
2105
|
-
return Math.abs(c) >=
|
|
2233
|
+
return Math.abs(c) >= Ne * l ? c : -Be(e, t, n, r, i, a, l);
|
|
2106
2234
|
}
|
|
2107
|
-
(7 + 56 *
|
|
2235
|
+
(7 + 56 * U) * U, (3 + 28 * U) * U, (26 + 288 * U) * U * U, G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(8), G(8), G(8), G(4), G(8), G(8), G(16), G(12), G(192), G(192), (10 + 96 * U) * U, (4 + 48 * U) * U, (44 + 576 * U) * U * U, G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(8), G(8), G(8), G(8), G(8), G(8), G(8), G(8), G(8), G(4), G(4), G(4), G(8), G(16), G(16), G(16), G(32), G(32), G(48), G(64), G(1152), G(1152), (16 + 224 * U) * U, (5 + 72 * U) * U, (71 + 1408 * U) * U * U, G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(4), G(24), G(24), G(24), G(24), G(24), G(24), G(24), G(24), G(24), G(24), G(1152), G(1152), G(1152), G(1152), G(1152), G(2304), G(2304), G(3456), G(5760), G(8), G(8), G(8), G(16), G(24), G(48), G(48), G(96), G(192), G(384), G(384), G(384), G(768), G(96), G(96), G(96), G(1152);
|
|
2108
2236
|
//#endregion
|
|
2109
2237
|
//#region node_modules/delaunator/index.js
|
|
2110
|
-
var
|
|
2111
|
-
static from(t, n =
|
|
2238
|
+
var He = 2 ** -52, Ue = new Uint32Array(512), We = class e {
|
|
2239
|
+
static from(t, n = Qe, r = $e) {
|
|
2112
2240
|
let i = t.length, a = new Float64Array(i * 2);
|
|
2113
2241
|
for (let e = 0; e < i; e++) {
|
|
2114
2242
|
let i = t[e];
|
|
@@ -2131,25 +2259,25 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2131
2259
|
}
|
|
2132
2260
|
let u = (o + c) / 2, d = (s + l) / 2, f = 0, p = 0, m = 0;
|
|
2133
2261
|
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2134
|
-
let r =
|
|
2262
|
+
let r = Ke(u, d, e[2 * t], e[2 * t + 1]);
|
|
2135
2263
|
r < n && (f = t, n = r);
|
|
2136
2264
|
}
|
|
2137
2265
|
let h = e[2 * f], g = e[2 * f + 1];
|
|
2138
2266
|
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2139
2267
|
if (t === f) continue;
|
|
2140
|
-
let r =
|
|
2268
|
+
let r = Ke(h, g, e[2 * t], e[2 * t + 1]);
|
|
2141
2269
|
r < n && r > 0 && (p = t, n = r);
|
|
2142
2270
|
}
|
|
2143
2271
|
let _ = e[2 * p], v = e[2 * p + 1], y = Infinity;
|
|
2144
2272
|
for (let t = 0; t < a; t++) {
|
|
2145
2273
|
if (t === f || t === p) continue;
|
|
2146
|
-
let n =
|
|
2274
|
+
let n = Je(h, g, _, v, e[2 * t], e[2 * t + 1]);
|
|
2147
2275
|
n < y && (m = t, y = n);
|
|
2148
2276
|
}
|
|
2149
2277
|
let b = e[2 * m], x = e[2 * m + 1];
|
|
2150
2278
|
if (y === Infinity) {
|
|
2151
2279
|
for (let t = 0; t < a; t++) this._dists[t] = e[2 * t] - e[0] || e[2 * t + 1] - e[1];
|
|
2152
|
-
|
|
2280
|
+
Xe(this._ids, this._dists, 0, a - 1);
|
|
2153
2281
|
let t = new Uint32Array(a), n = 0;
|
|
2154
2282
|
for (let e = 0, r = -Infinity; e < a; e++) {
|
|
2155
2283
|
let i = this._ids[e], a = this._dists[i];
|
|
@@ -2158,24 +2286,24 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2158
2286
|
this.hull = t.subarray(0, n), this.triangles = new Uint32Array(), this.halfedges = new Int32Array();
|
|
2159
2287
|
return;
|
|
2160
2288
|
}
|
|
2161
|
-
if (
|
|
2289
|
+
if (Ve(h, g, _, v, b, x) < 0) {
|
|
2162
2290
|
let e = p, t = _, n = v;
|
|
2163
2291
|
p = m, _ = b, v = x, m = e, b = t, x = n;
|
|
2164
2292
|
}
|
|
2165
|
-
let S =
|
|
2293
|
+
let S = Ye(h, g, _, v, b, x);
|
|
2166
2294
|
this._cx = S.x, this._cy = S.y;
|
|
2167
|
-
for (let t = 0; t < a; t++) this._dists[t] =
|
|
2168
|
-
|
|
2295
|
+
for (let t = 0; t < a; t++) this._dists[t] = Ke(e[2 * t], e[2 * t + 1], S.x, S.y);
|
|
2296
|
+
Xe(this._ids, this._dists, 0, a - 1), this._hullStart = f;
|
|
2169
2297
|
let C = 3;
|
|
2170
2298
|
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
2299
|
for (let a = 0, o = 0, s = 0; a < this._ids.length; a++) {
|
|
2172
2300
|
let c = this._ids[a], l = e[2 * c], u = e[2 * c + 1];
|
|
2173
|
-
if (a > 0 && Math.abs(l - o) <=
|
|
2301
|
+
if (a > 0 && Math.abs(l - o) <= He && Math.abs(u - s) <= He || (o = l, s = u, c === f || c === p || c === m)) continue;
|
|
2174
2302
|
let d = 0;
|
|
2175
2303
|
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
2304
|
d = t[d];
|
|
2177
2305
|
let h = d, g;
|
|
2178
|
-
for (; g = n[h],
|
|
2306
|
+
for (; g = n[h], Ve(l, u, e[2 * h], e[2 * h + 1], e[2 * g], e[2 * g + 1]) >= 0;) if (h = g, h === d) {
|
|
2179
2307
|
h = -1;
|
|
2180
2308
|
break;
|
|
2181
2309
|
}
|
|
@@ -2183,8 +2311,8 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2183
2311
|
let _ = this._addTriangle(h, c, n[h], -1, -1, r[h]);
|
|
2184
2312
|
r[c] = this._legalize(_ + 2), r[h] = _, C++;
|
|
2185
2313
|
let v = n[h];
|
|
2186
|
-
for (; g = n[v],
|
|
2187
|
-
if (h === d) for (; g = t[h],
|
|
2314
|
+
for (; g = n[v], Ve(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;
|
|
2315
|
+
if (h === d) for (; g = t[h], Ve(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
2316
|
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
2317
|
}
|
|
2190
2318
|
this.hull = new Uint32Array(C);
|
|
@@ -2192,7 +2320,7 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2192
2320
|
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
2193
2321
|
}
|
|
2194
2322
|
_hashKey(e, t) {
|
|
2195
|
-
return Math.floor(
|
|
2323
|
+
return Math.floor(Ge(e - this._cx, t - this._cy) * this._hashSize) % this._hashSize;
|
|
2196
2324
|
}
|
|
2197
2325
|
_legalize(e) {
|
|
2198
2326
|
let { _triangles: t, _halfedges: n, coords: r } = this, i = 0, a = 0;
|
|
@@ -2200,11 +2328,11 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2200
2328
|
let o = n[e], s = e - e % 3;
|
|
2201
2329
|
if (a = s + (e + 2) % 3, o === -1) {
|
|
2202
2330
|
if (i === 0) break;
|
|
2203
|
-
e =
|
|
2331
|
+
e = Ue[--i];
|
|
2204
2332
|
continue;
|
|
2205
2333
|
}
|
|
2206
2334
|
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 (
|
|
2335
|
+
if (qe(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
2336
|
t[e] = m, t[o] = d;
|
|
2209
2337
|
let r = n[u];
|
|
2210
2338
|
if (r === -1) {
|
|
@@ -2219,10 +2347,10 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2219
2347
|
}
|
|
2220
2348
|
this._link(e, r), this._link(o, n[a]), this._link(a, u);
|
|
2221
2349
|
let s = c + (o + 1) % 3;
|
|
2222
|
-
i <
|
|
2350
|
+
i < Ue.length && (Ue[i++] = s);
|
|
2223
2351
|
} else {
|
|
2224
2352
|
if (i === 0) break;
|
|
2225
|
-
e =
|
|
2353
|
+
e = Ue[--i];
|
|
2226
2354
|
}
|
|
2227
2355
|
}
|
|
2228
2356
|
return a;
|
|
@@ -2235,30 +2363,30 @@ var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
|
2235
2363
|
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
2364
|
}
|
|
2237
2365
|
};
|
|
2238
|
-
function
|
|
2366
|
+
function Ge(e, t) {
|
|
2239
2367
|
let n = e / (Math.abs(e) + Math.abs(t));
|
|
2240
2368
|
return (t > 0 ? 3 - n : 1 + n) / 4;
|
|
2241
2369
|
}
|
|
2242
|
-
function
|
|
2370
|
+
function Ke(e, t, n, r) {
|
|
2243
2371
|
let i = e - n, a = t - r;
|
|
2244
2372
|
return i * i + a * a;
|
|
2245
2373
|
}
|
|
2246
|
-
function
|
|
2374
|
+
function qe(e, t, n, r, i, a, o, s) {
|
|
2247
2375
|
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
2376
|
return c * (d * g - h * p) - l * (u * g - h * f) + m * (u * p - d * f) < 0;
|
|
2249
2377
|
}
|
|
2250
|
-
function
|
|
2378
|
+
function Je(e, t, n, r, i, a) {
|
|
2251
2379
|
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
2380
|
return p * p + m * m;
|
|
2253
2381
|
}
|
|
2254
|
-
function
|
|
2382
|
+
function Ye(e, t, n, r, i, a) {
|
|
2255
2383
|
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
2384
|
return {
|
|
2257
2385
|
x: e + (l * u - s * d) * f,
|
|
2258
2386
|
y: t + (o * d - c * u) * f
|
|
2259
2387
|
};
|
|
2260
2388
|
}
|
|
2261
|
-
function
|
|
2389
|
+
function Xe(e, t, n, r) {
|
|
2262
2390
|
if (r - n <= 20) for (let i = n + 1; i <= r; i++) {
|
|
2263
2391
|
let r = e[i], a = t[r], o = i - 1;
|
|
2264
2392
|
for (; o >= n && t[e[o]] > a;) e[o + 1] = e[o--];
|
|
@@ -2266,7 +2394,7 @@ function Be(e, t, n, r) {
|
|
|
2266
2394
|
}
|
|
2267
2395
|
else {
|
|
2268
2396
|
let i = n + r >> 1, a = n + 1, o = r;
|
|
2269
|
-
|
|
2397
|
+
Ze(e, i, a), t[e[n]] > t[e[r]] && Ze(e, n, r), t[e[a]] > t[e[r]] && Ze(e, a, r), t[e[n]] > t[e[a]] && Ze(e, n, a);
|
|
2270
2398
|
let s = e[a], c = t[s];
|
|
2271
2399
|
for (;;) {
|
|
2272
2400
|
do
|
|
@@ -2276,24 +2404,24 @@ function Be(e, t, n, r) {
|
|
|
2276
2404
|
o--;
|
|
2277
2405
|
while (t[e[o]] > c);
|
|
2278
2406
|
if (o < a) break;
|
|
2279
|
-
|
|
2407
|
+
Ze(e, a, o);
|
|
2280
2408
|
}
|
|
2281
|
-
e[n + 1] = e[o], e[o] = s, r - a + 1 >= o - n ? (
|
|
2409
|
+
e[n + 1] = e[o], e[o] = s, r - a + 1 >= o - n ? (Xe(e, t, a, r), Xe(e, t, n, o - 1)) : (Xe(e, t, n, o - 1), Xe(e, t, a, r));
|
|
2282
2410
|
}
|
|
2283
2411
|
}
|
|
2284
|
-
function
|
|
2412
|
+
function Ze(e, t, n) {
|
|
2285
2413
|
let r = e[t];
|
|
2286
2414
|
e[t] = e[n], e[n] = r;
|
|
2287
2415
|
}
|
|
2288
|
-
function
|
|
2416
|
+
function Qe(e) {
|
|
2289
2417
|
return e[0];
|
|
2290
2418
|
}
|
|
2291
|
-
function
|
|
2419
|
+
function $e(e) {
|
|
2292
2420
|
return e[1];
|
|
2293
2421
|
}
|
|
2294
2422
|
//#endregion
|
|
2295
2423
|
//#region node_modules/d3-delaunay/src/path.js
|
|
2296
|
-
var
|
|
2424
|
+
var et = 1e-6, tt = class {
|
|
2297
2425
|
constructor() {
|
|
2298
2426
|
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
|
|
2299
2427
|
}
|
|
@@ -2310,7 +2438,7 @@ var We = 1e-6, Ge = class {
|
|
|
2310
2438
|
e = +e, t = +t, n = +n;
|
|
2311
2439
|
let r = e + n, i = t;
|
|
2312
2440
|
if (n < 0) throw Error("negative radius");
|
|
2313
|
-
this._x1 === null ? this._ += `M${r},${i}` : (Math.abs(this._x1 - r) >
|
|
2441
|
+
this._x1 === null ? this._ += `M${r},${i}` : (Math.abs(this._x1 - r) > et || Math.abs(this._y1 - i) > et) && (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
2442
|
}
|
|
2315
2443
|
rect(e, t, n, r) {
|
|
2316
2444
|
this._ += `M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${+n}v${+r}h${-n}Z`;
|
|
@@ -2318,7 +2446,7 @@ var We = 1e-6, Ge = class {
|
|
|
2318
2446
|
value() {
|
|
2319
2447
|
return this._ || null;
|
|
2320
2448
|
}
|
|
2321
|
-
},
|
|
2449
|
+
}, nt = class {
|
|
2322
2450
|
constructor() {
|
|
2323
2451
|
this._ = [];
|
|
2324
2452
|
}
|
|
@@ -2334,7 +2462,7 @@ var We = 1e-6, Ge = class {
|
|
|
2334
2462
|
value() {
|
|
2335
2463
|
return this._.length ? this._ : null;
|
|
2336
2464
|
}
|
|
2337
|
-
},
|
|
2465
|
+
}, rt = class {
|
|
2338
2466
|
constructor(e, [t, n, r, i] = [
|
|
2339
2467
|
0,
|
|
2340
2468
|
0,
|
|
@@ -2370,7 +2498,7 @@ var We = 1e-6, Ge = class {
|
|
|
2370
2498
|
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
2499
|
}
|
|
2372
2500
|
render(e) {
|
|
2373
|
-
let t = e == null ? e = new
|
|
2501
|
+
let t = e == null ? e = new tt() : void 0, { delaunay: { halfedges: n, inedges: r, hull: i }, circumcenters: a, vectors: o } = this;
|
|
2374
2502
|
if (i.length <= 1) return null;
|
|
2375
2503
|
for (let t = 0, r = n.length; t < r; ++t) {
|
|
2376
2504
|
let r = n[t];
|
|
@@ -2387,11 +2515,11 @@ var We = 1e-6, Ge = class {
|
|
|
2387
2515
|
return t && t.value();
|
|
2388
2516
|
}
|
|
2389
2517
|
renderBounds(e) {
|
|
2390
|
-
let t = e == null ? e = new
|
|
2518
|
+
let t = e == null ? e = new tt() : void 0;
|
|
2391
2519
|
return e.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), t && t.value();
|
|
2392
2520
|
}
|
|
2393
2521
|
renderCell(e, t) {
|
|
2394
|
-
let n = t == null ? t = new
|
|
2522
|
+
let n = t == null ? t = new tt() : void 0, r = this._clip(e);
|
|
2395
2523
|
if (r === null || !r.length) return;
|
|
2396
2524
|
t.moveTo(r[0], r[1]);
|
|
2397
2525
|
let i = r.length;
|
|
@@ -2407,7 +2535,7 @@ var We = 1e-6, Ge = class {
|
|
|
2407
2535
|
}
|
|
2408
2536
|
}
|
|
2409
2537
|
cellPolygon(e) {
|
|
2410
|
-
let t = new
|
|
2538
|
+
let t = new nt();
|
|
2411
2539
|
return this.renderCell(e, t), t.value();
|
|
2412
2540
|
}
|
|
2413
2541
|
_renderSegment(e, t, n, r, i) {
|
|
@@ -2591,14 +2719,14 @@ var We = 1e-6, Ge = class {
|
|
|
2591
2719
|
}
|
|
2592
2720
|
return e;
|
|
2593
2721
|
}
|
|
2594
|
-
},
|
|
2595
|
-
function
|
|
2722
|
+
}, it = 2 * Math.PI, at = Math.pow;
|
|
2723
|
+
function ot(e) {
|
|
2596
2724
|
return e[0];
|
|
2597
2725
|
}
|
|
2598
|
-
function
|
|
2726
|
+
function st(e) {
|
|
2599
2727
|
return e[1];
|
|
2600
2728
|
}
|
|
2601
|
-
function
|
|
2729
|
+
function ct(e) {
|
|
2602
2730
|
let { triangles: t, coords: n } = e;
|
|
2603
2731
|
for (let e = 0; e < t.length; e += 3) {
|
|
2604
2732
|
let r = 2 * t[e], i = 2 * t[e + 1], a = 2 * t[e + 2];
|
|
@@ -2606,22 +2734,22 @@ function Qe(e) {
|
|
|
2606
2734
|
}
|
|
2607
2735
|
return !0;
|
|
2608
2736
|
}
|
|
2609
|
-
function
|
|
2737
|
+
function lt(e, t, n) {
|
|
2610
2738
|
return [e + Math.sin(e + t) * n, t + Math.cos(e - t) * n];
|
|
2611
2739
|
}
|
|
2612
|
-
var
|
|
2613
|
-
static from(t, n =
|
|
2614
|
-
return new e("length" in t ?
|
|
2740
|
+
var ut = class e {
|
|
2741
|
+
static from(t, n = ot, r = st, i) {
|
|
2742
|
+
return new e("length" in t ? dt(t, n, r, i) : Float64Array.from(ft(t, n, r, i)));
|
|
2615
2743
|
}
|
|
2616
2744
|
constructor(e) {
|
|
2617
|
-
this._delaunator = new
|
|
2745
|
+
this._delaunator = new We(e), this.inedges = new Int32Array(e.length / 2), this._hullIndex = new Int32Array(e.length / 2), this.points = this._delaunator.coords, this._init();
|
|
2618
2746
|
}
|
|
2619
2747
|
update() {
|
|
2620
2748
|
return this._delaunator.update(), this._init(), this;
|
|
2621
2749
|
}
|
|
2622
2750
|
_init() {
|
|
2623
2751
|
let e = this._delaunator, t = this.points;
|
|
2624
|
-
if (e.hull && e.hull.length > 2 &&
|
|
2752
|
+
if (e.hull && e.hull.length > 2 && ct(e)) {
|
|
2625
2753
|
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
2754
|
let e = this.collinear[0], n = this.collinear[this.collinear.length - 1], r = [
|
|
2627
2755
|
t[2 * e],
|
|
@@ -2630,10 +2758,10 @@ var et = class e {
|
|
|
2630
2758
|
t[2 * n + 1]
|
|
2631
2759
|
], i = 1e-8 * Math.hypot(r[3] - r[1], r[2] - r[0]);
|
|
2632
2760
|
for (let e = 0, n = t.length / 2; e < n; ++e) {
|
|
2633
|
-
let n =
|
|
2761
|
+
let n = lt(t[2 * e], t[2 * e + 1], i);
|
|
2634
2762
|
t[2 * e] = n[0], t[2 * e + 1] = n[1];
|
|
2635
2763
|
}
|
|
2636
|
-
this._delaunator = new
|
|
2764
|
+
this._delaunator = new We(t);
|
|
2637
2765
|
} else delete this.collinear;
|
|
2638
2766
|
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
2767
|
for (let e = 0, t = n.length; e < t; ++e) {
|
|
@@ -2644,7 +2772,7 @@ var et = class e {
|
|
|
2644
2772
|
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
2773
|
}
|
|
2646
2774
|
voronoi(e) {
|
|
2647
|
-
return new
|
|
2775
|
+
return new rt(this, e);
|
|
2648
2776
|
}
|
|
2649
2777
|
*neighbors(e) {
|
|
2650
2778
|
let { inedges: t, hull: n, _hullIndex: r, halfedges: i, triangles: a, collinear: o } = this;
|
|
@@ -2674,19 +2802,19 @@ var et = class e {
|
|
|
2674
2802
|
_step(e, t, n) {
|
|
2675
2803
|
let { inedges: r, hull: i, _hullIndex: a, halfedges: o, triangles: s, points: c } = this;
|
|
2676
2804
|
if (r[e] === -1 || !c.length) return (e + 1) % (c.length >> 1);
|
|
2677
|
-
let l = e, u =
|
|
2805
|
+
let l = e, u = at(t - c[e * 2], 2) + at(n - c[e * 2 + 1], 2), d = r[e], f = d;
|
|
2678
2806
|
do {
|
|
2679
|
-
let r = s[f], d =
|
|
2807
|
+
let r = s[f], d = at(t - c[r * 2], 2) + at(n - c[r * 2 + 1], 2);
|
|
2680
2808
|
if (d < u && (u = d, l = r), f = f % 3 == 2 ? f - 2 : f + 1, s[f] !== e) break;
|
|
2681
2809
|
if (f = o[f], f === -1) {
|
|
2682
|
-
if (f = i[(a[e] + 1) % i.length], f !== r &&
|
|
2810
|
+
if (f = i[(a[e] + 1) % i.length], f !== r && at(t - c[f * 2], 2) + at(n - c[f * 2 + 1], 2) < u) return f;
|
|
2683
2811
|
break;
|
|
2684
2812
|
}
|
|
2685
2813
|
} while (f !== d);
|
|
2686
2814
|
return l;
|
|
2687
2815
|
}
|
|
2688
2816
|
render(e) {
|
|
2689
|
-
let t = e == null ? e = new
|
|
2817
|
+
let t = e == null ? e = new tt() : void 0, { points: n, halfedges: r, triangles: i } = this;
|
|
2690
2818
|
for (let t = 0, a = r.length; t < a; ++t) {
|
|
2691
2819
|
let a = r[t];
|
|
2692
2820
|
if (a < t) continue;
|
|
@@ -2697,15 +2825,15 @@ var et = class e {
|
|
|
2697
2825
|
}
|
|
2698
2826
|
renderPoints(e, t) {
|
|
2699
2827
|
t === void 0 && (!e || typeof e.moveTo != "function") && (t = e, e = null), t = t == null ? 2 : +t;
|
|
2700
|
-
let n = e == null ? e = new
|
|
2828
|
+
let n = e == null ? e = new tt() : void 0, { points: r } = this;
|
|
2701
2829
|
for (let n = 0, i = r.length; n < i; n += 2) {
|
|
2702
2830
|
let i = r[n], a = r[n + 1];
|
|
2703
|
-
e.moveTo(i + t, a), e.arc(i, a, t, 0,
|
|
2831
|
+
e.moveTo(i + t, a), e.arc(i, a, t, 0, it);
|
|
2704
2832
|
}
|
|
2705
2833
|
return n && n.value();
|
|
2706
2834
|
}
|
|
2707
2835
|
renderHull(e) {
|
|
2708
|
-
let t = e == null ? e = new
|
|
2836
|
+
let t = e == null ? e = new tt() : void 0, { hull: n, points: r } = this, i = n[0] * 2, a = n.length;
|
|
2709
2837
|
e.moveTo(r[i], r[i + 1]);
|
|
2710
2838
|
for (let t = 1; t < a; ++t) {
|
|
2711
2839
|
let i = 2 * n[t];
|
|
@@ -2714,11 +2842,11 @@ var et = class e {
|
|
|
2714
2842
|
return e.closePath(), t && t.value();
|
|
2715
2843
|
}
|
|
2716
2844
|
hullPolygon() {
|
|
2717
|
-
let e = new
|
|
2845
|
+
let e = new nt();
|
|
2718
2846
|
return this.renderHull(e), e.value();
|
|
2719
2847
|
}
|
|
2720
2848
|
renderTriangle(e, t) {
|
|
2721
|
-
let n = t == null ? t = new
|
|
2849
|
+
let n = t == null ? t = new tt() : void 0, { points: r, triangles: i } = this, a = i[e *= 3] * 2, o = i[e + 1] * 2, s = i[e + 2] * 2;
|
|
2722
2850
|
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
2851
|
}
|
|
2724
2852
|
*trianglePolygons() {
|
|
@@ -2726,11 +2854,11 @@ var et = class e {
|
|
|
2726
2854
|
for (let t = 0, n = e.length / 3; t < n; ++t) yield this.trianglePolygon(t);
|
|
2727
2855
|
}
|
|
2728
2856
|
trianglePolygon(e) {
|
|
2729
|
-
let t = new
|
|
2857
|
+
let t = new nt();
|
|
2730
2858
|
return this.renderTriangle(e, t), t.value();
|
|
2731
2859
|
}
|
|
2732
2860
|
};
|
|
2733
|
-
function
|
|
2861
|
+
function dt(e, t, n, r) {
|
|
2734
2862
|
let i = e.length, a = new Float64Array(i * 2);
|
|
2735
2863
|
for (let o = 0; o < i; ++o) {
|
|
2736
2864
|
let i = e[o];
|
|
@@ -2738,20 +2866,20 @@ function tt(e, t, n, r) {
|
|
|
2738
2866
|
}
|
|
2739
2867
|
return a;
|
|
2740
2868
|
}
|
|
2741
|
-
function*
|
|
2869
|
+
function* ft(e, t, n, r) {
|
|
2742
2870
|
let i = 0;
|
|
2743
2871
|
for (let a of e) yield t.call(r, a, i, e), yield n.call(r, a, i, e), ++i;
|
|
2744
2872
|
}
|
|
2745
2873
|
//#endregion
|
|
2746
2874
|
//#region src/utils/clusert.mjs
|
|
2747
|
-
function
|
|
2875
|
+
function pt(e, t, n, r) {
|
|
2748
2876
|
return 1 + (e[t][0] === 0 || e[n][0] === 0 || e[r][0] === 0 ? 1 : 0);
|
|
2749
2877
|
}
|
|
2750
|
-
function
|
|
2878
|
+
function mt(e, t, n, r, i, a) {
|
|
2751
2879
|
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
2880
|
return l === 0 ? Infinity : o * s * c / (4 * l);
|
|
2753
2881
|
}
|
|
2754
|
-
function
|
|
2882
|
+
function ht(e) {
|
|
2755
2883
|
if (!e || e.length < 3) return [];
|
|
2756
2884
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2757
2885
|
for (let r of e) {
|
|
@@ -2759,12 +2887,12 @@ function at(e) {
|
|
|
2759
2887
|
t.has(e) || (t.add(e), n.push(r));
|
|
2760
2888
|
}
|
|
2761
2889
|
if (n.length < 3) return [];
|
|
2762
|
-
let { triangles: r } = new
|
|
2890
|
+
let { triangles: r } = new ut(Float64Array.from(n.flat()));
|
|
2763
2891
|
if (!r.length) return [];
|
|
2764
2892
|
let i = /* @__PURE__ */ new Map(), a = (e, t) => e < t ? `${e}_${t}` : `${t}_${e}`;
|
|
2765
2893
|
for (let e = 0; e < r.length; e += 3) {
|
|
2766
2894
|
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 (
|
|
2895
|
+
if (mt(c, l, u, d, f, p) <= 1 / pt(n, t, o, s)) for (let [e, n] of [
|
|
2768
2896
|
[t, o],
|
|
2769
2897
|
[o, s],
|
|
2770
2898
|
[s, t]
|
|
@@ -2789,7 +2917,7 @@ function at(e) {
|
|
|
2789
2917
|
}
|
|
2790
2918
|
//#endregion
|
|
2791
2919
|
//#region node_modules/three/examples/jsm/math/OBB.js
|
|
2792
|
-
var
|
|
2920
|
+
var q = {
|
|
2793
2921
|
c: null,
|
|
2794
2922
|
u: [
|
|
2795
2923
|
new d(),
|
|
@@ -2797,7 +2925,7 @@ var K = {
|
|
|
2797
2925
|
new d()
|
|
2798
2926
|
],
|
|
2799
2927
|
e: []
|
|
2800
|
-
},
|
|
2928
|
+
}, J = {
|
|
2801
2929
|
c: null,
|
|
2802
2930
|
u: [
|
|
2803
2931
|
new d(),
|
|
@@ -2805,15 +2933,15 @@ var K = {
|
|
|
2805
2933
|
new d()
|
|
2806
2934
|
],
|
|
2807
2935
|
e: []
|
|
2808
|
-
},
|
|
2936
|
+
}, Y = [
|
|
2809
2937
|
[],
|
|
2810
2938
|
[],
|
|
2811
2939
|
[]
|
|
2812
|
-
],
|
|
2940
|
+
], X = [
|
|
2813
2941
|
[],
|
|
2814
2942
|
[],
|
|
2815
2943
|
[]
|
|
2816
|
-
],
|
|
2944
|
+
], Z = [], gt = new d(), _t = new d(), vt = new d(), Q = new d(), yt = new d(), bt = new d(), xt = new a(), St = new t(), Ct = new o(), wt = new o(), Tt = new l(), Et = class {
|
|
2817
2945
|
constructor(e = new d(), t = new d(), n = new a()) {
|
|
2818
2946
|
this.center = e, this.halfSize = t, this.rotation = n;
|
|
2819
2947
|
}
|
|
@@ -2831,43 +2959,43 @@ var K = {
|
|
|
2831
2959
|
}
|
|
2832
2960
|
clampPoint(e, t) {
|
|
2833
2961
|
let n = this.halfSize;
|
|
2834
|
-
|
|
2835
|
-
let r = i.clamp(
|
|
2836
|
-
t.add(
|
|
2837
|
-
let a = i.clamp(
|
|
2838
|
-
t.add(
|
|
2839
|
-
let o = i.clamp(
|
|
2840
|
-
return t.add(
|
|
2962
|
+
Q.subVectors(e, this.center), this.rotation.extractBasis(gt, _t, vt), t.copy(this.center);
|
|
2963
|
+
let r = i.clamp(Q.dot(gt), -n.x, n.x);
|
|
2964
|
+
t.add(gt.multiplyScalar(r));
|
|
2965
|
+
let a = i.clamp(Q.dot(_t), -n.y, n.y);
|
|
2966
|
+
t.add(_t.multiplyScalar(a));
|
|
2967
|
+
let o = i.clamp(Q.dot(vt), -n.z, n.z);
|
|
2968
|
+
return t.add(vt.multiplyScalar(o)), t;
|
|
2841
2969
|
}
|
|
2842
2970
|
containsPoint(e) {
|
|
2843
|
-
return
|
|
2971
|
+
return Q.subVectors(e, this.center), this.rotation.extractBasis(gt, _t, vt), Math.abs(Q.dot(gt)) <= this.halfSize.x && Math.abs(Q.dot(_t)) <= this.halfSize.y && Math.abs(Q.dot(vt)) <= this.halfSize.z;
|
|
2844
2972
|
}
|
|
2845
2973
|
intersectsBox3(e) {
|
|
2846
|
-
return this.intersectsOBB(
|
|
2974
|
+
return this.intersectsOBB(Dt.fromBox3(e));
|
|
2847
2975
|
}
|
|
2848
2976
|
intersectsSphere(e) {
|
|
2849
|
-
return this.clampPoint(e.center,
|
|
2977
|
+
return this.clampPoint(e.center, bt), bt.distanceToSquared(e.center) <= e.radius * e.radius;
|
|
2850
2978
|
}
|
|
2851
2979
|
intersectsOBB(e, t = 2 ** -52) {
|
|
2852
|
-
|
|
2853
|
-
for (let e = 0; e < 3; e++) for (let t = 0; t < 3; t++)
|
|
2854
|
-
|
|
2855
|
-
for (let e = 0; e < 3; e++) for (let n = 0; n < 3; n++)
|
|
2980
|
+
q.c = this.center, q.e[0] = this.halfSize.x, q.e[1] = this.halfSize.y, q.e[2] = this.halfSize.z, this.rotation.extractBasis(q.u[0], q.u[1], q.u[2]), J.c = e.center, J.e[0] = e.halfSize.x, J.e[1] = e.halfSize.y, J.e[2] = e.halfSize.z, e.rotation.extractBasis(J.u[0], J.u[1], J.u[2]);
|
|
2981
|
+
for (let e = 0; e < 3; e++) for (let t = 0; t < 3; t++) Y[e][t] = q.u[e].dot(J.u[t]);
|
|
2982
|
+
Q.subVectors(J.c, q.c), Z[0] = Q.dot(q.u[0]), Z[1] = Q.dot(q.u[1]), Z[2] = Q.dot(q.u[2]);
|
|
2983
|
+
for (let e = 0; e < 3; e++) for (let n = 0; n < 3; n++) X[e][n] = Math.abs(Y[e][n]) + t;
|
|
2856
2984
|
let n, r;
|
|
2857
|
-
for (let e = 0; e < 3; e++) if (n =
|
|
2858
|
-
for (let e = 0; e < 3; e++) if (n =
|
|
2859
|
-
return n =
|
|
2985
|
+
for (let e = 0; e < 3; e++) if (n = q.e[e], r = J.e[0] * X[e][0] + J.e[1] * X[e][1] + J.e[2] * X[e][2], Math.abs(Z[e]) > n + r) return !1;
|
|
2986
|
+
for (let e = 0; e < 3; e++) if (n = q.e[0] * X[0][e] + q.e[1] * X[1][e] + q.e[2] * X[2][e], r = J.e[e], Math.abs(Z[0] * Y[0][e] + Z[1] * Y[1][e] + Z[2] * Y[2][e]) > n + r) return !1;
|
|
2987
|
+
return n = q.e[1] * X[2][0] + q.e[2] * X[1][0], r = J.e[1] * X[0][2] + J.e[2] * X[0][1], !(Math.abs(Z[2] * Y[1][0] - Z[1] * Y[2][0]) > n + r || (n = q.e[1] * X[2][1] + q.e[2] * X[1][1], r = J.e[0] * X[0][2] + J.e[2] * X[0][0], Math.abs(Z[2] * Y[1][1] - Z[1] * Y[2][1]) > n + r) || (n = q.e[1] * X[2][2] + q.e[2] * X[1][2], r = J.e[0] * X[0][1] + J.e[1] * X[0][0], Math.abs(Z[2] * Y[1][2] - Z[1] * Y[2][2]) > n + r) || (n = q.e[0] * X[2][0] + q.e[2] * X[0][0], r = J.e[1] * X[1][2] + J.e[2] * X[1][1], Math.abs(Z[0] * Y[2][0] - Z[2] * Y[0][0]) > n + r) || (n = q.e[0] * X[2][1] + q.e[2] * X[0][1], r = J.e[0] * X[1][2] + J.e[2] * X[1][0], Math.abs(Z[0] * Y[2][1] - Z[2] * Y[0][1]) > n + r) || (n = q.e[0] * X[2][2] + q.e[2] * X[0][2], r = J.e[0] * X[1][1] + J.e[1] * X[1][0], Math.abs(Z[0] * Y[2][2] - Z[2] * Y[0][2]) > n + r) || (n = q.e[0] * X[1][0] + q.e[1] * X[0][0], r = J.e[1] * X[2][2] + J.e[2] * X[2][1], Math.abs(Z[1] * Y[0][0] - Z[0] * Y[1][0]) > n + r) || (n = q.e[0] * X[1][1] + q.e[1] * X[0][1], r = J.e[0] * X[2][2] + J.e[2] * X[2][0], Math.abs(Z[1] * Y[0][1] - Z[0] * Y[1][1]) > n + r) || (n = q.e[0] * X[1][2] + q.e[1] * X[0][2], r = J.e[0] * X[2][1] + J.e[1] * X[2][0], Math.abs(Z[1] * Y[0][2] - Z[0] * Y[1][2]) > n + r));
|
|
2860
2988
|
}
|
|
2861
2989
|
intersectsPlane(e) {
|
|
2862
|
-
this.rotation.extractBasis(
|
|
2863
|
-
let t = this.halfSize.x * Math.abs(e.normal.dot(
|
|
2990
|
+
this.rotation.extractBasis(gt, _t, vt);
|
|
2991
|
+
let t = this.halfSize.x * Math.abs(e.normal.dot(gt)) + this.halfSize.y * Math.abs(e.normal.dot(_t)) + this.halfSize.z * Math.abs(e.normal.dot(vt)), n = e.normal.dot(this.center) - e.constant;
|
|
2864
2992
|
return Math.abs(n) <= t;
|
|
2865
2993
|
}
|
|
2866
2994
|
intersectRay(e, t) {
|
|
2867
|
-
return this.getSize(
|
|
2995
|
+
return this.getSize(yt), St.setFromCenterAndSize(Q.set(0, 0, 0), yt), 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
2996
|
}
|
|
2869
2997
|
intersectsRay(e) {
|
|
2870
|
-
return this.intersectRay(e,
|
|
2998
|
+
return this.intersectRay(e, Q) !== null;
|
|
2871
2999
|
}
|
|
2872
3000
|
fromBox3(e) {
|
|
2873
3001
|
return e.getCenter(this.center), e.getSize(this.halfSize).multiplyScalar(.5), this.rotation.identity(), this;
|
|
@@ -2876,12 +3004,12 @@ var K = {
|
|
|
2876
3004
|
return e.center.equals(this.center) && e.halfSize.equals(this.halfSize) && e.rotation.equals(this.rotation);
|
|
2877
3005
|
}
|
|
2878
3006
|
applyMatrix4(e) {
|
|
2879
|
-
let t = e.elements, n =
|
|
2880
|
-
e.determinant() < 0 && (n = -n),
|
|
3007
|
+
let t = e.elements, n = Q.set(t[0], t[1], t[2]).length(), r = Q.set(t[4], t[5], t[6]).length(), i = Q.set(t[8], t[9], t[10]).length();
|
|
3008
|
+
e.determinant() < 0 && (n = -n), xt.setFromMatrix4(e);
|
|
2881
3009
|
let a = 1 / n, o = 1 / r, s = 1 / i;
|
|
2882
|
-
return
|
|
3010
|
+
return xt.elements[0] *= a, xt.elements[1] *= a, xt.elements[2] *= a, xt.elements[3] *= o, xt.elements[4] *= o, xt.elements[5] *= o, xt.elements[6] *= s, xt.elements[7] *= s, xt.elements[8] *= s, this.rotation.multiply(xt), this.halfSize.x *= n, this.halfSize.y *= r, this.halfSize.z *= i, Q.setFromMatrixPosition(e), this.center.add(Q), this;
|
|
2883
3011
|
}
|
|
2884
|
-
},
|
|
3012
|
+
}, Dt = new Et(), $ = 6371008.8, Ot = {
|
|
2885
3013
|
centimeters: $ * 100,
|
|
2886
3014
|
centimetres: $ * 100,
|
|
2887
3015
|
degrees: 360 / (2 * Math.PI),
|
|
@@ -2898,60 +3026,60 @@ var K = {
|
|
|
2898
3026
|
radians: 1,
|
|
2899
3027
|
yards: $ * 1.0936
|
|
2900
3028
|
};
|
|
2901
|
-
function
|
|
3029
|
+
function kt(e, t, n = {}) {
|
|
2902
3030
|
let r = { type: "Feature" };
|
|
2903
3031
|
return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
|
|
2904
3032
|
}
|
|
2905
|
-
function
|
|
3033
|
+
function At(e, t, n = {}) {
|
|
2906
3034
|
if (!e) throw Error("coordinates is required");
|
|
2907
3035
|
if (!Array.isArray(e)) throw Error("coordinates must be an Array");
|
|
2908
3036
|
if (e.length < 2) throw Error("coordinates must be at least 2 numbers long");
|
|
2909
|
-
if (!
|
|
2910
|
-
return
|
|
3037
|
+
if (!Lt(e[0]) || !Lt(e[1])) throw Error("coordinates must contain numbers");
|
|
3038
|
+
return kt({
|
|
2911
3039
|
type: "Point",
|
|
2912
3040
|
coordinates: e
|
|
2913
3041
|
}, t, n);
|
|
2914
3042
|
}
|
|
2915
|
-
function
|
|
3043
|
+
function jt(e, t, n = {}) {
|
|
2916
3044
|
for (let t of e) {
|
|
2917
3045
|
if (t.length < 4) throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");
|
|
2918
3046
|
if (t[t.length - 1].length !== t[0].length) throw Error("First and last Position are not equivalent.");
|
|
2919
3047
|
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
3048
|
}
|
|
2921
|
-
return
|
|
3049
|
+
return kt({
|
|
2922
3050
|
type: "Polygon",
|
|
2923
3051
|
coordinates: e
|
|
2924
3052
|
}, t, n);
|
|
2925
3053
|
}
|
|
2926
|
-
function
|
|
2927
|
-
let n =
|
|
3054
|
+
function Mt(e, t = "kilometers") {
|
|
3055
|
+
let n = Ot[t];
|
|
2928
3056
|
if (!n) throw Error(t + " units is invalid");
|
|
2929
3057
|
return e * n;
|
|
2930
3058
|
}
|
|
2931
|
-
function
|
|
2932
|
-
let n =
|
|
3059
|
+
function Nt(e, t = "kilometers") {
|
|
3060
|
+
let n = Ot[t];
|
|
2933
3061
|
if (!n) throw Error(t + " units is invalid");
|
|
2934
3062
|
return e / n;
|
|
2935
3063
|
}
|
|
2936
|
-
function
|
|
3064
|
+
function Pt(e) {
|
|
2937
3065
|
return e % (2 * Math.PI) * 180 / Math.PI;
|
|
2938
3066
|
}
|
|
2939
|
-
function
|
|
3067
|
+
function Ft(e) {
|
|
2940
3068
|
return e % 360 * Math.PI / 180;
|
|
2941
3069
|
}
|
|
2942
|
-
function
|
|
3070
|
+
function It(e, t = "kilometers", n = "kilometers") {
|
|
2943
3071
|
if (!(e >= 0)) throw Error("length must be a positive number");
|
|
2944
|
-
return
|
|
3072
|
+
return Mt(Nt(e, t), n);
|
|
2945
3073
|
}
|
|
2946
|
-
function
|
|
3074
|
+
function Lt(e) {
|
|
2947
3075
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
2948
3076
|
}
|
|
2949
|
-
function
|
|
3077
|
+
function Rt(e) {
|
|
2950
3078
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2951
3079
|
}
|
|
2952
3080
|
//#endregion
|
|
2953
3081
|
//#region node_modules/@turf/meta/dist/esm/index.js
|
|
2954
|
-
function
|
|
3082
|
+
function zt(e, t, n) {
|
|
2955
3083
|
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
3084
|
l = m ? e.features[_].geometry : h ? e.geometry : e, f = l ? l.type === "GeometryCollection" : !1, s = f ? l.geometries.length : 1;
|
|
2957
3085
|
for (var v = 0; v < s; v++) {
|
|
@@ -2997,7 +3125,7 @@ function Ot(e, t, n) {
|
|
|
2997
3125
|
}
|
|
2998
3126
|
break;
|
|
2999
3127
|
case "GeometryCollection":
|
|
3000
|
-
for (r = 0; r < o.geometries.length; r++) if (
|
|
3128
|
+
for (r = 0; r < o.geometries.length; r++) if (zt(o.geometries[r], t, n) === !1) return !1;
|
|
3001
3129
|
break;
|
|
3002
3130
|
default: throw Error("Unknown Geometry Type");
|
|
3003
3131
|
}
|
|
@@ -3005,13 +3133,13 @@ function Ot(e, t, n) {
|
|
|
3005
3133
|
}
|
|
3006
3134
|
}
|
|
3007
3135
|
}
|
|
3008
|
-
function
|
|
3136
|
+
function Bt(e) {
|
|
3009
3137
|
var t = [];
|
|
3010
|
-
return
|
|
3138
|
+
return zt(e, function(e) {
|
|
3011
3139
|
t.push(e);
|
|
3012
3140
|
}), t;
|
|
3013
3141
|
}
|
|
3014
|
-
function
|
|
3142
|
+
function Vt(e, t) {
|
|
3015
3143
|
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
3144
|
for (n = 0; n < h; n++) {
|
|
3017
3145
|
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 +3165,15 @@ function At(e, t) {
|
|
|
3037
3165
|
f++;
|
|
3038
3166
|
}
|
|
3039
3167
|
}
|
|
3040
|
-
function
|
|
3168
|
+
function Ht(e, t, n) {
|
|
3041
3169
|
var r = n;
|
|
3042
|
-
return
|
|
3170
|
+
return Vt(e, function(e, i, a, o, s) {
|
|
3043
3171
|
r = i === 0 && n === void 0 ? e : t(r, e, i, a, o, s);
|
|
3044
3172
|
}), r;
|
|
3045
3173
|
}
|
|
3046
3174
|
//#endregion
|
|
3047
3175
|
//#region node_modules/rbush/rbush.min.js
|
|
3048
|
-
var
|
|
3176
|
+
var Ut = /* @__PURE__ */ y(((e, t) => {
|
|
3049
3177
|
(function(n, r) {
|
|
3050
3178
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n ||= self).RBush = r();
|
|
3051
3179
|
})(e, function() {
|
|
@@ -3262,13 +3390,13 @@ var Mt = /* @__PURE__ */ y(((e, t) => {
|
|
|
3262
3390
|
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
3391
|
}, r;
|
|
3264
3392
|
});
|
|
3265
|
-
})),
|
|
3266
|
-
function
|
|
3393
|
+
})), Wt = /* @__PURE__ */ b({ default: () => Kt });
|
|
3394
|
+
function Gt(e, t) {
|
|
3267
3395
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
3268
3396
|
}
|
|
3269
|
-
var
|
|
3270
|
-
|
|
3271
|
-
constructor(e = [], t =
|
|
3397
|
+
var Kt, qt = v((() => {
|
|
3398
|
+
Kt = class {
|
|
3399
|
+
constructor(e = [], t = Gt) {
|
|
3272
3400
|
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
3401
|
}
|
|
3274
3402
|
push(e) {
|
|
@@ -3301,7 +3429,7 @@ var Ft, It = v((() => {
|
|
|
3301
3429
|
t[e] = i;
|
|
3302
3430
|
}
|
|
3303
3431
|
};
|
|
3304
|
-
})),
|
|
3432
|
+
})), Jt = /* @__PURE__ */ y(((e, t) => {
|
|
3305
3433
|
t.exports = function(e, t, n, r) {
|
|
3306
3434
|
var i = e[0], a = e[1], o = !1;
|
|
3307
3435
|
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
@@ -3311,7 +3439,7 @@ var Ft, It = v((() => {
|
|
|
3311
3439
|
}
|
|
3312
3440
|
return o;
|
|
3313
3441
|
};
|
|
3314
|
-
})),
|
|
3442
|
+
})), Yt = /* @__PURE__ */ y(((e, t) => {
|
|
3315
3443
|
t.exports = function(e, t, n, r) {
|
|
3316
3444
|
var i = e[0], a = e[1], o = !1;
|
|
3317
3445
|
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
@@ -3321,12 +3449,12 @@ var Ft, It = v((() => {
|
|
|
3321
3449
|
}
|
|
3322
3450
|
return o;
|
|
3323
3451
|
};
|
|
3324
|
-
})),
|
|
3325
|
-
var n =
|
|
3452
|
+
})), Xt = /* @__PURE__ */ y(((e, t) => {
|
|
3453
|
+
var n = Jt(), r = Yt();
|
|
3326
3454
|
t.exports = function(e, t, i, a) {
|
|
3327
3455
|
return t.length > 0 && Array.isArray(t[0]) ? r(e, t, i, a) : n(e, t, i, a);
|
|
3328
3456
|
}, t.exports.nested = r, t.exports.flat = n;
|
|
3329
|
-
})),
|
|
3457
|
+
})), Zt = /* @__PURE__ */ y(((e, t) => {
|
|
3330
3458
|
(function(n, r) {
|
|
3331
3459
|
typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n ||= self).predicates = {});
|
|
3332
3460
|
})(e, function(e) {
|
|
@@ -3360,15 +3488,15 @@ var Ft, It = v((() => {
|
|
|
3360
3488
|
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
3489
|
let R = n(4, i, 4, c, a);
|
|
3362
3490
|
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(
|
|
3491
|
+
let z = n(R, a, 4, c, o);
|
|
3492
|
+
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
3493
|
}(e, r, l, u, d, f, g);
|
|
3366
3494
|
}, e.orient2dfast = function(e, t, n, r, i, a) {
|
|
3367
3495
|
return (t - a) * (n - i) - (e - i) * (r - a);
|
|
3368
3496
|
}, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3369
3497
|
});
|
|
3370
|
-
})),
|
|
3371
|
-
var n =
|
|
3498
|
+
})), Qt = /* @__PURE__ */ S((/* @__PURE__ */ y(((e, t) => {
|
|
3499
|
+
var n = Ut(), r = (qt(), C(Wt)), i = Xt(), a = Zt().orient2d;
|
|
3372
3500
|
r.default && (r = r.default), t.exports = o, t.exports.default = o;
|
|
3373
3501
|
function o(e, t, r) {
|
|
3374
3502
|
t = Math.max(0, t === void 0 ? 2 : t), r ||= 0;
|
|
@@ -3518,26 +3646,26 @@ var Ft, It = v((() => {
|
|
|
3518
3646
|
return r.pop(), t.pop(), t.concat(r);
|
|
3519
3647
|
}
|
|
3520
3648
|
})))(), 1);
|
|
3521
|
-
function
|
|
3649
|
+
function $t(e, t = {}) {
|
|
3522
3650
|
t.concavity = t.concavity || Infinity;
|
|
3523
3651
|
let n = [];
|
|
3524
|
-
if (
|
|
3652
|
+
if (zt(e, (e) => {
|
|
3525
3653
|
n.push([e[0], e[1]]);
|
|
3526
3654
|
}), !n.length) return null;
|
|
3527
|
-
let r = (0,
|
|
3528
|
-
return r.length > 3 ?
|
|
3655
|
+
let r = (0, Qt.default)(n, t.concavity);
|
|
3656
|
+
return r.length > 3 ? jt([r]) : null;
|
|
3529
3657
|
}
|
|
3530
3658
|
//#endregion
|
|
3531
3659
|
//#region node_modules/@turf/centroid/dist/esm/index.js
|
|
3532
|
-
function
|
|
3660
|
+
function en(e, t = {}) {
|
|
3533
3661
|
let n = 0, r = 0, i = 0;
|
|
3534
|
-
return
|
|
3662
|
+
return zt(e, function(e) {
|
|
3535
3663
|
n += e[0], r += e[1], i++;
|
|
3536
|
-
}, !0),
|
|
3664
|
+
}, !0), At([n / i, r / i], t.properties);
|
|
3537
3665
|
}
|
|
3538
3666
|
//#endregion
|
|
3539
3667
|
//#region node_modules/@turf/invariant/dist/esm/index.js
|
|
3540
|
-
function
|
|
3668
|
+
function tn(e) {
|
|
3541
3669
|
if (!e) throw Error("coord is required");
|
|
3542
3670
|
if (!Array.isArray(e)) {
|
|
3543
3671
|
if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point") return [...e.geometry.coordinates];
|
|
@@ -3546,7 +3674,7 @@ function Wt(e) {
|
|
|
3546
3674
|
if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1])) return [...e];
|
|
3547
3675
|
throw Error("coord must be GeoJSON Point or an Array of numbers");
|
|
3548
3676
|
}
|
|
3549
|
-
function
|
|
3677
|
+
function nn(e) {
|
|
3550
3678
|
if (Array.isArray(e)) return e;
|
|
3551
3679
|
if (e.type === "Feature") {
|
|
3552
3680
|
if (e.geometry !== null) return e.geometry.coordinates;
|
|
@@ -3555,23 +3683,23 @@ function Gt(e) {
|
|
|
3555
3683
|
}
|
|
3556
3684
|
//#endregion
|
|
3557
3685
|
//#region node_modules/@turf/rhumb-bearing/dist/esm/index.js
|
|
3558
|
-
function
|
|
3686
|
+
function rn(e, t, n = {}) {
|
|
3559
3687
|
let r;
|
|
3560
|
-
return r = n.final ?
|
|
3688
|
+
return r = n.final ? an(tn(t), tn(e)) : an(tn(e), tn(t)), r > 180 ? -(360 - r) : r;
|
|
3561
3689
|
}
|
|
3562
|
-
function
|
|
3563
|
-
let n =
|
|
3690
|
+
function an(e, t) {
|
|
3691
|
+
let n = Ft(e[1]), r = Ft(t[1]), i = Ft(t[0] - e[0]);
|
|
3564
3692
|
i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
|
|
3565
3693
|
let a = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4));
|
|
3566
|
-
return (
|
|
3694
|
+
return (Pt(Math.atan2(i, a)) + 360) % 360;
|
|
3567
3695
|
}
|
|
3568
3696
|
//#endregion
|
|
3569
3697
|
//#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,
|
|
3698
|
+
function on(e, t, n = {}) {
|
|
3699
|
+
let r = tn(e), i = tn(t);
|
|
3700
|
+
return i[0] += i[0] - r[0] > 180 ? -360 : r[0] - i[0] > 180 ? 360 : 0, It(sn(r, i), "meters", n.units);
|
|
3573
3701
|
}
|
|
3574
|
-
function
|
|
3702
|
+
function sn(e, t, n) {
|
|
3575
3703
|
n = n === void 0 ? $ : Number(n);
|
|
3576
3704
|
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
3705
|
s > Math.PI && (s -= 2 * Math.PI);
|
|
@@ -3580,37 +3708,37 @@ function Yt(e, t, n) {
|
|
|
3580
3708
|
}
|
|
3581
3709
|
//#endregion
|
|
3582
3710
|
//#region node_modules/@turf/rhumb-destination/dist/esm/index.js
|
|
3583
|
-
function
|
|
3584
|
-
let i = t < 0, a =
|
|
3711
|
+
function cn(e, t, n, r = {}) {
|
|
3712
|
+
let i = t < 0, a = It(Math.abs(t), r.units, "meters");
|
|
3585
3713
|
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,
|
|
3714
|
+
let o = tn(e), s = ln(o, a, n);
|
|
3715
|
+
return s[0] += s[0] - o[0] > 180 ? -360 : o[0] - s[0] > 180 ? 360 : 0, At(s, r.properties);
|
|
3588
3716
|
}
|
|
3589
|
-
function
|
|
3717
|
+
function ln(e, t, n, r) {
|
|
3590
3718
|
r = r === void 0 ? $ : Number(r);
|
|
3591
|
-
let i = t / r, a = e[0] * Math.PI / 180, o =
|
|
3719
|
+
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
3720
|
Math.abs(l) > Math.PI / 2 && (l = l > 0 ? Math.PI - l : -Math.PI - l);
|
|
3593
3721
|
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
3722
|
return [((a + i * Math.sin(s) / d) * 180 / Math.PI + 540) % 360 - 180, l * 180 / Math.PI];
|
|
3595
3723
|
}
|
|
3596
3724
|
//#endregion
|
|
3597
3725
|
//#region node_modules/@turf/clone/dist/esm/index.js
|
|
3598
|
-
function
|
|
3726
|
+
function un(e) {
|
|
3599
3727
|
if (!e) throw Error("geojson is required");
|
|
3600
3728
|
switch (e.type) {
|
|
3601
|
-
case "Feature": return
|
|
3602
|
-
case "FeatureCollection": return
|
|
3729
|
+
case "Feature": return dn(e);
|
|
3730
|
+
case "FeatureCollection": return pn(e);
|
|
3603
3731
|
case "Point":
|
|
3604
3732
|
case "LineString":
|
|
3605
3733
|
case "Polygon":
|
|
3606
3734
|
case "MultiPoint":
|
|
3607
3735
|
case "MultiLineString":
|
|
3608
3736
|
case "MultiPolygon":
|
|
3609
|
-
case "GeometryCollection": return
|
|
3737
|
+
case "GeometryCollection": return mn(e);
|
|
3610
3738
|
default: throw Error("unknown GeoJSON type");
|
|
3611
3739
|
}
|
|
3612
3740
|
}
|
|
3613
|
-
function
|
|
3741
|
+
function dn(e) {
|
|
3614
3742
|
let t = { type: "Feature" };
|
|
3615
3743
|
return Object.keys(e).forEach((n) => {
|
|
3616
3744
|
switch (n) {
|
|
@@ -3619,16 +3747,16 @@ function $t(e) {
|
|
|
3619
3747
|
case "geometry": return;
|
|
3620
3748
|
default: t[n] = e[n];
|
|
3621
3749
|
}
|
|
3622
|
-
}), t.properties =
|
|
3750
|
+
}), t.properties = fn(e.properties), e.geometry == null ? t.geometry = null : t.geometry = mn(e.geometry), t;
|
|
3623
3751
|
}
|
|
3624
|
-
function
|
|
3752
|
+
function fn(e) {
|
|
3625
3753
|
let t = {};
|
|
3626
3754
|
return e && Object.keys(e).forEach((n) => {
|
|
3627
3755
|
let r = e[n];
|
|
3628
|
-
typeof r == "object" ? r === null ? t[n] = null : Array.isArray(r) ? t[n] = r.map((e) => e) : t[n] =
|
|
3756
|
+
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
3757
|
}), t;
|
|
3630
3758
|
}
|
|
3631
|
-
function
|
|
3759
|
+
function pn(e) {
|
|
3632
3760
|
let t = { type: "FeatureCollection" };
|
|
3633
3761
|
return Object.keys(e).forEach((n) => {
|
|
3634
3762
|
switch (n) {
|
|
@@ -3636,44 +3764,44 @@ function tn(e) {
|
|
|
3636
3764
|
case "features": return;
|
|
3637
3765
|
default: t[n] = e[n];
|
|
3638
3766
|
}
|
|
3639
|
-
}), t.features = e.features.map((e) =>
|
|
3767
|
+
}), t.features = e.features.map((e) => dn(e)), t;
|
|
3640
3768
|
}
|
|
3641
|
-
function
|
|
3769
|
+
function mn(e) {
|
|
3642
3770
|
let t = { type: e.type };
|
|
3643
|
-
return e.bbox && (t.bbox = e.bbox), e.type === "GeometryCollection" ? (t.geometries = e.geometries.map((e) =>
|
|
3771
|
+
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
3772
|
}
|
|
3645
|
-
function
|
|
3773
|
+
function hn(e) {
|
|
3646
3774
|
let t = e;
|
|
3647
|
-
return typeof t[0] == "object" ? t.map((e) =>
|
|
3775
|
+
return typeof t[0] == "object" ? t.map((e) => hn(e)) : t.slice();
|
|
3648
3776
|
}
|
|
3649
3777
|
//#endregion
|
|
3650
3778
|
//#region node_modules/@turf/transform-rotate/dist/esm/index.js
|
|
3651
|
-
function
|
|
3652
|
-
if (n ||= {}, !
|
|
3779
|
+
function gn(e, t, n) {
|
|
3780
|
+
if (n ||= {}, !Rt(n)) throw Error("options is invalid");
|
|
3653
3781
|
let r = n.pivot, i = n.mutate;
|
|
3654
3782
|
if (!e) throw Error("geojson is required");
|
|
3655
3783
|
if (t == null || isNaN(t)) throw Error("angle is required");
|
|
3656
3784
|
if (t === 0) return e;
|
|
3657
|
-
let a = r ??
|
|
3658
|
-
return (i === !1 || i === void 0) && (e =
|
|
3659
|
-
let n =
|
|
3785
|
+
let a = r ?? en(e);
|
|
3786
|
+
return (i === !1 || i === void 0) && (e = un(e)), zt(e, function(e) {
|
|
3787
|
+
let n = rn(a, e) + t, r = nn(cn(a, on(a, e), n));
|
|
3660
3788
|
e[0] = r[0], e[1] = r[1];
|
|
3661
3789
|
}), e;
|
|
3662
3790
|
}
|
|
3663
3791
|
//#endregion
|
|
3664
3792
|
//#region node_modules/@turf/bearing/dist/esm/index.js
|
|
3665
|
-
function
|
|
3666
|
-
if (n.final === !0) return
|
|
3667
|
-
let r =
|
|
3668
|
-
return
|
|
3793
|
+
function _n(e, t, n = {}) {
|
|
3794
|
+
if (n.final === !0) return vn(e, t);
|
|
3795
|
+
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);
|
|
3796
|
+
return Pt(Math.atan2(l, u));
|
|
3669
3797
|
}
|
|
3670
|
-
function
|
|
3671
|
-
let n =
|
|
3798
|
+
function vn(e, t) {
|
|
3799
|
+
let n = _n(t, e);
|
|
3672
3800
|
return n = (n + 180) % 360, n;
|
|
3673
3801
|
}
|
|
3674
3802
|
//#endregion
|
|
3675
3803
|
//#region node_modules/@turf/bbox/dist/esm/index.js
|
|
3676
|
-
function
|
|
3804
|
+
function yn(e, t = {}) {
|
|
3677
3805
|
if (e.bbox != null && !0 !== t.recompute) return e.bbox;
|
|
3678
3806
|
let n = [
|
|
3679
3807
|
Infinity,
|
|
@@ -3681,17 +3809,17 @@ function cn(e, t = {}) {
|
|
|
3681
3809
|
-Infinity,
|
|
3682
3810
|
-Infinity
|
|
3683
3811
|
];
|
|
3684
|
-
return
|
|
3812
|
+
return zt(e, (e) => {
|
|
3685
3813
|
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
3814
|
}), n;
|
|
3687
3815
|
}
|
|
3688
3816
|
//#endregion
|
|
3689
3817
|
//#region node_modules/@turf/bbox-polygon/dist/esm/index.js
|
|
3690
|
-
function
|
|
3818
|
+
function bn(e, t = {}) {
|
|
3691
3819
|
let n = Number(e[0]), r = Number(e[1]), i = Number(e[2]), a = Number(e[3]);
|
|
3692
3820
|
if (e.length === 6) throw Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
3693
3821
|
let o = [n, r];
|
|
3694
|
-
return
|
|
3822
|
+
return jt([[
|
|
3695
3823
|
o,
|
|
3696
3824
|
[i, r],
|
|
3697
3825
|
[i, a],
|
|
@@ -3704,20 +3832,20 @@ function ln(e, t = {}) {
|
|
|
3704
3832
|
}
|
|
3705
3833
|
//#endregion
|
|
3706
3834
|
//#region node_modules/@turf/envelope/dist/esm/index.js
|
|
3707
|
-
function
|
|
3708
|
-
return
|
|
3835
|
+
function xn(e) {
|
|
3836
|
+
return bn(yn(e));
|
|
3709
3837
|
}
|
|
3710
3838
|
//#endregion
|
|
3711
3839
|
//#region node_modules/@turf/area/dist/esm/index.js
|
|
3712
|
-
function
|
|
3713
|
-
return
|
|
3840
|
+
function Sn(e) {
|
|
3841
|
+
return Ht(e, (e, t) => e + Cn(t), 0);
|
|
3714
3842
|
}
|
|
3715
|
-
function
|
|
3843
|
+
function Cn(e) {
|
|
3716
3844
|
let t = 0, n;
|
|
3717
3845
|
switch (e.type) {
|
|
3718
|
-
case "Polygon": return
|
|
3846
|
+
case "Polygon": return wn(e.coordinates);
|
|
3719
3847
|
case "MultiPolygon":
|
|
3720
|
-
for (n = 0; n < e.coordinates.length; n++) t +=
|
|
3848
|
+
for (n = 0; n < e.coordinates.length; n++) t += wn(e.coordinates[n]);
|
|
3721
3849
|
return t;
|
|
3722
3850
|
case "Point":
|
|
3723
3851
|
case "MultiPoint":
|
|
@@ -3726,57 +3854,57 @@ function fn(e) {
|
|
|
3726
3854
|
}
|
|
3727
3855
|
return 0;
|
|
3728
3856
|
}
|
|
3729
|
-
function
|
|
3857
|
+
function wn(e) {
|
|
3730
3858
|
let t = 0;
|
|
3731
3859
|
if (e && e.length > 0) {
|
|
3732
|
-
t += Math.abs(
|
|
3733
|
-
for (let n = 1; n < e.length; n++) t -= Math.abs(
|
|
3860
|
+
t += Math.abs(Dn(e[0]));
|
|
3861
|
+
for (let n = 1; n < e.length; n++) t -= Math.abs(Dn(e[n]));
|
|
3734
3862
|
}
|
|
3735
3863
|
return t;
|
|
3736
3864
|
}
|
|
3737
|
-
var
|
|
3738
|
-
function
|
|
3865
|
+
var Tn = $ * $ / 2, En = Math.PI / 180;
|
|
3866
|
+
function Dn(e) {
|
|
3739
3867
|
let t = e.length - 1;
|
|
3740
3868
|
if (t <= 2) return 0;
|
|
3741
3869
|
let n = 0, r = 0;
|
|
3742
3870
|
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] *
|
|
3871
|
+
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
3872
|
n += (l - s) * Math.sin(c), r++;
|
|
3745
3873
|
}
|
|
3746
|
-
return n *
|
|
3874
|
+
return n * Tn;
|
|
3747
3875
|
}
|
|
3748
3876
|
//#endregion
|
|
3749
3877
|
//#region node_modules/geojson-minimum-bounding-rectangle/dist/index.js
|
|
3750
|
-
function
|
|
3751
|
-
let t =
|
|
3878
|
+
function On(e) {
|
|
3879
|
+
let t = $t(e);
|
|
3752
3880
|
if (!t) throw Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
|
|
3753
|
-
let n =
|
|
3881
|
+
let n = en(t), r = Bt(t), i = 2 ** 53 - 1, a = null;
|
|
3754
3882
|
for (let e = 0; e < r.length - 1; e++) {
|
|
3755
|
-
let o =
|
|
3756
|
-
c < i && (i = c, a =
|
|
3883
|
+
let o = _n(r[e], r[e + 1]), s = xn(gn(t, -1 * o, { pivot: n })), c = Sn(s);
|
|
3884
|
+
c < i && (i = c, a = gn(s, o, { pivot: n }));
|
|
3757
3885
|
}
|
|
3758
3886
|
return a;
|
|
3759
3887
|
}
|
|
3760
3888
|
//#endregion
|
|
3761
3889
|
//#region src/utils/OBB.mjs
|
|
3762
|
-
function
|
|
3890
|
+
function kn(e, t) {
|
|
3763
3891
|
let n = t[0] - e[0], r = t[1] - e[1];
|
|
3764
3892
|
return Math.sqrt(n * n + r * r);
|
|
3765
3893
|
}
|
|
3766
|
-
function
|
|
3894
|
+
function An(e) {
|
|
3767
3895
|
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
|
|
3768
3896
|
for (let [a, o] of e) a < t && (t = a), a > n && (n = a), o < r && (r = o), o > i && (i = o);
|
|
3769
3897
|
return [(n + t) * .5, (i + r) * .5];
|
|
3770
3898
|
}
|
|
3771
|
-
var
|
|
3899
|
+
var jn = class t extends Et {
|
|
3772
3900
|
getBoxMesh() {
|
|
3773
|
-
|
|
3901
|
+
Mn.identity(), Mn.setFromMatrix3(this.rotation), Mn.decompose(In, Nn, new e.Vector3());
|
|
3774
3902
|
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(
|
|
3903
|
+
return n.position.copy(this.center), n.rotation.setFromQuaternion(Nn), n;
|
|
3776
3904
|
}
|
|
3777
3905
|
getBoxEdge(t = 16776960) {
|
|
3778
3906
|
let n = this.getBoxMesh();
|
|
3779
|
-
|
|
3907
|
+
Ln.setFromObject(n);
|
|
3780
3908
|
let r = new e.EdgesGeometry(n.geometry.clone().applyMatrix4(n.matrixWorld));
|
|
3781
3909
|
return new e.LineSegments(r, new e.LineBasicMaterial({
|
|
3782
3910
|
color: t,
|
|
@@ -3784,33 +3912,33 @@ var bn = class t extends ht {
|
|
|
3784
3912
|
}));
|
|
3785
3913
|
}
|
|
3786
3914
|
toJson() {
|
|
3787
|
-
return
|
|
3915
|
+
return Mn.identity(), Mn.setFromMatrix3(this.rotation), Mn.decompose(In, Nn, new e.Vector3()), {
|
|
3788
3916
|
size: this.halfSize.toArray(),
|
|
3789
3917
|
center: this.center.toArray(),
|
|
3790
|
-
quaternion:
|
|
3918
|
+
quaternion: Nn.toArray()
|
|
3791
3919
|
};
|
|
3792
3920
|
}
|
|
3793
3921
|
static from(n, r, i, a = new t()) {
|
|
3794
|
-
if (i instanceof e.Euler)
|
|
3795
|
-
else if (i instanceof e.Quaternion)
|
|
3922
|
+
if (i instanceof e.Euler) Nn.setFromEuler(i);
|
|
3923
|
+
else if (i instanceof e.Quaternion) Nn.copy(i);
|
|
3796
3924
|
else throw Error("传入的旋转不是欧拉角或者四元数");
|
|
3797
|
-
return
|
|
3925
|
+
return Mn.compose(r, Nn, Fn), a.center.copy(r), a.halfSize.copy(n.multiplyScalar(.5)), a.rotation.setFromMatrix4(Mn), a;
|
|
3798
3926
|
}
|
|
3799
3927
|
static fromByPath2D(e, n, r, i = new t()) {
|
|
3800
|
-
let a =
|
|
3928
|
+
let a = On({
|
|
3801
3929
|
type: "Polygon",
|
|
3802
3930
|
coordinates: [e.map((e) => [e.x, e.y])]
|
|
3803
3931
|
});
|
|
3804
3932
|
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(
|
|
3933
|
+
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]);
|
|
3934
|
+
In.set(s, c, r), Pn.set(0, 0, l);
|
|
3935
|
+
let [u, d] = An(o);
|
|
3936
|
+
return n.x = u, n.y = d, this.from(In, n, Pn, i);
|
|
3809
3937
|
}
|
|
3810
|
-
},
|
|
3938
|
+
}, 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
3939
|
//#endregion
|
|
3812
3940
|
//#region src/pointCloudProcessing/mergeMeaning.mjs
|
|
3813
|
-
function
|
|
3941
|
+
function Rn(e, t, n = .005, r = .2) {
|
|
3814
3942
|
if (!e.length || !t.length) return 0;
|
|
3815
3943
|
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
3944
|
for (let e of t) {
|
|
@@ -3839,26 +3967,26 @@ function Dn(e, t, n = .005, r = .2) {
|
|
|
3839
3967
|
}
|
|
3840
3968
|
return c / e.length;
|
|
3841
3969
|
}
|
|
3842
|
-
function
|
|
3970
|
+
function zn(e, t, n = .5) {
|
|
3843
3971
|
let r = 0, i = 0;
|
|
3844
3972
|
for (let a of e) if (t.containsPoint(a) && (r++, i = r / e.length, i > n)) break;
|
|
3845
3973
|
return i;
|
|
3846
3974
|
}
|
|
3847
|
-
function
|
|
3975
|
+
function Bn(e, t, n, r) {
|
|
3848
3976
|
if (e.intersectsOBB(t)) return !0;
|
|
3849
3977
|
{
|
|
3850
|
-
let i =
|
|
3978
|
+
let i = Hn(e, r), a = Hn(t, n);
|
|
3851
3979
|
if (i || a) return !0;
|
|
3852
3980
|
}
|
|
3853
3981
|
return !1;
|
|
3854
3982
|
}
|
|
3855
|
-
function
|
|
3983
|
+
function Vn(t, n) {
|
|
3856
3984
|
let r = new e.Vector3(), i = new e.Vector3();
|
|
3857
3985
|
t.getSize(r), n.getSize(i);
|
|
3858
3986
|
let a = r.x * r.y * r.z, o = i.x * i.y * i.z;
|
|
3859
3987
|
return a > o ? 1 : a < o ? -1 : 0;
|
|
3860
3988
|
}
|
|
3861
|
-
function
|
|
3989
|
+
function Hn(e, t) {
|
|
3862
3990
|
let n = !0;
|
|
3863
3991
|
for (let r = 0; r < t.length; r++) if (!e.containsPoint(t[r])) {
|
|
3864
3992
|
n = !1;
|
|
@@ -3866,7 +3994,7 @@ function jn(e, t) {
|
|
|
3866
3994
|
}
|
|
3867
3995
|
return n;
|
|
3868
3996
|
}
|
|
3869
|
-
function
|
|
3997
|
+
function Un(e) {
|
|
3870
3998
|
if (e.length === 0) return {
|
|
3871
3999
|
x: 0,
|
|
3872
4000
|
y: 0,
|
|
@@ -3884,52 +4012,85 @@ function Mn(e) {
|
|
|
3884
4012
|
h: r - i
|
|
3885
4013
|
};
|
|
3886
4014
|
}
|
|
3887
|
-
function
|
|
4015
|
+
function Wn(t, n, r, i) {
|
|
3888
4016
|
let a = [];
|
|
3889
4017
|
for (let n = 0; n < t.length; n++) a.push(new e.Vector3(t[n][0], t[n][1], 0));
|
|
3890
4018
|
if (a.length == 0) return null;
|
|
3891
|
-
let o =
|
|
4019
|
+
let o = jn.fromByPath2D(a, n, r);
|
|
3892
4020
|
return o.center.z = i, o;
|
|
3893
4021
|
}
|
|
3894
|
-
var
|
|
4022
|
+
var Gn = (t) => {
|
|
3895
4023
|
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
|
-
|
|
4024
|
+
let n = [], r = /* @__PURE__ */ new Map();
|
|
4025
|
+
for (let i = 0; i < t.length; i++) {
|
|
4026
|
+
let a = t[i].points.map((e) => [e.x, e.y]), o = Un(t[i].points), s = t[i].obj_id;
|
|
4027
|
+
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];
|
|
4028
|
+
let c = s.indexOf("_") + 1, l = s.lastIndexOf("_"), u = s.substring(c, l);
|
|
4029
|
+
if (u === "wall") continue;
|
|
4030
|
+
let d = [];
|
|
4031
|
+
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));
|
|
4032
|
+
let f = -99999;
|
|
4033
|
+
if (u === "floor") {
|
|
4034
|
+
let n = /* @__PURE__ */ new Map();
|
|
4035
|
+
for (let e = 0; e < t[i].points.length; e++) {
|
|
4036
|
+
let r = t[i].points[e].z;
|
|
4037
|
+
if (r = Math.floor(r * 10) / 10, n.has(r)) {
|
|
4038
|
+
let a = n.get(r);
|
|
4039
|
+
a.num += 1, a.points.push(t[i].points[e]), n.set(r, a);
|
|
4040
|
+
} else n.set(r, {
|
|
4041
|
+
num: 1,
|
|
4042
|
+
points: [t[i].points[e]]
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
let r = [...n.entries()].reduce((e, t) => t[1].num > e[1].num ? t : e);
|
|
4046
|
+
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];
|
|
4047
|
+
}
|
|
4048
|
+
let p = {
|
|
4049
|
+
points: d,
|
|
4050
|
+
path: ht(a),
|
|
4051
|
+
h: o.h,
|
|
4052
|
+
minz: o.minz,
|
|
4053
|
+
maxz: o.maxz,
|
|
3910
4054
|
center: {
|
|
3911
|
-
x:
|
|
3912
|
-
y:
|
|
3913
|
-
z:
|
|
4055
|
+
x: o.x,
|
|
4056
|
+
y: o.y,
|
|
4057
|
+
z: o.z
|
|
3914
4058
|
},
|
|
3915
|
-
obj_id: t[
|
|
3916
|
-
type:
|
|
3917
|
-
averagePz: t[
|
|
4059
|
+
obj_id: t[i].obj_id,
|
|
4060
|
+
type: u,
|
|
4061
|
+
averagePz: t[i].averagePz,
|
|
3918
4062
|
obb: null,
|
|
3919
4063
|
isDel: !1,
|
|
3920
|
-
obj_id:
|
|
3921
|
-
positionArr: [t[
|
|
4064
|
+
obj_id: s,
|
|
4065
|
+
positionArr: [t[i].position]
|
|
3922
4066
|
};
|
|
3923
|
-
if (
|
|
3924
|
-
let
|
|
3925
|
-
for (let e = 0; e < n.length; e++) if (n[e].type ==
|
|
3926
|
-
|
|
4067
|
+
if (p.obb = Wn(p.path, p.center, p.h, (p.maxz + p.minz) / 2), p.obb == null) continue;
|
|
4068
|
+
let m = -1;
|
|
4069
|
+
for (let e = 0; e < n.length; e++) if (n[e].type == u) {
|
|
4070
|
+
m = e;
|
|
4071
|
+
break;
|
|
4072
|
+
}
|
|
4073
|
+
if (m == -1 ? n.push({
|
|
4074
|
+
type: u,
|
|
4075
|
+
array: [p]
|
|
4076
|
+
}) : n[m].array.push(p), u == "floor" && f != -99999) if (r.has(f)) {
|
|
4077
|
+
let e = r.get(f);
|
|
4078
|
+
e.num += p.points.length, e.datas.push(p), r.set(f, e);
|
|
4079
|
+
} else r.set(f, {
|
|
4080
|
+
num: p.points.length,
|
|
4081
|
+
datas: [p]
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
if (r.size > 0) {
|
|
4085
|
+
let e = [];
|
|
4086
|
+
for (let [t, n] of r.entries()) {
|
|
4087
|
+
let { num: t, datas: r } = n;
|
|
4088
|
+
t > 3e3 && e.push(...r);
|
|
4089
|
+
}
|
|
4090
|
+
for (let t = 0; t < n.length; t++) if (n[t].type == "floor") {
|
|
4091
|
+
n[t].array = e;
|
|
3927
4092
|
break;
|
|
3928
4093
|
}
|
|
3929
|
-
f == -1 ? n.push({
|
|
3930
|
-
type: l,
|
|
3931
|
-
array: [d]
|
|
3932
|
-
}) : n[f].array.push(d);
|
|
3933
4094
|
}
|
|
3934
4095
|
for (let e = 0; e < n.length; e++) {
|
|
3935
4096
|
let t = n[e].array, r = [], i = [];
|
|
@@ -3940,13 +4101,13 @@ var Pn = (t) => {
|
|
|
3940
4101
|
obb: t[e].obb.clone()
|
|
3941
4102
|
};
|
|
3942
4103
|
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 =
|
|
4104
|
+
r.push(i), n.points.push(...t[i].points), n.path = ht(n.points.map((e) => [e.x, e.y]));
|
|
4105
|
+
let a = Un(n.points);
|
|
3945
4106
|
n.h = a.h, n.minz = a.minz, n.maxz = a.maxz, n.center = {
|
|
3946
4107
|
x: a.x,
|
|
3947
4108
|
y: a.y,
|
|
3948
4109
|
z: a.z
|
|
3949
|
-
}, n.obb =
|
|
4110
|
+
}, n.obb = Wn(n.path, n.center, n.h, (n.maxz + n.minz) / 2), n.positionArr.push(...t[i].positionArr), i = e;
|
|
3950
4111
|
}
|
|
3951
4112
|
n.path.length > t[e].path.length && (r.push(e), i.push(n));
|
|
3952
4113
|
}
|
|
@@ -3955,7 +4116,9 @@ var Pn = (t) => {
|
|
|
3955
4116
|
a.push(...i), n[e].array = a;
|
|
3956
4117
|
}
|
|
3957
4118
|
for (let t = 0; t < n.length; t++) {
|
|
3958
|
-
let r = n[t].type
|
|
4119
|
+
let r = n[t].type;
|
|
4120
|
+
if (r === "people" || r === "floor") continue;
|
|
4121
|
+
let i = n[t].array;
|
|
3959
4122
|
for (let a = 0; a < i.length; a++) {
|
|
3960
4123
|
let o = i[a].obb, s = i[a].minz;
|
|
3961
4124
|
i[a].maxz;
|
|
@@ -3974,74 +4137,61 @@ var Pn = (t) => {
|
|
|
3974
4137
|
}
|
|
3975
4138
|
}
|
|
3976
4139
|
if (!i[a].isDel) for (let e = t + 1; e < n.length; e++) {
|
|
3977
|
-
let t = n[e].type
|
|
4140
|
+
let t = n[e].type;
|
|
4141
|
+
if (t === "people" || t === "floor") continue;
|
|
4142
|
+
let l = n[e].array;
|
|
3978
4143
|
for (let e = 0; e < l.length; e++) {
|
|
3979
4144
|
if (l[e].isDel) continue;
|
|
3980
4145
|
let n = l[e].obb, u = l[e].minz;
|
|
3981
4146
|
if (l[e].maxz, o.intersectsOBB(n)) {
|
|
3982
|
-
|
|
3983
|
-
let d =
|
|
4147
|
+
zn(l[e].points, o);
|
|
4148
|
+
let d = zn(i[a].points, n), f = Vn(o, n);
|
|
3984
4149
|
if (d >= .3 && f == -1) {
|
|
3985
4150
|
i[a].isDel = !0;
|
|
3986
4151
|
break;
|
|
3987
4152
|
}
|
|
3988
4153
|
if (r !== "wall" && r !== "floor" && r !== "roof") {
|
|
3989
4154
|
if (r === "window") {
|
|
3990
|
-
if (t === "balcony railing" &&
|
|
4155
|
+
if (t === "balcony railing" && Hn(o, l[e].points)) {
|
|
3991
4156
|
l[e].isDel = !0;
|
|
3992
4157
|
continue;
|
|
3993
4158
|
}
|
|
3994
|
-
if (t === "balcony railing" &&
|
|
4159
|
+
if (t === "balcony railing" && Hn(n, i[a].points)) {
|
|
3995
4160
|
i[a].isDel = !0;
|
|
3996
4161
|
break;
|
|
3997
4162
|
}
|
|
3998
|
-
if (t === "balcony railing" &&
|
|
4163
|
+
if (t === "balcony railing" && Bn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(u - c) > .3)) {
|
|
3999
4164
|
l[e].isDel = !0;
|
|
4000
4165
|
continue;
|
|
4001
4166
|
}
|
|
4002
4167
|
} else if (r === "balcony railing") {
|
|
4003
|
-
if (t === "window" &&
|
|
4168
|
+
if (t === "window" && Hn(o, l[e].points)) {
|
|
4004
4169
|
l[e].isDel = !0;
|
|
4005
4170
|
continue;
|
|
4006
4171
|
}
|
|
4007
|
-
if (t === "window" &&
|
|
4172
|
+
if (t === "window" && Hn(n, i[a].points)) {
|
|
4008
4173
|
i[a].isDel = !0;
|
|
4009
4174
|
break;
|
|
4010
4175
|
}
|
|
4011
|
-
if (t === "window" &&
|
|
4176
|
+
if (t === "window" && Bn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(s - c) > .3)) {
|
|
4012
4177
|
i[a].isDel = !0;
|
|
4013
4178
|
break;
|
|
4014
4179
|
}
|
|
4015
4180
|
}
|
|
4016
4181
|
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);
|
|
4182
|
+
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;
|
|
4183
|
+
else {
|
|
4184
|
+
i[a].isDel = !0;
|
|
4185
|
+
break;
|
|
4186
|
+
}
|
|
4187
|
+
else if (Bn(o, n)) {
|
|
4188
|
+
let s = Vn(o, n);
|
|
4039
4189
|
if (s === 1 || s === 0) {
|
|
4040
4190
|
if (t === "switch") continue;
|
|
4041
|
-
|
|
4191
|
+
zn(p, o) >= .5 && (l[e].isDel = !0);
|
|
4042
4192
|
} else {
|
|
4043
4193
|
if (r === "switch") continue;
|
|
4044
|
-
if (
|
|
4194
|
+
if (zn(p, n) >= .5) {
|
|
4045
4195
|
i[a].isDel = !0;
|
|
4046
4196
|
break;
|
|
4047
4197
|
}
|
|
@@ -4070,29 +4220,29 @@ var Pn = (t) => {
|
|
|
4070
4220
|
let n = new e.Vector3();
|
|
4071
4221
|
i[t].obb.getSize(n), (n.x < .1 || n.y < .1) && (i[t].isDel = !0);
|
|
4072
4222
|
}
|
|
4073
|
-
r === "balcony railing" && (Math.abs(n - a) < .4 && (i[t].isDel = !0), (a < s && Math.abs(a - s) > 1 || a > s && Math.abs(a - s) > 1) && (i[t].isDel = !0), n < s && (i[t].isDel = !0));
|
|
4223
|
+
r === "balcony railing" && (Math.abs(n - a) < .4 && (i[t].isDel = !0), (a < s && Math.abs(a - s) > 1 || a > s && Math.abs(a - s) > 1) && (i[t].isDel = !0), n < s && (i[t].isDel = !0)), r === "people" && (Math.abs(n - a) < 1 && (i[t].isDel = !0), a > s && a - s > .3 && (i[t].isDel = !0), n < s && (i[t].isDel = !0));
|
|
4074
4224
|
}
|
|
4075
4225
|
}
|
|
4076
4226
|
for (let e = 0; e < n.length; e++) n[e].array = n[e].array.filter((e) => !e.isDel);
|
|
4077
|
-
let
|
|
4227
|
+
let i = [];
|
|
4078
4228
|
for (let t = 0; t < n.length; t++) {
|
|
4079
|
-
let
|
|
4080
|
-
for (let t = 0; t <
|
|
4081
|
-
obbBox:
|
|
4082
|
-
box: new e.Box3().setFromPoints(
|
|
4083
|
-
category:
|
|
4229
|
+
let r = n[t].array;
|
|
4230
|
+
for (let t = 0; t < r.length; t++) i.push({
|
|
4231
|
+
obbBox: r[t].obb,
|
|
4232
|
+
box: new e.Box3().setFromPoints(r[t].points),
|
|
4233
|
+
category: r[t].type,
|
|
4084
4234
|
center: {
|
|
4085
|
-
x:
|
|
4086
|
-
y:
|
|
4087
|
-
z: (
|
|
4235
|
+
x: r[t].center.x,
|
|
4236
|
+
y: r[t].center.y,
|
|
4237
|
+
z: (r[t].minz + r[t].maxz) / 2
|
|
4088
4238
|
},
|
|
4089
|
-
name:
|
|
4090
|
-
obj_id:
|
|
4091
|
-
pcdPoints:
|
|
4092
|
-
positionArr:
|
|
4239
|
+
name: r[t].obj_id,
|
|
4240
|
+
obj_id: r[t].obj_id,
|
|
4241
|
+
pcdPoints: r[t].points,
|
|
4242
|
+
positionArr: r[t].positionArr
|
|
4093
4243
|
});
|
|
4094
4244
|
}
|
|
4095
|
-
return
|
|
4245
|
+
return i;
|
|
4096
4246
|
};
|
|
4097
4247
|
//#endregion
|
|
4098
|
-
export {
|
|
4248
|
+
export { z as classifySegments, he as getAllGeometry, De as getBeamLine, ke as getColLine, Oe as getMainBeamLine, Gn as getMergeMeaning, I as getParallelism, re as getPointCloudMinMax, te as getPointCoverageOnQuad, j as isParallel, L as perpendicularInfo, ae as removeNoisePoints, O as segmentsIntersect2D, ge as updateStEdPoint, Ee as usegetBeamLine };
|