rm-graphical-computing 1.0.34 → 1.0.35
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 +2549 -507
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,68 +1,87 @@
|
|
|
1
1
|
import * as e from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { Box3 as t, BufferAttribute as n, BufferGeometry as r, MathUtils as i, Matrix3 as a, Matrix4 as o, Object3D as s, Plane as c, Ray as l, Vector2 as u, Vector3 as d } from "three";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var f = Object.create, p = Object.defineProperty, m = Object.getOwnPropertyDescriptor, h = Object.getOwnPropertyNames, g = Object.getPrototypeOf, _ = Object.prototype.hasOwnProperty, v = (e, t) => () => (e && (t = e(e = 0)), t), y = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), b = (e, t) => {
|
|
5
|
+
let n = {};
|
|
6
|
+
for (var r in e) p(n, r, {
|
|
7
|
+
get: e[r],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
return t || p(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
11
|
+
}, x = (e, t, n, r) => {
|
|
12
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = h(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !_.call(e, s) && s !== n && p(e, s, {
|
|
13
|
+
get: ((e) => t[e]).bind(null, s),
|
|
14
|
+
enumerable: !(r = m(t, s)) || r.enumerable
|
|
15
|
+
});
|
|
16
|
+
return e;
|
|
17
|
+
}, S = (e, t, n) => (n = e == null ? {} : f(g(e)), x(t || !e || !e.__esModule ? p(n, "default", {
|
|
18
|
+
value: e,
|
|
19
|
+
enumerable: !0
|
|
20
|
+
}) : n, e)), C = (e) => _.call(e, "module.exports") ? e["module.exports"] : x(p({}, "__esModule", { value: !0 }), e);
|
|
21
|
+
//#endregion
|
|
3
22
|
//#region node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
for (let
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
for (let e in
|
|
10
|
-
if (!i.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
11
|
-
o[e] === void 0 && (o[e] = []), o[e].push(
|
|
12
|
-
}
|
|
13
|
-
if (f !== i.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
14
|
-
if (c !==
|
|
15
|
-
for (let e in
|
|
16
|
-
if (!a.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
17
|
-
s[e] === void 0 && (s[e] = []), s[e].push(
|
|
23
|
+
function w(e, t = !1) {
|
|
24
|
+
let n = e[0].index !== null, i = new Set(Object.keys(e[0].attributes)), a = new Set(Object.keys(e[0].morphAttributes)), o = {}, s = {}, c = e[0].morphTargetsRelative, l = new r(), u = 0;
|
|
25
|
+
for (let r = 0; r < e.length; ++r) {
|
|
26
|
+
let d = e[r], f = 0;
|
|
27
|
+
if (n !== (d.index !== null)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
|
|
28
|
+
for (let e in d.attributes) {
|
|
29
|
+
if (!i.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". All geometries must have compatible attributes; make sure \"" + e + "\" attribute exists among all geometries, or in none of them."), null;
|
|
30
|
+
o[e] === void 0 && (o[e] = []), o[e].push(d.attributes[e]), f++;
|
|
31
|
+
}
|
|
32
|
+
if (f !== i.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". Make sure all geometries have the same number of attributes."), null;
|
|
33
|
+
if (c !== d.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
|
|
34
|
+
for (let e in d.morphAttributes) {
|
|
35
|
+
if (!a.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". .morphAttributes must be consistent throughout all geometries."), null;
|
|
36
|
+
s[e] === void 0 && (s[e] = []), s[e].push(d.morphAttributes[e]);
|
|
18
37
|
}
|
|
19
38
|
if (t) {
|
|
20
39
|
let e;
|
|
21
|
-
if (
|
|
22
|
-
else if (
|
|
23
|
-
else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
24
|
-
|
|
40
|
+
if (n) e = d.index.count;
|
|
41
|
+
else if (d.attributes.position !== void 0) e = d.attributes.position.count;
|
|
42
|
+
else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + r + ". The geometry must have either an index or a position attribute"), null;
|
|
43
|
+
l.addGroup(u, e, r), u += e;
|
|
25
44
|
}
|
|
26
45
|
}
|
|
27
|
-
if (
|
|
46
|
+
if (n) {
|
|
28
47
|
let t = 0, n = [];
|
|
29
48
|
for (let r = 0; r < e.length; ++r) {
|
|
30
49
|
let i = e[r].index;
|
|
31
50
|
for (let e = 0; e < i.count; ++e) n.push(i.getX(e) + t);
|
|
32
51
|
t += e[r].attributes.position.count;
|
|
33
52
|
}
|
|
34
|
-
|
|
53
|
+
l.setIndex(n);
|
|
35
54
|
}
|
|
36
55
|
for (let e in o) {
|
|
37
|
-
let t =
|
|
56
|
+
let t = T(o[e]);
|
|
38
57
|
if (!t) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " attribute."), null;
|
|
39
|
-
|
|
58
|
+
l.setAttribute(e, t);
|
|
40
59
|
}
|
|
41
60
|
for (let e in s) {
|
|
42
61
|
let t = s[e][0].length;
|
|
43
62
|
if (t === 0) break;
|
|
44
|
-
|
|
63
|
+
l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[e] = [];
|
|
45
64
|
for (let n = 0; n < t; ++n) {
|
|
46
65
|
let t = [];
|
|
47
66
|
for (let r = 0; r < s[e].length; ++r) t.push(s[e][r][n]);
|
|
48
|
-
let r =
|
|
67
|
+
let r = T(t);
|
|
49
68
|
if (!r) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " morphAttribute."), null;
|
|
50
|
-
|
|
69
|
+
l.morphAttributes[e].push(r);
|
|
51
70
|
}
|
|
52
71
|
}
|
|
53
|
-
return
|
|
72
|
+
return l;
|
|
54
73
|
}
|
|
55
|
-
function
|
|
56
|
-
let
|
|
57
|
-
for (let
|
|
58
|
-
let s = e[
|
|
59
|
-
if (
|
|
74
|
+
function T(e) {
|
|
75
|
+
let t, r, i, a = -1, o = 0;
|
|
76
|
+
for (let n = 0; n < e.length; ++n) {
|
|
77
|
+
let s = e[n];
|
|
78
|
+
if (t === void 0 && (t = s.array.constructor), t !== s.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
|
|
60
79
|
if (r === void 0 && (r = s.itemSize), r !== s.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null;
|
|
61
80
|
if (i === void 0 && (i = s.normalized), i !== s.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null;
|
|
62
81
|
if (a === -1 && (a = s.gpuType), a !== s.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
|
|
63
82
|
o += s.count * r;
|
|
64
83
|
}
|
|
65
|
-
let s = new
|
|
84
|
+
let s = new t(o), c = new n(s, r, i), l = 0;
|
|
66
85
|
for (let t = 0; t < e.length; ++t) {
|
|
67
86
|
let n = e[t];
|
|
68
87
|
if (n.isInterleavedBufferAttribute) {
|
|
@@ -78,9 +97,9 @@ function l(e) {
|
|
|
78
97
|
}
|
|
79
98
|
//#endregion
|
|
80
99
|
//#region node_modules/three/examples/jsm/renderers/CSS2DRenderer.js
|
|
81
|
-
var
|
|
100
|
+
var E = class extends s {
|
|
82
101
|
constructor(e = document.createElement("div")) {
|
|
83
|
-
super(), this.isCSS2DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new
|
|
102
|
+
super(), this.isCSS2DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new u(.5, .5), this.addEventListener("removed", function() {
|
|
84
103
|
this.traverse(function(e) {
|
|
85
104
|
e.element && e.element instanceof e.element.ownerDocument.defaultView.Element && e.element.parentNode !== null && e.element.remove();
|
|
86
105
|
});
|
|
@@ -90,31 +109,31 @@ var u = class extends i {
|
|
|
90
109
|
return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center, this;
|
|
91
110
|
}
|
|
92
111
|
};
|
|
93
|
-
new
|
|
112
|
+
new d(), new o(), new o(), new d(), new d();
|
|
94
113
|
//#endregion
|
|
95
114
|
//#region src/utils/utils.mjs
|
|
96
|
-
var
|
|
115
|
+
var D = (t, n, r, i, a = 1e-8) => {
|
|
97
116
|
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;
|
|
98
117
|
if (Math.abs(u) < a) return null;
|
|
99
118
|
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;
|
|
100
119
|
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) };
|
|
101
|
-
},
|
|
120
|
+
}, O = (t, n, r = {}) => {
|
|
102
121
|
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");
|
|
103
122
|
u.font = `bold ${i}px ${a}`;
|
|
104
|
-
let d = u.measureText(t).width, f = Math.min(d + c * 2, l),
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
let
|
|
109
|
-
map:
|
|
123
|
+
let d = u.measureText(t).width, f = Math.min(d + c * 2, l), p = i + c * 2, m = document.createElement("canvas");
|
|
124
|
+
m.width = f, m.height = p;
|
|
125
|
+
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 ? k(h, t, f / 2, p / 2, l, i) : h.fillText(t, f / 2, p / 2);
|
|
127
|
+
let g = new e.CanvasTexture(m), _ = new e.SpriteMaterial({
|
|
128
|
+
map: g,
|
|
110
129
|
depthTest: !1,
|
|
111
130
|
transparent: !0
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
let
|
|
115
|
-
return
|
|
131
|
+
}), v = new e.Sprite(_);
|
|
132
|
+
v.position.set(n.x, n.y, n.z);
|
|
133
|
+
let y = .005;
|
|
134
|
+
return v.scale.set(f * y, p * y, 1), v;
|
|
116
135
|
};
|
|
117
|
-
function
|
|
136
|
+
function k(e, t, n, r, i, a) {
|
|
118
137
|
let o = t.split(""), s = "", c = a * 1.2, l = r;
|
|
119
138
|
for (let t = 0; t < o.length; t++) {
|
|
120
139
|
let r = s + o[t];
|
|
@@ -122,7 +141,7 @@ function p(e, t, n, r, i, a) {
|
|
|
122
141
|
}
|
|
123
142
|
e.fillText(s, n, l);
|
|
124
143
|
}
|
|
125
|
-
var
|
|
144
|
+
var A = (e, t, n = .01) => {
|
|
126
145
|
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);
|
|
127
146
|
if (r < 1e-10 || i < 1e-10) return {
|
|
128
147
|
parallel: !1,
|
|
@@ -146,7 +165,7 @@ var m = (e, t, n = .01) => {
|
|
|
146
165
|
angle: c
|
|
147
166
|
};
|
|
148
167
|
};
|
|
149
|
-
function
|
|
168
|
+
function j(t, n, r) {
|
|
150
169
|
let i = new e.BufferGeometry(), a = [], o = [];
|
|
151
170
|
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();
|
|
152
171
|
let s = new e.MeshBasicMaterial({
|
|
@@ -157,7 +176,7 @@ function h(t, n, r) {
|
|
|
157
176
|
});
|
|
158
177
|
return new e.Mesh(i, s);
|
|
159
178
|
}
|
|
160
|
-
var
|
|
179
|
+
var M = class {
|
|
161
180
|
constructor(t = {}) {
|
|
162
181
|
this.config = {
|
|
163
182
|
value: t.value || "0.0000m",
|
|
@@ -172,7 +191,7 @@ var g = class {
|
|
|
172
191
|
}, this.label = null, this.labelElement = null, this.createLabel();
|
|
173
192
|
}
|
|
174
193
|
createLabel() {
|
|
175
|
-
return this.labelElement = document.createElement("div"), this.labelElement.textContent = this.config.value, this.applyBlackWhiteStyle(), this.label = new
|
|
194
|
+
return this.labelElement = document.createElement("div"), this.labelElement.textContent = this.config.value, this.applyBlackWhiteStyle(), this.label = new E(this.labelElement), this.label.position.copy(this.config.position), this.label;
|
|
176
195
|
}
|
|
177
196
|
applyBlackWhiteStyle() {
|
|
178
197
|
let e = this.labelElement.style, t = this.config;
|
|
@@ -199,33 +218,33 @@ var g = class {
|
|
|
199
218
|
dispose() {
|
|
200
219
|
this.labelElement && this.labelElement.parentNode && this.labelElement.parentNode.removeChild(this.labelElement), this.label = null, this.labelElement = null;
|
|
201
220
|
}
|
|
202
|
-
},
|
|
221
|
+
}, N = (t) => {
|
|
203
222
|
let n = new e.Group(), r = new e.Group();
|
|
204
223
|
if (t && t.length) {
|
|
205
224
|
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(".");
|
|
206
225
|
t.forEach((t, a) => {
|
|
207
|
-
let o = i[a], s = new e.Group(), { pcdPoints: c, category: l, name: u, center: d, box: f, obbBox: p, contour: m, nline:
|
|
208
|
-
s.add(
|
|
209
|
-
let
|
|
226
|
+
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
|
+
s.add(b);
|
|
228
|
+
let x = new M({
|
|
210
229
|
value: u,
|
|
211
230
|
position: new e.Vector3(d.x, d.y, d.z)
|
|
212
231
|
}).getLabel();
|
|
213
|
-
s.add(
|
|
214
|
-
let
|
|
215
|
-
s.add(
|
|
216
|
-
let
|
|
232
|
+
s.add(x);
|
|
233
|
+
let S = new e.InstancedMesh(new e.SphereGeometry(.007, 8, 8), new e.MeshBasicMaterial({ color: o }), v);
|
|
234
|
+
s.add(S);
|
|
235
|
+
let C = new e.Matrix4(), w = 0;
|
|
217
236
|
if (c.forEach((e) => {
|
|
218
|
-
|
|
219
|
-
}),
|
|
237
|
+
C.setPosition(e.x, e.y, e.z), S.setMatrixAt(w, C), w++;
|
|
238
|
+
}), S.instanceMatrix.needsUpdate = !0, h) {
|
|
220
239
|
let t = new e.BufferGeometry();
|
|
221
|
-
t.setFromPoints([new e.Vector3(
|
|
240
|
+
t.setFromPoints([new e.Vector3(h.start.x, h.start.y, h.start.z), new e.Vector3(h.end.x, h.end.y, h.end.z)]);
|
|
222
241
|
let n = new e.LineBasicMaterial({
|
|
223
242
|
color: "red",
|
|
224
243
|
depthTest: !1,
|
|
225
244
|
depthWrite: !1
|
|
226
245
|
});
|
|
227
246
|
new e.Line(t, n);
|
|
228
|
-
let r = new e.Vector3().copy(new e.Vector3(
|
|
247
|
+
let r = new e.Vector3().copy(new e.Vector3(h.start.x, h.start.y, h.start.z)).add(new e.Vector3(h.end.x, h.end.y, h.end.z)).multiplyScalar(.5), i = new e.Vector3(h.centerDir.x, h.centerDir.y, h.centerDir.z);
|
|
229
248
|
new e.ArrowHelper(i, r, 1, "red");
|
|
230
249
|
}
|
|
231
250
|
if (m) {
|
|
@@ -242,9 +261,9 @@ var g = class {
|
|
|
242
261
|
}), o = new e.Line(i, a);
|
|
243
262
|
l == "door" ? n.add(o) : r.add(o);
|
|
244
263
|
}
|
|
245
|
-
if (
|
|
264
|
+
if (_) {
|
|
246
265
|
let t = [], i = [];
|
|
247
|
-
|
|
266
|
+
_.coordinates.forEach((n, r) => {
|
|
248
267
|
t.push(new e.Vector3(n.x, n.y, n.z)), i.length < 4 && i.push(new e.Vector3(n.x, n.y, n.z));
|
|
249
268
|
});
|
|
250
269
|
let a = new e.BufferGeometry();
|
|
@@ -255,17 +274,17 @@ var g = class {
|
|
|
255
274
|
depthWrite: !1
|
|
256
275
|
}), s = new e.Line(a, o);
|
|
257
276
|
l == "door" ? n.add(s) : r.add(s);
|
|
258
|
-
let c =
|
|
277
|
+
let c = j(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);
|
|
259
278
|
l == "door" ? n.add(c) : r.add(c);
|
|
260
279
|
let [u, d, f] = t, p = u.distanceTo(d), m = new e.Vector3().copy(u).add(d).multiplyScalar(.5);
|
|
261
|
-
new
|
|
280
|
+
new M({
|
|
262
281
|
value: String(p.toFixed(3)),
|
|
263
282
|
position: m
|
|
264
283
|
}).getLabel();
|
|
265
|
-
let
|
|
266
|
-
new
|
|
267
|
-
value: String(
|
|
268
|
-
position:
|
|
284
|
+
let h = d.distanceTo(f), g = new e.Vector3().copy(d).add(f).multiplyScalar(.5);
|
|
285
|
+
new M({
|
|
286
|
+
value: String(h.toFixed(3)),
|
|
287
|
+
position: g
|
|
269
288
|
}).getLabel();
|
|
270
289
|
}
|
|
271
290
|
if (p) {
|
|
@@ -281,7 +300,7 @@ var g = class {
|
|
|
281
300
|
AiProjectionGroup: n,
|
|
282
301
|
AiProjectionGroup2: r
|
|
283
302
|
};
|
|
284
|
-
},
|
|
303
|
+
}, P = (t, n, r, i) => {
|
|
285
304
|
let a = t, o = [];
|
|
286
305
|
if (i && i.length && (o = i.map((e) => e.clone())), !a || a.length < 4) return {};
|
|
287
306
|
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;
|
|
@@ -289,23 +308,23 @@ var g = class {
|
|
|
289
308
|
let t = e.dot(s), n = e.dot(c);
|
|
290
309
|
t < u && (u = t), t > d && (d = t), n < f && (f = n), n > p && (p = n);
|
|
291
310
|
}
|
|
292
|
-
let
|
|
311
|
+
let m = a[0].dot(l), h = s.clone().multiplyScalar(u).add(c.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(m)), g = s.clone().multiplyScalar(d).add(c.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(m)), _ = s.clone().multiplyScalar(d).add(c.clone().multiplyScalar(p)).add(l.clone().multiplyScalar(m)), v = s.clone().multiplyScalar(u).add(c.clone().multiplyScalar(p)).add(l.clone().multiplyScalar(m)), y = [
|
|
312
|
+
h,
|
|
293
313
|
g,
|
|
294
314
|
_,
|
|
315
|
+
v
|
|
316
|
+
], b = A(new e.Vector3().subVectors(h, g), new e.Vector3(0, 0, 1));
|
|
317
|
+
b && b.parallel && (y = [
|
|
318
|
+
h,
|
|
295
319
|
v,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
x && x.parallel && (b = [
|
|
299
|
-
g,
|
|
300
|
-
y,
|
|
301
|
-
v,
|
|
302
|
-
_
|
|
320
|
+
_,
|
|
321
|
+
g
|
|
303
322
|
]);
|
|
304
|
-
let
|
|
323
|
+
let x = 0;
|
|
305
324
|
if (i.length > 0) {
|
|
306
|
-
let t = new e.Vector3().subVectors(
|
|
325
|
+
let t = new e.Vector3().subVectors(y[1], y[0]).normalize(), i = t.clone().negate(), a = new e.Vector3().subVectors(y[3], y[0]).normalize(), s = a.clone().negate(), c = y[0].distanceTo(y[1]), l = y[0].distanceTo(y[3]), u = c / n, d = l / r, f = .001;
|
|
307
326
|
for (let i = 0; i < u; i++) {
|
|
308
|
-
let i =
|
|
327
|
+
let i = y[0], s = 0;
|
|
309
328
|
for (let c = 0; c < d; c++) {
|
|
310
329
|
let c = i.clone().addScaledVector(t, n), l = c.clone().addScaledVector(a, r), u = i.clone().addScaledVector(a, r), d = new e.Vector3().add(i).add(c).add(l).add(u).multiplyScalar(.25);
|
|
311
330
|
for (let e = 0; e < o.length; e++) if (o[e].distanceTo(d) < f) {
|
|
@@ -315,11 +334,11 @@ var g = class {
|
|
|
315
334
|
i = u;
|
|
316
335
|
}
|
|
317
336
|
if (s >= d / 2) break;
|
|
318
|
-
|
|
337
|
+
x += s, y[0] = y[0].addScaledVector(t, n), y[3] = y[3].addScaledVector(t, n);
|
|
319
338
|
}
|
|
320
|
-
c =
|
|
339
|
+
c = y[0].distanceTo(y[1]), u = c / n;
|
|
321
340
|
for (let t = 0; t < u; t++) {
|
|
322
|
-
let t =
|
|
341
|
+
let t = y[1], s = 0;
|
|
323
342
|
for (let c = 0; c < d; c++) {
|
|
324
343
|
let c = t.clone().addScaledVector(i, n), l = c.clone().addScaledVector(a, r), u = t.clone().addScaledVector(a, r), d = new e.Vector3().add(t).add(c).add(l).add(u).multiplyScalar(.25);
|
|
325
344
|
for (let e = 0; e < o.length; e++) if (o[e].distanceTo(d) < f) {
|
|
@@ -329,11 +348,11 @@ var g = class {
|
|
|
329
348
|
t = u;
|
|
330
349
|
}
|
|
331
350
|
if (s >= d / 2) break;
|
|
332
|
-
|
|
351
|
+
x += s, y[1] = y[1].addScaledVector(i, n), y[2] = y[2].addScaledVector(i, n);
|
|
333
352
|
}
|
|
334
|
-
c =
|
|
353
|
+
c = y[0].distanceTo(y[1]), u = c / n;
|
|
335
354
|
for (let i = 0; i < d; i++) {
|
|
336
|
-
let i =
|
|
355
|
+
let i = y[3], a = 0;
|
|
337
356
|
for (let c = 0; c < u; c++) {
|
|
338
357
|
let c = i.clone().addScaledVector(t, n), l = c.clone().addScaledVector(s, r), u = i.clone().addScaledVector(s, r), d = new e.Vector3().add(i).add(c).add(l).add(u).multiplyScalar(.25);
|
|
339
358
|
for (let e = 0; e < o.length; e++) if (o[e].distanceTo(d) < f) {
|
|
@@ -343,16 +362,16 @@ var g = class {
|
|
|
343
362
|
i = c;
|
|
344
363
|
}
|
|
345
364
|
if (a >= u / 2) break;
|
|
346
|
-
|
|
365
|
+
x += a, y[2] = y[2].addScaledVector(s, r), y[3] = y[3].addScaledVector(s, r);
|
|
347
366
|
}
|
|
348
367
|
}
|
|
349
|
-
let
|
|
368
|
+
let S = y[0].distanceTo(y[1]) * y[0].distanceTo(y[3]);
|
|
350
369
|
return {
|
|
351
|
-
facePoints:
|
|
352
|
-
boxArea:
|
|
353
|
-
totalInPlaneNum:
|
|
370
|
+
facePoints: y,
|
|
371
|
+
boxArea: S,
|
|
372
|
+
totalInPlaneNum: x
|
|
354
373
|
};
|
|
355
|
-
},
|
|
374
|
+
}, F = (t, n, r, i, a = e.MathUtils.degToRad(8)) => {
|
|
356
375
|
let o = new e.Vector3(), s = new e.Vector3();
|
|
357
376
|
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();
|
|
358
377
|
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";
|
|
@@ -367,7 +386,7 @@ var g = class {
|
|
|
367
386
|
v2: s
|
|
368
387
|
}
|
|
369
388
|
};
|
|
370
|
-
},
|
|
389
|
+
}, I = (t, n, r, i) => {
|
|
371
390
|
let a = new e.Vector3().subVectors(n, t), o = new e.Vector3().subVectors(i, r), s = a.length(), c = o.length();
|
|
372
391
|
if (s === 0 || c === 0) return {
|
|
373
392
|
rate: NaN,
|
|
@@ -384,7 +403,7 @@ var g = class {
|
|
|
384
403
|
isPerpendicular: Math.abs(f - 90) < .01,
|
|
385
404
|
isParallel: f < .01
|
|
386
405
|
};
|
|
387
|
-
},
|
|
406
|
+
}, L = (t, n, r = !1) => new e.Vector3((t.x + n.x) / 2, (t.y + n.y) / 2, r ? 0 : (t.z + n.z) / 2), R = (t, n, r, i, a = {}) => {
|
|
388
407
|
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);
|
|
389
408
|
if (h > o) return {
|
|
390
409
|
type: "not_parallel",
|
|
@@ -396,28 +415,28 @@ var g = class {
|
|
|
396
415
|
closestDistance: null
|
|
397
416
|
};
|
|
398
417
|
m < 0 && p.negate();
|
|
399
|
-
let _ = new e.Vector3().addVectors(f, p).normalize(), v = new e.Vector3().addVectors(t, n).multiplyScalar(.5), y =
|
|
400
|
-
return
|
|
401
|
-
type:
|
|
418
|
+
let _ = new e.Vector3().addVectors(f, p).normalize(), v = new e.Vector3().addVectors(t, n).multiplyScalar(.5), y = ee(r, v, f), b = ee(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 = te(t, n, r, i), z = h <= s && x < c, ne;
|
|
419
|
+
return z ? ne = L > .5 ? "collinear_overlap" : "collinear_gap" : h <= o && (ne = "parallel_offset"), {
|
|
420
|
+
type: ne,
|
|
402
421
|
angleDeg: g,
|
|
403
422
|
avgPerpendicularDistance: x,
|
|
404
423
|
maxPerpendicularDistance: S,
|
|
405
|
-
gap:
|
|
406
|
-
overlap:
|
|
407
|
-
closestDistance:
|
|
424
|
+
gap: F,
|
|
425
|
+
overlap: I,
|
|
426
|
+
closestDistance: R
|
|
408
427
|
};
|
|
409
428
|
};
|
|
410
|
-
function
|
|
429
|
+
function ee(t, n, r) {
|
|
411
430
|
let i = new e.Vector3().subVectors(t, n), a = i.dot(r), o = r.clone().multiplyScalar(a);
|
|
412
431
|
return new e.Vector3().subVectors(i, o).length();
|
|
413
432
|
}
|
|
414
|
-
function
|
|
433
|
+
function te(t, n, r, i) {
|
|
415
434
|
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;
|
|
416
435
|
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);
|
|
417
436
|
let g = t.clone().add(a.clone().multiplyScalar(m)), _ = r.clone().add(o.clone().multiplyScalar(h));
|
|
418
437
|
return g.distanceTo(_);
|
|
419
438
|
}
|
|
420
|
-
var
|
|
439
|
+
var z = (t, n, r, i = .05, a = .02) => {
|
|
421
440
|
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);
|
|
422
441
|
for (let t = 0; t < n.length; t++) {
|
|
423
442
|
y.subVectors(n[t], o);
|
|
@@ -438,8 +457,8 @@ var T = (t, n, r, i = .05, a = .02) => {
|
|
|
438
457
|
quadArea: O,
|
|
439
458
|
coveredArea: k
|
|
440
459
|
};
|
|
441
|
-
},
|
|
442
|
-
let n = new e.Vector3(t.start.x, t.start.y, t.start.z), r = new e.Vector3(t.end.x, t.end.y, t.end.z), i = n.distanceTo(r), a = t.rooftopPz - t.start.z, o =
|
|
460
|
+
}, ne = (e, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(e)))), re = (t) => {
|
|
461
|
+
let n = new e.Vector3(t.start.x, t.start.y, t.start.z), r = new e.Vector3(t.end.x, t.end.y, t.end.z), i = n.distanceTo(r), a = t.rooftopPz - t.start.z, o = ne(i, 100), s = ne(a, 70), c = a / s, l = /* @__PURE__ */ new Map();
|
|
443
462
|
for (let e = 0; e < s; e++) l.set((e + 1) * c, {
|
|
444
463
|
count: 0,
|
|
445
464
|
minZ: Infinity,
|
|
@@ -466,7 +485,7 @@ var T = (t, n, r, i = .05, a = .02) => {
|
|
|
466
485
|
minZ: p,
|
|
467
486
|
maxZ: m
|
|
468
487
|
};
|
|
469
|
-
},
|
|
488
|
+
}, ie = (t, n, r) => {
|
|
470
489
|
let i = new e.Plane(), a = new e.Vector3(t.x, t.y, t.z), o = new e.Vector3(n.x, n.y, n.z), s = new e.Vector3(n.x, n.y, n.z + 5);
|
|
471
490
|
i.setFromCoplanarPoints(a, o, s);
|
|
472
491
|
let c = [];
|
|
@@ -483,7 +502,7 @@ var T = (t, n, r, i = .05, a = .02) => {
|
|
|
483
502
|
newOriginalPoints: f,
|
|
484
503
|
newProjectPoints: p
|
|
485
504
|
};
|
|
486
|
-
},
|
|
505
|
+
}, ae = (t) => {
|
|
487
506
|
function n(t, n, r, i, a, o, s, c, l) {
|
|
488
507
|
let u = new e.Line3(t, n), d = /* @__PURE__ */ new Map(), f = new e.Vector3(), p = t.clone(), m = n.clone(), h = 0;
|
|
489
508
|
for (;;) {
|
|
@@ -525,45 +544,45 @@ var T = (t, n, r, i = .05, a = .02) => {
|
|
|
525
544
|
if (i.checkResults[0].originalVertices && i.checkResults[0].originalVertices.length > 0) {
|
|
526
545
|
let [t, n, r, s] = i.checkResults[0].originalVertices[0];
|
|
527
546
|
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);
|
|
528
|
-
let c =
|
|
547
|
+
let c = A(new e.Vector3().subVectors(t, n).normalize(), new e.Vector3(0, 0, 1));
|
|
529
548
|
c && c.parallel && ([o, a] = [a, o]);
|
|
530
549
|
}
|
|
531
550
|
if (a < 0 || o < 0) continue;
|
|
532
|
-
let 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 = s.distanceTo(c), u = i.rooftopPz - i.start.z, d = Math.ceil(l / a), f = Math.ceil(u / o), p = s.clone(),
|
|
533
|
-
new e.Vector3().subVectors(
|
|
534
|
-
let
|
|
551
|
+
let 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 = s.distanceTo(c), u = i.rooftopPz - i.start.z, d = Math.ceil(l / a), f = Math.ceil(u / o), p = s.clone(), m = c.clone(), h = m.clone().add(new e.Vector3(0, 0, u)), g = p.clone().add(new e.Vector3(0, 0, u)), _ = new e.Vector3().subVectors(m, p).normalize(), v = _.clone().negate();
|
|
552
|
+
new e.Vector3().subVectors(h, p).normalize().clone().negate();
|
|
553
|
+
let y = a / 2;
|
|
535
554
|
o / 2;
|
|
536
|
-
let
|
|
537
|
-
n(p,
|
|
538
|
-
let { newOriginalPoints:
|
|
539
|
-
i.originalPoints =
|
|
555
|
+
let b = l * u / (a * o);
|
|
556
|
+
n(p, g, _, a, y, f, d, b, i), n(m, h, v, a, y, f, d, b, i), i.start = p, i.end = m;
|
|
557
|
+
let { newOriginalPoints: x } = ie(p, m, i.originalPoints);
|
|
558
|
+
i.originalPoints = x;
|
|
540
559
|
}
|
|
541
|
-
},
|
|
560
|
+
}, B = (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) => {
|
|
542
561
|
let i = new e.Vector3();
|
|
543
562
|
return t.closestPointToPoint(n, !0, i), i.distanceTo(n) < r;
|
|
544
|
-
},
|
|
563
|
+
}, se = (e) => {
|
|
545
564
|
let t = 0, n = [];
|
|
546
565
|
for (let r = 0; r < e.length; r++) for (let i = r + 1; i < e.length; i++) {
|
|
547
566
|
let a = e[r].distanceTo(e[i]);
|
|
548
567
|
a > t && (t = a, n = [e[r], e[i]]);
|
|
549
568
|
}
|
|
550
569
|
return n;
|
|
551
|
-
},
|
|
570
|
+
}, V = (e, t, n = .03) => Math.abs(e.x - t.x) < n && Math.abs(e.y - t.y) < n && Math.abs(e.z - t.z) < n, ce = (e) => {
|
|
552
571
|
let t = [];
|
|
553
572
|
e.children.forEach((e) => {
|
|
554
573
|
e.type == "GridHelper" || e.type == "DirectionalLight" || e.type == "AmbientLight" || t.push(e);
|
|
555
574
|
}), t.forEach((t) => {
|
|
556
|
-
e.remove(t),
|
|
575
|
+
e.remove(t), ue(t);
|
|
557
576
|
});
|
|
558
|
-
},
|
|
559
|
-
function
|
|
577
|
+
}, le = () => `#${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}${Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0")}`;
|
|
578
|
+
function ue(e) {
|
|
560
579
|
for (; e.children && e.children.length > 0;) {
|
|
561
580
|
let t = e.children[0];
|
|
562
|
-
e.remove(t),
|
|
581
|
+
e.remove(t), ue(t);
|
|
563
582
|
}
|
|
564
|
-
e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) =>
|
|
583
|
+
e.geometry && e.geometry.dispose(), e.material && (Array.isArray(e.material) ? e.material.forEach((e) => de(e)) : de(e.material));
|
|
565
584
|
}
|
|
566
|
-
function
|
|
585
|
+
function de(e) {
|
|
567
586
|
for (let t of Object.keys(e)) {
|
|
568
587
|
let n = e[t];
|
|
569
588
|
n && typeof n == "object" && typeof n.dispose == "function" && n.dispose();
|
|
@@ -572,7 +591,7 @@ function L(e) {
|
|
|
572
591
|
}
|
|
573
592
|
//#endregion
|
|
574
593
|
//#region src/geometry/handleWallSegment.mjs
|
|
575
|
-
var
|
|
594
|
+
var fe = class {
|
|
576
595
|
results;
|
|
577
596
|
clusterResults;
|
|
578
597
|
constructor() {
|
|
@@ -998,114 +1017,114 @@ var R = class {
|
|
|
998
1017
|
t.forEach((e, t) => {
|
|
999
1018
|
e.applyMatrix4(n[t].matrixWorld);
|
|
1000
1019
|
});
|
|
1001
|
-
let r =
|
|
1020
|
+
let r = w(t), i = n[0].material.clone(), a = new e.Mesh(r, i);
|
|
1002
1021
|
return a.name = "mergedWalls", a;
|
|
1003
1022
|
} catch (e) {
|
|
1004
1023
|
return console.error("合并网格时出错:", e), null;
|
|
1005
1024
|
}
|
|
1006
1025
|
}
|
|
1007
|
-
},
|
|
1026
|
+
}, pe = (e) => {
|
|
1008
1027
|
let t = {}, n = [], r = [], i = [];
|
|
1009
1028
|
return e[0].width, e[0].height, e.forEach((e) => {
|
|
1010
1029
|
r.push(...e.vertices), i.push(e.center), n.push(e.vertices);
|
|
1011
1030
|
}), t.originalVertices = n, t.allCenterPoints = i, t;
|
|
1012
|
-
},
|
|
1013
|
-
let t = new
|
|
1031
|
+
}, me = (e) => {
|
|
1032
|
+
let t = new d().copy(e.start).add(e.end).multiplyScalar(.5), n = new d().subVectors(new d(t.x, t.y, t.z + 1), t).normalize(), r = new d(e.direction.x, e.direction.y, 0);
|
|
1014
1033
|
r.applyAxisAngle(n, Math.PI / 2);
|
|
1015
|
-
let i = new
|
|
1034
|
+
let i = new d().copy(t).add(r.clone().multiplyScalar(e.length)), a = new d().copy(t).sub(r.clone().multiplyScalar(e.length));
|
|
1016
1035
|
return t.z = e.start.z, i.z = e.start.z, a.z = e.start.z, {
|
|
1017
1036
|
start: i,
|
|
1018
1037
|
end: a,
|
|
1019
1038
|
center: t,
|
|
1020
1039
|
direction: r
|
|
1021
1040
|
};
|
|
1022
|
-
},
|
|
1041
|
+
}, he = (t, n, r = !0) => {
|
|
1023
1042
|
let i = [];
|
|
1024
1043
|
if (!t) return [];
|
|
1025
|
-
for (let
|
|
1026
|
-
let
|
|
1027
|
-
if (!
|
|
1028
|
-
let
|
|
1029
|
-
|
|
1030
|
-
let
|
|
1031
|
-
if (
|
|
1032
|
-
let
|
|
1033
|
-
|
|
1034
|
-
let n = new
|
|
1035
|
-
|
|
1044
|
+
for (let a = 0; a < t.length; a++) {
|
|
1045
|
+
let o = t[a];
|
|
1046
|
+
if (!o) continue;
|
|
1047
|
+
let s = new e.Vector3(o.start.x, o.start.y, o.start.z);
|
|
1048
|
+
s.applyEuler(new e.Euler(-Math.PI / 2, 0, 0));
|
|
1049
|
+
let l = new e.Vector3(o.end.x, o.end.y, o.end.z);
|
|
1050
|
+
if (l.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), n.add(O(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;
|
|
1051
|
+
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 = [];
|
|
1052
|
+
o.originalPoints.forEach((e, t) => {
|
|
1053
|
+
let n = new d();
|
|
1054
|
+
u.projectPoint(e, n), f.push(n);
|
|
1036
1055
|
});
|
|
1037
|
-
let
|
|
1056
|
+
let p = new d(o.start.x, o.start.y, o.start.z).distanceTo(new d(o.end.x, o.end.y, o.end.z)), m = Math.abs(o.rooftopPz - o.start.z), h = new e.MeshBasicMaterial({
|
|
1038
1057
|
color: "red",
|
|
1039
1058
|
side: e.DoubleSide,
|
|
1040
1059
|
wireframe: !1,
|
|
1041
1060
|
transparent: !0,
|
|
1042
1061
|
opacity: .5
|
|
1043
|
-
}),
|
|
1044
|
-
|
|
1045
|
-
let
|
|
1062
|
+
}), g = new e.Group(), _ = new fe(), { horizontalSubdivisions: v, verticalSubdivisions: y } = _.initLimits4(p, m), b = _.createSubdividedWallPlane(o, y, v, h, g);
|
|
1063
|
+
_.analyzePointDistribution(b, f, .01);
|
|
1064
|
+
let x = new e.MeshBasicMaterial({
|
|
1046
1065
|
color: "black",
|
|
1047
1066
|
transparent: !0,
|
|
1048
1067
|
opacity: .8,
|
|
1049
1068
|
side: e.DoubleSide
|
|
1050
|
-
}),
|
|
1051
|
-
for (let e of
|
|
1052
|
-
let t =
|
|
1053
|
-
t &&
|
|
1069
|
+
}), S = _.highlightEmptySegments(b, x, g), C = [];
|
|
1070
|
+
for (let e of S.clusters) {
|
|
1071
|
+
let t = pe(e);
|
|
1072
|
+
t && C.push(t);
|
|
1054
1073
|
}
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1074
|
+
let w = me(o).direction;
|
|
1075
|
+
o.checkResults = C, o.verticalDirection = w, o.originaIndex = a, i.push(o);
|
|
1057
1076
|
}
|
|
1058
1077
|
return i;
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1078
|
+
}, ge = async (t, n, r, i) => {
|
|
1079
|
+
ce(i);
|
|
1061
1080
|
let a = await fetch(t);
|
|
1062
1081
|
if (!a) return;
|
|
1063
|
-
let o = await a.json(), s = new e.Group(),
|
|
1082
|
+
let o = await a.json(), s = new e.Group(), c = new e.Group(), l = new e.Group(), u = new e.Group(), d = new e.Group(), f = new e.Group(), p = new e.Group(), m = new e.Group();
|
|
1064
1083
|
for (let t = 0; t < o.length; t++) {
|
|
1065
1084
|
let n = o[t];
|
|
1066
1085
|
if (!n) continue;
|
|
1067
1086
|
let r = new e.Vector3(n.start.x, n.start.y, n.start.z);
|
|
1068
1087
|
r.applyEuler(new e.Euler(-Math.PI / 2, 0, 0));
|
|
1069
1088
|
let i = new e.Vector3(n.end.x, n.end.y, n.end.z);
|
|
1070
|
-
i.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)),
|
|
1089
|
+
i.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(O(String(t), new e.Vector3((r.x + i.x) / 2, (r.y + i.y) / 2, (r.z + i.z) / 2)));
|
|
1071
1090
|
}
|
|
1072
1091
|
o.sort((e, t) => e.originalIndex - t.originalIndex), console.log("lins", o);
|
|
1073
|
-
let
|
|
1074
|
-
if (!
|
|
1075
|
-
let
|
|
1076
|
-
if (console.log("respcd",
|
|
1077
|
-
let
|
|
1078
|
-
for (let t = 0; t <
|
|
1079
|
-
let n =
|
|
1092
|
+
let h = await fetch(n);
|
|
1093
|
+
if (!h) return;
|
|
1094
|
+
let g = await h.json(), _ = Array.isArray(g) ? g : Object.values(g), v = await fetch(r);
|
|
1095
|
+
if (console.log("respcd", v), !v) return;
|
|
1096
|
+
let y = await v.json(), b = 0;
|
|
1097
|
+
for (let t = 0; t < y.length; t++) {
|
|
1098
|
+
let n = y[t];
|
|
1080
1099
|
if (n.isFindBeam = !1, n.category == "door") {
|
|
1081
1100
|
let t = new e.Vector3(n.center.x, n.center.y, n.center.z);
|
|
1082
|
-
t.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)),
|
|
1101
|
+
t.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), m.add(O(`door:${b}`, t)), b++;
|
|
1083
1102
|
}
|
|
1084
1103
|
}
|
|
1085
|
-
i.add(
|
|
1086
|
-
let { beamGroup:
|
|
1087
|
-
console.timeEnd(), console.log("beamGroup",
|
|
1088
|
-
let
|
|
1104
|
+
i.add(m), console.time();
|
|
1105
|
+
let { beamGroup: x } = await _e(o, _, y, i);
|
|
1106
|
+
console.timeEnd(), console.log("beamGroup", x);
|
|
1107
|
+
let S = new e.MeshBasicMaterial({
|
|
1089
1108
|
color: "#cffd00",
|
|
1090
1109
|
transparent: !0,
|
|
1091
1110
|
opacity: .4,
|
|
1092
1111
|
side: e.DoubleSide
|
|
1093
|
-
}),
|
|
1112
|
+
}), C = new e.MeshBasicMaterial({
|
|
1094
1113
|
color: "#ff0000",
|
|
1095
1114
|
transparent: !0,
|
|
1096
1115
|
opacity: .4,
|
|
1097
1116
|
side: e.DoubleSide
|
|
1098
|
-
}),
|
|
1117
|
+
}), T = new e.MeshBasicMaterial({
|
|
1099
1118
|
color: "#e100ff",
|
|
1100
1119
|
transparent: !0,
|
|
1101
1120
|
opacity: .4,
|
|
1102
1121
|
side: e.DoubleSide
|
|
1103
|
-
}),
|
|
1122
|
+
}), E = new e.MeshBasicMaterial({
|
|
1104
1123
|
color: "#0400ff",
|
|
1105
1124
|
transparent: !0,
|
|
1106
1125
|
opacity: .4,
|
|
1107
1126
|
side: e.DoubleSide
|
|
1108
|
-
}),
|
|
1127
|
+
}), D = new e.LineBasicMaterial({ color: "#cffd00" }), k = [];
|
|
1109
1128
|
for (let t = 0; t < o.length; t++) {
|
|
1110
1129
|
let n = o[t];
|
|
1111
1130
|
if (n.checkResults) for (let t of n.checkResults) for (let n of t.originalVertices) {
|
|
@@ -1132,12 +1151,12 @@ var R = class {
|
|
|
1132
1151
|
3
|
|
1133
1152
|
]), o.computeVertexNormals();
|
|
1134
1153
|
let c = new e.EdgesGeometry(o, 1);
|
|
1135
|
-
|
|
1154
|
+
k.push(c);
|
|
1136
1155
|
}
|
|
1137
1156
|
}
|
|
1138
|
-
if (
|
|
1139
|
-
let t =
|
|
1140
|
-
t.rotateX(-Math.PI / 2), s.add(new e.LineSegments(t,
|
|
1157
|
+
if (k.length > 0) {
|
|
1158
|
+
let t = w(k, !1);
|
|
1159
|
+
t.rotateX(-Math.PI / 2), s.add(new e.LineSegments(t, D)), s.visible = !1, i.add(s), k.forEach((e) => e.dispose());
|
|
1141
1160
|
}
|
|
1142
1161
|
new e.PointsMaterial({
|
|
1143
1162
|
color: 65535,
|
|
@@ -1150,36 +1169,36 @@ var R = class {
|
|
|
1150
1169
|
n[t * 3] = e.x, n[t * 3 + 1] = e.y, n[t * 3 + 2] = e.z;
|
|
1151
1170
|
});
|
|
1152
1171
|
let r = new e.BufferGeometry();
|
|
1153
|
-
r.setAttribute("position", new e.BufferAttribute(n, 3)), r.rotateX(-Math.PI / 2),
|
|
1154
|
-
color:
|
|
1172
|
+
r.setAttribute("position", new e.BufferAttribute(n, 3)), r.rotateX(-Math.PI / 2), c.add(new e.Points(r, new e.PointsMaterial({
|
|
1173
|
+
color: le(),
|
|
1155
1174
|
size: .02
|
|
1156
1175
|
})));
|
|
1157
1176
|
let i = [];
|
|
1158
1177
|
i.push(new e.Vector3(t.start.x, t.start.y, t.start.z)), i.push(new e.Vector3(t.end.x, t.end.y, t.end.z));
|
|
1159
1178
|
let a = new e.BufferGeometry();
|
|
1160
|
-
a.setFromPoints(i), a.rotateX(-Math.PI / 2),
|
|
1179
|
+
a.setFromPoints(i), a.rotateX(-Math.PI / 2), f.add(new e.Line(a, D));
|
|
1161
1180
|
}
|
|
1162
|
-
|
|
1163
|
-
let
|
|
1164
|
-
for (let t = 0; t <
|
|
1181
|
+
f.visible = !1, i.add(c), i.add(f);
|
|
1182
|
+
let A = [], j = [], M = new e.LineBasicMaterial({ color: "#f30606" }), P = new e.MeshBasicMaterial({ color: "#071ac4" });
|
|
1183
|
+
for (let t = 0; t < _.length; t++) {
|
|
1165
1184
|
let n = new e.SphereGeometry(.05);
|
|
1166
|
-
n.translate(
|
|
1167
|
-
let r = [], i = new e.Vector3(
|
|
1185
|
+
n.translate(_[t].x, _[t].y, _[t].z);
|
|
1186
|
+
let r = [], i = new e.Vector3(_[t].x, _[t].y, _[t].z), a = new e.Quaternion(_[t].qx, _[t].qy, _[t].qz, _[t].qw), o = new e.Vector3(0, 0, -1).applyQuaternion(a), s = i.clone().addScaledVector(o, .001);
|
|
1168
1187
|
r.push(i), r.push(s);
|
|
1169
1188
|
let c = new e.BufferGeometry();
|
|
1170
|
-
c.setFromPoints(r),
|
|
1189
|
+
c.setFromPoints(r), j.push(c), A.push(n);
|
|
1171
1190
|
}
|
|
1172
|
-
if (
|
|
1173
|
-
let t =
|
|
1174
|
-
t.rotateX(-Math.PI / 2),
|
|
1191
|
+
if (A.length > 0) {
|
|
1192
|
+
let t = w(A, !1);
|
|
1193
|
+
t.rotateX(-Math.PI / 2), l.add(new e.Mesh(t, P)), A.forEach((e) => e.dispose());
|
|
1175
1194
|
}
|
|
1176
|
-
if (
|
|
1177
|
-
let t =
|
|
1178
|
-
t.rotateX(-Math.PI / 2),
|
|
1195
|
+
if (j.length > 0) {
|
|
1196
|
+
let t = w(j, !1);
|
|
1197
|
+
t.rotateX(-Math.PI / 2), l.add(new e.Line(t, M)), j.forEach((e) => e.dispose());
|
|
1179
1198
|
}
|
|
1180
|
-
i.add(
|
|
1181
|
-
let { AiProjectionGroup:
|
|
1182
|
-
return
|
|
1199
|
+
i.add(l);
|
|
1200
|
+
let { AiProjectionGroup: F, AiProjectionGroup2: I } = N(y);
|
|
1201
|
+
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) => {
|
|
1183
1202
|
t.doorAndBeamData && t.doorAndBeamData.length > 0 && (t.doorAndBeamData.forEach((t) => {
|
|
1184
1203
|
if (t.beamStart) {
|
|
1185
1204
|
let n = new e.BufferGeometry(), r = new Float32Array([
|
|
@@ -1203,7 +1222,7 @@ var R = class {
|
|
|
1203
1222
|
0,
|
|
1204
1223
|
2,
|
|
1205
1224
|
3
|
|
1206
|
-
]), n.computeVertexNormals(), n.rotateX(-Math.PI / 2),
|
|
1225
|
+
]), n.computeVertexNormals(), n.rotateX(-Math.PI / 2), p.add(new e.Mesh(n, S));
|
|
1207
1226
|
}
|
|
1208
1227
|
let n = new e.BufferGeometry(), r = new Float32Array([
|
|
1209
1228
|
t.doorStart.x,
|
|
@@ -1226,22 +1245,22 @@ var R = class {
|
|
|
1226
1245
|
0,
|
|
1227
1246
|
2,
|
|
1228
1247
|
3
|
|
1229
|
-
]), n.computeVertexNormals(), n.rotateX(-Math.PI / 2), t.isDoor ?
|
|
1248
|
+
]), 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));
|
|
1230
1249
|
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);
|
|
1231
|
-
a.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)),
|
|
1232
|
-
}), i.add(
|
|
1250
|
+
a.applyEuler(new e.Euler(-Math.PI / 2, 0, 0)), p.add(O(i, a));
|
|
1251
|
+
}), i.add(p));
|
|
1233
1252
|
}), {
|
|
1234
1253
|
checkResultGroup: s,
|
|
1235
|
-
pointCloudGroup:
|
|
1236
|
-
runData:
|
|
1237
|
-
pcdGroup:
|
|
1238
|
-
pcdGroup2:
|
|
1239
|
-
pointLineGroup:
|
|
1240
|
-
beamDoorGroup:
|
|
1241
|
-
lineIndexGroup:
|
|
1254
|
+
pointCloudGroup: c,
|
|
1255
|
+
runData: l,
|
|
1256
|
+
pcdGroup: u,
|
|
1257
|
+
pcdGroup2: d,
|
|
1258
|
+
pointLineGroup: f,
|
|
1259
|
+
beamDoorGroup: p,
|
|
1260
|
+
lineIndexGroup: m
|
|
1242
1261
|
};
|
|
1243
|
-
},
|
|
1244
|
-
if (
|
|
1262
|
+
}, _e = async (t, n, r, i) => {
|
|
1263
|
+
if (ae(t, i), t.length <= 0 || n.length <= 0) return t;
|
|
1245
1264
|
r ||= [];
|
|
1246
1265
|
for (let n of t) {
|
|
1247
1266
|
let t = [];
|
|
@@ -1280,11 +1299,11 @@ var R = class {
|
|
|
1280
1299
|
gridHeight: -1,
|
|
1281
1300
|
centerPts: []
|
|
1282
1301
|
});
|
|
1283
|
-
let i = l.get(n), [o, s, f, p] = a[t],
|
|
1284
|
-
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(
|
|
1302
|
+
let i = l.get(n), [o, s, f, p] = a[t], m = new e.Vector3().add(o).add(s).add(f).add(p).multiplyScalar(.25);
|
|
1303
|
+
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) {
|
|
1285
1304
|
let t = new e.Vector3().subVectors(o, s).normalize();
|
|
1286
1305
|
d = o.distanceTo(p), u = o.distanceTo(s);
|
|
1287
|
-
let n =
|
|
1306
|
+
let n = A(t, new e.Vector3(0, 0, 1));
|
|
1288
1307
|
n && n.parallel && ([d, u] = [u, d]);
|
|
1289
1308
|
}
|
|
1290
1309
|
i.gridWidth = u, i.gridHeight = d;
|
|
@@ -1323,7 +1342,7 @@ var R = class {
|
|
|
1323
1342
|
r[2],
|
|
1324
1343
|
r[1]
|
|
1325
1344
|
]);
|
|
1326
|
-
let o =
|
|
1345
|
+
let o = L(r[0], r[3], !0), s = L(r[1], r[2], !0);
|
|
1327
1346
|
c.push({
|
|
1328
1347
|
doorStartPt: o,
|
|
1329
1348
|
doorEndPt: s,
|
|
@@ -1340,8 +1359,8 @@ var R = class {
|
|
|
1340
1359
|
let r = c[n];
|
|
1341
1360
|
for (let n = 0; n < t.length; n++) {
|
|
1342
1361
|
if (t[n].length < .5) continue;
|
|
1343
|
-
let i = [], a =
|
|
1344
|
-
i.push(a), i.push(
|
|
1362
|
+
let i = [], a = L(t[n].start, t[n].end, !0);
|
|
1363
|
+
i.push(a), i.push(L(a, t[n].start, !0)), i.push(L(a, t[n].end, !0));
|
|
1345
1364
|
let o = !1, s = r.boxPoints.length;
|
|
1346
1365
|
for (let e = 0; e < i.length; e++) {
|
|
1347
1366
|
let t = i[e].x, n = i[e].y;
|
|
@@ -1352,12 +1371,12 @@ var R = class {
|
|
|
1352
1371
|
if (o) break;
|
|
1353
1372
|
}
|
|
1354
1373
|
if (o) {
|
|
1355
|
-
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 =
|
|
1374
|
+
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 = F(r.doorStartPt, r.doorEndPt, i, a);
|
|
1356
1375
|
if (Math.abs(s - o) < .5 && c && c.isParallel) {
|
|
1357
1376
|
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);
|
|
1358
1377
|
break;
|
|
1359
1378
|
} else if (Math.abs(s - o) > 1.3 && c && c.isParallel) {
|
|
1360
|
-
let e =
|
|
1379
|
+
let e = R(r.doorStartPt, r.doorEndPt, i, a), t = r.doorStartPt.distanceTo(i), n = r.doorStartPt.distanceTo(a), o = r.doorEndPt.distanceTo(i), s = r.doorEndPt.distanceTo(a), c = t < .2 || n < .2 || o < .2 || s < .2;
|
|
1361
1380
|
if (e && e.type == "collinear_overlap" && e.maxPerpendicularDistance < .1 && !c) {
|
|
1362
1381
|
r.inWall = !0;
|
|
1363
1382
|
break;
|
|
@@ -1366,455 +1385,455 @@ var R = class {
|
|
|
1366
1385
|
} else continue;
|
|
1367
1386
|
}
|
|
1368
1387
|
}
|
|
1369
|
-
let l = 0, u = [],
|
|
1388
|
+
let l = 0, u = [], d = [], f = [], p = [], m = .2;
|
|
1370
1389
|
for (let i = 0; i < t.length; i++) {
|
|
1371
1390
|
let a = t[i];
|
|
1372
1391
|
if (!a.mergeCheckRegion || a.mergeCheckRegion.length == 0) continue;
|
|
1373
1392
|
a.doorAndBeamData = [], a.completePointAreaPercentage = -1;
|
|
1374
1393
|
let o = new e.Box3();
|
|
1375
1394
|
o.setFromPoints(a.originalPoints);
|
|
1376
|
-
let
|
|
1377
|
-
if (
|
|
1378
|
-
let
|
|
1395
|
+
let h = o.max.z, g = o.min.z, _ = new e.Vector3(a.start.x, a.start.y, a.start.z), v = new e.Vector3(a.end.x, a.end.y, a.end.z), y = a.rooftopPz - a.start.z;
|
|
1396
|
+
if (y < s - .5 || y > s + 2) continue;
|
|
1397
|
+
let b = 0;
|
|
1379
1398
|
for (let o of a.mergeCheckRegion) {
|
|
1380
|
-
let { facePoints: s, boxArea:
|
|
1399
|
+
let { facePoints: s, boxArea: x, totalInPlaneNum: S } = P(o.points, o.gridWidth, o.gridHeight, o.centerPts);
|
|
1381
1400
|
if (!s || s.length <= 0) continue;
|
|
1382
1401
|
s[0].distanceTo(s[1]);
|
|
1383
|
-
let
|
|
1402
|
+
let C = s[0].distanceTo(s[3]), w = o.gridHeight * (C / o.gridHeight / 3 * 2) + o.gridHeight / 2, T = new e.Vector3(s[0].x, s[0].y, s[0].z + w), E = new e.Vector3(s[1].x, s[1].y, s[1].z + w), O = new e.Line3(T, E), k = [], j = new e.Vector3();
|
|
1384
1403
|
o.points.forEach((e) => {
|
|
1385
|
-
|
|
1404
|
+
O.closestPointToPoint(e, !0, j).distanceTo(e) < o.gridHeight + .01 && k.push(e);
|
|
1386
1405
|
});
|
|
1387
|
-
let
|
|
1406
|
+
let M = [], N = [];
|
|
1388
1407
|
for (;;) {
|
|
1389
1408
|
let e = [];
|
|
1390
|
-
for (let t = 0; t <
|
|
1391
|
-
for (let t = 0; t <
|
|
1392
|
-
for (let n = 0; n < e.length; n++) if (
|
|
1393
|
-
e.push(
|
|
1409
|
+
for (let t = 0; t < k.length; t++) N.includes(t) || e.length == 0 && (e.push(k[t]), N.push(t));
|
|
1410
|
+
for (let t = 0; t < k.length; t++) if (!N.includes(t)) {
|
|
1411
|
+
for (let n = 0; n < e.length; n++) if (k[t].distanceTo(e[n]) < o.gridWidth + .01) {
|
|
1412
|
+
e.push(k[t]), N.push(t), t = -1;
|
|
1394
1413
|
break;
|
|
1395
1414
|
}
|
|
1396
1415
|
}
|
|
1397
1416
|
if (e.length == 0) break;
|
|
1398
|
-
|
|
1417
|
+
M.push(e);
|
|
1399
1418
|
}
|
|
1400
|
-
let
|
|
1401
|
-
for (let t = 0; t <
|
|
1419
|
+
let ee = [];
|
|
1420
|
+
for (let t = 0; t < M.length; t++) {
|
|
1402
1421
|
let n = {
|
|
1403
1422
|
lineSt: new e.Vector3(),
|
|
1404
1423
|
lineEd: new e.Vector3(),
|
|
1405
1424
|
facePoints: []
|
|
1406
|
-
}, r = M
|
|
1407
|
-
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, s[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, s[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, s[2].z)), n.facePoints.push(new e.Vector3(r[0].x, r[0].y, s[2].z)),
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
let
|
|
1411
|
-
if (
|
|
1412
|
-
let
|
|
1413
|
-
if (
|
|
1414
|
-
let
|
|
1415
|
-
if (Math.abs(
|
|
1416
|
-
if (
|
|
1417
|
-
let n =
|
|
1425
|
+
}, r = se(M[t]);
|
|
1426
|
+
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, s[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, s[0].z)), n.facePoints.push(new e.Vector3(r[1].x, r[1].y, s[2].z)), n.facePoints.push(new e.Vector3(r[0].x, r[0].y, s[2].z)), ee.push(n));
|
|
1427
|
+
}
|
|
1428
|
+
b += o.area;
|
|
1429
|
+
let te = 0;
|
|
1430
|
+
if (S != 0 && (te = o.gridHeight * o.gridWidth * S), (o.area - te) / x * 100 > 70 && ee.length == 1 || ee.length > 1) for (let s = 0; s < ee.length; s++) {
|
|
1431
|
+
let b = ee[s], x = b.facePoints[0].distanceTo(b.facePoints[1]), S = b.facePoints[0].distanceTo(b.facePoints[3]), C = x / a.length * 100, w = a.rooftopPz - b.facePoints[2].z;
|
|
1432
|
+
if (S < 1.5 || h < b.facePoints[2].z || w > y / 3 * 2) continue;
|
|
1433
|
+
let T = !1, E = !1, O = !1, k = [], j = b.facePoints[2].clone(), M = b.facePoints[3].clone(), N = b.facePoints[0].clone(), P = b.facePoints[1].clone(), te = !1, z = -1;
|
|
1434
|
+
if (Math.abs(b.facePoints[0].z - a.start.z) < .25) {
|
|
1435
|
+
if (x > .17 && a.length > .5) {
|
|
1436
|
+
let n = B(_, N), r = B(_, P), o = B(v, N), s = B(v, P), c = .1;
|
|
1418
1437
|
if (n < c || r < c) {
|
|
1419
|
-
let { newOriginalPoints: r } =
|
|
1438
|
+
let { newOriginalPoints: r } = ie(N, P, a.originalPoints), o = [], s = [];
|
|
1420
1439
|
if (r.forEach((e) => {
|
|
1421
|
-
e.z >=
|
|
1440
|
+
e.z >= j.z ? o.push(e) : e.z <= N.z && s.push(e);
|
|
1422
1441
|
}), o.length > 10) {
|
|
1423
|
-
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,
|
|
1442
|
+
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;
|
|
1424
1443
|
for (let n = 0; n < t.length; n++) {
|
|
1425
1444
|
if (n == i) continue;
|
|
1426
|
-
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),
|
|
1427
|
-
if (
|
|
1428
|
-
if (
|
|
1429
|
-
let e =
|
|
1430
|
-
if (
|
|
1431
|
-
u = Infinity,
|
|
1445
|
+
let a = new e.Vector3(t[n].start.x, t[n].start.y, 0), c = new e.Vector3(t[n].end.x, t[n].end.y, 0), p = D(r, o, a, c), m = I(r, o, a, c);
|
|
1446
|
+
if (p != null) {
|
|
1447
|
+
if (m && m.angle > 85) {
|
|
1448
|
+
let e = p.point.distanceTo(r);
|
|
1449
|
+
if (p.point.distanceTo(o), e < .3) {
|
|
1450
|
+
u = Infinity, d = -1;
|
|
1432
1451
|
break;
|
|
1433
1452
|
}
|
|
1434
1453
|
}
|
|
1435
1454
|
continue;
|
|
1436
1455
|
}
|
|
1437
|
-
if (
|
|
1438
|
-
let t =
|
|
1456
|
+
if (m && m.angle > 65) {
|
|
1457
|
+
let t = F(r, o, new e.Line3(a, c).closestPointToPoint(r, !0, l), r);
|
|
1439
1458
|
if (!t || t.direction != "same") continue;
|
|
1440
|
-
let i = r.clone().addScaledVector(s, 10),
|
|
1441
|
-
if (
|
|
1442
|
-
let
|
|
1443
|
-
|
|
1444
|
-
} else if (
|
|
1445
|
-
let t = new e.Vector3(
|
|
1459
|
+
let i = r.clone().addScaledVector(s, 10), f = o.clone().addScaledVector(s.clone().negate(), 10), p = new e.Vector3().subVectors(c, a).normalize(), m = D(i, f, a.clone().addScaledVector(p.clone().negate(), .03), c.clone().addScaledVector(p, .03));
|
|
1460
|
+
if (m == null) continue;
|
|
1461
|
+
let h = r.distanceTo(m.point);
|
|
1462
|
+
h < u && (u = h, d = n);
|
|
1463
|
+
} else if (m && m.angle < 5) {
|
|
1464
|
+
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(P.x, P.y, 0), r = B(t, a), i = B(t, c), o = B(n, a), s = B(n, c);
|
|
1446
1465
|
if (r < .08 || i < .08 || o < .08 || s < .08) {
|
|
1447
|
-
|
|
1466
|
+
f = !0, u = Infinity, d = -1;
|
|
1448
1467
|
break;
|
|
1449
1468
|
}
|
|
1450
1469
|
}
|
|
1451
1470
|
}
|
|
1452
|
-
if (u != Infinity && u < 2) t[
|
|
1453
|
-
else if (!
|
|
1454
|
-
let r = .05, a =
|
|
1471
|
+
if (u != Infinity && u < 2) t[d].length > .25 && x + u > .5 && (te = !0, n < c ? (M = M.addScaledVector(s, u), N = N.addScaledVector(s, u)) : (j = j.addScaledVector(s, u), P = P.addScaledVector(s, u)));
|
|
1472
|
+
else if (!f) {
|
|
1473
|
+
let r = .05, a = _.clone().addScaledVector(s, r), o = _.clone().addScaledVector(s.clone().negate(), r);
|
|
1455
1474
|
a.z = o.z = 0;
|
|
1456
1475
|
let l = !1;
|
|
1457
|
-
for (let
|
|
1458
|
-
if (
|
|
1459
|
-
let
|
|
1460
|
-
|
|
1461
|
-
let
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1464
|
-
let e =
|
|
1465
|
-
if (
|
|
1476
|
+
for (let d = 0; d < t.length; d++) {
|
|
1477
|
+
if (d == i) continue;
|
|
1478
|
+
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();
|
|
1479
|
+
f = f.clone().addScaledVector(m.clone().negate(), r), p = p.clone().addScaledVector(m, r);
|
|
1480
|
+
let h = D(a, o, f, p);
|
|
1481
|
+
if (h) {
|
|
1482
|
+
h.point.z = _.z;
|
|
1483
|
+
let e = h.point.distanceTo(_);
|
|
1484
|
+
if (h.point.distanceTo(v) < e) continue;
|
|
1466
1485
|
u > e && (u = e), l = !0;
|
|
1467
1486
|
}
|
|
1468
1487
|
if (l) break;
|
|
1469
|
-
u != Infinity && u < 2 && (n < c ? (
|
|
1488
|
+
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)));
|
|
1470
1489
|
}
|
|
1471
1490
|
if (!l) continue;
|
|
1472
1491
|
}
|
|
1473
1492
|
} else continue;
|
|
1474
1493
|
} else if (o < c || s < c) {
|
|
1475
|
-
let { newOriginalPoints: n } =
|
|
1494
|
+
let { newOriginalPoints: n } = ie(N, P, a.originalPoints), r = [], s = [];
|
|
1476
1495
|
if (n.forEach((e) => {
|
|
1477
|
-
e.z >=
|
|
1496
|
+
e.z >= j.z ? r.push(e) : e.z <= N.z && s.push(e);
|
|
1478
1497
|
}), r.length > 10) {
|
|
1479
|
-
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,
|
|
1498
|
+
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;
|
|
1480
1499
|
for (let a = 0; a < t.length; a++) {
|
|
1481
1500
|
if (a == i) continue;
|
|
1482
|
-
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),
|
|
1483
|
-
if (
|
|
1484
|
-
if (
|
|
1485
|
-
u = Infinity,
|
|
1501
|
+
let o = new e.Vector3(t[a].start.x, t[a].start.y, 0), c = new e.Vector3(t[a].end.x, t[a].end.y, 0), p = D(n, r, o, c), m = I(n, r, o, c);
|
|
1502
|
+
if (p != null) {
|
|
1503
|
+
if (m && m.angle > 85 && (p.point.distanceTo(n), p.point.distanceTo(r) < .3)) {
|
|
1504
|
+
u = Infinity, d = -1;
|
|
1486
1505
|
break;
|
|
1487
1506
|
}
|
|
1488
1507
|
continue;
|
|
1489
1508
|
}
|
|
1490
|
-
if (
|
|
1491
|
-
let t =
|
|
1509
|
+
if (m && m.angle > 65) {
|
|
1510
|
+
let t = F(r, n, new e.Line3(o, c).closestPointToPoint(r, !0, l), r);
|
|
1492
1511
|
if (!t || t.direction != "same") continue;
|
|
1493
|
-
let i = n.clone().addScaledVector(s.clone().negate(), 10),
|
|
1494
|
-
if (
|
|
1495
|
-
let
|
|
1496
|
-
|
|
1497
|
-
} else if (
|
|
1498
|
-
let t = new e.Vector3(
|
|
1512
|
+
let i = n.clone().addScaledVector(s.clone().negate(), 10), f = r.clone().addScaledVector(s, 10), p = new e.Vector3().subVectors(c, o).normalize(), m = D(i, f, o.clone().addScaledVector(p.clone().negate(), .03), c.clone().addScaledVector(p, .03));
|
|
1513
|
+
if (m == null) continue;
|
|
1514
|
+
let h = r.distanceTo(m.point);
|
|
1515
|
+
h < u && (u = h, d = a);
|
|
1516
|
+
} else if (m && m.angle < 5) {
|
|
1517
|
+
let t = new e.Vector3(N.x, N.y, 0), n = new e.Vector3(P.x, P.y, 0), r = B(t, o), i = B(t, c), a = B(n, o), s = B(n, c);
|
|
1499
1518
|
if (r < .08 || i < .08 || a < .08 || s < .08) {
|
|
1500
|
-
|
|
1519
|
+
f = !0, u = Infinity, d = -1;
|
|
1501
1520
|
break;
|
|
1502
1521
|
}
|
|
1503
1522
|
}
|
|
1504
1523
|
}
|
|
1505
|
-
if (u != Infinity && u < 2) t[
|
|
1506
|
-
else if (!
|
|
1507
|
-
let n = .05, r =
|
|
1524
|
+
if (u != Infinity && u < 2) t[d].length > .25 && x + u > .5 && (te = !0, o < c ? (M = M.addScaledVector(s, u), N = N.addScaledVector(s, u)) : (j = j.addScaledVector(s, u), P = P.addScaledVector(s, u)));
|
|
1525
|
+
else if (!f) {
|
|
1526
|
+
let n = .05, r = v.clone().addScaledVector(s, n), a = _.clone();
|
|
1508
1527
|
r.z = a.z = 0;
|
|
1509
1528
|
let l = !1;
|
|
1510
1529
|
for (let o = 0; o < t.length; o++) {
|
|
1511
1530
|
if (o == i) continue;
|
|
1512
|
-
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),
|
|
1513
|
-
s = s.clone().addScaledVector(
|
|
1514
|
-
let
|
|
1515
|
-
if (
|
|
1516
|
-
|
|
1517
|
-
let e =
|
|
1518
|
-
if (
|
|
1531
|
+
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();
|
|
1532
|
+
s = s.clone().addScaledVector(d.clone().negate(), n), c = c.clone().addScaledVector(d, n);
|
|
1533
|
+
let f = D(r, a, s, c);
|
|
1534
|
+
if (f) {
|
|
1535
|
+
f.point.z = v.z;
|
|
1536
|
+
let e = f.point.distanceTo(v);
|
|
1537
|
+
if (f.point.distanceTo(_) < e) continue;
|
|
1519
1538
|
u > e && (u = e), l = !0;
|
|
1520
1539
|
}
|
|
1521
1540
|
}
|
|
1522
1541
|
if (!l) continue;
|
|
1523
|
-
u != Infinity && u < 2 && (o < c ? (
|
|
1542
|
+
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)));
|
|
1524
1543
|
}
|
|
1525
1544
|
} else continue;
|
|
1526
1545
|
}
|
|
1527
|
-
|
|
1546
|
+
x = M.distanceTo(j);
|
|
1528
1547
|
}
|
|
1529
|
-
if (
|
|
1548
|
+
if (C < 85 && x > .35 || x > .7 && S > y - y / 3) {
|
|
1530
1549
|
let t = !1;
|
|
1531
1550
|
for (let r = 0; r < n.length; r++) {
|
|
1532
1551
|
let i = r + 1;
|
|
1533
1552
|
if (i >= n.length) continue;
|
|
1534
1553
|
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);
|
|
1535
|
-
if (
|
|
1554
|
+
if (D(new e.Vector3(a.x, a.y, 0), new e.Vector3(o.x, o.y, 0), new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), .1) != null) {
|
|
1536
1555
|
t = !0;
|
|
1537
1556
|
break;
|
|
1538
1557
|
}
|
|
1539
1558
|
}
|
|
1540
1559
|
for (let t = 0; t < c.length; t++) {
|
|
1541
|
-
let n = new e.Vector3(c[t].doorStartPt.x, c[t].doorStartPt.y, 0), i = new e.Vector3(c[t].doorEndPt.x, c[t].doorEndPt.y, 0), o = new e.Vector3(
|
|
1542
|
-
if (Math.abs(
|
|
1543
|
-
let l =
|
|
1560
|
+
let n = new e.Vector3(c[t].doorStartPt.x, c[t].doorStartPt.y, 0), i = new e.Vector3(c[t].doorEndPt.x, c[t].doorEndPt.y, 0), o = new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), s = new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), l = b.facePoints[2].z < c[t].maxZ || Math.abs(b.facePoints[2].z - c[t].maxZ) < .3;
|
|
1561
|
+
if (Math.abs(b.facePoints[2].z - c[t].maxZ), l) {
|
|
1562
|
+
let l = R(n.clone(), i.clone(), o.clone(), s.clone(), { distanceThreshold: 2 });
|
|
1544
1563
|
if (l && l.type == "collinear_gap") {
|
|
1545
|
-
let u =
|
|
1564
|
+
let u = L(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);
|
|
1546
1565
|
if (u.distanceTo(p) < .15) {
|
|
1547
1566
|
let a = o.distanceTo(n), u = s.distanceTo(n);
|
|
1548
1567
|
if (a > .25 && u > .25) {
|
|
1549
1568
|
let e = o.distanceTo(i), t = s.distanceTo(i);
|
|
1550
1569
|
if (e > .2 && t > .2) continue;
|
|
1551
1570
|
}
|
|
1552
|
-
|
|
1571
|
+
E = !0, O = !0, k.push(c[t].index), c[t].isFind = !0, z = t, r[c[t].index].isFindBeam = !0;
|
|
1553
1572
|
let d = new e.Vector3().subVectors(o, s).normalize(), f = n.distanceTo(i) - l.overlap;
|
|
1554
|
-
u < a && d.negate(), a > u ? (
|
|
1573
|
+
u < a && d.negate(), a > u ? (j = b.facePoints[2].clone().addScaledVector(d, f), M = b.facePoints[3].clone(), N = M.clone(), P = j.clone(), N.z = P.z = b.facePoints[0].z) : (j = b.facePoints[2].clone(), M = b.facePoints[3].clone().addScaledVector(d, f), N = M.clone(), P = j.clone(), N.z = P.z = b.facePoints[0].z);
|
|
1555
1574
|
}
|
|
1556
1575
|
} else if (l && l.type == "collinear_overlap" && l.maxPerpendicularDistance < .35) {
|
|
1557
1576
|
let a = o.distanceTo(s), u = i.distanceTo(n);
|
|
1558
1577
|
if (Math.abs(a - l.overlap) < .25 || Math.abs(u - l.overlap) < .25) {
|
|
1559
1578
|
if (u > a && Math.abs(u - l.overlap) > 1) {
|
|
1560
1579
|
let t = o.distanceTo(n), r = o.distanceTo(i), a = s.distanceTo(n), c = s.distanceTo(i), d = t < r ? t : r, f = a < c ? a : c, p = new e.Vector3().subVectors(o, s).normalize(), m = u - l.overlap;
|
|
1561
|
-
d < f ? (p.negate(),
|
|
1580
|
+
d < f ? (p.negate(), j = b.facePoints[2].clone().addScaledVector(p, m), M = b.facePoints[3].clone(), N = M.clone(), P = j.clone(), N.z = P.z = b.facePoints[0].z) : (j = b.facePoints[2].clone(), M = b.facePoints[3].clone().addScaledVector(p, m), N = M.clone(), P = j.clone(), N.z = P.z = b.facePoints[0].z);
|
|
1562
1581
|
}
|
|
1563
|
-
|
|
1582
|
+
E = !0, O = !0, k.push(c[t].index), c[t].isFind = !0, r[c[t].index].isFindBeam = !0, z = t;
|
|
1564
1583
|
}
|
|
1565
1584
|
}
|
|
1566
1585
|
}
|
|
1567
1586
|
}
|
|
1568
|
-
if (!
|
|
1587
|
+
if (!O) for (let t = 0; t < c.length; t++) {
|
|
1569
1588
|
if (c[t].inWall) continue;
|
|
1570
|
-
let n = new e.Vector3(c[t].doorStartPt.x, c[t].doorStartPt.y, 0), i = new e.Vector3(c[t].doorEndPt.x, c[t].doorEndPt.y, 0), a = new e.Vector3(
|
|
1571
|
-
(
|
|
1589
|
+
let n = new e.Vector3(c[t].doorStartPt.x, c[t].doorStartPt.y, 0), i = new e.Vector3(c[t].doorEndPt.x, c[t].doorEndPt.y, 0), a = new e.Vector3(b.facePoints[0].x, b.facePoints[0].y, 0), o = new e.Vector3(b.facePoints[1].x, b.facePoints[1].y, 0), s = new e.Vector3().subVectors(n, i).normalize(), l = new e.Vector3().subVectors(a, o).normalize(), u = .2, d = D(n.clone().addScaledVector(s, u), i.clone().addScaledVector(s.clone().negate(), u), a.clone().addScaledVector(l, u), o.clone().addScaledVector(l.clone().negate(), u)), f = b.facePoints[2].z < c[t].maxZ || Math.abs(b.facePoints[2].z - c[t].maxZ) < .3, p = n.distanceTo(a), h = n.distanceTo(o), g = i.distanceTo(a), _ = i.distanceTo(o);
|
|
1590
|
+
(p < m || h < m || g < m || _ < m || d) && f && (r[c[t].index].isFindBeam = !0, E = !0, c[t].isFind = !0, z = t);
|
|
1572
1591
|
}
|
|
1573
|
-
(
|
|
1592
|
+
(E || t || Math.abs(S - y) > .1 && S > y / 2 && x > .3 && Math.abs(g - a.start.z) < .4) && (T = !0);
|
|
1574
1593
|
}
|
|
1575
1594
|
}
|
|
1576
|
-
if (
|
|
1595
|
+
if (T) {
|
|
1577
1596
|
let n = !1;
|
|
1578
|
-
for (let e = 0; e <
|
|
1579
|
-
let t =
|
|
1597
|
+
for (let e = 0; e < f.length; e++) {
|
|
1598
|
+
let t = R(f[e].start, f[e].end, N, P);
|
|
1580
1599
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .01) {
|
|
1581
1600
|
n = !0;
|
|
1582
1601
|
break;
|
|
1583
1602
|
}
|
|
1584
1603
|
}
|
|
1585
1604
|
if (n) {
|
|
1586
|
-
|
|
1605
|
+
z != -1 && (r[c[z].index].isFindBeam = !1, c[z].isFind = !1);
|
|
1587
1606
|
continue;
|
|
1588
1607
|
}
|
|
1589
|
-
|
|
1590
|
-
start:
|
|
1591
|
-
end:
|
|
1608
|
+
f.push({
|
|
1609
|
+
start: N,
|
|
1610
|
+
end: P
|
|
1592
1611
|
});
|
|
1593
1612
|
{
|
|
1594
|
-
let t = new e.Vector3().subVectors(
|
|
1613
|
+
let t = new e.Vector3().subVectors(N, P), n = new e.Vector3().subVectors(P, N), r = Infinity, i = Infinity, o = N.clone(), s = P.clone(), c = [];
|
|
1595
1614
|
if (a.originalPoints.forEach((e) => {
|
|
1596
|
-
e.z -
|
|
1615
|
+
e.z - N.z < S / 2 + .1 && e.z - N.z > S / 2 - .1 && c.push(e);
|
|
1597
1616
|
}), c.length > 0) {
|
|
1598
|
-
let { newProjectPoints: a } =
|
|
1599
|
-
for (let e of a) e.z =
|
|
1617
|
+
let { newProjectPoints: a } = ie(N, P, c);
|
|
1618
|
+
for (let e of a) e.z = N.z;
|
|
1600
1619
|
a.forEach((a) => {
|
|
1601
|
-
let c = new e.Vector3(a.x, a.y,
|
|
1620
|
+
let c = new e.Vector3(a.x, a.y, N.z), l = new e.Vector3().subVectors(c, P), u = A(t, new e.Vector3().subVectors(c, N)), d = A(n, l);
|
|
1602
1621
|
if (u && u.parallel && u.sameDirection) {
|
|
1603
|
-
let e = c.distanceTo(
|
|
1622
|
+
let e = c.distanceTo(N);
|
|
1604
1623
|
e < r && (r = e, o = c);
|
|
1605
1624
|
} else if (d && d.parallel && d.sameDirection) {
|
|
1606
|
-
let e = c.distanceTo(
|
|
1625
|
+
let e = c.distanceTo(P);
|
|
1607
1626
|
e < i && (i = e, s = c);
|
|
1608
1627
|
}
|
|
1609
1628
|
});
|
|
1610
1629
|
}
|
|
1611
|
-
o.equals(
|
|
1630
|
+
o.equals(N) || (N = o, M = new e.Vector3(N.x, N.y, M.z)), s.equals(P) || (P = s, j = new e.Vector3(P.x, P.y, j.z));
|
|
1612
1631
|
}
|
|
1613
|
-
let s =
|
|
1614
|
-
if (s < .4 && !
|
|
1615
|
-
|
|
1616
|
-
let
|
|
1632
|
+
let s = P.distanceTo(N);
|
|
1633
|
+
if (s < .4 && !E || s < .3 && E) continue;
|
|
1634
|
+
d.includes(i) || d.push(i), a.checkResults[o.index].isDoor = !0;
|
|
1635
|
+
let m = "", h = {
|
|
1617
1636
|
id: l,
|
|
1618
|
-
beamStart:
|
|
1619
|
-
beamEnd:
|
|
1620
|
-
beamHeight: a.rooftopPz -
|
|
1621
|
-
doorStart:
|
|
1622
|
-
doorEnd:
|
|
1623
|
-
doorHeight:
|
|
1637
|
+
beamStart: j,
|
|
1638
|
+
beamEnd: M,
|
|
1639
|
+
beamHeight: a.rooftopPz - b.facePoints[2].z,
|
|
1640
|
+
doorStart: N,
|
|
1641
|
+
doorEnd: P,
|
|
1642
|
+
doorHeight: S,
|
|
1624
1643
|
nearId: -1,
|
|
1625
|
-
type:
|
|
1626
|
-
isExtend:
|
|
1627
|
-
isDoor:
|
|
1628
|
-
isPullOutDoor:
|
|
1629
|
-
pcbDoorIndexs:
|
|
1630
|
-
},
|
|
1644
|
+
type: m,
|
|
1645
|
+
isExtend: te,
|
|
1646
|
+
isDoor: E,
|
|
1647
|
+
isPullOutDoor: O,
|
|
1648
|
+
pcbDoorIndexs: k
|
|
1649
|
+
}, g = !1, _ = new e.Vector3(), v = new e.Vector3(), y = -1;
|
|
1631
1650
|
for (let n = 0; n < u.length; n++) {
|
|
1632
1651
|
let r = t[u[n].linesIndex].doorAndBeamData[u[n].doorIndex];
|
|
1633
1652
|
if (r.nearId != -1) continue;
|
|
1634
|
-
let i =
|
|
1653
|
+
let i = F(j.clone(), M.clone(), r.beamStart.clone(), r.beamEnd.clone());
|
|
1635
1654
|
if (i && i.isParallel) {
|
|
1636
|
-
let t =
|
|
1655
|
+
let t = j.distanceTo(M), n = r.beamStart.distanceTo(r.beamEnd), i = new e.Line3(j.clone(), M.clone());
|
|
1637
1656
|
i.start.z = 0, i.end.z = 0;
|
|
1638
|
-
let a =
|
|
1639
|
-
n > t && (i.start = new e.Vector3(r.beamStart.x, r.beamStart.y, 0), i.end = new e.Vector3(r.beamEnd.x, r.beamEnd.y, 0), a =
|
|
1640
|
-
let o = new e.Vector3(), s = i.closestPointToPoint(a, !0, o), c = s.distanceTo(a), u = new e.Vector3().subVectors(a, s).normalize(),
|
|
1641
|
-
if (c < .4 &&
|
|
1642
|
-
r.nearId = l,
|
|
1657
|
+
let a = L(r.beamStart, r.beamEnd, !0);
|
|
1658
|
+
n > t && (i.start = new e.Vector3(r.beamStart.x, r.beamStart.y, 0), i.end = new e.Vector3(r.beamEnd.x, r.beamEnd.y, 0), a = L(j, M, !0));
|
|
1659
|
+
let o = new e.Vector3(), s = i.closestPointToPoint(a, !0, o), c = s.distanceTo(a), u = new e.Vector3().subVectors(a, s).normalize(), d = u.clone().negate(), f = a.clone().addScaledVector(d, c + .1), p = D(i.start, i.end, a, f), m = !E && !r.isDoor && (t > n * 2 || n > t * 2);
|
|
1660
|
+
if (c < .4 && p != null && !m) {
|
|
1661
|
+
r.nearId = l, h.nearId = r.id;
|
|
1643
1662
|
let e = .8;
|
|
1644
|
-
(r.isDoor ||
|
|
1645
|
-
let i =
|
|
1646
|
-
t < n ? t > e && !r.isPullOutDoor ? (r.beamStart =
|
|
1663
|
+
(r.isDoor || h.isDoor) && (r.isDoor = !0, h.isDoor = !0);
|
|
1664
|
+
let i = k.some((e) => r.pcbDoorIndexs.includes(e));
|
|
1665
|
+
t < n ? t > e && !r.isPullOutDoor ? (r.beamStart = j.clone().addScaledVector(d, c), r.beamEnd = M.clone().addScaledVector(d, c), r.doorStart = N.clone().addScaledVector(d, c), r.doorEnd = P.clone().addScaledVector(d, c), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : !O || O && r.isPullOutDoor && i ? (h.beamStart = r.beamStart.clone().addScaledVector(u, c), h.beamEnd = r.beamEnd.clone().addScaledVector(u, c), h.doorStart = r.doorStart.clone().addScaledVector(u, c), h.doorEnd = r.doorEnd.clone().addScaledVector(u, c), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : (r.beamStart = j.clone().addScaledVector(d, c), r.beamEnd = M.clone().addScaledVector(d, c), r.doorStart = N.clone().addScaledVector(d, c), r.doorEnd = P.clone().addScaledVector(d, c), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : t > n && (n > e && !O ? (h.beamStart = r.beamStart.clone().addScaledVector(d, c), h.beamEnd = r.beamEnd.clone().addScaledVector(d, c), h.doorStart = r.doorStart.clone().addScaledVector(d, c), h.doorEnd = r.doorEnd.clone().addScaledVector(d, c), h.doorHeight = r.doorHeight, h.beamStart.z = h.beamEnd.z = h.doorStart.z + h.doorHeight) : !r.isPullOutDoor || O && r.isPullOutDoor && i ? (r.beamStart = j.clone().addScaledVector(u, c), r.beamEnd = M.clone().addScaledVector(u, c), r.doorStart = N.clone().addScaledVector(u, c), r.doorEnd = P.clone().addScaledVector(u, c), r.doorHeight = h.doorHeight, r.beamStart.z = r.beamEnd.z = r.doorStart.z + r.doorHeight) : (h.beamStart = r.beamStart.clone().addScaledVector(d, c), h.beamEnd = r.beamEnd.clone().addScaledVector(d, c), h.doorStart = r.doorStart.clone().addScaledVector(d, c), h.doorEnd = r.doorEnd.clone().addScaledVector(d, c), 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;
|
|
1647
1666
|
break;
|
|
1648
1667
|
}
|
|
1649
1668
|
}
|
|
1650
1669
|
}
|
|
1651
|
-
let
|
|
1652
|
-
if (!
|
|
1653
|
-
let a = new e.Line3(
|
|
1670
|
+
let C = !1;
|
|
1671
|
+
if (!g) {
|
|
1672
|
+
let a = new e.Line3(N.clone(), P.clone());
|
|
1654
1673
|
for (let o = 0; o < t.length; o++) {
|
|
1655
1674
|
if (t[o].length < .5 || o == i || !t[o].checkResults) continue;
|
|
1656
|
-
let s =
|
|
1675
|
+
let s = R(new e.Vector3(t[o].start.x, t[o].start.y, t[o].start.z), new e.Vector3(t[o].end.x, t[o].end.y, t[o].end.z), N, P);
|
|
1657
1676
|
if (s && s.maxPerpendicularDistance < .3) {
|
|
1658
1677
|
for (let i = 0; i < t[o].checkResults.length; i++) {
|
|
1659
1678
|
let i = [];
|
|
1660
1679
|
t[o].originalPoints.forEach((t) => {
|
|
1661
|
-
t.z >
|
|
1680
|
+
t.z > N.z && t.z < N.z + S / 2 && i.push(new e.Vector3(t.x, t.y, N.z));
|
|
1662
1681
|
});
|
|
1663
1682
|
let s = new e.Vector3(), l = [], u = [];
|
|
1664
1683
|
for (let e = 0; e < i.length; e++) {
|
|
1665
1684
|
let t = a.closestPointToPoint(i[e], !0, s);
|
|
1666
1685
|
t.distanceTo(i[e]) < .15 && (l.push(i[e]), u.push(t.clone()));
|
|
1667
1686
|
}
|
|
1668
|
-
for (let e = 0; e < u.length; e++)
|
|
1687
|
+
for (let e = 0; e < u.length; e++) oe(a, u[e]) && l.push(u[e]);
|
|
1669
1688
|
if (l = u, l.length < 500) continue;
|
|
1670
|
-
let d =
|
|
1689
|
+
let d = se(l);
|
|
1671
1690
|
if (d.length == 2) {
|
|
1672
1691
|
let e = d[0].distanceTo(d[1]);
|
|
1673
1692
|
if (Math.abs(e - a.distance()) < .3) {
|
|
1674
|
-
n = !0,
|
|
1693
|
+
n = !0, z != -1 && (r[c[z].index].isFindBeam = !1, c[z].isFind = !1);
|
|
1675
1694
|
break;
|
|
1676
1695
|
}
|
|
1677
1696
|
}
|
|
1678
1697
|
}
|
|
1679
1698
|
if (n) break;
|
|
1680
|
-
} else s && s.type == "collinear_overlap" && s.maxPerpendicularDistance > .3 && s.maxPerpendicularDistance < .7 && (
|
|
1699
|
+
} else s && s.type == "collinear_overlap" && s.maxPerpendicularDistance > .3 && s.maxPerpendicularDistance < .7 && (C = !0);
|
|
1681
1700
|
}
|
|
1682
1701
|
if (n) continue;
|
|
1683
1702
|
}
|
|
1684
|
-
let
|
|
1685
|
-
if (
|
|
1686
|
-
id:
|
|
1687
|
-
beamStart:
|
|
1688
|
-
beamEnd:
|
|
1689
|
-
}),
|
|
1703
|
+
let w = !1;
|
|
1704
|
+
if (y != -1) for (let e = 0; e < p.length && !(p[e].length == 1 && (p[e][0].id == l ? (p[e].push({
|
|
1705
|
+
id: y,
|
|
1706
|
+
beamStart: _,
|
|
1707
|
+
beamEnd: v
|
|
1708
|
+
}), w = !0) : p[e][0].id == y && (p[e].push({
|
|
1690
1709
|
id: l,
|
|
1691
|
-
beamStart:
|
|
1692
|
-
beamEnd:
|
|
1693
|
-
}),
|
|
1694
|
-
|
|
1710
|
+
beamStart: j,
|
|
1711
|
+
beamEnd: M
|
|
1712
|
+
}), w = !0), w)); e++);
|
|
1713
|
+
w || p.push([{
|
|
1695
1714
|
id: l,
|
|
1696
|
-
beamStart:
|
|
1697
|
-
beamEnd:
|
|
1715
|
+
beamStart: j,
|
|
1716
|
+
beamEnd: M
|
|
1698
1717
|
}]);
|
|
1699
|
-
let
|
|
1700
|
-
if (
|
|
1718
|
+
let T = h.doorStart.distanceTo(h.doorEnd);
|
|
1719
|
+
if (m = E ? "door" : T > 1.8 || C && T > 1 ? "beam" : "hole", h.type = m, h.nearId != -1 && m == "hole") {
|
|
1701
1720
|
let e = !1;
|
|
1702
1721
|
for (let n = 0; n < t.length; n++) if (t[n].doorAndBeamData) {
|
|
1703
1722
|
for (let r = 0; r < t[n].doorAndBeamData.length; r++) if (t[n].doorAndBeamData[r].nearId == l && t[n].doorAndBeamData[r].type == "beam") {
|
|
1704
|
-
t[n].doorAndBeamData[r].type =
|
|
1723
|
+
t[n].doorAndBeamData[r].type = m, e = !0;
|
|
1705
1724
|
break;
|
|
1706
1725
|
}
|
|
1707
1726
|
if (e) break;
|
|
1708
1727
|
}
|
|
1709
1728
|
}
|
|
1710
|
-
if (a.doorAndBeamData.push(
|
|
1729
|
+
if (a.doorAndBeamData.push(h), u.push({
|
|
1711
1730
|
linesIndex: i,
|
|
1712
1731
|
doorIndex: a.doorAndBeamData.length - 1
|
|
1713
|
-
}), l++,
|
|
1732
|
+
}), l++, O && x < 2) break;
|
|
1714
1733
|
}
|
|
1715
1734
|
}
|
|
1716
1735
|
}
|
|
1717
|
-
let
|
|
1718
|
-
a.completePointAreaPercentage =
|
|
1736
|
+
let x = a.length * (a.rooftopPz - a.start.z);
|
|
1737
|
+
a.completePointAreaPercentage = b / x * 100;
|
|
1719
1738
|
}
|
|
1720
|
-
if (
|
|
1739
|
+
if (d.length > 1) for (let n = 0; n < d.length; n++) {
|
|
1721
1740
|
let r = [];
|
|
1722
|
-
for (let i = 0; i < t[
|
|
1723
|
-
let a = t[
|
|
1741
|
+
for (let i = 0; i < t[d[n]].doorAndBeamData.length; i++) {
|
|
1742
|
+
let a = t[d[n]].doorAndBeamData[i].doorStart.clone(), o = t[d[n]].doorAndBeamData[i].doorEnd.clone();
|
|
1724
1743
|
a.z = o.z = 0;
|
|
1725
1744
|
let s = a.distanceTo(o), c = !1;
|
|
1726
|
-
for (let r = 0; r <
|
|
1727
|
-
let i = t[
|
|
1745
|
+
for (let r = 0; r < d.length; r++) if (n != r) for (let n = 0; n < t[d[r]].doorAndBeamData.length; n++) {
|
|
1746
|
+
let i = t[d[r]].doorAndBeamData[n].doorStart.clone(), l = t[d[r]].doorAndBeamData[n].doorEnd.clone();
|
|
1728
1747
|
i.z = l.z = 0, i.distanceTo(l);
|
|
1729
|
-
let u =
|
|
1748
|
+
let u = R(a, o, i, l);
|
|
1730
1749
|
if (u.type == "collinear_overlap" && u.maxPerpendicularDistance < .2) {
|
|
1731
|
-
let t = new e.Line3(i, l), n =
|
|
1750
|
+
let t = new e.Line3(i, l), n = L(a, o), r = t.closestPointToPoint(n, !0, new e.Vector3()), d = n.distanceTo(r);
|
|
1732
1751
|
if (Math.abs(s - u.overlap) < .1 && d < .04) {
|
|
1733
1752
|
c = !0;
|
|
1734
1753
|
break;
|
|
1735
1754
|
}
|
|
1736
1755
|
}
|
|
1737
1756
|
}
|
|
1738
|
-
c || r.push(t[
|
|
1757
|
+
c || r.push(t[d[n]].doorAndBeamData[i]);
|
|
1739
1758
|
}
|
|
1740
|
-
r.length != t[
|
|
1759
|
+
r.length != t[d[n]].doorAndBeamData.length && (t[d[n]].doorAndBeamData = r);
|
|
1741
1760
|
}
|
|
1742
|
-
let
|
|
1761
|
+
let h = .65, g = [], _ = [];
|
|
1743
1762
|
for (let n = 0; n < c.length; n++) {
|
|
1744
1763
|
if (c[n].isFind) continue;
|
|
1745
1764
|
let i = new e.Vector3(c[n].doorStartPt.x, c[n].doorStartPt.y, 0), a = new e.Vector3(c[n].doorEndPt.x, c[n].doorEndPt.y, 0), o = new e.Vector3().subVectors(i, a).normalize();
|
|
1746
1765
|
for (let s = 0; s < t.length; s++) {
|
|
1747
1766
|
if (t[s].length < .7 || t[s].completePointAreaPercentage > 60) continue;
|
|
1748
|
-
let u = new e.Vector3(t[s].start.x, t[s].start.y, 0),
|
|
1749
|
-
|
|
1750
|
-
let
|
|
1751
|
-
if ((
|
|
1752
|
-
let o = i.distanceTo(u) < i.distanceTo(
|
|
1753
|
-
for (let
|
|
1754
|
-
if (
|
|
1755
|
-
let
|
|
1756
|
-
if (
|
|
1757
|
-
let
|
|
1758
|
-
if (
|
|
1759
|
-
else if (
|
|
1767
|
+
let u = new e.Vector3(t[s].start.x, t[s].start.y, 0), d = new e.Vector3(t[s].end.x, t[s].end.y, 0), f = 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(f, v), S = d.clone().addScaledVector(f.clone().negate(), v);
|
|
1768
|
+
D(y, b, x, S);
|
|
1769
|
+
let C = F(y, b, x, S), w = i.distanceTo(u) > a.distanceTo(u) ? a : i, T = w.distanceTo(u), E = w.distanceTo(d);
|
|
1770
|
+
if ((T < m || E < m) && C && !C.isParallel) {
|
|
1771
|
+
let o = i.distanceTo(u) < i.distanceTo(d) ? u : d, f = !1;
|
|
1772
|
+
for (let v = 0; v < t.length; v++) {
|
|
1773
|
+
if (v == s || g.includes(v) || t[v].length < .7) continue;
|
|
1774
|
+
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 = I(u, d, y, b), E = R(u, d, y, b), O = D(u, d, C, w), k = !0;
|
|
1775
|
+
if (O != null && (k = O.point.distanceTo(u) < m || O.point.distanceTo(d) < m), (T && T.angle > 85 || E && E.type == "collinear_gap") && k) {
|
|
1776
|
+
let m = new e.Line3(u, d), x = new e.Vector3(), S = m.closestPointToPoint(y, !0, x), C = m.closestPointToPoint(b, !0, x), w = S.distanceTo(y), T = C.distanceTo(b), E, D;
|
|
1777
|
+
if (w > T && T > h) E = b, D = C;
|
|
1778
|
+
else if (w < T && w > h) E = y, D = S;
|
|
1760
1779
|
else continue;
|
|
1761
|
-
if (
|
|
1762
|
-
let
|
|
1763
|
-
if (!
|
|
1764
|
-
let
|
|
1765
|
-
if (
|
|
1766
|
-
|
|
1767
|
-
let
|
|
1768
|
-
for (let e = 0; e <
|
|
1769
|
-
let t =
|
|
1780
|
+
if (w = o.distanceTo(y), T = o.distanceTo(b), w > 2 && T > 2) continue;
|
|
1781
|
+
let O = F(E, D, y, b);
|
|
1782
|
+
if (!O || !O.isParallel) continue;
|
|
1783
|
+
let k = R(i, a, E, D);
|
|
1784
|
+
if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < .2) continue;
|
|
1785
|
+
E.z = D.z = t[v].start.z;
|
|
1786
|
+
let A = !1;
|
|
1787
|
+
for (let e = 0; e < _.length; e++) {
|
|
1788
|
+
let t = R(_[e].start, _[e].end, E, D);
|
|
1770
1789
|
if (t && t.type == "collinear_overlap" && t.maxPerpendicularDistance < .2) {
|
|
1771
|
-
|
|
1790
|
+
A = !0;
|
|
1772
1791
|
break;
|
|
1773
1792
|
}
|
|
1774
1793
|
}
|
|
1775
|
-
if (
|
|
1794
|
+
if (A) continue;
|
|
1776
1795
|
for (let n = 0; n < t.length; n++) {
|
|
1777
1796
|
if (t[n].length < .5) continue;
|
|
1778
|
-
let r =
|
|
1797
|
+
let r = R(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);
|
|
1779
1798
|
if (r && r.type == "collinear_overlap" && r.maxPerpendicularDistance < .1) {
|
|
1780
|
-
|
|
1799
|
+
A = !0;
|
|
1781
1800
|
break;
|
|
1782
1801
|
}
|
|
1783
1802
|
}
|
|
1784
|
-
if (
|
|
1785
|
-
|
|
1786
|
-
start:
|
|
1787
|
-
end:
|
|
1788
|
-
}),
|
|
1789
|
-
let
|
|
1790
|
-
t[
|
|
1803
|
+
if (A) continue;
|
|
1804
|
+
_.push({
|
|
1805
|
+
start: E,
|
|
1806
|
+
end: D
|
|
1807
|
+
}), g.push(v);
|
|
1808
|
+
let j = t[v].rooftopPz - t[v].start.z, M = t[s].rooftopPz - t[s].start.z, N = j < M ? j : M;
|
|
1809
|
+
t[v].doorAndBeamData || (t[v].doorAndBeamData = []), t[v].doorAndBeamData.push({
|
|
1791
1810
|
id: l,
|
|
1792
|
-
beamStart:
|
|
1793
|
-
beamEnd:
|
|
1794
|
-
beamHeight:
|
|
1795
|
-
doorStart:
|
|
1796
|
-
doorEnd:
|
|
1797
|
-
doorHeight:
|
|
1811
|
+
beamStart: E,
|
|
1812
|
+
beamEnd: D,
|
|
1813
|
+
beamHeight: N,
|
|
1814
|
+
doorStart: E,
|
|
1815
|
+
doorEnd: D,
|
|
1816
|
+
doorHeight: N,
|
|
1798
1817
|
nearId: -1,
|
|
1799
1818
|
type: "onlyDoor",
|
|
1800
1819
|
isDoor: !0
|
|
1801
|
-
}), r[c[n].index].isFindBeam = !0, r[c[n].index].isFindOnlyDoor = !0,
|
|
1820
|
+
}), r[c[n].index].isFindBeam = !0, r[c[n].index].isFindOnlyDoor = !0, p.push([{
|
|
1802
1821
|
id: l,
|
|
1803
|
-
beamStart:
|
|
1804
|
-
beamEnd:
|
|
1805
|
-
}]), l++,
|
|
1822
|
+
beamStart: E,
|
|
1823
|
+
beamEnd: D
|
|
1824
|
+
}]), l++, f = !0;
|
|
1806
1825
|
break;
|
|
1807
1826
|
}
|
|
1808
1827
|
}
|
|
1809
|
-
if (
|
|
1828
|
+
if (f) break;
|
|
1810
1829
|
}
|
|
1811
1830
|
}
|
|
1812
1831
|
}
|
|
1813
1832
|
return {
|
|
1814
1833
|
lines: t,
|
|
1815
|
-
beamGroup:
|
|
1834
|
+
beamGroup: p
|
|
1816
1835
|
};
|
|
1817
|
-
},
|
|
1836
|
+
}, ve = (t, n) => {
|
|
1818
1837
|
if (t.length <= 0) return t;
|
|
1819
1838
|
for (let n of t) {
|
|
1820
1839
|
let t = [];
|
|
@@ -1852,11 +1871,11 @@ var R = class {
|
|
|
1852
1871
|
gridHeight: -1,
|
|
1853
1872
|
centerPts: []
|
|
1854
1873
|
});
|
|
1855
|
-
let i = l.get(n), [o, s, f, p] = a[t],
|
|
1856
|
-
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(
|
|
1874
|
+
let i = l.get(n), [o, s, f, p] = a[t], m = new e.Vector3().add(o).add(s).add(f).add(p).multiplyScalar(.25);
|
|
1875
|
+
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) {
|
|
1857
1876
|
let t = new e.Vector3().subVectors(o, s).normalize();
|
|
1858
1877
|
d = o.distanceTo(p), u = o.distanceTo(s);
|
|
1859
|
-
let n =
|
|
1878
|
+
let n = A(t, new e.Vector3(0, 0, 1));
|
|
1860
1879
|
n && n.parallel && ([d, u] = [u, d]);
|
|
1861
1880
|
}
|
|
1862
1881
|
i.gridWidth = u, i.gridHeight = d;
|
|
@@ -1887,7 +1906,7 @@ var R = class {
|
|
|
1887
1906
|
size: .01
|
|
1888
1907
|
});
|
|
1889
1908
|
for (let r = 0; r < t.length; r++) {
|
|
1890
|
-
let i = t[r], { minZ: o, maxZ: s } =
|
|
1909
|
+
let i = t[r], { minZ: o, maxZ: s } = re(i);
|
|
1891
1910
|
if (o == null || s == null) continue;
|
|
1892
1911
|
i.doorAndBeamData = [], i.completePointAreaPercentage = -1, s - o;
|
|
1893
1912
|
let c = i.rooftopPz - i.start.z;
|
|
@@ -1895,17 +1914,17 @@ var R = class {
|
|
|
1895
1914
|
let l = new e.Vector3(i.start.x, i.start.y, 0), u = new e.Vector3(i.end.x, i.end.y, 0);
|
|
1896
1915
|
for (let i = 0; i < t.length; i++) {
|
|
1897
1916
|
if (i == r || t[i].length < 1) continue;
|
|
1898
|
-
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 =
|
|
1899
|
-
if (!(
|
|
1900
|
-
let a =
|
|
1917
|
+
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 = F(l, u, o, c), f = L(l, u), p = new e.Line3(o, c).closestPointToPoint(f, !0, new e.Vector3()), m = f.distanceTo(p), h = re(a);
|
|
1918
|
+
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) {
|
|
1919
|
+
let a = L(l, u), s = L(o, c);
|
|
1901
1920
|
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));
|
|
1902
|
-
let d = `w:${t[r].originaIndex},b:${t[i].originaIndex}`,
|
|
1903
|
-
n.add(
|
|
1921
|
+
let d = `w:${t[r].originaIndex},b:${t[i].originaIndex}`, f = `b:${t[i].originaIndex},w:${t[r].originaIndex}`;
|
|
1922
|
+
n.add(O(d, a, { textColor: "#fd0000" })), n.add(O(f, s, { textColor: "#fd0000" }));
|
|
1904
1923
|
}
|
|
1905
1924
|
}
|
|
1906
1925
|
}
|
|
1907
1926
|
return t;
|
|
1908
|
-
},
|
|
1927
|
+
}, ye = (t, n) => {
|
|
1909
1928
|
let r = {
|
|
1910
1929
|
rectangles: [],
|
|
1911
1930
|
threeEdgeRect: []
|
|
@@ -1913,42 +1932,42 @@ var R = class {
|
|
|
1913
1932
|
for (let n = 0; n < t.length; n++) {
|
|
1914
1933
|
let c = t[n].length;
|
|
1915
1934
|
if (i.has(n) || c < a || c > o) continue;
|
|
1916
|
-
let l = [], 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 = new e.Vector3().subVectors(d, u).normalize().clone().negate(), p = new e.Vector3(),
|
|
1935
|
+
let l = [], 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 = new e.Vector3().subVectors(d, u).normalize().clone().negate(), p = new e.Vector3(), m = new e.Vector3(), h = new e.Vector3();
|
|
1917
1936
|
new e.Vector3();
|
|
1918
1937
|
for (let r = 0; r < t.length; r++) {
|
|
1919
1938
|
let i = t[r].length;
|
|
1920
1939
|
if (r == n || i < a || i > o) continue;
|
|
1921
|
-
let
|
|
1922
|
-
if (!
|
|
1923
|
-
let
|
|
1924
|
-
if (!(!
|
|
1925
|
-
|
|
1940
|
+
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 = I(u, d, g, _);
|
|
1941
|
+
if (!v || v.angle < 85) continue;
|
|
1942
|
+
let y = V(g, u), b = V(g, d), x = V(_, u), S = V(_, d);
|
|
1943
|
+
if (!(!y && !b && !x && !S)) {
|
|
1944
|
+
y || b ? (p = g.clone(), m = _.clone()) : (p = _.clone(), m = g.clone()), h = new e.Vector3().subVectors(m, p).normalize(), h.clone().negate();
|
|
1926
1945
|
for (let p = 0; p < t.length; p++) {
|
|
1927
|
-
let
|
|
1928
|
-
if (p == n || p == r ||
|
|
1929
|
-
let
|
|
1930
|
-
if (!
|
|
1931
|
-
let
|
|
1932
|
-
if (!
|
|
1946
|
+
let h = t[p].length;
|
|
1947
|
+
if (p == n || p == r || h < a || h > o) continue;
|
|
1948
|
+
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 = I(g, _, v, y);
|
|
1949
|
+
if (!b || b.angle < 85) continue;
|
|
1950
|
+
let x = V(v, m), S = V(y, m);
|
|
1951
|
+
if (!x && !S) continue;
|
|
1933
1952
|
new e.Vector3();
|
|
1934
|
-
let
|
|
1935
|
-
|
|
1936
|
-
let
|
|
1937
|
-
if (!(!
|
|
1953
|
+
let C = new e.Vector3(), w = new e.Vector3();
|
|
1954
|
+
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());
|
|
1955
|
+
let T = A(f, w, .1);
|
|
1956
|
+
if (!(!T || !T.parallel || !T.sameDirection)) {
|
|
1938
1957
|
for (let f = 0; f < t.length; f++) {
|
|
1939
1958
|
let m = t[f].length;
|
|
1940
1959
|
if (f == n || f == r || f == p || m < a || m > o) continue;
|
|
1941
|
-
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), _ =
|
|
1960
|
+
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), _ = I(h, g, v, y);
|
|
1942
1961
|
if (!_ || _.angle < 85) continue;
|
|
1943
|
-
let
|
|
1944
|
-
if (!
|
|
1962
|
+
let b = V(h, C), x = V(g, C);
|
|
1963
|
+
if (!b && !x) continue;
|
|
1945
1964
|
new e.Vector3();
|
|
1946
|
-
let
|
|
1947
|
-
|
|
1948
|
-
let w =
|
|
1949
|
-
if (!w && !
|
|
1950
|
-
let
|
|
1951
|
-
if (!(
|
|
1965
|
+
let S = new e.Vector3();
|
|
1966
|
+
b ? (h.clone(), S = g.clone()) : (g.clone(), S = h.clone());
|
|
1967
|
+
let w = V(S, u), T = V(S, d);
|
|
1968
|
+
if (!w && !T) continue;
|
|
1969
|
+
let E = c * i;
|
|
1970
|
+
if (!(E < s || E > 2)) {
|
|
1952
1971
|
l = [
|
|
1953
1972
|
n,
|
|
1954
1973
|
r,
|
|
@@ -1978,48 +1997,48 @@ var R = class {
|
|
|
1978
1997
|
}, 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;
|
|
1979
1998
|
for (let r = 0; r < t.length; r++) {
|
|
1980
1999
|
if (r == n) continue;
|
|
1981
|
-
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 =
|
|
2000
|
+
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 = V(i, u), s = V(a, u), c = V(i, d), l = V(a, d);
|
|
1982
2001
|
if (o || s ? f = !1 : (c || l) && (p = !1), !f && !p) break;
|
|
1983
2002
|
}
|
|
1984
2003
|
if (!f && !p) continue;
|
|
1985
|
-
let
|
|
1986
|
-
f || ([u, d] = [d, u]),
|
|
1987
|
-
let
|
|
2004
|
+
let m = new e.Vector3();
|
|
2005
|
+
f || ([u, d] = [d, u]), m = new e.Vector3().subVectors(d, u).normalize();
|
|
2006
|
+
let h = m.clone().negate();
|
|
1988
2007
|
for (let r = 0; r < t.length; r++) {
|
|
1989
2008
|
let f = t[r].length;
|
|
1990
2009
|
if (r == n || i.has(r) || f < a || f > o) continue;
|
|
1991
|
-
let p = new e.Vector3(t[r].start.x, t[r].start.y, t[r].start.z),
|
|
1992
|
-
if (!
|
|
1993
|
-
let
|
|
1994
|
-
if (!
|
|
2010
|
+
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 = I(u, d, p, m);
|
|
2011
|
+
if (!g || g.angle < 85) continue;
|
|
2012
|
+
let _ = V(p, d), v = V(m, d);
|
|
2013
|
+
if (!_ && !v) continue;
|
|
1995
2014
|
new e.Vector3();
|
|
1996
|
-
let
|
|
1997
|
-
|
|
2015
|
+
let y = new e.Vector3();
|
|
2016
|
+
_ ? (p.clone(), y = m.clone()) : (m.clone(), y = p.clone());
|
|
1998
2017
|
for (let d = 0; d < t.length; d++) {
|
|
1999
|
-
let
|
|
2000
|
-
if (d == n || d == r || i.has(d) ||
|
|
2001
|
-
let
|
|
2002
|
-
if (!
|
|
2003
|
-
let
|
|
2004
|
-
if (!
|
|
2005
|
-
let
|
|
2006
|
-
|
|
2007
|
-
let
|
|
2008
|
-
if (!
|
|
2009
|
-
let
|
|
2018
|
+
let g = t[d].length;
|
|
2019
|
+
if (d == n || d == r || i.has(d) || g < a || g > o) continue;
|
|
2020
|
+
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 = I(p, m, _, v);
|
|
2021
|
+
if (!b || b.angle < 85) continue;
|
|
2022
|
+
let x = V(_, y), S = V(v, y);
|
|
2023
|
+
if (!x && !S) continue;
|
|
2024
|
+
let C = new e.Vector3(), w = new e.Vector3();
|
|
2025
|
+
x ? (C = _.clone(), w = v.clone()) : (C = v.clone(), w = _.clone());
|
|
2026
|
+
let T = A(h, new e.Vector3().subVectors(w, C).normalize(), .1);
|
|
2027
|
+
if (!T || !T.parallel || !T.sameDirection) continue;
|
|
2028
|
+
let E = !0, D = !0;
|
|
2010
2029
|
for (let n = 0; n < t.length; n++) {
|
|
2011
2030
|
if (n == d) continue;
|
|
2012
|
-
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 =
|
|
2013
|
-
if (a || o ?
|
|
2031
|
+
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 = V(r, _), o = V(i, _), s = V(r, v), c = V(i, v);
|
|
2032
|
+
if (a || o ? E = !1 : (s || c) && (D = !1), !E && !D) break;
|
|
2014
2033
|
}
|
|
2015
|
-
if (!
|
|
2016
|
-
let
|
|
2017
|
-
if (!(
|
|
2034
|
+
if (!E && !D) continue;
|
|
2035
|
+
let O = c * f;
|
|
2036
|
+
if (!(O < s || O > 2)) {
|
|
2018
2037
|
l.indexs = [
|
|
2019
2038
|
n,
|
|
2020
2039
|
r,
|
|
2021
2040
|
d
|
|
2022
|
-
], l.missingEdge.start =
|
|
2041
|
+
], l.missingEdge.start = w, l.missingEdge.end = u;
|
|
2023
2042
|
break;
|
|
2024
2043
|
}
|
|
2025
2044
|
}
|
|
@@ -2028,6 +2047,2029 @@ var R = class {
|
|
|
2028
2047
|
l.indexs.length == 3 && (l.indexs.forEach((e) => i.add(e)), r.threeEdgeRect.push(l));
|
|
2029
2048
|
}
|
|
2030
2049
|
return r;
|
|
2050
|
+
}, H = 11102230246251565e-32, U = 134217729, be = (3 + 8 * H) * H;
|
|
2051
|
+
function xe(e, t, n, r, i) {
|
|
2052
|
+
let a, o, s, c, l = t[0], u = r[0], d = 0, f = 0;
|
|
2053
|
+
u > l == u > -l ? (a = l, l = t[++d]) : (a = u, u = r[++f]);
|
|
2054
|
+
let p = 0;
|
|
2055
|
+
if (d < e && f < n) for (u > l == u > -l ? (o = l + a, s = a - (o - l), l = t[++d]) : (o = u + a, s = a - (o - u), u = r[++f]), a = o, s !== 0 && (i[p++] = s); d < e && f < n;) u > l == u > -l ? (o = a + l, c = o - a, s = a - (o - c) + (l - c), l = t[++d]) : (o = a + u, c = o - a, s = a - (o - c) + (u - c), u = r[++f]), a = o, s !== 0 && (i[p++] = s);
|
|
2056
|
+
for (; d < e;) o = a + l, c = o - a, s = a - (o - c) + (l - c), l = t[++d], a = o, s !== 0 && (i[p++] = s);
|
|
2057
|
+
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);
|
|
2058
|
+
return (a !== 0 || p === 0) && (i[p++] = a), p;
|
|
2059
|
+
}
|
|
2060
|
+
function Se(e, t) {
|
|
2061
|
+
let n = t[0];
|
|
2062
|
+
for (let r = 1; r < e; r++) n += t[r];
|
|
2063
|
+
return n;
|
|
2064
|
+
}
|
|
2065
|
+
function W(e) {
|
|
2066
|
+
return new Float64Array(e);
|
|
2067
|
+
}
|
|
2068
|
+
//#endregion
|
|
2069
|
+
//#region node_modules/robust-predicates/esm/orient2d.js
|
|
2070
|
+
var Ce = (3 + 16 * H) * H, we = (2 + 12 * H) * H, Te = (9 + 64 * H) * H * H, Ee = W(4), De = W(8), Oe = W(12), ke = W(16), G = W(4);
|
|
2071
|
+
function Ae(e, t, n, r, i, a, o) {
|
|
2072
|
+
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;
|
|
2073
|
+
b = T * O, f = U * T, p = f - (f - T), m = T - p, f = U * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = D * E, f = U * D, p = f - (f - D), m = D - p, f = U * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Ee[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Ee[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Ee[2] = v - (w - d) + (_ - d), Ee[3] = w;
|
|
2074
|
+
let k = Se(4, Ee), A = we * o;
|
|
2075
|
+
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 = Te * o + be * Math.abs(k), k += T * u + O * s - (D * l + E * c), k >= A || -k >= A)) return k;
|
|
2076
|
+
b = s * O, f = U * s, p = f - (f - s), m = s - p, f = U * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = c * E, f = U * c, p = f - (f - c), m = c - p, f = U * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w;
|
|
2077
|
+
let j = xe(4, Ee, 4, G, De);
|
|
2078
|
+
b = T * u, f = U * T, p = f - (f - T), m = T - p, f = U * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = D * l, f = U * D, p = f - (f - D), m = D - p, f = U * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w;
|
|
2079
|
+
let M = xe(j, De, 4, G, Oe);
|
|
2080
|
+
return b = s * u, f = U * s, p = f - (f - s), m = s - p, f = U * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = c * l, f = U * c, p = f - (f - c), m = c - p, f = U * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, G[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, G[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, G[2] = v - (w - d) + (_ - d), G[3] = w, ke[xe(M, Oe, 4, G, ke) - 1];
|
|
2081
|
+
}
|
|
2082
|
+
function je(e, t, n, r, i, a) {
|
|
2083
|
+
let o = (t - a) * (n - i), s = (e - i) * (r - a), c = o - s, l = Math.abs(o + s);
|
|
2084
|
+
return Math.abs(c) >= Ce * l ? c : -Ae(e, t, n, r, i, a, l);
|
|
2085
|
+
}
|
|
2086
|
+
(7 + 56 * H) * H, (3 + 28 * H) * H, (26 + 288 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(8), W(8), W(8), W(4), W(8), W(8), W(16), W(12), W(192), W(192), (10 + 96 * H) * H, (4 + 48 * H) * H, (44 + 576 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(8), W(4), W(4), W(4), W(8), W(16), W(16), W(16), W(32), W(32), W(48), W(64), W(1152), W(1152), (16 + 224 * H) * H, (5 + 72 * H) * H, (71 + 1408 * H) * H * H, W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(4), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(24), W(1152), W(1152), W(1152), W(1152), W(1152), W(2304), W(2304), W(3456), W(5760), W(8), W(8), W(8), W(16), W(24), W(48), W(48), W(96), W(192), W(384), W(384), W(384), W(768), W(96), W(96), W(96), W(1152);
|
|
2087
|
+
//#endregion
|
|
2088
|
+
//#region node_modules/delaunator/index.js
|
|
2089
|
+
var Me = 2 ** -52, Ne = new Uint32Array(512), Pe = class e {
|
|
2090
|
+
static from(t, n = He, r = Ue) {
|
|
2091
|
+
let i = t.length, a = new Float64Array(i * 2);
|
|
2092
|
+
for (let e = 0; e < i; e++) {
|
|
2093
|
+
let i = t[e];
|
|
2094
|
+
a[2 * e] = n(i), a[2 * e + 1] = r(i);
|
|
2095
|
+
}
|
|
2096
|
+
return new e(a);
|
|
2097
|
+
}
|
|
2098
|
+
constructor(e) {
|
|
2099
|
+
let t = e.length >> 1;
|
|
2100
|
+
if (t > 0 && typeof e[0] != "number") throw Error("Expected coords to contain numbers.");
|
|
2101
|
+
this.coords = e;
|
|
2102
|
+
let n = Math.max(2 * t - 5, 0);
|
|
2103
|
+
this._triangles = new Uint32Array(n * 3), this._halfedges = new Int32Array(n * 3), this._hashSize = Math.ceil(Math.sqrt(t)), this._hullPrev = new Uint32Array(t), this._hullNext = new Uint32Array(t), this._hullTri = new Uint32Array(t), this._hullHash = new Int32Array(this._hashSize), this._ids = new Uint32Array(t), this._dists = new Float64Array(t), this.trianglesLen = 0, this._cx = 0, this._cy = 0, this._hullStart = 0, this.hull = this._triangles, this.triangles = this._triangles, this.halfedges = this._halfedges, this.update();
|
|
2104
|
+
}
|
|
2105
|
+
update() {
|
|
2106
|
+
let { coords: e, _hullPrev: t, _hullNext: n, _hullTri: r, _hullHash: i } = this, a = e.length >> 1, o = Infinity, s = Infinity, c = -Infinity, l = -Infinity;
|
|
2107
|
+
for (let t = 0; t < a; t++) {
|
|
2108
|
+
let n = e[2 * t], r = e[2 * t + 1];
|
|
2109
|
+
n < o && (o = n), r < s && (s = r), n > c && (c = n), r > l && (l = r), this._ids[t] = t;
|
|
2110
|
+
}
|
|
2111
|
+
let u = (o + c) / 2, d = (s + l) / 2, f = 0, p = 0, m = 0;
|
|
2112
|
+
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2113
|
+
let r = Ie(u, d, e[2 * t], e[2 * t + 1]);
|
|
2114
|
+
r < n && (f = t, n = r);
|
|
2115
|
+
}
|
|
2116
|
+
let h = e[2 * f], g = e[2 * f + 1];
|
|
2117
|
+
for (let t = 0, n = Infinity; t < a; t++) {
|
|
2118
|
+
if (t === f) continue;
|
|
2119
|
+
let r = Ie(h, g, e[2 * t], e[2 * t + 1]);
|
|
2120
|
+
r < n && r > 0 && (p = t, n = r);
|
|
2121
|
+
}
|
|
2122
|
+
let _ = e[2 * p], v = e[2 * p + 1], y = Infinity;
|
|
2123
|
+
for (let t = 0; t < a; t++) {
|
|
2124
|
+
if (t === f || t === p) continue;
|
|
2125
|
+
let n = Re(h, g, _, v, e[2 * t], e[2 * t + 1]);
|
|
2126
|
+
n < y && (m = t, y = n);
|
|
2127
|
+
}
|
|
2128
|
+
let b = e[2 * m], x = e[2 * m + 1];
|
|
2129
|
+
if (y === Infinity) {
|
|
2130
|
+
for (let t = 0; t < a; t++) this._dists[t] = e[2 * t] - e[0] || e[2 * t + 1] - e[1];
|
|
2131
|
+
Be(this._ids, this._dists, 0, a - 1);
|
|
2132
|
+
let t = new Uint32Array(a), n = 0;
|
|
2133
|
+
for (let e = 0, r = -Infinity; e < a; e++) {
|
|
2134
|
+
let i = this._ids[e], a = this._dists[i];
|
|
2135
|
+
a > r && (t[n++] = i, r = a);
|
|
2136
|
+
}
|
|
2137
|
+
this.hull = t.subarray(0, n), this.triangles = new Uint32Array(), this.halfedges = new Int32Array();
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
if (je(h, g, _, v, b, x) < 0) {
|
|
2141
|
+
let e = p, t = _, n = v;
|
|
2142
|
+
p = m, _ = b, v = x, m = e, b = t, x = n;
|
|
2143
|
+
}
|
|
2144
|
+
let S = ze(h, g, _, v, b, x);
|
|
2145
|
+
this._cx = S.x, this._cy = S.y;
|
|
2146
|
+
for (let t = 0; t < a; t++) this._dists[t] = Ie(e[2 * t], e[2 * t + 1], S.x, S.y);
|
|
2147
|
+
Be(this._ids, this._dists, 0, a - 1), this._hullStart = f;
|
|
2148
|
+
let C = 3;
|
|
2149
|
+
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);
|
|
2150
|
+
for (let a = 0, o = 0, s = 0; a < this._ids.length; a++) {
|
|
2151
|
+
let c = this._ids[a], l = e[2 * c], u = e[2 * c + 1];
|
|
2152
|
+
if (a > 0 && Math.abs(l - o) <= Me && Math.abs(u - s) <= Me || (o = l, s = u, c === f || c === p || c === m)) continue;
|
|
2153
|
+
let d = 0;
|
|
2154
|
+
for (let e = 0, t = this._hashKey(l, u); e < this._hashSize && (d = i[(t + e) % this._hashSize], !(d !== -1 && d !== n[d])); e++);
|
|
2155
|
+
d = t[d];
|
|
2156
|
+
let h = d, g;
|
|
2157
|
+
for (; g = n[h], je(l, u, e[2 * h], e[2 * h + 1], e[2 * g], e[2 * g + 1]) >= 0;) if (h = g, h === d) {
|
|
2158
|
+
h = -1;
|
|
2159
|
+
break;
|
|
2160
|
+
}
|
|
2161
|
+
if (h === -1) continue;
|
|
2162
|
+
let _ = this._addTriangle(h, c, n[h], -1, -1, r[h]);
|
|
2163
|
+
r[c] = this._legalize(_ + 2), r[h] = _, C++;
|
|
2164
|
+
let v = n[h];
|
|
2165
|
+
for (; g = n[v], je(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;
|
|
2166
|
+
if (h === d) for (; g = t[h], je(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;
|
|
2167
|
+
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;
|
|
2168
|
+
}
|
|
2169
|
+
this.hull = new Uint32Array(C);
|
|
2170
|
+
for (let e = 0, t = this._hullStart; e < C; e++) this.hull[e] = t, t = n[t];
|
|
2171
|
+
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
2172
|
+
}
|
|
2173
|
+
_hashKey(e, t) {
|
|
2174
|
+
return Math.floor(Fe(e - this._cx, t - this._cy) * this._hashSize) % this._hashSize;
|
|
2175
|
+
}
|
|
2176
|
+
_legalize(e) {
|
|
2177
|
+
let { _triangles: t, _halfedges: n, coords: r } = this, i = 0, a = 0;
|
|
2178
|
+
for (;;) {
|
|
2179
|
+
let o = n[e], s = e - e % 3;
|
|
2180
|
+
if (a = s + (e + 2) % 3, o === -1) {
|
|
2181
|
+
if (i === 0) break;
|
|
2182
|
+
e = Ne[--i];
|
|
2183
|
+
continue;
|
|
2184
|
+
}
|
|
2185
|
+
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];
|
|
2186
|
+
if (Le(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])) {
|
|
2187
|
+
t[e] = m, t[o] = d;
|
|
2188
|
+
let r = n[u];
|
|
2189
|
+
if (r === -1) {
|
|
2190
|
+
let t = this._hullStart;
|
|
2191
|
+
do {
|
|
2192
|
+
if (this._hullTri[t] === u) {
|
|
2193
|
+
this._hullTri[t] = e;
|
|
2194
|
+
break;
|
|
2195
|
+
}
|
|
2196
|
+
t = this._hullPrev[t];
|
|
2197
|
+
} while (t !== this._hullStart);
|
|
2198
|
+
}
|
|
2199
|
+
this._link(e, r), this._link(o, n[a]), this._link(a, u);
|
|
2200
|
+
let s = c + (o + 1) % 3;
|
|
2201
|
+
i < Ne.length && (Ne[i++] = s);
|
|
2202
|
+
} else {
|
|
2203
|
+
if (i === 0) break;
|
|
2204
|
+
e = Ne[--i];
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
return a;
|
|
2208
|
+
}
|
|
2209
|
+
_link(e, t) {
|
|
2210
|
+
this._halfedges[e] = t, t !== -1 && (this._halfedges[t] = e);
|
|
2211
|
+
}
|
|
2212
|
+
_addTriangle(e, t, n, r, i, a) {
|
|
2213
|
+
let o = this.trianglesLen;
|
|
2214
|
+
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;
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2217
|
+
function Fe(e, t) {
|
|
2218
|
+
let n = e / (Math.abs(e) + Math.abs(t));
|
|
2219
|
+
return (t > 0 ? 3 - n : 1 + n) / 4;
|
|
2220
|
+
}
|
|
2221
|
+
function Ie(e, t, n, r) {
|
|
2222
|
+
let i = e - n, a = t - r;
|
|
2223
|
+
return i * i + a * a;
|
|
2224
|
+
}
|
|
2225
|
+
function Le(e, t, n, r, i, a, o, s) {
|
|
2226
|
+
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;
|
|
2227
|
+
return c * (d * g - h * p) - l * (u * g - h * f) + m * (u * p - d * f) < 0;
|
|
2228
|
+
}
|
|
2229
|
+
function Re(e, t, n, r, i, a) {
|
|
2230
|
+
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;
|
|
2231
|
+
return p * p + m * m;
|
|
2232
|
+
}
|
|
2233
|
+
function ze(e, t, n, r, i, a) {
|
|
2234
|
+
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);
|
|
2235
|
+
return {
|
|
2236
|
+
x: e + (l * u - s * d) * f,
|
|
2237
|
+
y: t + (o * d - c * u) * f
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
function Be(e, t, n, r) {
|
|
2241
|
+
if (r - n <= 20) for (let i = n + 1; i <= r; i++) {
|
|
2242
|
+
let r = e[i], a = t[r], o = i - 1;
|
|
2243
|
+
for (; o >= n && t[e[o]] > a;) e[o + 1] = e[o--];
|
|
2244
|
+
e[o + 1] = r;
|
|
2245
|
+
}
|
|
2246
|
+
else {
|
|
2247
|
+
let i = n + r >> 1, a = n + 1, o = r;
|
|
2248
|
+
Ve(e, i, a), t[e[n]] > t[e[r]] && Ve(e, n, r), t[e[a]] > t[e[r]] && Ve(e, a, r), t[e[n]] > t[e[a]] && Ve(e, n, a);
|
|
2249
|
+
let s = e[a], c = t[s];
|
|
2250
|
+
for (;;) {
|
|
2251
|
+
do
|
|
2252
|
+
a++;
|
|
2253
|
+
while (t[e[a]] < c);
|
|
2254
|
+
do
|
|
2255
|
+
o--;
|
|
2256
|
+
while (t[e[o]] > c);
|
|
2257
|
+
if (o < a) break;
|
|
2258
|
+
Ve(e, a, o);
|
|
2259
|
+
}
|
|
2260
|
+
e[n + 1] = e[o], e[o] = s, r - a + 1 >= o - n ? (Be(e, t, a, r), Be(e, t, n, o - 1)) : (Be(e, t, n, o - 1), Be(e, t, a, r));
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
function Ve(e, t, n) {
|
|
2264
|
+
let r = e[t];
|
|
2265
|
+
e[t] = e[n], e[n] = r;
|
|
2266
|
+
}
|
|
2267
|
+
function He(e) {
|
|
2268
|
+
return e[0];
|
|
2269
|
+
}
|
|
2270
|
+
function Ue(e) {
|
|
2271
|
+
return e[1];
|
|
2272
|
+
}
|
|
2273
|
+
//#endregion
|
|
2274
|
+
//#region node_modules/d3-delaunay/src/path.js
|
|
2275
|
+
var We = 1e-6, Ge = class {
|
|
2276
|
+
constructor() {
|
|
2277
|
+
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
|
|
2278
|
+
}
|
|
2279
|
+
moveTo(e, t) {
|
|
2280
|
+
this._ += `M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}`;
|
|
2281
|
+
}
|
|
2282
|
+
closePath() {
|
|
2283
|
+
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
|
|
2284
|
+
}
|
|
2285
|
+
lineTo(e, t) {
|
|
2286
|
+
this._ += `L${this._x1 = +e},${this._y1 = +t}`;
|
|
2287
|
+
}
|
|
2288
|
+
arc(e, t, n) {
|
|
2289
|
+
e = +e, t = +t, n = +n;
|
|
2290
|
+
let r = e + n, i = t;
|
|
2291
|
+
if (n < 0) throw Error("negative radius");
|
|
2292
|
+
this._x1 === null ? this._ += `M${r},${i}` : (Math.abs(this._x1 - r) > We || Math.abs(this._y1 - i) > We) && (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}`);
|
|
2293
|
+
}
|
|
2294
|
+
rect(e, t, n, r) {
|
|
2295
|
+
this._ += `M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${+n}v${+r}h${-n}Z`;
|
|
2296
|
+
}
|
|
2297
|
+
value() {
|
|
2298
|
+
return this._ || null;
|
|
2299
|
+
}
|
|
2300
|
+
}, Ke = class {
|
|
2301
|
+
constructor() {
|
|
2302
|
+
this._ = [];
|
|
2303
|
+
}
|
|
2304
|
+
moveTo(e, t) {
|
|
2305
|
+
this._.push([e, t]);
|
|
2306
|
+
}
|
|
2307
|
+
closePath() {
|
|
2308
|
+
this._.push(this._[0].slice());
|
|
2309
|
+
}
|
|
2310
|
+
lineTo(e, t) {
|
|
2311
|
+
this._.push([e, t]);
|
|
2312
|
+
}
|
|
2313
|
+
value() {
|
|
2314
|
+
return this._.length ? this._ : null;
|
|
2315
|
+
}
|
|
2316
|
+
}, qe = class {
|
|
2317
|
+
constructor(e, [t, n, r, i] = [
|
|
2318
|
+
0,
|
|
2319
|
+
0,
|
|
2320
|
+
960,
|
|
2321
|
+
500
|
|
2322
|
+
]) {
|
|
2323
|
+
if (!((r = +r) >= (t = +t)) || !((i = +i) >= (n = +n))) throw Error("invalid bounds");
|
|
2324
|
+
this.delaunay = e, this._circumcenters = new Float64Array(e.points.length * 2), this.vectors = new Float64Array(e.points.length * 2), this.xmax = r, this.xmin = t, this.ymax = i, this.ymin = n, this._init();
|
|
2325
|
+
}
|
|
2326
|
+
update() {
|
|
2327
|
+
return this.delaunay.update(), this._init(), this;
|
|
2328
|
+
}
|
|
2329
|
+
_init() {
|
|
2330
|
+
let { delaunay: { points: e, hull: t, triangles: n }, vectors: r } = this, i, a, o = this.circumcenters = this._circumcenters.subarray(0, n.length / 3 * 2);
|
|
2331
|
+
for (let r = 0, s = 0, c = n.length, l, u; r < c; r += 3, s += 2) {
|
|
2332
|
+
let c = n[r] * 2, d = n[r + 1] * 2, f = n[r + 2] * 2, p = e[c], m = e[c + 1], h = e[d], g = e[d + 1], _ = e[f], v = e[f + 1], y = h - p, b = g - m, x = _ - p, S = v - m, C = (y * S - b * x) * 2;
|
|
2333
|
+
if (Math.abs(C) < 1e-9) {
|
|
2334
|
+
if (i === void 0) {
|
|
2335
|
+
i = a = 0;
|
|
2336
|
+
for (let n of t) i += e[n * 2], a += e[n * 2 + 1];
|
|
2337
|
+
i /= t.length, a /= t.length;
|
|
2338
|
+
}
|
|
2339
|
+
let n = 1e9 * Math.sign((i - p) * S - (a - m) * x);
|
|
2340
|
+
l = (p + _) / 2 - n * S, u = (m + v) / 2 + n * x;
|
|
2341
|
+
} else {
|
|
2342
|
+
let e = 1 / C, t = y * y + b * b, n = x * x + S * S;
|
|
2343
|
+
l = p + (S * t - b * n) * e, u = m + (y * n - x * t) * e;
|
|
2344
|
+
}
|
|
2345
|
+
o[s] = l, o[s + 1] = u;
|
|
2346
|
+
}
|
|
2347
|
+
let s = t[t.length - 1], c, l = s * 4, u, d = e[2 * s], f, p = e[2 * s + 1];
|
|
2348
|
+
r.fill(0);
|
|
2349
|
+
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;
|
|
2350
|
+
}
|
|
2351
|
+
render(e) {
|
|
2352
|
+
let t = e == null ? e = new Ge() : void 0, { delaunay: { halfedges: n, inedges: r, hull: i }, circumcenters: a, vectors: o } = this;
|
|
2353
|
+
if (i.length <= 1) return null;
|
|
2354
|
+
for (let t = 0, r = n.length; t < r; ++t) {
|
|
2355
|
+
let r = n[t];
|
|
2356
|
+
if (r < t) continue;
|
|
2357
|
+
let i = Math.floor(t / 3) * 2, o = Math.floor(r / 3) * 2, s = a[i], c = a[i + 1], l = a[o], u = a[o + 1];
|
|
2358
|
+
this._renderSegment(s, c, l, u, e);
|
|
2359
|
+
}
|
|
2360
|
+
let s, c = i[i.length - 1];
|
|
2361
|
+
for (let t = 0; t < i.length; ++t) {
|
|
2362
|
+
s = c, c = i[t];
|
|
2363
|
+
let n = Math.floor(r[c] / 3) * 2, l = a[n], u = a[n + 1], d = s * 4, f = this._project(l, u, o[d + 2], o[d + 3]);
|
|
2364
|
+
f && this._renderSegment(l, u, f[0], f[1], e);
|
|
2365
|
+
}
|
|
2366
|
+
return t && t.value();
|
|
2367
|
+
}
|
|
2368
|
+
renderBounds(e) {
|
|
2369
|
+
let t = e == null ? e = new Ge() : void 0;
|
|
2370
|
+
return e.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), t && t.value();
|
|
2371
|
+
}
|
|
2372
|
+
renderCell(e, t) {
|
|
2373
|
+
let n = t == null ? t = new Ge() : void 0, r = this._clip(e);
|
|
2374
|
+
if (r === null || !r.length) return;
|
|
2375
|
+
t.moveTo(r[0], r[1]);
|
|
2376
|
+
let i = r.length;
|
|
2377
|
+
for (; r[0] === r[i - 2] && r[1] === r[i - 1] && i > 1;) i -= 2;
|
|
2378
|
+
for (let e = 2; e < i; e += 2) (r[e] !== r[e - 2] || r[e + 1] !== r[e - 1]) && t.lineTo(r[e], r[e + 1]);
|
|
2379
|
+
return t.closePath(), n && n.value();
|
|
2380
|
+
}
|
|
2381
|
+
*cellPolygons() {
|
|
2382
|
+
let { delaunay: { points: e } } = this;
|
|
2383
|
+
for (let t = 0, n = e.length / 2; t < n; ++t) {
|
|
2384
|
+
let e = this.cellPolygon(t);
|
|
2385
|
+
e && (e.index = t, yield e);
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
cellPolygon(e) {
|
|
2389
|
+
let t = new Ke();
|
|
2390
|
+
return this.renderCell(e, t), t.value();
|
|
2391
|
+
}
|
|
2392
|
+
_renderSegment(e, t, n, r, i) {
|
|
2393
|
+
let a, o = this._regioncode(e, t), s = this._regioncode(n, r);
|
|
2394
|
+
o === 0 && s === 0 ? (i.moveTo(e, t), i.lineTo(n, r)) : (a = this._clipSegment(e, t, n, r, o, s)) && (i.moveTo(a[0], a[1]), i.lineTo(a[2], a[3]));
|
|
2395
|
+
}
|
|
2396
|
+
contains(e, t, n) {
|
|
2397
|
+
return (t = +t, t !== t) || (n = +n, n !== n) ? !1 : this.delaunay._step(e, t, n) === e;
|
|
2398
|
+
}
|
|
2399
|
+
*neighbors(e) {
|
|
2400
|
+
let t = this._clip(e);
|
|
2401
|
+
if (t) for (let n of this.delaunay.neighbors(e)) {
|
|
2402
|
+
let e = this._clip(n);
|
|
2403
|
+
if (e) {
|
|
2404
|
+
loop: for (let r = 0, i = t.length; r < i; r += 2) for (let a = 0, o = e.length; a < o; a += 2) if (t[r] === e[a] && t[r + 1] === e[a + 1] && t[(r + 2) % i] === e[(a + o - 2) % o] && t[(r + 3) % i] === e[(a + o - 1) % o]) {
|
|
2405
|
+
yield n;
|
|
2406
|
+
break loop;
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
_cell(e) {
|
|
2412
|
+
let { circumcenters: t, delaunay: { inedges: n, halfedges: r, triangles: i } } = this, a = n[e];
|
|
2413
|
+
if (a === -1) return null;
|
|
2414
|
+
let o = [], s = a;
|
|
2415
|
+
do {
|
|
2416
|
+
let n = Math.floor(s / 3);
|
|
2417
|
+
if (o.push(t[n * 2], t[n * 2 + 1]), s = s % 3 == 2 ? s - 2 : s + 1, i[s] !== e) break;
|
|
2418
|
+
s = r[s];
|
|
2419
|
+
} while (s !== a && s !== -1);
|
|
2420
|
+
return o;
|
|
2421
|
+
}
|
|
2422
|
+
_clip(e) {
|
|
2423
|
+
if (e === 0 && this.delaunay.hull.length === 1) return [
|
|
2424
|
+
this.xmax,
|
|
2425
|
+
this.ymin,
|
|
2426
|
+
this.xmax,
|
|
2427
|
+
this.ymax,
|
|
2428
|
+
this.xmin,
|
|
2429
|
+
this.ymax,
|
|
2430
|
+
this.xmin,
|
|
2431
|
+
this.ymin
|
|
2432
|
+
];
|
|
2433
|
+
let t = this._cell(e);
|
|
2434
|
+
if (t === null) return null;
|
|
2435
|
+
let { vectors: n } = this, r = e * 4;
|
|
2436
|
+
return this._simplify(n[r] || n[r + 1] ? this._clipInfinite(e, t, n[r], n[r + 1], n[r + 2], n[r + 3]) : this._clipFinite(e, t));
|
|
2437
|
+
}
|
|
2438
|
+
_clipFinite(e, t) {
|
|
2439
|
+
let n = t.length, r = null, i, a, o = t[n - 2], s = t[n - 1], c, l = this._regioncode(o, s), u, d = 0;
|
|
2440
|
+
for (let f = 0; f < n; f += 2) if (i = o, a = s, o = t[f], s = t[f + 1], c = l, l = this._regioncode(o, s), c === 0 && l === 0) u = d, d = 0, r ? r.push(o, s) : r = [o, s];
|
|
2441
|
+
else {
|
|
2442
|
+
let t, n, f, p, m;
|
|
2443
|
+
if (c === 0) {
|
|
2444
|
+
if ((t = this._clipSegment(i, a, o, s, c, l)) === null) continue;
|
|
2445
|
+
[n, f, p, m] = t;
|
|
2446
|
+
} else {
|
|
2447
|
+
if ((t = this._clipSegment(o, s, i, a, l, c)) === null) continue;
|
|
2448
|
+
[p, m, n, f] = t, u = d, d = this._edgecode(n, f), u && d && this._edge(e, u, d, r, r.length), r ? r.push(n, f) : r = [n, f];
|
|
2449
|
+
}
|
|
2450
|
+
u = d, d = this._edgecode(p, m), u && d && this._edge(e, u, d, r, r.length), r ? r.push(p, m) : r = [p, m];
|
|
2451
|
+
}
|
|
2452
|
+
if (r) u = d, d = this._edgecode(r[0], r[1]), u && d && this._edge(e, u, d, r, r.length);
|
|
2453
|
+
else if (this.contains(e, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [
|
|
2454
|
+
this.xmax,
|
|
2455
|
+
this.ymin,
|
|
2456
|
+
this.xmax,
|
|
2457
|
+
this.ymax,
|
|
2458
|
+
this.xmin,
|
|
2459
|
+
this.ymax,
|
|
2460
|
+
this.xmin,
|
|
2461
|
+
this.ymin
|
|
2462
|
+
];
|
|
2463
|
+
return r;
|
|
2464
|
+
}
|
|
2465
|
+
_clipSegment(e, t, n, r, i, a) {
|
|
2466
|
+
let o = i < a;
|
|
2467
|
+
for (o && ([e, t, n, r, i, a] = [
|
|
2468
|
+
n,
|
|
2469
|
+
r,
|
|
2470
|
+
e,
|
|
2471
|
+
t,
|
|
2472
|
+
a,
|
|
2473
|
+
i
|
|
2474
|
+
]);;) {
|
|
2475
|
+
if (i === 0 && a === 0) return o ? [
|
|
2476
|
+
n,
|
|
2477
|
+
r,
|
|
2478
|
+
e,
|
|
2479
|
+
t
|
|
2480
|
+
] : [
|
|
2481
|
+
e,
|
|
2482
|
+
t,
|
|
2483
|
+
n,
|
|
2484
|
+
r
|
|
2485
|
+
];
|
|
2486
|
+
if (i & a) return null;
|
|
2487
|
+
let s, c, l = i || a;
|
|
2488
|
+
l & 8 ? (s = e + (n - e) * (this.ymax - t) / (r - t), c = this.ymax) : l & 4 ? (s = e + (n - e) * (this.ymin - t) / (r - t), c = this.ymin) : l & 2 ? (c = t + (r - t) * (this.xmax - e) / (n - e), s = this.xmax) : (c = t + (r - t) * (this.xmin - e) / (n - e), s = this.xmin), i ? (e = s, t = c, i = this._regioncode(e, t)) : (n = s, r = c, a = this._regioncode(n, r));
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
_clipInfinite(e, t, n, r, i, a) {
|
|
2492
|
+
let o = Array.from(t), s;
|
|
2493
|
+
if ((s = this._project(o[0], o[1], n, r)) && o.unshift(s[0], s[1]), (s = this._project(o[o.length - 2], o[o.length - 1], i, a)) && o.push(s[0], s[1]), o = this._clipFinite(e, o)) for (let t = 0, n = o.length, r, i = this._edgecode(o[n - 2], o[n - 1]); t < n; t += 2) r = i, i = this._edgecode(o[t], o[t + 1]), r && i && (t = this._edge(e, r, i, o, t), n = o.length);
|
|
2494
|
+
else this.contains(e, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (o = [
|
|
2495
|
+
this.xmin,
|
|
2496
|
+
this.ymin,
|
|
2497
|
+
this.xmax,
|
|
2498
|
+
this.ymin,
|
|
2499
|
+
this.xmax,
|
|
2500
|
+
this.ymax,
|
|
2501
|
+
this.xmin,
|
|
2502
|
+
this.ymax
|
|
2503
|
+
]);
|
|
2504
|
+
return o;
|
|
2505
|
+
}
|
|
2506
|
+
_edge(e, t, n, r, i) {
|
|
2507
|
+
for (; t !== n;) {
|
|
2508
|
+
let n, a;
|
|
2509
|
+
switch (t) {
|
|
2510
|
+
case 5:
|
|
2511
|
+
t = 4;
|
|
2512
|
+
continue;
|
|
2513
|
+
case 4:
|
|
2514
|
+
t = 6, n = this.xmax, a = this.ymin;
|
|
2515
|
+
break;
|
|
2516
|
+
case 6:
|
|
2517
|
+
t = 2;
|
|
2518
|
+
continue;
|
|
2519
|
+
case 2:
|
|
2520
|
+
t = 10, n = this.xmax, a = this.ymax;
|
|
2521
|
+
break;
|
|
2522
|
+
case 10:
|
|
2523
|
+
t = 8;
|
|
2524
|
+
continue;
|
|
2525
|
+
case 8:
|
|
2526
|
+
t = 9, n = this.xmin, a = this.ymax;
|
|
2527
|
+
break;
|
|
2528
|
+
case 9:
|
|
2529
|
+
t = 1;
|
|
2530
|
+
continue;
|
|
2531
|
+
case 1:
|
|
2532
|
+
t = 5, n = this.xmin, a = this.ymin;
|
|
2533
|
+
break;
|
|
2534
|
+
}
|
|
2535
|
+
(r[i] !== n || r[i + 1] !== a) && this.contains(e, n, a) && (r.splice(i, 0, n, a), i += 2);
|
|
2536
|
+
}
|
|
2537
|
+
return i;
|
|
2538
|
+
}
|
|
2539
|
+
_project(e, t, n, r) {
|
|
2540
|
+
let i = Infinity, a, o, s;
|
|
2541
|
+
if (r < 0) {
|
|
2542
|
+
if (t <= this.ymin) return null;
|
|
2543
|
+
(a = (this.ymin - t) / r) < i && (s = this.ymin, o = e + (i = a) * n);
|
|
2544
|
+
} else if (r > 0) {
|
|
2545
|
+
if (t >= this.ymax) return null;
|
|
2546
|
+
(a = (this.ymax - t) / r) < i && (s = this.ymax, o = e + (i = a) * n);
|
|
2547
|
+
}
|
|
2548
|
+
if (n > 0) {
|
|
2549
|
+
if (e >= this.xmax) return null;
|
|
2550
|
+
(a = (this.xmax - e) / n) < i && (o = this.xmax, s = t + (i = a) * r);
|
|
2551
|
+
} else if (n < 0) {
|
|
2552
|
+
if (e <= this.xmin) return null;
|
|
2553
|
+
(a = (this.xmin - e) / n) < i && (o = this.xmin, s = t + (i = a) * r);
|
|
2554
|
+
}
|
|
2555
|
+
return [o, s];
|
|
2556
|
+
}
|
|
2557
|
+
_edgecode(e, t) {
|
|
2558
|
+
return (e === this.xmin ? 1 : e === this.xmax ? 2 : 0) | (t === this.ymin ? 4 : t === this.ymax ? 8 : 0);
|
|
2559
|
+
}
|
|
2560
|
+
_regioncode(e, t) {
|
|
2561
|
+
return (e < this.xmin ? 1 : e > this.xmax ? 2 : 0) | (t < this.ymin ? 4 : t > this.ymax ? 8 : 0);
|
|
2562
|
+
}
|
|
2563
|
+
_simplify(e) {
|
|
2564
|
+
if (e && e.length > 4) {
|
|
2565
|
+
for (let t = 0; t < e.length; t += 2) {
|
|
2566
|
+
let n = (t + 2) % e.length, r = (t + 4) % e.length;
|
|
2567
|
+
(e[t] === e[n] && e[n] === e[r] || e[t + 1] === e[n + 1] && e[n + 1] === e[r + 1]) && (e.splice(n, 2), t -= 2);
|
|
2568
|
+
}
|
|
2569
|
+
e.length || (e = null);
|
|
2570
|
+
}
|
|
2571
|
+
return e;
|
|
2572
|
+
}
|
|
2573
|
+
}, Je = 2 * Math.PI, Ye = Math.pow;
|
|
2574
|
+
function Xe(e) {
|
|
2575
|
+
return e[0];
|
|
2576
|
+
}
|
|
2577
|
+
function Ze(e) {
|
|
2578
|
+
return e[1];
|
|
2579
|
+
}
|
|
2580
|
+
function Qe(e) {
|
|
2581
|
+
let { triangles: t, coords: n } = e;
|
|
2582
|
+
for (let e = 0; e < t.length; e += 3) {
|
|
2583
|
+
let r = 2 * t[e], i = 2 * t[e + 1], a = 2 * t[e + 2];
|
|
2584
|
+
if ((n[a] - n[r]) * (n[i + 1] - n[r + 1]) - (n[i] - n[r]) * (n[a + 1] - n[r + 1]) > 1e-10) return !1;
|
|
2585
|
+
}
|
|
2586
|
+
return !0;
|
|
2587
|
+
}
|
|
2588
|
+
function $e(e, t, n) {
|
|
2589
|
+
return [e + Math.sin(e + t) * n, t + Math.cos(e - t) * n];
|
|
2590
|
+
}
|
|
2591
|
+
var et = class e {
|
|
2592
|
+
static from(t, n = Xe, r = Ze, i) {
|
|
2593
|
+
return new e("length" in t ? tt(t, n, r, i) : Float64Array.from(nt(t, n, r, i)));
|
|
2594
|
+
}
|
|
2595
|
+
constructor(e) {
|
|
2596
|
+
this._delaunator = new Pe(e), this.inedges = new Int32Array(e.length / 2), this._hullIndex = new Int32Array(e.length / 2), this.points = this._delaunator.coords, this._init();
|
|
2597
|
+
}
|
|
2598
|
+
update() {
|
|
2599
|
+
return this._delaunator.update(), this._init(), this;
|
|
2600
|
+
}
|
|
2601
|
+
_init() {
|
|
2602
|
+
let e = this._delaunator, t = this.points;
|
|
2603
|
+
if (e.hull && e.hull.length > 2 && Qe(e)) {
|
|
2604
|
+
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]);
|
|
2605
|
+
let e = this.collinear[0], n = this.collinear[this.collinear.length - 1], r = [
|
|
2606
|
+
t[2 * e],
|
|
2607
|
+
t[2 * e + 1],
|
|
2608
|
+
t[2 * n],
|
|
2609
|
+
t[2 * n + 1]
|
|
2610
|
+
], i = 1e-8 * Math.hypot(r[3] - r[1], r[2] - r[0]);
|
|
2611
|
+
for (let e = 0, n = t.length / 2; e < n; ++e) {
|
|
2612
|
+
let n = $e(t[2 * e], t[2 * e + 1], i);
|
|
2613
|
+
t[2 * e] = n[0], t[2 * e + 1] = n[1];
|
|
2614
|
+
}
|
|
2615
|
+
this._delaunator = new Pe(t);
|
|
2616
|
+
} else delete this.collinear;
|
|
2617
|
+
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);
|
|
2618
|
+
for (let e = 0, t = n.length; e < t; ++e) {
|
|
2619
|
+
let t = i[e % 3 == 2 ? e - 2 : e + 1];
|
|
2620
|
+
(n[e] === -1 || a[t] === -1) && (a[t] = e);
|
|
2621
|
+
}
|
|
2622
|
+
for (let e = 0, t = r.length; e < t; ++e) o[r[e]] = e;
|
|
2623
|
+
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]));
|
|
2624
|
+
}
|
|
2625
|
+
voronoi(e) {
|
|
2626
|
+
return new qe(this, e);
|
|
2627
|
+
}
|
|
2628
|
+
*neighbors(e) {
|
|
2629
|
+
let { inedges: t, hull: n, _hullIndex: r, halfedges: i, triangles: a, collinear: o } = this;
|
|
2630
|
+
if (o) {
|
|
2631
|
+
let t = o.indexOf(e);
|
|
2632
|
+
t > 0 && (yield o[t - 1]), t < o.length - 1 && (yield o[t + 1]);
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
let s = t[e];
|
|
2636
|
+
if (s === -1) return;
|
|
2637
|
+
let c = s, l = -1;
|
|
2638
|
+
do {
|
|
2639
|
+
if (yield l = a[c], c = c % 3 == 2 ? c - 2 : c + 1, a[c] !== e) return;
|
|
2640
|
+
if (c = i[c], c === -1) {
|
|
2641
|
+
let t = n[(r[e] + 1) % n.length];
|
|
2642
|
+
t !== l && (yield t);
|
|
2643
|
+
return;
|
|
2644
|
+
}
|
|
2645
|
+
} while (c !== s);
|
|
2646
|
+
}
|
|
2647
|
+
find(e, t, n = 0) {
|
|
2648
|
+
if ((e = +e, e !== e) || (t = +t, t !== t)) return -1;
|
|
2649
|
+
let r = n, i;
|
|
2650
|
+
for (; (i = this._step(n, e, t)) >= 0 && i !== n && i !== r;) n = i;
|
|
2651
|
+
return i;
|
|
2652
|
+
}
|
|
2653
|
+
_step(e, t, n) {
|
|
2654
|
+
let { inedges: r, hull: i, _hullIndex: a, halfedges: o, triangles: s, points: c } = this;
|
|
2655
|
+
if (r[e] === -1 || !c.length) return (e + 1) % (c.length >> 1);
|
|
2656
|
+
let l = e, u = Ye(t - c[e * 2], 2) + Ye(n - c[e * 2 + 1], 2), d = r[e], f = d;
|
|
2657
|
+
do {
|
|
2658
|
+
let r = s[f], d = Ye(t - c[r * 2], 2) + Ye(n - c[r * 2 + 1], 2);
|
|
2659
|
+
if (d < u && (u = d, l = r), f = f % 3 == 2 ? f - 2 : f + 1, s[f] !== e) break;
|
|
2660
|
+
if (f = o[f], f === -1) {
|
|
2661
|
+
if (f = i[(a[e] + 1) % i.length], f !== r && Ye(t - c[f * 2], 2) + Ye(n - c[f * 2 + 1], 2) < u) return f;
|
|
2662
|
+
break;
|
|
2663
|
+
}
|
|
2664
|
+
} while (f !== d);
|
|
2665
|
+
return l;
|
|
2666
|
+
}
|
|
2667
|
+
render(e) {
|
|
2668
|
+
let t = e == null ? e = new Ge() : void 0, { points: n, halfedges: r, triangles: i } = this;
|
|
2669
|
+
for (let t = 0, a = r.length; t < a; ++t) {
|
|
2670
|
+
let a = r[t];
|
|
2671
|
+
if (a < t) continue;
|
|
2672
|
+
let o = i[t] * 2, s = i[a] * 2;
|
|
2673
|
+
e.moveTo(n[o], n[o + 1]), e.lineTo(n[s], n[s + 1]);
|
|
2674
|
+
}
|
|
2675
|
+
return this.renderHull(e), t && t.value();
|
|
2676
|
+
}
|
|
2677
|
+
renderPoints(e, t) {
|
|
2678
|
+
t === void 0 && (!e || typeof e.moveTo != "function") && (t = e, e = null), t = t == null ? 2 : +t;
|
|
2679
|
+
let n = e == null ? e = new Ge() : void 0, { points: r } = this;
|
|
2680
|
+
for (let n = 0, i = r.length; n < i; n += 2) {
|
|
2681
|
+
let i = r[n], a = r[n + 1];
|
|
2682
|
+
e.moveTo(i + t, a), e.arc(i, a, t, 0, Je);
|
|
2683
|
+
}
|
|
2684
|
+
return n && n.value();
|
|
2685
|
+
}
|
|
2686
|
+
renderHull(e) {
|
|
2687
|
+
let t = e == null ? e = new Ge() : void 0, { hull: n, points: r } = this, i = n[0] * 2, a = n.length;
|
|
2688
|
+
e.moveTo(r[i], r[i + 1]);
|
|
2689
|
+
for (let t = 1; t < a; ++t) {
|
|
2690
|
+
let i = 2 * n[t];
|
|
2691
|
+
e.lineTo(r[i], r[i + 1]);
|
|
2692
|
+
}
|
|
2693
|
+
return e.closePath(), t && t.value();
|
|
2694
|
+
}
|
|
2695
|
+
hullPolygon() {
|
|
2696
|
+
let e = new Ke();
|
|
2697
|
+
return this.renderHull(e), e.value();
|
|
2698
|
+
}
|
|
2699
|
+
renderTriangle(e, t) {
|
|
2700
|
+
let n = t == null ? t = new Ge() : void 0, { points: r, triangles: i } = this, a = i[e *= 3] * 2, o = i[e + 1] * 2, s = i[e + 2] * 2;
|
|
2701
|
+
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();
|
|
2702
|
+
}
|
|
2703
|
+
*trianglePolygons() {
|
|
2704
|
+
let { triangles: e } = this;
|
|
2705
|
+
for (let t = 0, n = e.length / 3; t < n; ++t) yield this.trianglePolygon(t);
|
|
2706
|
+
}
|
|
2707
|
+
trianglePolygon(e) {
|
|
2708
|
+
let t = new Ke();
|
|
2709
|
+
return this.renderTriangle(e, t), t.value();
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
function tt(e, t, n, r) {
|
|
2713
|
+
let i = e.length, a = new Float64Array(i * 2);
|
|
2714
|
+
for (let o = 0; o < i; ++o) {
|
|
2715
|
+
let i = e[o];
|
|
2716
|
+
a[o * 2] = t.call(r, i, o, e), a[o * 2 + 1] = n.call(r, i, o, e);
|
|
2717
|
+
}
|
|
2718
|
+
return a;
|
|
2719
|
+
}
|
|
2720
|
+
function* nt(e, t, n, r) {
|
|
2721
|
+
let i = 0;
|
|
2722
|
+
for (let a of e) yield t.call(r, a, i, e), yield n.call(r, a, i, e), ++i;
|
|
2723
|
+
}
|
|
2724
|
+
//#endregion
|
|
2725
|
+
//#region src/utils/clusert.mjs
|
|
2726
|
+
function rt(e, t, n, r) {
|
|
2727
|
+
return 1 + (e[t][0] === 0 || e[n][0] === 0 || e[r][0] === 0 ? 1 : 0);
|
|
2728
|
+
}
|
|
2729
|
+
function it(e, t, n, r, i, a) {
|
|
2730
|
+
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;
|
|
2731
|
+
return l === 0 ? Infinity : o * s * c / (4 * l);
|
|
2732
|
+
}
|
|
2733
|
+
function at(e) {
|
|
2734
|
+
if (!e || e.length < 3) return [];
|
|
2735
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2736
|
+
for (let r of e) {
|
|
2737
|
+
let e = `${r[0]}_${r[1]}`;
|
|
2738
|
+
t.has(e) || (t.add(e), n.push(r));
|
|
2739
|
+
}
|
|
2740
|
+
if (n.length < 3) return [];
|
|
2741
|
+
let { triangles: r } = new et(Float64Array.from(n.flat()));
|
|
2742
|
+
if (!r.length) return [];
|
|
2743
|
+
let i = /* @__PURE__ */ new Map(), a = (e, t) => e < t ? `${e}_${t}` : `${t}_${e}`;
|
|
2744
|
+
for (let e = 0; e < r.length; e += 3) {
|
|
2745
|
+
let t = r[e], o = r[e + 1], s = r[e + 2], [c, l] = n[t], [u, d] = n[o], [f, p] = n[s];
|
|
2746
|
+
if (it(c, l, u, d, f, p) <= 1 / rt(n, t, o, s)) for (let [e, n] of [
|
|
2747
|
+
[t, o],
|
|
2748
|
+
[o, s],
|
|
2749
|
+
[s, t]
|
|
2750
|
+
]) {
|
|
2751
|
+
let t = a(e, n);
|
|
2752
|
+
i.set(t, (i.get(t) || 0) + 1);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
let o = [];
|
|
2756
|
+
for (let [e, t] of i) t === 1 && o.push(e.split("_").map(Number));
|
|
2757
|
+
if (!o.length) return [];
|
|
2758
|
+
let s = /* @__PURE__ */ new Map();
|
|
2759
|
+
for (let [e, t] of o) (s.get(e) || s.set(e, []).get(e)).push(t), (s.get(t) || s.set(t, []).get(t)).push(e);
|
|
2760
|
+
let c = o[0][0], l = [], u = /* @__PURE__ */ new Set(), d = c, f = -1;
|
|
2761
|
+
do {
|
|
2762
|
+
l.push(n[d]), u.add(d);
|
|
2763
|
+
let e = s.get(d) || [], t = e.find((e) => e !== f && !u.has(e));
|
|
2764
|
+
if (t === void 0 && (t = e.find((e) => e !== f)), t === void 0) break;
|
|
2765
|
+
f = d, d = t;
|
|
2766
|
+
} while (d !== c && l.length <= o.length + 1);
|
|
2767
|
+
return l;
|
|
2768
|
+
}
|
|
2769
|
+
//#endregion
|
|
2770
|
+
//#region node_modules/three/examples/jsm/math/OBB.js
|
|
2771
|
+
var K = {
|
|
2772
|
+
c: null,
|
|
2773
|
+
u: [
|
|
2774
|
+
new d(),
|
|
2775
|
+
new d(),
|
|
2776
|
+
new d()
|
|
2777
|
+
],
|
|
2778
|
+
e: []
|
|
2779
|
+
}, q = {
|
|
2780
|
+
c: null,
|
|
2781
|
+
u: [
|
|
2782
|
+
new d(),
|
|
2783
|
+
new d(),
|
|
2784
|
+
new d()
|
|
2785
|
+
],
|
|
2786
|
+
e: []
|
|
2787
|
+
}, J = [
|
|
2788
|
+
[],
|
|
2789
|
+
[],
|
|
2790
|
+
[]
|
|
2791
|
+
], Y = [
|
|
2792
|
+
[],
|
|
2793
|
+
[],
|
|
2794
|
+
[]
|
|
2795
|
+
], X = [], ot = new d(), st = new d(), ct = new d(), Z = new d(), lt = new d(), ut = new d(), Q = new a(), dt = new t(), ft = new o(), pt = new o(), mt = new l(), ht = class {
|
|
2796
|
+
constructor(e = new d(), t = new d(), n = new a()) {
|
|
2797
|
+
this.center = e, this.halfSize = t, this.rotation = n;
|
|
2798
|
+
}
|
|
2799
|
+
set(e, t, n) {
|
|
2800
|
+
return this.center = e, this.halfSize = t, this.rotation = n, this;
|
|
2801
|
+
}
|
|
2802
|
+
copy(e) {
|
|
2803
|
+
return this.center.copy(e.center), this.halfSize.copy(e.halfSize), this.rotation.copy(e.rotation), this;
|
|
2804
|
+
}
|
|
2805
|
+
clone() {
|
|
2806
|
+
return new this.constructor().copy(this);
|
|
2807
|
+
}
|
|
2808
|
+
getSize(e) {
|
|
2809
|
+
return e.copy(this.halfSize).multiplyScalar(2);
|
|
2810
|
+
}
|
|
2811
|
+
clampPoint(e, t) {
|
|
2812
|
+
let n = this.halfSize;
|
|
2813
|
+
Z.subVectors(e, this.center), this.rotation.extractBasis(ot, st, ct), t.copy(this.center);
|
|
2814
|
+
let r = i.clamp(Z.dot(ot), -n.x, n.x);
|
|
2815
|
+
t.add(ot.multiplyScalar(r));
|
|
2816
|
+
let a = i.clamp(Z.dot(st), -n.y, n.y);
|
|
2817
|
+
t.add(st.multiplyScalar(a));
|
|
2818
|
+
let o = i.clamp(Z.dot(ct), -n.z, n.z);
|
|
2819
|
+
return t.add(ct.multiplyScalar(o)), t;
|
|
2820
|
+
}
|
|
2821
|
+
containsPoint(e) {
|
|
2822
|
+
return Z.subVectors(e, this.center), this.rotation.extractBasis(ot, st, ct), Math.abs(Z.dot(ot)) <= this.halfSize.x && Math.abs(Z.dot(st)) <= this.halfSize.y && Math.abs(Z.dot(ct)) <= this.halfSize.z;
|
|
2823
|
+
}
|
|
2824
|
+
intersectsBox3(e) {
|
|
2825
|
+
return this.intersectsOBB(gt.fromBox3(e));
|
|
2826
|
+
}
|
|
2827
|
+
intersectsSphere(e) {
|
|
2828
|
+
return this.clampPoint(e.center, ut), ut.distanceToSquared(e.center) <= e.radius * e.radius;
|
|
2829
|
+
}
|
|
2830
|
+
intersectsOBB(e, t = 2 ** -52) {
|
|
2831
|
+
K.c = this.center, K.e[0] = this.halfSize.x, K.e[1] = this.halfSize.y, K.e[2] = this.halfSize.z, this.rotation.extractBasis(K.u[0], K.u[1], K.u[2]), q.c = e.center, q.e[0] = e.halfSize.x, q.e[1] = e.halfSize.y, q.e[2] = e.halfSize.z, e.rotation.extractBasis(q.u[0], q.u[1], q.u[2]);
|
|
2832
|
+
for (let e = 0; e < 3; e++) for (let t = 0; t < 3; t++) J[e][t] = K.u[e].dot(q.u[t]);
|
|
2833
|
+
Z.subVectors(q.c, K.c), X[0] = Z.dot(K.u[0]), X[1] = Z.dot(K.u[1]), X[2] = Z.dot(K.u[2]);
|
|
2834
|
+
for (let e = 0; e < 3; e++) for (let n = 0; n < 3; n++) Y[e][n] = Math.abs(J[e][n]) + t;
|
|
2835
|
+
let n, r;
|
|
2836
|
+
for (let e = 0; e < 3; e++) if (n = K.e[e], r = q.e[0] * Y[e][0] + q.e[1] * Y[e][1] + q.e[2] * Y[e][2], Math.abs(X[e]) > n + r) return !1;
|
|
2837
|
+
for (let e = 0; e < 3; e++) if (n = K.e[0] * Y[0][e] + K.e[1] * Y[1][e] + K.e[2] * Y[2][e], r = q.e[e], Math.abs(X[0] * J[0][e] + X[1] * J[1][e] + X[2] * J[2][e]) > n + r) return !1;
|
|
2838
|
+
return n = K.e[1] * Y[2][0] + K.e[2] * Y[1][0], r = q.e[1] * Y[0][2] + q.e[2] * Y[0][1], !(Math.abs(X[2] * J[1][0] - X[1] * J[2][0]) > n + r || (n = K.e[1] * Y[2][1] + K.e[2] * Y[1][1], r = q.e[0] * Y[0][2] + q.e[2] * Y[0][0], Math.abs(X[2] * J[1][1] - X[1] * J[2][1]) > n + r) || (n = K.e[1] * Y[2][2] + K.e[2] * Y[1][2], r = q.e[0] * Y[0][1] + q.e[1] * Y[0][0], Math.abs(X[2] * J[1][2] - X[1] * J[2][2]) > n + r) || (n = K.e[0] * Y[2][0] + K.e[2] * Y[0][0], r = q.e[1] * Y[1][2] + q.e[2] * Y[1][1], Math.abs(X[0] * J[2][0] - X[2] * J[0][0]) > n + r) || (n = K.e[0] * Y[2][1] + K.e[2] * Y[0][1], r = q.e[0] * Y[1][2] + q.e[2] * Y[1][0], Math.abs(X[0] * J[2][1] - X[2] * J[0][1]) > n + r) || (n = K.e[0] * Y[2][2] + K.e[2] * Y[0][2], r = q.e[0] * Y[1][1] + q.e[1] * Y[1][0], Math.abs(X[0] * J[2][2] - X[2] * J[0][2]) > n + r) || (n = K.e[0] * Y[1][0] + K.e[1] * Y[0][0], r = q.e[1] * Y[2][2] + q.e[2] * Y[2][1], Math.abs(X[1] * J[0][0] - X[0] * J[1][0]) > n + r) || (n = K.e[0] * Y[1][1] + K.e[1] * Y[0][1], r = q.e[0] * Y[2][2] + q.e[2] * Y[2][0], Math.abs(X[1] * J[0][1] - X[0] * J[1][1]) > n + r) || (n = K.e[0] * Y[1][2] + K.e[1] * Y[0][2], r = q.e[0] * Y[2][1] + q.e[1] * Y[2][0], Math.abs(X[1] * J[0][2] - X[0] * J[1][2]) > n + r));
|
|
2839
|
+
}
|
|
2840
|
+
intersectsPlane(e) {
|
|
2841
|
+
this.rotation.extractBasis(ot, st, ct);
|
|
2842
|
+
let t = this.halfSize.x * Math.abs(e.normal.dot(ot)) + this.halfSize.y * Math.abs(e.normal.dot(st)) + this.halfSize.z * Math.abs(e.normal.dot(ct)), n = e.normal.dot(this.center) - e.constant;
|
|
2843
|
+
return Math.abs(n) <= t;
|
|
2844
|
+
}
|
|
2845
|
+
intersectRay(e, t) {
|
|
2846
|
+
return this.getSize(lt), dt.setFromCenterAndSize(Z.set(0, 0, 0), lt), ft.setFromMatrix3(this.rotation), ft.setPosition(this.center), pt.copy(ft).invert(), mt.copy(e).applyMatrix4(pt), mt.intersectBox(dt, t) ? t.applyMatrix4(ft) : null;
|
|
2847
|
+
}
|
|
2848
|
+
intersectsRay(e) {
|
|
2849
|
+
return this.intersectRay(e, Z) !== null;
|
|
2850
|
+
}
|
|
2851
|
+
fromBox3(e) {
|
|
2852
|
+
return e.getCenter(this.center), e.getSize(this.halfSize).multiplyScalar(.5), this.rotation.identity(), this;
|
|
2853
|
+
}
|
|
2854
|
+
equals(e) {
|
|
2855
|
+
return e.center.equals(this.center) && e.halfSize.equals(this.halfSize) && e.rotation.equals(this.rotation);
|
|
2856
|
+
}
|
|
2857
|
+
applyMatrix4(e) {
|
|
2858
|
+
let t = e.elements, n = Z.set(t[0], t[1], t[2]).length(), r = Z.set(t[4], t[5], t[6]).length(), i = Z.set(t[8], t[9], t[10]).length();
|
|
2859
|
+
e.determinant() < 0 && (n = -n), Q.setFromMatrix4(e);
|
|
2860
|
+
let a = 1 / n, o = 1 / r, s = 1 / i;
|
|
2861
|
+
return Q.elements[0] *= a, Q.elements[1] *= a, Q.elements[2] *= a, Q.elements[3] *= o, Q.elements[4] *= o, Q.elements[5] *= o, Q.elements[6] *= s, Q.elements[7] *= s, Q.elements[8] *= s, this.rotation.multiply(Q), this.halfSize.x *= n, this.halfSize.y *= r, this.halfSize.z *= i, Z.setFromMatrixPosition(e), this.center.add(Z), this;
|
|
2862
|
+
}
|
|
2863
|
+
}, gt = new ht(), $ = 6371008.8, _t = {
|
|
2864
|
+
centimeters: $ * 100,
|
|
2865
|
+
centimetres: $ * 100,
|
|
2866
|
+
degrees: 360 / (2 * Math.PI),
|
|
2867
|
+
feet: $ * 3.28084,
|
|
2868
|
+
inches: $ * 39.37,
|
|
2869
|
+
kilometers: $ / 1e3,
|
|
2870
|
+
kilometres: $ / 1e3,
|
|
2871
|
+
meters: $,
|
|
2872
|
+
metres: $,
|
|
2873
|
+
miles: $ / 1609.344,
|
|
2874
|
+
millimeters: $ * 1e3,
|
|
2875
|
+
millimetres: $ * 1e3,
|
|
2876
|
+
nauticalmiles: $ / 1852,
|
|
2877
|
+
radians: 1,
|
|
2878
|
+
yards: $ * 1.0936
|
|
2879
|
+
};
|
|
2880
|
+
function vt(e, t, n = {}) {
|
|
2881
|
+
let r = { type: "Feature" };
|
|
2882
|
+
return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
|
|
2883
|
+
}
|
|
2884
|
+
function yt(e, t, n = {}) {
|
|
2885
|
+
if (!e) throw Error("coordinates is required");
|
|
2886
|
+
if (!Array.isArray(e)) throw Error("coordinates must be an Array");
|
|
2887
|
+
if (e.length < 2) throw Error("coordinates must be at least 2 numbers long");
|
|
2888
|
+
if (!Et(e[0]) || !Et(e[1])) throw Error("coordinates must contain numbers");
|
|
2889
|
+
return vt({
|
|
2890
|
+
type: "Point",
|
|
2891
|
+
coordinates: e
|
|
2892
|
+
}, t, n);
|
|
2893
|
+
}
|
|
2894
|
+
function bt(e, t, n = {}) {
|
|
2895
|
+
for (let t of e) {
|
|
2896
|
+
if (t.length < 4) throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");
|
|
2897
|
+
if (t[t.length - 1].length !== t[0].length) throw Error("First and last Position are not equivalent.");
|
|
2898
|
+
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.");
|
|
2899
|
+
}
|
|
2900
|
+
return vt({
|
|
2901
|
+
type: "Polygon",
|
|
2902
|
+
coordinates: e
|
|
2903
|
+
}, t, n);
|
|
2904
|
+
}
|
|
2905
|
+
function xt(e, t = "kilometers") {
|
|
2906
|
+
let n = _t[t];
|
|
2907
|
+
if (!n) throw Error(t + " units is invalid");
|
|
2908
|
+
return e * n;
|
|
2909
|
+
}
|
|
2910
|
+
function St(e, t = "kilometers") {
|
|
2911
|
+
let n = _t[t];
|
|
2912
|
+
if (!n) throw Error(t + " units is invalid");
|
|
2913
|
+
return e / n;
|
|
2914
|
+
}
|
|
2915
|
+
function Ct(e) {
|
|
2916
|
+
return e % (2 * Math.PI) * 180 / Math.PI;
|
|
2917
|
+
}
|
|
2918
|
+
function wt(e) {
|
|
2919
|
+
return e % 360 * Math.PI / 180;
|
|
2920
|
+
}
|
|
2921
|
+
function Tt(e, t = "kilometers", n = "kilometers") {
|
|
2922
|
+
if (!(e >= 0)) throw Error("length must be a positive number");
|
|
2923
|
+
return xt(St(e, t), n);
|
|
2924
|
+
}
|
|
2925
|
+
function Et(e) {
|
|
2926
|
+
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
2927
|
+
}
|
|
2928
|
+
function Dt(e) {
|
|
2929
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2930
|
+
}
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region node_modules/@turf/meta/dist/esm/index.js
|
|
2933
|
+
function Ot(e, t, n) {
|
|
2934
|
+
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; _++) {
|
|
2935
|
+
l = m ? e.features[_].geometry : h ? e.geometry : e, f = l ? l.type === "GeometryCollection" : !1, s = f ? l.geometries.length : 1;
|
|
2936
|
+
for (var v = 0; v < s; v++) {
|
|
2937
|
+
var y = 0, b = 0;
|
|
2938
|
+
if (o = f ? l.geometries[v] : l, o !== null) {
|
|
2939
|
+
c = o.coordinates;
|
|
2940
|
+
var x = o.type;
|
|
2941
|
+
switch (u = n && (x === "Polygon" || x === "MultiPolygon") ? 1 : 0, x) {
|
|
2942
|
+
case null: break;
|
|
2943
|
+
case "Point":
|
|
2944
|
+
if (t(c, d, _, y, b) === !1) return !1;
|
|
2945
|
+
d++, y++;
|
|
2946
|
+
break;
|
|
2947
|
+
case "LineString":
|
|
2948
|
+
case "MultiPoint":
|
|
2949
|
+
for (r = 0; r < c.length; r++) {
|
|
2950
|
+
if (t(c[r], d, _, y, b) === !1) return !1;
|
|
2951
|
+
d++, x === "MultiPoint" && y++;
|
|
2952
|
+
}
|
|
2953
|
+
x === "LineString" && y++;
|
|
2954
|
+
break;
|
|
2955
|
+
case "Polygon":
|
|
2956
|
+
case "MultiLineString":
|
|
2957
|
+
for (r = 0; r < c.length; r++) {
|
|
2958
|
+
for (i = 0; i < c[r].length - u; i++) {
|
|
2959
|
+
if (t(c[r][i], d, _, y, b) === !1) return !1;
|
|
2960
|
+
d++;
|
|
2961
|
+
}
|
|
2962
|
+
x === "MultiLineString" && y++, x === "Polygon" && b++;
|
|
2963
|
+
}
|
|
2964
|
+
x === "Polygon" && y++;
|
|
2965
|
+
break;
|
|
2966
|
+
case "MultiPolygon":
|
|
2967
|
+
for (r = 0; r < c.length; r++) {
|
|
2968
|
+
for (b = 0, i = 0; i < c[r].length; i++) {
|
|
2969
|
+
for (a = 0; a < c[r][i].length - u; a++) {
|
|
2970
|
+
if (t(c[r][i][a], d, _, y, b) === !1) return !1;
|
|
2971
|
+
d++;
|
|
2972
|
+
}
|
|
2973
|
+
b++;
|
|
2974
|
+
}
|
|
2975
|
+
y++;
|
|
2976
|
+
}
|
|
2977
|
+
break;
|
|
2978
|
+
case "GeometryCollection":
|
|
2979
|
+
for (r = 0; r < o.geometries.length; r++) if (Ot(o.geometries[r], t, n) === !1) return !1;
|
|
2980
|
+
break;
|
|
2981
|
+
default: throw Error("Unknown Geometry Type");
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
function kt(e) {
|
|
2988
|
+
var t = [];
|
|
2989
|
+
return Ot(e, function(e) {
|
|
2990
|
+
t.push(e);
|
|
2991
|
+
}), t;
|
|
2992
|
+
}
|
|
2993
|
+
function At(e, t) {
|
|
2994
|
+
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;
|
|
2995
|
+
for (n = 0; n < h; n++) {
|
|
2996
|
+
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++) {
|
|
2997
|
+
if (a = c ? s.geometries[i] : s, a === null) {
|
|
2998
|
+
if (t(null, f, l, u, d) === !1) return !1;
|
|
2999
|
+
continue;
|
|
3000
|
+
}
|
|
3001
|
+
switch (a.type) {
|
|
3002
|
+
case "Point":
|
|
3003
|
+
case "LineString":
|
|
3004
|
+
case "MultiPoint":
|
|
3005
|
+
case "Polygon":
|
|
3006
|
+
case "MultiLineString":
|
|
3007
|
+
case "MultiPolygon":
|
|
3008
|
+
if (t(a, f, l, u, d) === !1) return !1;
|
|
3009
|
+
break;
|
|
3010
|
+
case "GeometryCollection":
|
|
3011
|
+
for (r = 0; r < a.geometries.length; r++) if (t(a.geometries[r], f, l, u, d) === !1) return !1;
|
|
3012
|
+
break;
|
|
3013
|
+
default: throw Error("Unknown Geometry Type");
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
f++;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
function jt(e, t, n) {
|
|
3020
|
+
var r = n;
|
|
3021
|
+
return At(e, function(e, i, a, o, s) {
|
|
3022
|
+
r = i === 0 && n === void 0 ? e : t(r, e, i, a, o, s);
|
|
3023
|
+
}), r;
|
|
3024
|
+
}
|
|
3025
|
+
//#endregion
|
|
3026
|
+
//#region node_modules/rbush/rbush.min.js
|
|
3027
|
+
var Mt = /* @__PURE__ */ y(((e, t) => {
|
|
3028
|
+
(function(n, r) {
|
|
3029
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n ||= self).RBush = r();
|
|
3030
|
+
})(e, function() {
|
|
3031
|
+
function e(e, r, i, a, o) {
|
|
3032
|
+
(function e(n, r, i, a, o) {
|
|
3033
|
+
for (; a > i;) {
|
|
3034
|
+
if (a - i > 600) {
|
|
3035
|
+
var s = a - i + 1, c = r - i + 1, l = Math.log(s), u = .5 * Math.exp(2 * l / 3), d = .5 * Math.sqrt(l * u * (s - u) / s) * (c - s / 2 < 0 ? -1 : 1);
|
|
3036
|
+
e(n, r, Math.max(i, Math.floor(r - c * u / s + d)), Math.min(a, Math.floor(r + (s - c) * u / s + d)), o);
|
|
3037
|
+
}
|
|
3038
|
+
var f = n[r], p = i, m = a;
|
|
3039
|
+
for (t(n, i, r), o(n[a], f) > 0 && t(n, i, a); p < m;) {
|
|
3040
|
+
for (t(n, p, m), p++, m--; o(n[p], f) < 0;) p++;
|
|
3041
|
+
for (; o(n[m], f) > 0;) m--;
|
|
3042
|
+
}
|
|
3043
|
+
o(n[i], f) === 0 ? t(n, i, m) : t(n, ++m, a), m <= r && (i = m + 1), r <= m && (a = m - 1);
|
|
3044
|
+
}
|
|
3045
|
+
})(e, r, i || 0, a || e.length - 1, o || n);
|
|
3046
|
+
}
|
|
3047
|
+
function t(e, t, n) {
|
|
3048
|
+
var r = e[t];
|
|
3049
|
+
e[t] = e[n], e[n] = r;
|
|
3050
|
+
}
|
|
3051
|
+
function n(e, t) {
|
|
3052
|
+
return e < t ? -1 : e > t ? 1 : 0;
|
|
3053
|
+
}
|
|
3054
|
+
var r = function(e) {
|
|
3055
|
+
e === void 0 && (e = 9), this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)), this.clear();
|
|
3056
|
+
};
|
|
3057
|
+
function i(e, t, n) {
|
|
3058
|
+
if (!n) return t.indexOf(e);
|
|
3059
|
+
for (var r = 0; r < t.length; r++) if (n(e, t[r])) return r;
|
|
3060
|
+
return -1;
|
|
3061
|
+
}
|
|
3062
|
+
function a(e, t) {
|
|
3063
|
+
o(e, 0, e.children.length, t, e);
|
|
3064
|
+
}
|
|
3065
|
+
function o(e, t, n, r, i) {
|
|
3066
|
+
i ||= m(null), i.minX = Infinity, i.minY = Infinity, i.maxX = -Infinity, i.maxY = -Infinity;
|
|
3067
|
+
for (var a = t; a < n; a++) {
|
|
3068
|
+
var o = e.children[a];
|
|
3069
|
+
s(i, e.leaf ? r(o) : o);
|
|
3070
|
+
}
|
|
3071
|
+
return i;
|
|
3072
|
+
}
|
|
3073
|
+
function s(e, t) {
|
|
3074
|
+
return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
|
|
3075
|
+
}
|
|
3076
|
+
function c(e, t) {
|
|
3077
|
+
return e.minX - t.minX;
|
|
3078
|
+
}
|
|
3079
|
+
function l(e, t) {
|
|
3080
|
+
return e.minY - t.minY;
|
|
3081
|
+
}
|
|
3082
|
+
function u(e) {
|
|
3083
|
+
return (e.maxX - e.minX) * (e.maxY - e.minY);
|
|
3084
|
+
}
|
|
3085
|
+
function d(e) {
|
|
3086
|
+
return e.maxX - e.minX + (e.maxY - e.minY);
|
|
3087
|
+
}
|
|
3088
|
+
function f(e, t) {
|
|
3089
|
+
return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
|
|
3090
|
+
}
|
|
3091
|
+
function p(e, t) {
|
|
3092
|
+
return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
|
|
3093
|
+
}
|
|
3094
|
+
function m(e) {
|
|
3095
|
+
return {
|
|
3096
|
+
children: e,
|
|
3097
|
+
height: 1,
|
|
3098
|
+
leaf: !0,
|
|
3099
|
+
minX: Infinity,
|
|
3100
|
+
minY: Infinity,
|
|
3101
|
+
maxX: -Infinity,
|
|
3102
|
+
maxY: -Infinity
|
|
3103
|
+
};
|
|
3104
|
+
}
|
|
3105
|
+
function h(t, n, r, i, a) {
|
|
3106
|
+
for (var o = [n, r]; o.length;) if (!((r = o.pop()) - (n = o.pop()) <= i)) {
|
|
3107
|
+
var s = n + Math.ceil((r - n) / i / 2) * i;
|
|
3108
|
+
e(t, s, n, r, a), o.push(n, s, s, r);
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
return r.prototype.all = function() {
|
|
3112
|
+
return this._all(this.data, []);
|
|
3113
|
+
}, r.prototype.search = function(e) {
|
|
3114
|
+
var t = this.data, n = [];
|
|
3115
|
+
if (!p(e, t)) return n;
|
|
3116
|
+
for (var r = this.toBBox, i = []; t;) {
|
|
3117
|
+
for (var a = 0; a < t.children.length; a++) {
|
|
3118
|
+
var o = t.children[a], s = t.leaf ? r(o) : o;
|
|
3119
|
+
p(e, s) && (t.leaf ? n.push(o) : f(e, s) ? this._all(o, n) : i.push(o));
|
|
3120
|
+
}
|
|
3121
|
+
t = i.pop();
|
|
3122
|
+
}
|
|
3123
|
+
return n;
|
|
3124
|
+
}, r.prototype.collides = function(e) {
|
|
3125
|
+
var t = this.data;
|
|
3126
|
+
if (!p(e, t)) return !1;
|
|
3127
|
+
for (var n = []; t;) {
|
|
3128
|
+
for (var r = 0; r < t.children.length; r++) {
|
|
3129
|
+
var i = t.children[r], a = t.leaf ? this.toBBox(i) : i;
|
|
3130
|
+
if (p(e, a)) {
|
|
3131
|
+
if (t.leaf || f(e, a)) return !0;
|
|
3132
|
+
n.push(i);
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
t = n.pop();
|
|
3136
|
+
}
|
|
3137
|
+
return !1;
|
|
3138
|
+
}, r.prototype.load = function(e) {
|
|
3139
|
+
if (!e || !e.length) return this;
|
|
3140
|
+
if (e.length < this._minEntries) {
|
|
3141
|
+
for (var t = 0; t < e.length; t++) this.insert(e[t]);
|
|
3142
|
+
return this;
|
|
3143
|
+
}
|
|
3144
|
+
var n = this._build(e.slice(), 0, e.length - 1, 0);
|
|
3145
|
+
if (this.data.children.length) if (this.data.height === n.height) this._splitRoot(this.data, n);
|
|
3146
|
+
else {
|
|
3147
|
+
if (this.data.height < n.height) {
|
|
3148
|
+
var r = this.data;
|
|
3149
|
+
this.data = n, n = r;
|
|
3150
|
+
}
|
|
3151
|
+
this._insert(n, this.data.height - n.height - 1, !0);
|
|
3152
|
+
}
|
|
3153
|
+
else this.data = n;
|
|
3154
|
+
return this;
|
|
3155
|
+
}, r.prototype.insert = function(e) {
|
|
3156
|
+
return e && this._insert(e, this.data.height - 1), this;
|
|
3157
|
+
}, r.prototype.clear = function() {
|
|
3158
|
+
return this.data = m([]), this;
|
|
3159
|
+
}, r.prototype.remove = function(e, t) {
|
|
3160
|
+
if (!e) return this;
|
|
3161
|
+
for (var n, r, a, o = this.data, s = this.toBBox(e), c = [], l = []; o || c.length;) {
|
|
3162
|
+
if (o || (o = c.pop(), r = c[c.length - 1], n = l.pop(), a = !0), o.leaf) {
|
|
3163
|
+
var u = i(e, o.children, t);
|
|
3164
|
+
if (u !== -1) return o.children.splice(u, 1), c.push(o), this._condense(c), this;
|
|
3165
|
+
}
|
|
3166
|
+
a || o.leaf || !f(o, s) ? r ? (n++, o = r.children[n], a = !1) : o = null : (c.push(o), l.push(n), n = 0, r = o, o = o.children[0]);
|
|
3167
|
+
}
|
|
3168
|
+
return this;
|
|
3169
|
+
}, r.prototype.toBBox = function(e) {
|
|
3170
|
+
return e;
|
|
3171
|
+
}, r.prototype.compareMinX = function(e, t) {
|
|
3172
|
+
return e.minX - t.minX;
|
|
3173
|
+
}, r.prototype.compareMinY = function(e, t) {
|
|
3174
|
+
return e.minY - t.minY;
|
|
3175
|
+
}, r.prototype.toJSON = function() {
|
|
3176
|
+
return this.data;
|
|
3177
|
+
}, r.prototype.fromJSON = function(e) {
|
|
3178
|
+
return this.data = e, this;
|
|
3179
|
+
}, r.prototype._all = function(e, t) {
|
|
3180
|
+
for (var n = []; e;) e.leaf ? t.push.apply(t, e.children) : n.push.apply(n, e.children), e = n.pop();
|
|
3181
|
+
return t;
|
|
3182
|
+
}, r.prototype._build = function(e, t, n, r) {
|
|
3183
|
+
var i, o = n - t + 1, s = this._maxEntries;
|
|
3184
|
+
if (o <= s) return a(i = m(e.slice(t, n + 1)), this.toBBox), i;
|
|
3185
|
+
r || (r = Math.ceil(Math.log(o) / Math.log(s)), s = Math.ceil(o / s ** (r - 1))), (i = m([])).leaf = !1, i.height = r;
|
|
3186
|
+
var c = Math.ceil(o / s), l = c * Math.ceil(Math.sqrt(s));
|
|
3187
|
+
h(e, t, n, l, this.compareMinX);
|
|
3188
|
+
for (var u = t; u <= n; u += l) {
|
|
3189
|
+
var d = Math.min(u + l - 1, n);
|
|
3190
|
+
h(e, u, d, c, this.compareMinY);
|
|
3191
|
+
for (var f = u; f <= d; f += c) {
|
|
3192
|
+
var p = Math.min(f + c - 1, d);
|
|
3193
|
+
i.children.push(this._build(e, f, p, r - 1));
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
return a(i, this.toBBox), i;
|
|
3197
|
+
}, r.prototype._chooseSubtree = function(e, t, n, r) {
|
|
3198
|
+
for (; r.push(t), !t.leaf && r.length - 1 !== n;) {
|
|
3199
|
+
for (var i = Infinity, a = Infinity, o = void 0, s = 0; s < t.children.length; s++) {
|
|
3200
|
+
var c = t.children[s], l = u(c), d = (f = e, p = c, (Math.max(p.maxX, f.maxX) - Math.min(p.minX, f.minX)) * (Math.max(p.maxY, f.maxY) - Math.min(p.minY, f.minY)) - l);
|
|
3201
|
+
d < a ? (a = d, i = l < i ? l : i, o = c) : d === a && l < i && (i = l, o = c);
|
|
3202
|
+
}
|
|
3203
|
+
t = o || t.children[0];
|
|
3204
|
+
}
|
|
3205
|
+
var f, p;
|
|
3206
|
+
return t;
|
|
3207
|
+
}, r.prototype._insert = function(e, t, n) {
|
|
3208
|
+
var r = n ? e : this.toBBox(e), i = [], a = this._chooseSubtree(r, this.data, t, i);
|
|
3209
|
+
for (a.children.push(e), s(a, r); t >= 0 && i[t].children.length > this._maxEntries;) this._split(i, t), t--;
|
|
3210
|
+
this._adjustParentBBoxes(r, i, t);
|
|
3211
|
+
}, r.prototype._split = function(e, t) {
|
|
3212
|
+
var n = e[t], r = n.children.length, i = this._minEntries;
|
|
3213
|
+
this._chooseSplitAxis(n, i, r);
|
|
3214
|
+
var o = this._chooseSplitIndex(n, i, r), s = m(n.children.splice(o, n.children.length - o));
|
|
3215
|
+
s.height = n.height, s.leaf = n.leaf, a(n, this.toBBox), a(s, this.toBBox), t ? e[t - 1].children.push(s) : this._splitRoot(n, s);
|
|
3216
|
+
}, r.prototype._splitRoot = function(e, t) {
|
|
3217
|
+
this.data = m([e, t]), this.data.height = e.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
|
|
3218
|
+
}, r.prototype._chooseSplitIndex = function(e, t, n) {
|
|
3219
|
+
for (var r, i, a, s, c, l, d, f = Infinity, p = Infinity, m = t; m <= n - t; m++) {
|
|
3220
|
+
var h = o(e, 0, m, this.toBBox), g = o(e, m, n, this.toBBox), _ = (i = h, a = g, s = void 0, c = void 0, l = void 0, d = void 0, s = Math.max(i.minX, a.minX), c = Math.max(i.minY, a.minY), l = Math.min(i.maxX, a.maxX), d = Math.min(i.maxY, a.maxY), Math.max(0, l - s) * Math.max(0, d - c)), v = u(h) + u(g);
|
|
3221
|
+
_ < f ? (f = _, r = m, p = v < p ? v : p) : _ === f && v < p && (p = v, r = m);
|
|
3222
|
+
}
|
|
3223
|
+
return r || n - t;
|
|
3224
|
+
}, r.prototype._chooseSplitAxis = function(e, t, n) {
|
|
3225
|
+
var r = e.leaf ? this.compareMinX : c, i = e.leaf ? this.compareMinY : l;
|
|
3226
|
+
this._allDistMargin(e, t, n, r) < this._allDistMargin(e, t, n, i) && e.children.sort(r);
|
|
3227
|
+
}, r.prototype._allDistMargin = function(e, t, n, r) {
|
|
3228
|
+
e.children.sort(r);
|
|
3229
|
+
for (var i = this.toBBox, a = o(e, 0, t, i), c = o(e, n - t, n, i), l = d(a) + d(c), u = t; u < n - t; u++) {
|
|
3230
|
+
var f = e.children[u];
|
|
3231
|
+
s(a, e.leaf ? i(f) : f), l += d(a);
|
|
3232
|
+
}
|
|
3233
|
+
for (var p = n - t - 1; p >= t; p--) {
|
|
3234
|
+
var m = e.children[p];
|
|
3235
|
+
s(c, e.leaf ? i(m) : m), l += d(c);
|
|
3236
|
+
}
|
|
3237
|
+
return l;
|
|
3238
|
+
}, r.prototype._adjustParentBBoxes = function(e, t, n) {
|
|
3239
|
+
for (var r = n; r >= 0; r--) s(t[r], e);
|
|
3240
|
+
}, r.prototype._condense = function(e) {
|
|
3241
|
+
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);
|
|
3242
|
+
}, r;
|
|
3243
|
+
});
|
|
3244
|
+
})), Nt = /* @__PURE__ */ b({ default: () => Ft });
|
|
3245
|
+
function Pt(e, t) {
|
|
3246
|
+
return e < t ? -1 : e > t ? 1 : 0;
|
|
3247
|
+
}
|
|
3248
|
+
var Ft, It = v((() => {
|
|
3249
|
+
Ft = class {
|
|
3250
|
+
constructor(e = [], t = Pt) {
|
|
3251
|
+
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);
|
|
3252
|
+
}
|
|
3253
|
+
push(e) {
|
|
3254
|
+
this.data.push(e), this.length++, this._up(this.length - 1);
|
|
3255
|
+
}
|
|
3256
|
+
pop() {
|
|
3257
|
+
if (this.length === 0) return;
|
|
3258
|
+
let e = this.data[0], t = this.data.pop();
|
|
3259
|
+
return this.length--, this.length > 0 && (this.data[0] = t, this._down(0)), e;
|
|
3260
|
+
}
|
|
3261
|
+
peek() {
|
|
3262
|
+
return this.data[0];
|
|
3263
|
+
}
|
|
3264
|
+
_up(e) {
|
|
3265
|
+
let { data: t, compare: n } = this, r = t[e];
|
|
3266
|
+
for (; e > 0;) {
|
|
3267
|
+
let i = e - 1 >> 1, a = t[i];
|
|
3268
|
+
if (n(r, a) >= 0) break;
|
|
3269
|
+
t[e] = a, e = i;
|
|
3270
|
+
}
|
|
3271
|
+
t[e] = r;
|
|
3272
|
+
}
|
|
3273
|
+
_down(e) {
|
|
3274
|
+
let { data: t, compare: n } = this, r = this.length >> 1, i = t[e];
|
|
3275
|
+
for (; e < r;) {
|
|
3276
|
+
let r = (e << 1) + 1, a = t[r], o = r + 1;
|
|
3277
|
+
if (o < this.length && n(t[o], a) < 0 && (r = o, a = t[o]), n(a, i) >= 0) break;
|
|
3278
|
+
t[e] = a, e = r;
|
|
3279
|
+
}
|
|
3280
|
+
t[e] = i;
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3283
|
+
})), Lt = /* @__PURE__ */ y(((e, t) => {
|
|
3284
|
+
t.exports = function(e, t, n, r) {
|
|
3285
|
+
var i = e[0], a = e[1], o = !1;
|
|
3286
|
+
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
3287
|
+
for (var s = (r - n) / 2, c = 0, l = s - 1; c < s; l = c++) {
|
|
3288
|
+
var u = t[n + c * 2 + 0], d = t[n + c * 2 + 1], f = t[n + l * 2 + 0], p = t[n + l * 2 + 1];
|
|
3289
|
+
d > a != p > a && i < (f - u) * (a - d) / (p - d) + u && (o = !o);
|
|
3290
|
+
}
|
|
3291
|
+
return o;
|
|
3292
|
+
};
|
|
3293
|
+
})), Rt = /* @__PURE__ */ y(((e, t) => {
|
|
3294
|
+
t.exports = function(e, t, n, r) {
|
|
3295
|
+
var i = e[0], a = e[1], o = !1;
|
|
3296
|
+
n === void 0 && (n = 0), r === void 0 && (r = t.length);
|
|
3297
|
+
for (var s = r - n, c = 0, l = s - 1; c < s; l = c++) {
|
|
3298
|
+
var u = t[c + n][0], d = t[c + n][1], f = t[l + n][0], p = t[l + n][1];
|
|
3299
|
+
d > a != p > a && i < (f - u) * (a - d) / (p - d) + u && (o = !o);
|
|
3300
|
+
}
|
|
3301
|
+
return o;
|
|
3302
|
+
};
|
|
3303
|
+
})), zt = /* @__PURE__ */ y(((e, t) => {
|
|
3304
|
+
var n = Lt(), r = Rt();
|
|
3305
|
+
t.exports = function(e, t, i, a) {
|
|
3306
|
+
return t.length > 0 && Array.isArray(t[0]) ? r(e, t, i, a) : n(e, t, i, a);
|
|
3307
|
+
}, t.exports.nested = r, t.exports.flat = n;
|
|
3308
|
+
})), Bt = /* @__PURE__ */ y(((e, t) => {
|
|
3309
|
+
(function(n, r) {
|
|
3310
|
+
typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n ||= self).predicates = {});
|
|
3311
|
+
})(e, function(e) {
|
|
3312
|
+
let t = 134217729;
|
|
3313
|
+
function n(e, t, n, r, i) {
|
|
3314
|
+
let a, o, s, c, l = t[0], u = r[0], d = 0, f = 0;
|
|
3315
|
+
u > l == u > -l ? (a = l, l = t[++d]) : (a = u, u = r[++f]);
|
|
3316
|
+
let p = 0;
|
|
3317
|
+
if (d < e && f < n) for (u > l == u > -l ? (s = a - ((o = l + a) - l), l = t[++d]) : (s = a - ((o = u + a) - u), u = r[++f]), a = o, s !== 0 && (i[p++] = s); d < e && f < n;) u > l == u > -l ? (s = a - ((o = a + l) - (c = o - a)) + (l - c), l = t[++d]) : (s = a - ((o = a + u) - (c = o - a)) + (u - c), u = r[++f]), a = o, s !== 0 && (i[p++] = s);
|
|
3318
|
+
for (; d < e;) s = a - ((o = a + l) - (c = o - a)) + (l - c), l = t[++d], a = o, s !== 0 && (i[p++] = s);
|
|
3319
|
+
for (; f < n;) s = a - ((o = a + u) - (c = o - a)) + (u - c), u = r[++f], a = o, s !== 0 && (i[p++] = s);
|
|
3320
|
+
return a === 0 && p !== 0 || (i[p++] = a), p;
|
|
3321
|
+
}
|
|
3322
|
+
function r(e) {
|
|
3323
|
+
return new Float64Array(e);
|
|
3324
|
+
}
|
|
3325
|
+
let i = r(4), a = r(8), o = r(12), s = r(16), c = r(4);
|
|
3326
|
+
e.orient2d = function(e, r, l, u, d, f) {
|
|
3327
|
+
let p = (r - f) * (l - d), m = (e - d) * (u - f), h = p - m;
|
|
3328
|
+
if (p === 0 || m === 0 || p > 0 != m > 0) return h;
|
|
3329
|
+
let g = Math.abs(p + m);
|
|
3330
|
+
return Math.abs(h) >= 33306690738754716e-32 * g ? h : -function(e, r, l, u, d, f, p) {
|
|
3331
|
+
let m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M = e - d, N = l - d, P = r - f, F = u - f;
|
|
3332
|
+
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 = P - (b = (y = t * P) - (y - P))) * (C = N - (S = (y = t * N) - (y - N))) - ((k = P * N) - b * S - x * S - b * C))), i[0] = O - (w + v) + (v - A), v = (E = D - ((T = D + w) - (v = T - D)) + (w - v)) - (w = E - k), i[1] = E - (w + v) + (v - k), v = (j = T + w) - T, i[2] = T - (j - v) + (w - v), i[3] = j;
|
|
3333
|
+
let I = function(e, t) {
|
|
3334
|
+
let n = t[0];
|
|
3335
|
+
for (let r = 1; r < e; r++) n += t[r];
|
|
3336
|
+
return n;
|
|
3337
|
+
}(4, i), L = 22204460492503146e-32 * p;
|
|
3338
|
+
if (I >= L || -I >= L || (m = e - (M + (v = e - M)) + (v - d), g = l - (N + (v = l - N)) + (v - d), h = r - (P + (v = r - P)) + (v - f), _ = u - (F + (v = u - F)) + (v - f), m === 0 && h === 0 && g === 0 && _ === 0) || (L = 11093356479670487e-47 * p + 33306690738754706e-32 * Math.abs(I), (I += M * _ + F * m - (P * g + N * h)) >= L || -I >= L)) return I;
|
|
3339
|
+
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;
|
|
3340
|
+
let R = n(4, i, 4, c, a);
|
|
3341
|
+
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;
|
|
3342
|
+
let ee = n(R, a, 4, c, o);
|
|
3343
|
+
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(ee, o, 4, c, s) - 1];
|
|
3344
|
+
}(e, r, l, u, d, f, g);
|
|
3345
|
+
}, e.orient2dfast = function(e, t, n, r, i, a) {
|
|
3346
|
+
return (t - a) * (n - i) - (e - i) * (r - a);
|
|
3347
|
+
}, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3348
|
+
});
|
|
3349
|
+
})), Vt = /* @__PURE__ */ S((/* @__PURE__ */ y(((e, t) => {
|
|
3350
|
+
var n = Mt(), r = (It(), C(Nt)), i = zt(), a = Bt().orient2d;
|
|
3351
|
+
r.default && (r = r.default), t.exports = o, t.exports.default = o;
|
|
3352
|
+
function o(e, t, r) {
|
|
3353
|
+
t = Math.max(0, t === void 0 ? 2 : t), r ||= 0;
|
|
3354
|
+
var i = h(e), a = new n(16);
|
|
3355
|
+
a.toBBox = function(e) {
|
|
3356
|
+
return {
|
|
3357
|
+
minX: e[0],
|
|
3358
|
+
minY: e[1],
|
|
3359
|
+
maxX: e[0],
|
|
3360
|
+
maxY: e[1]
|
|
3361
|
+
};
|
|
3362
|
+
}, a.compareMinX = function(e, t) {
|
|
3363
|
+
return e[0] - t[0];
|
|
3364
|
+
}, a.compareMinY = function(e, t) {
|
|
3365
|
+
return e[1] - t[1];
|
|
3366
|
+
}, a.load(e);
|
|
3367
|
+
for (var o = [], c = 0, l; c < i.length; c++) {
|
|
3368
|
+
var u = i[c];
|
|
3369
|
+
a.remove(u), l = g(u, l), o.push(l);
|
|
3370
|
+
}
|
|
3371
|
+
var d = new n(16);
|
|
3372
|
+
for (c = 0; c < o.length; c++) d.insert(m(o[c]));
|
|
3373
|
+
for (var f = t * t, p = r * r; o.length;) {
|
|
3374
|
+
var v = o.shift(), y = v.p, b = v.next.p, x = _(y, b);
|
|
3375
|
+
if (!(x < p)) {
|
|
3376
|
+
var S = x / f;
|
|
3377
|
+
u = s(a, v.prev.p, y, b, v.next.next.p, S, d), u && Math.min(_(u, y), _(u, b)) <= S && (o.push(v), o.push(g(u, v)), a.remove(u), d.remove(v), d.insert(m(v)), d.insert(m(v.next)));
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
v = l;
|
|
3381
|
+
var C = [];
|
|
3382
|
+
do
|
|
3383
|
+
C.push(v.p), v = v.next;
|
|
3384
|
+
while (v !== l);
|
|
3385
|
+
return C.push(v.p), C;
|
|
3386
|
+
}
|
|
3387
|
+
function s(e, t, n, i, a, o, s) {
|
|
3388
|
+
for (var u = new r([], c), f = e.data; f;) {
|
|
3389
|
+
for (var p = 0; p < f.children.length; p++) {
|
|
3390
|
+
var m = f.children[p], h = f.leaf ? v(m, n, i) : l(n, i, m);
|
|
3391
|
+
h > o || u.push({
|
|
3392
|
+
node: m,
|
|
3393
|
+
dist: h
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
for (; u.length && !u.peek().node.children;) {
|
|
3397
|
+
var g = u.pop(), _ = g.node, y = v(_, t, n), b = v(_, i, a);
|
|
3398
|
+
if (g.dist < y && g.dist < b && d(n, _, s) && d(i, _, s)) return _;
|
|
3399
|
+
}
|
|
3400
|
+
f = u.pop(), f &&= f.node;
|
|
3401
|
+
}
|
|
3402
|
+
return null;
|
|
3403
|
+
}
|
|
3404
|
+
function c(e, t) {
|
|
3405
|
+
return e.dist - t.dist;
|
|
3406
|
+
}
|
|
3407
|
+
function l(e, t, n) {
|
|
3408
|
+
if (u(e, n) || u(t, n)) return 0;
|
|
3409
|
+
var r = y(e[0], e[1], t[0], t[1], n.minX, n.minY, n.maxX, n.minY);
|
|
3410
|
+
if (r === 0) return 0;
|
|
3411
|
+
var i = y(e[0], e[1], t[0], t[1], n.minX, n.minY, n.minX, n.maxY);
|
|
3412
|
+
if (i === 0) return 0;
|
|
3413
|
+
var a = y(e[0], e[1], t[0], t[1], n.maxX, n.minY, n.maxX, n.maxY);
|
|
3414
|
+
if (a === 0) return 0;
|
|
3415
|
+
var o = y(e[0], e[1], t[0], t[1], n.minX, n.maxY, n.maxX, n.maxY);
|
|
3416
|
+
return o === 0 ? 0 : Math.min(r, i, a, o);
|
|
3417
|
+
}
|
|
3418
|
+
function u(e, t) {
|
|
3419
|
+
return e[0] >= t.minX && e[0] <= t.maxX && e[1] >= t.minY && e[1] <= t.maxY;
|
|
3420
|
+
}
|
|
3421
|
+
function d(e, t, n) {
|
|
3422
|
+
for (var r = Math.min(e[0], t[0]), i = Math.min(e[1], t[1]), a = Math.max(e[0], t[0]), o = Math.max(e[1], t[1]), s = n.search({
|
|
3423
|
+
minX: r,
|
|
3424
|
+
minY: i,
|
|
3425
|
+
maxX: a,
|
|
3426
|
+
maxY: o
|
|
3427
|
+
}), c = 0; c < s.length; c++) if (p(s[c].p, s[c].next.p, e, t)) return !1;
|
|
3428
|
+
return !0;
|
|
3429
|
+
}
|
|
3430
|
+
function f(e, t, n) {
|
|
3431
|
+
return a(e[0], e[1], t[0], t[1], n[0], n[1]);
|
|
3432
|
+
}
|
|
3433
|
+
function p(e, t, n, r) {
|
|
3434
|
+
return e !== r && t !== n && f(e, t, n) > 0 != f(e, t, r) > 0 && f(n, r, e) > 0 != f(n, r, t) > 0;
|
|
3435
|
+
}
|
|
3436
|
+
function m(e) {
|
|
3437
|
+
var t = e.p, n = e.next.p;
|
|
3438
|
+
return e.minX = Math.min(t[0], n[0]), e.minY = Math.min(t[1], n[1]), e.maxX = Math.max(t[0], n[0]), e.maxY = Math.max(t[1], n[1]), e;
|
|
3439
|
+
}
|
|
3440
|
+
function h(e) {
|
|
3441
|
+
for (var t = e[0], n = e[0], r = e[0], a = e[0], o = 0; o < e.length; o++) {
|
|
3442
|
+
var s = e[o];
|
|
3443
|
+
s[0] < t[0] && (t = s), s[0] > r[0] && (r = s), s[1] < n[1] && (n = s), s[1] > a[1] && (a = s);
|
|
3444
|
+
}
|
|
3445
|
+
var c = [
|
|
3446
|
+
t,
|
|
3447
|
+
n,
|
|
3448
|
+
r,
|
|
3449
|
+
a
|
|
3450
|
+
], l = c.slice();
|
|
3451
|
+
for (o = 0; o < e.length; o++) i(e[o], c) || l.push(e[o]);
|
|
3452
|
+
return x(l);
|
|
3453
|
+
}
|
|
3454
|
+
function g(e, t) {
|
|
3455
|
+
var n = {
|
|
3456
|
+
p: e,
|
|
3457
|
+
prev: null,
|
|
3458
|
+
next: null,
|
|
3459
|
+
minX: 0,
|
|
3460
|
+
minY: 0,
|
|
3461
|
+
maxX: 0,
|
|
3462
|
+
maxY: 0
|
|
3463
|
+
};
|
|
3464
|
+
return t ? (n.next = t.next, n.prev = t, t.next.prev = n, t.next = n) : (n.prev = n, n.next = n), n;
|
|
3465
|
+
}
|
|
3466
|
+
function _(e, t) {
|
|
3467
|
+
var n = e[0] - t[0], r = e[1] - t[1];
|
|
3468
|
+
return n * n + r * r;
|
|
3469
|
+
}
|
|
3470
|
+
function v(e, t, n) {
|
|
3471
|
+
var r = t[0], i = t[1], a = n[0] - r, o = n[1] - i;
|
|
3472
|
+
if (a !== 0 || o !== 0) {
|
|
3473
|
+
var s = ((e[0] - r) * a + (e[1] - i) * o) / (a * a + o * o);
|
|
3474
|
+
s > 1 ? (r = n[0], i = n[1]) : s > 0 && (r += a * s, i += o * s);
|
|
3475
|
+
}
|
|
3476
|
+
return a = e[0] - r, o = e[1] - i, a * a + o * o;
|
|
3477
|
+
}
|
|
3478
|
+
function y(e, t, n, r, i, a, o, s) {
|
|
3479
|
+
var c = n - e, l = r - t, u = o - i, d = s - a, f = e - i, p = t - a, m = c * c + l * l, h = c * u + l * d, g = u * u + d * d, _ = c * f + l * p, v = u * f + d * p, y = m * g - h * h, b, x, S, C, w = y, T = y;
|
|
3480
|
+
y === 0 ? (x = 0, w = 1, C = v, T = g) : (x = h * v - g * _, C = m * v - h * _, x < 0 ? (x = 0, C = v, T = g) : x > w && (x = w, C = v + h, T = g)), C < 0 ? (C = 0, -_ < 0 ? x = 0 : -_ > m ? x = w : (x = -_, w = m)) : C > T && (C = T, -_ + h < 0 ? x = 0 : -_ + h > m ? x = w : (x = -_ + h, w = m)), b = x === 0 ? 0 : x / w, S = C === 0 ? 0 : C / T;
|
|
3481
|
+
var E = (1 - b) * e + b * n, D = (1 - b) * t + b * r, O = (1 - S) * i + S * o, k = (1 - S) * a + S * s, A = O - E, j = k - D;
|
|
3482
|
+
return A * A + j * j;
|
|
3483
|
+
}
|
|
3484
|
+
function b(e, t) {
|
|
3485
|
+
return e[0] === t[0] ? e[1] - t[1] : e[0] - t[0];
|
|
3486
|
+
}
|
|
3487
|
+
function x(e) {
|
|
3488
|
+
e.sort(b);
|
|
3489
|
+
for (var t = [], n = 0; n < e.length; n++) {
|
|
3490
|
+
for (; t.length >= 2 && f(t[t.length - 2], t[t.length - 1], e[n]) <= 0;) t.pop();
|
|
3491
|
+
t.push(e[n]);
|
|
3492
|
+
}
|
|
3493
|
+
for (var r = [], i = e.length - 1; i >= 0; i--) {
|
|
3494
|
+
for (; r.length >= 2 && f(r[r.length - 2], r[r.length - 1], e[i]) <= 0;) r.pop();
|
|
3495
|
+
r.push(e[i]);
|
|
3496
|
+
}
|
|
3497
|
+
return r.pop(), t.pop(), t.concat(r);
|
|
3498
|
+
}
|
|
3499
|
+
})))(), 1);
|
|
3500
|
+
function Ht(e, t = {}) {
|
|
3501
|
+
t.concavity = t.concavity || Infinity;
|
|
3502
|
+
let n = [];
|
|
3503
|
+
if (Ot(e, (e) => {
|
|
3504
|
+
n.push([e[0], e[1]]);
|
|
3505
|
+
}), !n.length) return null;
|
|
3506
|
+
let r = (0, Vt.default)(n, t.concavity);
|
|
3507
|
+
return r.length > 3 ? bt([r]) : null;
|
|
3508
|
+
}
|
|
3509
|
+
//#endregion
|
|
3510
|
+
//#region node_modules/@turf/centroid/dist/esm/index.js
|
|
3511
|
+
function Ut(e, t = {}) {
|
|
3512
|
+
let n = 0, r = 0, i = 0;
|
|
3513
|
+
return Ot(e, function(e) {
|
|
3514
|
+
n += e[0], r += e[1], i++;
|
|
3515
|
+
}, !0), yt([n / i, r / i], t.properties);
|
|
3516
|
+
}
|
|
3517
|
+
//#endregion
|
|
3518
|
+
//#region node_modules/@turf/invariant/dist/esm/index.js
|
|
3519
|
+
function Wt(e) {
|
|
3520
|
+
if (!e) throw Error("coord is required");
|
|
3521
|
+
if (!Array.isArray(e)) {
|
|
3522
|
+
if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point") return [...e.geometry.coordinates];
|
|
3523
|
+
if (e.type === "Point") return [...e.coordinates];
|
|
3524
|
+
}
|
|
3525
|
+
if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1])) return [...e];
|
|
3526
|
+
throw Error("coord must be GeoJSON Point or an Array of numbers");
|
|
3527
|
+
}
|
|
3528
|
+
function Gt(e) {
|
|
3529
|
+
if (Array.isArray(e)) return e;
|
|
3530
|
+
if (e.type === "Feature") {
|
|
3531
|
+
if (e.geometry !== null) return e.geometry.coordinates;
|
|
3532
|
+
} else if (e.coordinates) return e.coordinates;
|
|
3533
|
+
throw Error("coords must be GeoJSON Feature, Geometry Object or an Array");
|
|
3534
|
+
}
|
|
3535
|
+
//#endregion
|
|
3536
|
+
//#region node_modules/@turf/rhumb-bearing/dist/esm/index.js
|
|
3537
|
+
function Kt(e, t, n = {}) {
|
|
3538
|
+
let r;
|
|
3539
|
+
return r = n.final ? qt(Wt(t), Wt(e)) : qt(Wt(e), Wt(t)), r > 180 ? -(360 - r) : r;
|
|
3540
|
+
}
|
|
3541
|
+
function qt(e, t) {
|
|
3542
|
+
let n = wt(e[1]), r = wt(t[1]), i = wt(t[0] - e[0]);
|
|
3543
|
+
i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
|
|
3544
|
+
let a = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4));
|
|
3545
|
+
return (Ct(Math.atan2(i, a)) + 360) % 360;
|
|
3546
|
+
}
|
|
3547
|
+
//#endregion
|
|
3548
|
+
//#region node_modules/@turf/rhumb-distance/dist/esm/index.js
|
|
3549
|
+
function Jt(e, t, n = {}) {
|
|
3550
|
+
let r = Wt(e), i = Wt(t);
|
|
3551
|
+
return i[0] += i[0] - r[0] > 180 ? -360 : r[0] - i[0] > 180 ? 360 : 0, Tt(Yt(r, i), "meters", n.units);
|
|
3552
|
+
}
|
|
3553
|
+
function Yt(e, t, n) {
|
|
3554
|
+
n = n === void 0 ? $ : Number(n);
|
|
3555
|
+
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;
|
|
3556
|
+
s > Math.PI && (s -= 2 * Math.PI);
|
|
3557
|
+
let c = Math.log(Math.tan(a / 2 + Math.PI / 4) / Math.tan(i / 2 + Math.PI / 4)), l = Math.abs(c) > 1e-11 ? o / c : Math.cos(i);
|
|
3558
|
+
return Math.sqrt(o * o + l * l * s * s) * r;
|
|
3559
|
+
}
|
|
3560
|
+
//#endregion
|
|
3561
|
+
//#region node_modules/@turf/rhumb-destination/dist/esm/index.js
|
|
3562
|
+
function Xt(e, t, n, r = {}) {
|
|
3563
|
+
let i = t < 0, a = Tt(Math.abs(t), r.units, "meters");
|
|
3564
|
+
i && (a = -Math.abs(a));
|
|
3565
|
+
let o = Wt(e), s = Zt(o, a, n);
|
|
3566
|
+
return s[0] += s[0] - o[0] > 180 ? -360 : o[0] - s[0] > 180 ? 360 : 0, yt(s, r.properties);
|
|
3567
|
+
}
|
|
3568
|
+
function Zt(e, t, n, r) {
|
|
3569
|
+
r = r === void 0 ? $ : Number(r);
|
|
3570
|
+
let i = t / r, a = e[0] * Math.PI / 180, o = wt(e[1]), s = wt(n), c = i * Math.cos(s), l = o + c;
|
|
3571
|
+
Math.abs(l) > Math.PI / 2 && (l = l > 0 ? Math.PI - l : -Math.PI - l);
|
|
3572
|
+
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);
|
|
3573
|
+
return [((a + i * Math.sin(s) / d) * 180 / Math.PI + 540) % 360 - 180, l * 180 / Math.PI];
|
|
3574
|
+
}
|
|
3575
|
+
//#endregion
|
|
3576
|
+
//#region node_modules/@turf/clone/dist/esm/index.js
|
|
3577
|
+
function Qt(e) {
|
|
3578
|
+
if (!e) throw Error("geojson is required");
|
|
3579
|
+
switch (e.type) {
|
|
3580
|
+
case "Feature": return $t(e);
|
|
3581
|
+
case "FeatureCollection": return tn(e);
|
|
3582
|
+
case "Point":
|
|
3583
|
+
case "LineString":
|
|
3584
|
+
case "Polygon":
|
|
3585
|
+
case "MultiPoint":
|
|
3586
|
+
case "MultiLineString":
|
|
3587
|
+
case "MultiPolygon":
|
|
3588
|
+
case "GeometryCollection": return nn(e);
|
|
3589
|
+
default: throw Error("unknown GeoJSON type");
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
function $t(e) {
|
|
3593
|
+
let t = { type: "Feature" };
|
|
3594
|
+
return Object.keys(e).forEach((n) => {
|
|
3595
|
+
switch (n) {
|
|
3596
|
+
case "type":
|
|
3597
|
+
case "properties":
|
|
3598
|
+
case "geometry": return;
|
|
3599
|
+
default: t[n] = e[n];
|
|
3600
|
+
}
|
|
3601
|
+
}), t.properties = en(e.properties), e.geometry == null ? t.geometry = null : t.geometry = nn(e.geometry), t;
|
|
3602
|
+
}
|
|
3603
|
+
function en(e) {
|
|
3604
|
+
let t = {};
|
|
3605
|
+
return e && Object.keys(e).forEach((n) => {
|
|
3606
|
+
let r = e[n];
|
|
3607
|
+
typeof r == "object" ? r === null ? t[n] = null : Array.isArray(r) ? t[n] = r.map((e) => e) : t[n] = en(r) : t[n] = r;
|
|
3608
|
+
}), t;
|
|
3609
|
+
}
|
|
3610
|
+
function tn(e) {
|
|
3611
|
+
let t = { type: "FeatureCollection" };
|
|
3612
|
+
return Object.keys(e).forEach((n) => {
|
|
3613
|
+
switch (n) {
|
|
3614
|
+
case "type":
|
|
3615
|
+
case "features": return;
|
|
3616
|
+
default: t[n] = e[n];
|
|
3617
|
+
}
|
|
3618
|
+
}), t.features = e.features.map((e) => $t(e)), t;
|
|
3619
|
+
}
|
|
3620
|
+
function nn(e) {
|
|
3621
|
+
let t = { type: e.type };
|
|
3622
|
+
return e.bbox && (t.bbox = e.bbox), e.type === "GeometryCollection" ? (t.geometries = e.geometries.map((e) => nn(e)), t) : (t.coordinates = rn(e.coordinates), t);
|
|
3623
|
+
}
|
|
3624
|
+
function rn(e) {
|
|
3625
|
+
let t = e;
|
|
3626
|
+
return typeof t[0] == "object" ? t.map((e) => rn(e)) : t.slice();
|
|
3627
|
+
}
|
|
3628
|
+
//#endregion
|
|
3629
|
+
//#region node_modules/@turf/transform-rotate/dist/esm/index.js
|
|
3630
|
+
function an(e, t, n) {
|
|
3631
|
+
if (n ||= {}, !Dt(n)) throw Error("options is invalid");
|
|
3632
|
+
let r = n.pivot, i = n.mutate;
|
|
3633
|
+
if (!e) throw Error("geojson is required");
|
|
3634
|
+
if (t == null || isNaN(t)) throw Error("angle is required");
|
|
3635
|
+
if (t === 0) return e;
|
|
3636
|
+
let a = r ?? Ut(e);
|
|
3637
|
+
return (i === !1 || i === void 0) && (e = Qt(e)), Ot(e, function(e) {
|
|
3638
|
+
let n = Kt(a, e) + t, r = Gt(Xt(a, Jt(a, e), n));
|
|
3639
|
+
e[0] = r[0], e[1] = r[1];
|
|
3640
|
+
}), e;
|
|
3641
|
+
}
|
|
3642
|
+
//#endregion
|
|
3643
|
+
//#region node_modules/@turf/bearing/dist/esm/index.js
|
|
3644
|
+
function on(e, t, n = {}) {
|
|
3645
|
+
if (n.final === !0) return sn(e, t);
|
|
3646
|
+
let r = Wt(e), i = Wt(t), a = wt(r[0]), o = wt(i[0]), s = wt(r[1]), c = wt(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);
|
|
3647
|
+
return Ct(Math.atan2(l, u));
|
|
3648
|
+
}
|
|
3649
|
+
function sn(e, t) {
|
|
3650
|
+
let n = on(t, e);
|
|
3651
|
+
return n = (n + 180) % 360, n;
|
|
3652
|
+
}
|
|
3653
|
+
//#endregion
|
|
3654
|
+
//#region node_modules/@turf/bbox/dist/esm/index.js
|
|
3655
|
+
function cn(e, t = {}) {
|
|
3656
|
+
if (e.bbox != null && !0 !== t.recompute) return e.bbox;
|
|
3657
|
+
let n = [
|
|
3658
|
+
Infinity,
|
|
3659
|
+
Infinity,
|
|
3660
|
+
-Infinity,
|
|
3661
|
+
-Infinity
|
|
3662
|
+
];
|
|
3663
|
+
return Ot(e, (e) => {
|
|
3664
|
+
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]);
|
|
3665
|
+
}), n;
|
|
3666
|
+
}
|
|
3667
|
+
//#endregion
|
|
3668
|
+
//#region node_modules/@turf/bbox-polygon/dist/esm/index.js
|
|
3669
|
+
function ln(e, t = {}) {
|
|
3670
|
+
let n = Number(e[0]), r = Number(e[1]), i = Number(e[2]), a = Number(e[3]);
|
|
3671
|
+
if (e.length === 6) throw Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
3672
|
+
let o = [n, r];
|
|
3673
|
+
return bt([[
|
|
3674
|
+
o,
|
|
3675
|
+
[i, r],
|
|
3676
|
+
[i, a],
|
|
3677
|
+
[n, a],
|
|
3678
|
+
o
|
|
3679
|
+
]], t.properties, {
|
|
3680
|
+
bbox: e,
|
|
3681
|
+
id: t.id
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3684
|
+
//#endregion
|
|
3685
|
+
//#region node_modules/@turf/envelope/dist/esm/index.js
|
|
3686
|
+
function un(e) {
|
|
3687
|
+
return ln(cn(e));
|
|
3688
|
+
}
|
|
3689
|
+
//#endregion
|
|
3690
|
+
//#region node_modules/@turf/area/dist/esm/index.js
|
|
3691
|
+
function dn(e) {
|
|
3692
|
+
return jt(e, (e, t) => e + fn(t), 0);
|
|
3693
|
+
}
|
|
3694
|
+
function fn(e) {
|
|
3695
|
+
let t = 0, n;
|
|
3696
|
+
switch (e.type) {
|
|
3697
|
+
case "Polygon": return pn(e.coordinates);
|
|
3698
|
+
case "MultiPolygon":
|
|
3699
|
+
for (n = 0; n < e.coordinates.length; n++) t += pn(e.coordinates[n]);
|
|
3700
|
+
return t;
|
|
3701
|
+
case "Point":
|
|
3702
|
+
case "MultiPoint":
|
|
3703
|
+
case "LineString":
|
|
3704
|
+
case "MultiLineString": return 0;
|
|
3705
|
+
}
|
|
3706
|
+
return 0;
|
|
3707
|
+
}
|
|
3708
|
+
function pn(e) {
|
|
3709
|
+
let t = 0;
|
|
3710
|
+
if (e && e.length > 0) {
|
|
3711
|
+
t += Math.abs(gn(e[0]));
|
|
3712
|
+
for (let n = 1; n < e.length; n++) t -= Math.abs(gn(e[n]));
|
|
3713
|
+
}
|
|
3714
|
+
return t;
|
|
3715
|
+
}
|
|
3716
|
+
var mn = $ * $ / 2, hn = Math.PI / 180;
|
|
3717
|
+
function gn(e) {
|
|
3718
|
+
let t = e.length - 1;
|
|
3719
|
+
if (t <= 2) return 0;
|
|
3720
|
+
let n = 0, r = 0;
|
|
3721
|
+
for (; r < t;) {
|
|
3722
|
+
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] * hn, c = a[1] * hn, l = o[0] * hn;
|
|
3723
|
+
n += (l - s) * Math.sin(c), r++;
|
|
3724
|
+
}
|
|
3725
|
+
return n * mn;
|
|
3726
|
+
}
|
|
3727
|
+
//#endregion
|
|
3728
|
+
//#region node_modules/geojson-minimum-bounding-rectangle/dist/index.js
|
|
3729
|
+
function _n(e) {
|
|
3730
|
+
let t = Ht(e);
|
|
3731
|
+
if (!t) throw Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
|
|
3732
|
+
let n = Ut(t), r = kt(t), i = 2 ** 53 - 1, a = null;
|
|
3733
|
+
for (let e = 0; e < r.length - 1; e++) {
|
|
3734
|
+
let o = on(r[e], r[e + 1]), s = un(an(t, -1 * o, { pivot: n })), c = dn(s);
|
|
3735
|
+
c < i && (i = c, a = an(s, o, { pivot: n }));
|
|
3736
|
+
}
|
|
3737
|
+
return a;
|
|
3738
|
+
}
|
|
3739
|
+
//#endregion
|
|
3740
|
+
//#region src/utils/OBB.mjs
|
|
3741
|
+
function vn(e, t) {
|
|
3742
|
+
let n = t[0] - e[0], r = t[1] - e[1];
|
|
3743
|
+
return Math.sqrt(n * n + r * r);
|
|
3744
|
+
}
|
|
3745
|
+
function yn(e) {
|
|
3746
|
+
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
|
|
3747
|
+
for (let [a, o] of e) a < t && (t = a), a > n && (n = a), o < r && (r = o), o > i && (i = o);
|
|
3748
|
+
return [(n + t) * .5, (i + r) * .5];
|
|
3749
|
+
}
|
|
3750
|
+
var bn = class t extends ht {
|
|
3751
|
+
getBoxMesh() {
|
|
3752
|
+
xn.identity(), xn.setFromMatrix3(this.rotation), xn.decompose(Tn, Sn, new e.Vector3());
|
|
3753
|
+
let t = this.halfSize.clone().multiplyScalar(2), n = new e.Mesh(new e.BoxGeometry(t.x, t.y, t.z));
|
|
3754
|
+
return n.position.copy(this.center), n.rotation.setFromQuaternion(Sn), n;
|
|
3755
|
+
}
|
|
3756
|
+
getBoxEdge(t = 16776960) {
|
|
3757
|
+
let n = this.getBoxMesh();
|
|
3758
|
+
En.setFromObject(n);
|
|
3759
|
+
let r = new e.EdgesGeometry(n.geometry.clone().applyMatrix4(n.matrixWorld));
|
|
3760
|
+
return new e.LineSegments(r, new e.LineBasicMaterial({
|
|
3761
|
+
color: t,
|
|
3762
|
+
toneMapped: !1
|
|
3763
|
+
}));
|
|
3764
|
+
}
|
|
3765
|
+
toJson() {
|
|
3766
|
+
return xn.identity(), xn.setFromMatrix3(this.rotation), xn.decompose(Tn, Sn, new e.Vector3()), {
|
|
3767
|
+
size: this.halfSize.toArray(),
|
|
3768
|
+
center: this.center.toArray(),
|
|
3769
|
+
quaternion: Sn.toArray()
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
static from(n, r, i, a = new t()) {
|
|
3773
|
+
if (i instanceof e.Euler) Sn.setFromEuler(i);
|
|
3774
|
+
else if (i instanceof e.Quaternion) Sn.copy(i);
|
|
3775
|
+
else throw Error("传入的旋转不是欧拉角或者四元数");
|
|
3776
|
+
return xn.compose(r, Sn, wn), a.center.copy(r), a.halfSize.copy(n.multiplyScalar(.5)), a.rotation.setFromMatrix4(xn), a;
|
|
3777
|
+
}
|
|
3778
|
+
static fromByPath2D(e, n, r, i = new t()) {
|
|
3779
|
+
let a = _n({
|
|
3780
|
+
type: "Polygon",
|
|
3781
|
+
coordinates: [e.map((e) => [e.x, e.y])]
|
|
3782
|
+
});
|
|
3783
|
+
if (!a) throw Error("2d obb 获取失败");
|
|
3784
|
+
let o = a.geometry.coordinates[0], s = vn(o[0], o[1]), c = vn(o[1], o[2]), l = Math.atan2(o[1][1] - o[0][1], o[1][0] - o[0][0]);
|
|
3785
|
+
Tn.set(s, c, r), Cn.set(0, 0, l);
|
|
3786
|
+
let [u, d] = yn(o);
|
|
3787
|
+
return n.x = u, n.y = d, this.from(Tn, n, Cn, i);
|
|
3788
|
+
}
|
|
3789
|
+
}, xn = new e.Matrix4(), Sn = new e.Quaternion(), Cn = new e.Euler(), wn = new e.Vector3(1, 1, 1), Tn = new e.Vector3(), En = new e.Box3();
|
|
3790
|
+
//#endregion
|
|
3791
|
+
//#region src/pointCloudProcessing/mergeMeaning.mjs
|
|
3792
|
+
function Dn(e, t, n = .005, r = .2) {
|
|
3793
|
+
if (!e.length || !t.length) return 0;
|
|
3794
|
+
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)}`;
|
|
3795
|
+
for (let e of t) {
|
|
3796
|
+
let t = s(e.x, e.y, e.z);
|
|
3797
|
+
o.has(t) || o.set(t, []), o.get(t).push(e);
|
|
3798
|
+
}
|
|
3799
|
+
let c = 0, l = Math.ceil(n / i) + 1, u = [];
|
|
3800
|
+
for (let e = -l; e <= l; e++) for (let t = -l; t <= l; t++) for (let n = -l; n <= l; n++) e * e + t * t + n * n <= l * l && u.push([
|
|
3801
|
+
e,
|
|
3802
|
+
t,
|
|
3803
|
+
n
|
|
3804
|
+
]);
|
|
3805
|
+
for (let t of e) {
|
|
3806
|
+
let n = Math.floor(t.x / i), s = Math.floor(t.y / i), l = Math.floor(t.z / i), d = !1;
|
|
3807
|
+
for (let [e, r, i] of u) {
|
|
3808
|
+
let c = `${n + e},${s + r},${l + i}`;
|
|
3809
|
+
if (o.has(c)) {
|
|
3810
|
+
for (let e of o.get(c)) if (t.distanceToSquared(e) < a) {
|
|
3811
|
+
d = !0;
|
|
3812
|
+
break;
|
|
3813
|
+
}
|
|
3814
|
+
if (d) break;
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
if (d && (c++, c / e.length > r)) return c / e.length;
|
|
3818
|
+
}
|
|
3819
|
+
return c / e.length;
|
|
3820
|
+
}
|
|
3821
|
+
function On(e, t, n = .5) {
|
|
3822
|
+
let r = 0, i = 0;
|
|
3823
|
+
for (let a of e) if (t.containsPoint(a) && (r++, i = r / e.length, i > n)) break;
|
|
3824
|
+
return i;
|
|
3825
|
+
}
|
|
3826
|
+
function kn(e, t, n, r) {
|
|
3827
|
+
if (e.intersectsOBB(t)) return !0;
|
|
3828
|
+
{
|
|
3829
|
+
let i = jn(e, r), a = jn(t, n);
|
|
3830
|
+
if (i || a) return !0;
|
|
3831
|
+
}
|
|
3832
|
+
return !1;
|
|
3833
|
+
}
|
|
3834
|
+
function An(t, n) {
|
|
3835
|
+
let r = new e.Vector3(), i = new e.Vector3();
|
|
3836
|
+
t.getSize(r), n.getSize(i);
|
|
3837
|
+
let a = r.x * r.y * r.z, o = i.x * i.y * i.z;
|
|
3838
|
+
return a > o ? 1 : a < o ? -1 : 0;
|
|
3839
|
+
}
|
|
3840
|
+
function jn(e, t) {
|
|
3841
|
+
let n = !0;
|
|
3842
|
+
for (let r = 0; r < t.length; r++) if (!e.containsPoint(t[r])) {
|
|
3843
|
+
n = !1;
|
|
3844
|
+
break;
|
|
3845
|
+
}
|
|
3846
|
+
return n;
|
|
3847
|
+
}
|
|
3848
|
+
function Mn(e) {
|
|
3849
|
+
if (e.length === 0) return {
|
|
3850
|
+
x: 0,
|
|
3851
|
+
y: 0,
|
|
3852
|
+
z: 0,
|
|
3853
|
+
h: 0
|
|
3854
|
+
};
|
|
3855
|
+
let t = 0, n = 0, r = -Infinity, i = Infinity;
|
|
3856
|
+
for (let a of e) t += a.x, n += a.y, r = Math.max(r, a.z), i = Math.min(i, a.z);
|
|
3857
|
+
return {
|
|
3858
|
+
x: t / e.length,
|
|
3859
|
+
y: n / e.length,
|
|
3860
|
+
z: 0,
|
|
3861
|
+
maxz: r,
|
|
3862
|
+
minz: i,
|
|
3863
|
+
h: r - i
|
|
3864
|
+
};
|
|
3865
|
+
}
|
|
3866
|
+
function Nn(t, n, r, i) {
|
|
3867
|
+
let a = [];
|
|
3868
|
+
for (let n = 0; n < t.length; n++) a.push(new e.Vector3(t[n][0], t[n][1], 0));
|
|
3869
|
+
if (a.length == 0) return null;
|
|
3870
|
+
let o = bn.fromByPath2D(a, n, r);
|
|
3871
|
+
return o.center.z = i, o;
|
|
3872
|
+
}
|
|
3873
|
+
var Pn = (t) => {
|
|
3874
|
+
if (t.length == 0) return [];
|
|
3875
|
+
let n = [];
|
|
3876
|
+
for (let r = 0; r < t.length; r++) {
|
|
3877
|
+
let i = t[r].points.map((e) => [e.x, e.y]), a = Mn(t[r].points), o = t[r].obj_id;
|
|
3878
|
+
o = o.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"), o.split("_").slice(1, 3).join("_").split(".")[0].split("_")[0];
|
|
3879
|
+
let s = o.indexOf("_") + 1, c = o.lastIndexOf("_"), l = o.substring(s, c), u = [];
|
|
3880
|
+
for (let n = 0; n < t[r].points.length; n++) u.push(new e.Vector3(t[r].points[n].x, t[r].points[n].y, t[r].points[n].z));
|
|
3881
|
+
let d = {
|
|
3882
|
+
points: u,
|
|
3883
|
+
path: at(i),
|
|
3884
|
+
h: a.h,
|
|
3885
|
+
minz: a.minz,
|
|
3886
|
+
maxz: a.maxz,
|
|
3887
|
+
center: {
|
|
3888
|
+
x: a.x,
|
|
3889
|
+
y: a.y,
|
|
3890
|
+
z: a.z
|
|
3891
|
+
},
|
|
3892
|
+
obj_id: t[r].obj_id,
|
|
3893
|
+
type: l,
|
|
3894
|
+
averagePz: t[r].averagePz,
|
|
3895
|
+
obb: null,
|
|
3896
|
+
isDel: !1,
|
|
3897
|
+
obj_id: o,
|
|
3898
|
+
positionArr: [t[r].position]
|
|
3899
|
+
};
|
|
3900
|
+
if (d.obb = Nn(d.path, d.center, d.h, (d.maxz + d.minz) / 2), d.obb == null) continue;
|
|
3901
|
+
let f = -1;
|
|
3902
|
+
for (let e = 0; e < n.length; e++) if (n[e].type == l) {
|
|
3903
|
+
f = e;
|
|
3904
|
+
break;
|
|
3905
|
+
}
|
|
3906
|
+
f == -1 ? n.push({
|
|
3907
|
+
type: l,
|
|
3908
|
+
array: [d]
|
|
3909
|
+
}) : n[f].array.push(d);
|
|
3910
|
+
}
|
|
3911
|
+
for (let e = 0; e < n.length; e++) {
|
|
3912
|
+
let t = n[e].array, r = [], i = [];
|
|
3913
|
+
for (let e = 0; e < t.length; e++) {
|
|
3914
|
+
if (t[e].obb == null || r.includes(e)) continue;
|
|
3915
|
+
let n = {
|
|
3916
|
+
...t[e],
|
|
3917
|
+
obb: t[e].obb.clone()
|
|
3918
|
+
};
|
|
3919
|
+
for (let i = e + 1; i < t.length; i++) if (!(t[i].obb == null || r.includes(i)) && n.obb.intersectsOBB(t[i].obb)) {
|
|
3920
|
+
r.push(i), n.points.push(...t[i].points), n.path = at(n.points.map((e) => [e.x, e.y]));
|
|
3921
|
+
let a = Mn(n.points);
|
|
3922
|
+
n.h = a.h, n.minz = a.minz, n.maxz = a.maxz, n.center = {
|
|
3923
|
+
x: a.x,
|
|
3924
|
+
y: a.y,
|
|
3925
|
+
z: a.z
|
|
3926
|
+
}, n.obb = Nn(n.path, n.center, n.h, (n.maxz + n.minz) / 2), n.positionArr.push(...t[i].positionArr), i = e;
|
|
3927
|
+
}
|
|
3928
|
+
n.path.length > t[e].path.length && (r.push(e), i.push(n));
|
|
3929
|
+
}
|
|
3930
|
+
let a = [];
|
|
3931
|
+
for (let e = 0; e < t.length; e++) r.includes(e) || a.push(t[e]);
|
|
3932
|
+
a.push(...i), n[e].array = a;
|
|
3933
|
+
}
|
|
3934
|
+
for (let t = 0; t < n.length; t++) {
|
|
3935
|
+
let r = n[t].type, i = n[t].array;
|
|
3936
|
+
for (let a = 0; a < i.length; a++) {
|
|
3937
|
+
let o = i[a].obb, s = i[a].minz;
|
|
3938
|
+
i[a].maxz;
|
|
3939
|
+
let c = i[a].averagePz;
|
|
3940
|
+
if (r === "window" || r === "door" || r === "tv" || r === "chair" || r === "cabinet" || r === "table") {
|
|
3941
|
+
let t = new e.Vector3();
|
|
3942
|
+
o.getSize(t);
|
|
3943
|
+
let n = [
|
|
3944
|
+
t.x,
|
|
3945
|
+
t.y,
|
|
3946
|
+
t.z
|
|
3947
|
+
], r = 0;
|
|
3948
|
+
for (let e of n) if (e < .2 && (r++, r === 2)) {
|
|
3949
|
+
i[a].isDel = !0;
|
|
3950
|
+
break;
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
if (!i[a].isDel) for (let e = t + 1; e < n.length; e++) {
|
|
3954
|
+
let t = n[e].type, l = n[e].array;
|
|
3955
|
+
for (let e = 0; e < l.length; e++) {
|
|
3956
|
+
if (l[e].isDel) continue;
|
|
3957
|
+
let n = l[e].obb, u = l[e].minz;
|
|
3958
|
+
if (l[e].maxz, o.intersectsOBB(n)) {
|
|
3959
|
+
On(l[e].points, o);
|
|
3960
|
+
let d = On(i[a].points, n), f = An(o, n);
|
|
3961
|
+
if (d >= .3 && f == -1) {
|
|
3962
|
+
i[a].isDel = !0;
|
|
3963
|
+
break;
|
|
3964
|
+
}
|
|
3965
|
+
if (r !== "wall" && r !== "floor" && r !== "roof") {
|
|
3966
|
+
if (r === "window") {
|
|
3967
|
+
if (t === "balcony railing" && containsObb(o, l[e].points)) {
|
|
3968
|
+
l[e].isDel = !0;
|
|
3969
|
+
continue;
|
|
3970
|
+
}
|
|
3971
|
+
if (t === "balcony railing" && containsObb(n, i[a].points)) {
|
|
3972
|
+
i[a].isDel = !0;
|
|
3973
|
+
break;
|
|
3974
|
+
}
|
|
3975
|
+
if (t === "balcony railing" && kn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(u - c) > .3)) {
|
|
3976
|
+
l[e].isDel = !0;
|
|
3977
|
+
continue;
|
|
3978
|
+
}
|
|
3979
|
+
} else if (r === "balcony railing") {
|
|
3980
|
+
if (t === "window" && containsObb(o, l[e].points)) {
|
|
3981
|
+
l[e].isDel = !0;
|
|
3982
|
+
continue;
|
|
3983
|
+
}
|
|
3984
|
+
if (t === "window" && containsObb(n, i[a].points)) {
|
|
3985
|
+
i[a].isDel = !0;
|
|
3986
|
+
break;
|
|
3987
|
+
}
|
|
3988
|
+
if (t === "window" && kn(o, n, i[a].points, l[e].points) && (Math.abs(s - u) < .1 || Math.abs(s - c) > .3)) {
|
|
3989
|
+
i[a].isDel = !0;
|
|
3990
|
+
break;
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
let d = !1, f = [], p = [], m = i[a].points, h = l[e].points;
|
|
3994
|
+
if (m.length > h.length ? (d = !0, f = m, p = h) : (f = h, p = m), Dn(p, f, .03, .5) > .5) {
|
|
3995
|
+
if (t === "people") {
|
|
3996
|
+
l[e].isDel = !0;
|
|
3997
|
+
continue;
|
|
3998
|
+
} else if (r === "people") {
|
|
3999
|
+
i[a].isDel = !0;
|
|
4000
|
+
break;
|
|
4001
|
+
}
|
|
4002
|
+
if (d) l[e].isDel = !0;
|
|
4003
|
+
else {
|
|
4004
|
+
i[a].isDel = !0;
|
|
4005
|
+
break;
|
|
4006
|
+
}
|
|
4007
|
+
} else if (kn(o, n)) {
|
|
4008
|
+
if (t === "people") {
|
|
4009
|
+
l[e].isDel = !0;
|
|
4010
|
+
continue;
|
|
4011
|
+
} else if (r === "people") {
|
|
4012
|
+
i[a].isDel = !0;
|
|
4013
|
+
break;
|
|
4014
|
+
}
|
|
4015
|
+
let s = An(o, n);
|
|
4016
|
+
if (s === 1 || s === 0) {
|
|
4017
|
+
if (t === "switch") continue;
|
|
4018
|
+
On(p, o) >= .5 && (l[e].isDel = !0);
|
|
4019
|
+
} else {
|
|
4020
|
+
if (r === "switch") continue;
|
|
4021
|
+
if (On(p, n) >= .5) {
|
|
4022
|
+
i[a].isDel = !0;
|
|
4023
|
+
break;
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
if (i[a].isDel) break;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
for (let t = 0; t < n.length; t++) {
|
|
4035
|
+
let r = n[t].type, i = n[t].array;
|
|
4036
|
+
for (let t = 0; t < i.length; t++) {
|
|
4037
|
+
let n = i[t].maxz, a = i[t].minz, o = r === "switch" ? .1 : .3, s = i[t].averagePz;
|
|
4038
|
+
if (Math.abs(n - s) < o) {
|
|
4039
|
+
i[t].isDel = !0;
|
|
4040
|
+
continue;
|
|
4041
|
+
}
|
|
4042
|
+
if (r === "window" || r === "door" || r === "tv") {
|
|
4043
|
+
let e = Math.abs(n - s);
|
|
4044
|
+
r !== "window" && e < 1.6 && (i[t].isDel = !0), r === "window" && e < 1 && (i[t].isDel = !0);
|
|
4045
|
+
}
|
|
4046
|
+
if (r === "chair") {
|
|
4047
|
+
let n = new e.Vector3();
|
|
4048
|
+
i[t].obb.getSize(n), (n.x < .1 || n.y < .1) && (i[t].isDel = !0);
|
|
4049
|
+
}
|
|
4050
|
+
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));
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
for (let e = 0; e < n.length; e++) n[e].array = n[e].array.filter((e) => !e.isDel);
|
|
4054
|
+
let r = [];
|
|
4055
|
+
for (let t = 0; t < n.length; t++) {
|
|
4056
|
+
let i = n[t].array;
|
|
4057
|
+
for (let t = 0; t < i.length; t++) r.push({
|
|
4058
|
+
obbBox: i[t].obb,
|
|
4059
|
+
box: new e.Box3().setFromPoints(i[t].points),
|
|
4060
|
+
category: i[t].type,
|
|
4061
|
+
center: {
|
|
4062
|
+
x: i[t].center.x,
|
|
4063
|
+
y: i[t].center.y,
|
|
4064
|
+
z: (i[t].minz + i[t].maxz) / 2
|
|
4065
|
+
},
|
|
4066
|
+
name: i[t].obj_id,
|
|
4067
|
+
obj_id: i[t].obj_id,
|
|
4068
|
+
pcdPoints: i[t].points,
|
|
4069
|
+
positionArr: i[t].positionArr
|
|
4070
|
+
});
|
|
4071
|
+
}
|
|
4072
|
+
return r;
|
|
2031
4073
|
};
|
|
2032
4074
|
//#endregion
|
|
2033
|
-
export {
|
|
4075
|
+
export { R as classifySegments, he as getAllGeometry, _e as getBeamLine, ye as getColLine, ve as getMainBeamLine, Pn as getMergeMeaning, F as getParallelism, re as getPointCloudMinMax, z as getPointCoverageOnQuad, A as isParallel, I as perpendicularInfo, ae as removeNoisePoints, D as segmentsIntersect2D, ge as usegetBeamLine };
|