rm-graphical-computing 1.0.62 → 1.0.63
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 +1273 -1239
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Qn = Object.defineProperty;
|
|
2
|
+
var Jn = (n, t, e) => t in n ? Qn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var Fe = (n, t, e) => Jn(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import * as y from "three";
|
|
5
|
-
import { BufferGeometry as
|
|
6
|
-
function
|
|
7
|
-
const e = n[0].index !== null, o = new Set(Object.keys(n[0].attributes)), i = new Set(Object.keys(n[0].morphAttributes)), r = {}, s = {}, a = n[0].morphTargetsRelative, l = new
|
|
5
|
+
import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as zt, Matrix3 as Tn, MathUtils as Oe, Box3 as oo, Matrix4 as En, Ray as ro } from "three";
|
|
6
|
+
function io(n, t = !1) {
|
|
7
|
+
const e = n[0].index !== null, o = new Set(Object.keys(n[0].attributes)), i = new Set(Object.keys(n[0].morphAttributes)), r = {}, s = {}, a = n[0].morphTargetsRelative, l = new to();
|
|
8
8
|
let c = 0;
|
|
9
9
|
for (let h = 0; h < n.length; ++h) {
|
|
10
10
|
const f = n[h];
|
|
11
11
|
let u = 0;
|
|
12
12
|
if (e !== (f.index !== null))
|
|
13
13
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
|
|
14
|
-
for (const
|
|
15
|
-
if (!o.has(
|
|
16
|
-
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' +
|
|
17
|
-
r[
|
|
14
|
+
for (const p in f.attributes) {
|
|
15
|
+
if (!o.has(p))
|
|
16
|
+
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + p + '" attribute exists among all geometries, or in none of them.'), null;
|
|
17
|
+
r[p] === void 0 && (r[p] = []), r[p].push(f.attributes[p]), u++;
|
|
18
18
|
}
|
|
19
19
|
if (u !== o.size)
|
|
20
20
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". Make sure all geometries have the same number of attributes."), null;
|
|
21
21
|
if (a !== f.morphTargetsRelative)
|
|
22
22
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
|
|
23
|
-
for (const
|
|
24
|
-
if (!i.has(
|
|
23
|
+
for (const p in f.morphAttributes) {
|
|
24
|
+
if (!i.has(p))
|
|
25
25
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphAttributes must be consistent throughout all geometries."), null;
|
|
26
|
-
s[
|
|
26
|
+
s[p] === void 0 && (s[p] = []), s[p].push(f.morphAttributes[p]);
|
|
27
27
|
}
|
|
28
28
|
if (t) {
|
|
29
|
-
let
|
|
29
|
+
let p;
|
|
30
30
|
if (e)
|
|
31
|
-
|
|
31
|
+
p = f.index.count;
|
|
32
32
|
else if (f.attributes.position !== void 0)
|
|
33
|
-
|
|
33
|
+
p = f.attributes.position.count;
|
|
34
34
|
else
|
|
35
35
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". The geometry must have either an index or a position attribute"), null;
|
|
36
|
-
l.addGroup(c,
|
|
36
|
+
l.addGroup(c, p, h), c += p;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (e) {
|
|
40
40
|
let h = 0;
|
|
41
41
|
const f = [];
|
|
42
42
|
for (let u = 0; u < n.length; ++u) {
|
|
43
|
-
const
|
|
44
|
-
for (let w = 0; w <
|
|
45
|
-
f.push(
|
|
43
|
+
const p = n[u].index;
|
|
44
|
+
for (let w = 0; w < p.count; ++w)
|
|
45
|
+
f.push(p.getX(w) + h);
|
|
46
46
|
h += n[u].attributes.position.count;
|
|
47
47
|
}
|
|
48
48
|
l.setIndex(f);
|
|
49
49
|
}
|
|
50
50
|
for (const h in r) {
|
|
51
|
-
const f =
|
|
51
|
+
const f = Qe(r[h]);
|
|
52
52
|
if (!f)
|
|
53
53
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " attribute."), null;
|
|
54
54
|
l.setAttribute(h, f);
|
|
@@ -58,10 +58,10 @@ function eo(n, t = !1) {
|
|
|
58
58
|
if (f === 0) break;
|
|
59
59
|
l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[h] = [];
|
|
60
60
|
for (let u = 0; u < f; ++u) {
|
|
61
|
-
const
|
|
61
|
+
const p = [];
|
|
62
62
|
for (let x = 0; x < s[h].length; ++x)
|
|
63
|
-
|
|
64
|
-
const w =
|
|
63
|
+
p.push(s[h][x][u]);
|
|
64
|
+
const w = Qe(p);
|
|
65
65
|
if (!w)
|
|
66
66
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " morphAttribute."), null;
|
|
67
67
|
l.morphAttributes[h].push(w);
|
|
@@ -69,7 +69,7 @@ function eo(n, t = !1) {
|
|
|
69
69
|
}
|
|
70
70
|
return l;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function Qe(n) {
|
|
73
73
|
let t, e, o, i = -1, r = 0;
|
|
74
74
|
for (let c = 0; c < n.length; ++c) {
|
|
75
75
|
const h = n[c];
|
|
@@ -83,13 +83,13 @@ function Ge(n) {
|
|
|
83
83
|
return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
|
|
84
84
|
r += h.count * e;
|
|
85
85
|
}
|
|
86
|
-
const s = new t(r), a = new
|
|
86
|
+
const s = new t(r), a = new eo(s, e, o);
|
|
87
87
|
let l = 0;
|
|
88
88
|
for (let c = 0; c < n.length; ++c) {
|
|
89
89
|
const h = n[c];
|
|
90
90
|
if (h.isInterleavedBufferAttribute) {
|
|
91
91
|
const f = l / e;
|
|
92
|
-
for (let u = 0,
|
|
92
|
+
for (let u = 0, p = h.count; u < p; u++)
|
|
93
93
|
for (let w = 0; w < e; w++) {
|
|
94
94
|
const x = h.getComponent(u, w);
|
|
95
95
|
a.setComponent(u + f, w, x);
|
|
@@ -100,12 +100,12 @@ function Ge(n) {
|
|
|
100
100
|
}
|
|
101
101
|
return i !== void 0 && (a.gpuType = i), a;
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const so = (n, t, e) => {
|
|
104
104
|
let o = new y.LineBasicMaterial({ color: "#0011ff" }), i = [];
|
|
105
105
|
i.push(n), i.push(t);
|
|
106
106
|
let r = new y.BufferGeometry();
|
|
107
107
|
r.setFromPoints(i), r.rotateX(-Math.PI / 2), e.add(new y.Line(r, o));
|
|
108
|
-
},
|
|
108
|
+
}, te = (n, t, e, o, i = 1e-8) => {
|
|
109
109
|
const r = t.x - n.x, s = t.y - n.y, a = o.x - e.x, l = o.y - e.y, c = r * l - s * a;
|
|
110
110
|
if (Math.abs(c) < i) return null;
|
|
111
111
|
const h = ((e.x - n.x) * l - (e.y - n.y) * a) / c, f = ((e.x - n.x) * s - (e.y - n.y) * r) / c;
|
|
@@ -116,7 +116,7 @@ const no = (n, t, e) => {
|
|
|
116
116
|
n.z
|
|
117
117
|
)
|
|
118
118
|
};
|
|
119
|
-
},
|
|
119
|
+
}, ao = (n, t, e = {}) => {
|
|
120
120
|
const {
|
|
121
121
|
fontSize: o = 36,
|
|
122
122
|
fontFamily: i = "sans-serif",
|
|
@@ -128,21 +128,21 @@ const no = (n, t, e) => {
|
|
|
128
128
|
} = e, h = document.createElement("canvas").getContext("2d");
|
|
129
129
|
h.font = `bold ${o}px ${i}`;
|
|
130
130
|
const u = h.measureText(n).width;
|
|
131
|
-
let
|
|
131
|
+
let p = Math.min(u + a * 2, l), w = o + a * 2;
|
|
132
132
|
const x = document.createElement("canvas");
|
|
133
|
-
x.width =
|
|
133
|
+
x.width = p, x.height = w;
|
|
134
134
|
const P = x.getContext("2d");
|
|
135
|
-
P.fillStyle = r, P.fillRect(0, 0,
|
|
135
|
+
P.fillStyle = r, P.fillRect(0, 0, p, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", u > l - a * 2 ? lo(P, n, p / 2, w / 2, l, o) : P.fillText(n, p / 2, w / 2);
|
|
136
136
|
const M = new y.CanvasTexture(x), m = new y.SpriteMaterial({
|
|
137
137
|
map: M,
|
|
138
138
|
depthTest: !1,
|
|
139
139
|
transparent: !0
|
|
140
140
|
}), d = new y.Sprite(m);
|
|
141
141
|
d.position.set(t.x, t.y, t.z);
|
|
142
|
-
const
|
|
143
|
-
return d.scale.set(
|
|
142
|
+
const g = 5e-3;
|
|
143
|
+
return d.scale.set(p * g, w * g, 1), d;
|
|
144
144
|
};
|
|
145
|
-
function
|
|
145
|
+
function lo(n, t, e, o, i, r) {
|
|
146
146
|
const s = t.split("");
|
|
147
147
|
let a = "", l = r * 1.2, c = o;
|
|
148
148
|
for (let h = 0; h < s.length; h++) {
|
|
@@ -151,7 +151,7 @@ function ro(n, t, e, o, i, r) {
|
|
|
151
151
|
}
|
|
152
152
|
n.fillText(a, e, c);
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const oe = (n, t, e = 0.01) => {
|
|
155
155
|
const o = Math.sqrt(n.x * n.x + n.y * n.y + n.z * n.z), i = Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z);
|
|
156
156
|
if (o < 1e-10 || i < 1e-10)
|
|
157
157
|
return { parallel: !1, sameDirection: null, angle: NaN };
|
|
@@ -164,7 +164,7 @@ const te = (n, t, e = 0.01) => {
|
|
|
164
164
|
sameDirection: c ? a > 0 : null,
|
|
165
165
|
angle: l
|
|
166
166
|
};
|
|
167
|
-
},
|
|
167
|
+
}, co = (n, t, e, o) => {
|
|
168
168
|
const i = n;
|
|
169
169
|
let r = [];
|
|
170
170
|
if (o && o.length && (r = o.map((V) => V.clone())), !i || i.length < 4) return {};
|
|
@@ -174,49 +174,49 @@ const te = (n, t, e = 0.01) => {
|
|
|
174
174
|
const v = V.dot(s), S = V.dot(a);
|
|
175
175
|
v < c && (c = v), v > h && (h = v), S < f && (f = S), S > u && (u = S);
|
|
176
176
|
}
|
|
177
|
-
const
|
|
178
|
-
let m = [w, x, P, M], d =
|
|
177
|
+
const p = i[0].dot(l), w = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p)), M = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p));
|
|
178
|
+
let m = [w, x, P, M], d = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
|
|
179
179
|
d && d.parallel && (m = [w, M, P, x]);
|
|
180
|
-
let
|
|
180
|
+
let g = 0;
|
|
181
181
|
if (o.length > 0) {
|
|
182
182
|
const V = new y.Vector3().subVectors(m[1], m[0]).normalize(), v = V.clone().negate(), S = new y.Vector3().subVectors(m[3], m[0]).normalize(), z = S.clone().negate();
|
|
183
|
-
let D = m[0].distanceTo(m[1]), _ = m[0].distanceTo(m[3]),
|
|
184
|
-
for (let O = 0; O <
|
|
183
|
+
let D = m[0].distanceTo(m[1]), _ = m[0].distanceTo(m[3]), T = D / t, E = _ / e, A = 1e-3;
|
|
184
|
+
for (let O = 0; O < T; O++) {
|
|
185
185
|
let I = m[0], B = 0;
|
|
186
|
-
for (let
|
|
187
|
-
let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(S, e),
|
|
186
|
+
for (let R = 0; R < E; R++) {
|
|
187
|
+
let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
|
|
188
188
|
for (let X = 0; X < r.length; X++)
|
|
189
189
|
if (r[X].distanceTo(H) < A) {
|
|
190
190
|
B++;
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
193
|
-
I =
|
|
193
|
+
I = L;
|
|
194
194
|
}
|
|
195
|
-
if (B >=
|
|
195
|
+
if (B >= E / 2)
|
|
196
196
|
break;
|
|
197
|
-
|
|
197
|
+
g += B, m[0] = m[0].addScaledVector(V, t), m[3] = m[3].addScaledVector(V, t);
|
|
198
198
|
}
|
|
199
|
-
D = m[0].distanceTo(m[1]),
|
|
200
|
-
for (let O = 0; O <
|
|
199
|
+
D = m[0].distanceTo(m[1]), T = D / t;
|
|
200
|
+
for (let O = 0; O < T; O++) {
|
|
201
201
|
let I = m[1], B = 0;
|
|
202
|
-
for (let
|
|
203
|
-
let W = I.clone().addScaledVector(v, t), C = W.clone().addScaledVector(S, e),
|
|
202
|
+
for (let R = 0; R < E; R++) {
|
|
203
|
+
let W = I.clone().addScaledVector(v, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
|
|
204
204
|
for (let X = 0; X < r.length; X++)
|
|
205
205
|
if (r[X].distanceTo(H) < A) {
|
|
206
206
|
B++;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
|
-
I =
|
|
209
|
+
I = L;
|
|
210
210
|
}
|
|
211
|
-
if (B >=
|
|
211
|
+
if (B >= E / 2)
|
|
212
212
|
break;
|
|
213
|
-
|
|
213
|
+
g += B, m[1] = m[1].addScaledVector(v, t), m[2] = m[2].addScaledVector(v, t);
|
|
214
214
|
}
|
|
215
|
-
D = m[0].distanceTo(m[1]),
|
|
216
|
-
for (let O = 0; O <
|
|
215
|
+
D = m[0].distanceTo(m[1]), T = D / t;
|
|
216
|
+
for (let O = 0; O < E; O++) {
|
|
217
217
|
let I = m[3], B = 0;
|
|
218
|
-
for (let
|
|
219
|
-
let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(z, e),
|
|
218
|
+
for (let R = 0; R < T; R++) {
|
|
219
|
+
let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(z, e), L = I.clone().addScaledVector(z, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
|
|
220
220
|
for (let X = 0; X < r.length; X++)
|
|
221
221
|
if (r[X].distanceTo(H) < A) {
|
|
222
222
|
B++;
|
|
@@ -224,18 +224,18 @@ const te = (n, t, e = 0.01) => {
|
|
|
224
224
|
}
|
|
225
225
|
I = W;
|
|
226
226
|
}
|
|
227
|
-
if (B >=
|
|
227
|
+
if (B >= T / 2)
|
|
228
228
|
break;
|
|
229
|
-
|
|
229
|
+
g += B, m[2] = m[2].addScaledVector(z, e), m[3] = m[3].addScaledVector(z, e);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
const b = m[0].distanceTo(m[1]) * m[0].distanceTo(m[3]);
|
|
233
233
|
return {
|
|
234
234
|
facePoints: m,
|
|
235
235
|
boxArea: b,
|
|
236
|
-
totalInPlaneNum:
|
|
236
|
+
totalInPlaneNum: g
|
|
237
237
|
};
|
|
238
|
-
},
|
|
238
|
+
}, Jt = (n, t, e, o, i = y.MathUtils.degToRad(8)) => {
|
|
239
239
|
const r = new y.Vector3(), s = new y.Vector3();
|
|
240
240
|
r.subVectors(
|
|
241
241
|
new y.Vector3(t.x, t.y, 0),
|
|
@@ -259,7 +259,7 @@ const te = (n, t, e = 0.01) => {
|
|
|
259
259
|
vectors: { v1: r, v2: s }
|
|
260
260
|
// 方向向量
|
|
261
261
|
};
|
|
262
|
-
},
|
|
262
|
+
}, re = (n, t, e, o) => {
|
|
263
263
|
const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = i.length(), a = r.length();
|
|
264
264
|
if (s === 0 || a === 0)
|
|
265
265
|
return { rate: NaN, angle: NaN, isPerpendicular: !1, isParallel: !1 };
|
|
@@ -277,7 +277,7 @@ const te = (n, t, e = 0.01) => {
|
|
|
277
277
|
isParallel: f < 0.01
|
|
278
278
|
// 是否平行
|
|
279
279
|
};
|
|
280
|
-
},
|
|
280
|
+
}, ee = (n, t, e = !1) => new y.Vector3((n.x + t.x) / 2, (n.y + t.y) / 2, e ? 0 : (n.z + t.z) / 2), ne = (n, t, e, o, i = {}) => {
|
|
281
281
|
const {
|
|
282
282
|
parallelAngleMax: r = y.MathUtils.degToRad(10),
|
|
283
283
|
collinearAngleMax: s = y.MathUtils.degToRad(7),
|
|
@@ -285,8 +285,8 @@ const te = (n, t, e = 0.01) => {
|
|
|
285
285
|
overlapThreshold: l = 0.01
|
|
286
286
|
// 投影重叠量大于此值才算 overlap
|
|
287
287
|
} = i, c = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e), f = c.clone().normalize(), u = h.clone().normalize();
|
|
288
|
-
let
|
|
289
|
-
const w = Math.acos(Math.abs(
|
|
288
|
+
let p = y.MathUtils.clamp(f.dot(u), -1, 1);
|
|
289
|
+
const w = Math.acos(Math.abs(p)), x = y.MathUtils.radToDeg(w);
|
|
290
290
|
if (w > r)
|
|
291
291
|
return {
|
|
292
292
|
type: "not_parallel",
|
|
@@ -297,37 +297,37 @@ const te = (n, t, e = 0.01) => {
|
|
|
297
297
|
overlap: null,
|
|
298
298
|
closestDistance: null
|
|
299
299
|
};
|
|
300
|
-
|
|
301
|
-
const P = new y.Vector3().addVectors(f, u).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), m =
|
|
300
|
+
p < 0 && u.negate();
|
|
301
|
+
const P = new y.Vector3().addVectors(f, u).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), m = Je(e, M, f), d = Je(o, M, f), g = (m + d) / 2, b = Math.max(m, d), V = n.dot(P), v = t.dot(P), S = e.dot(P), z = o.dot(P), D = Math.min(V, v), _ = Math.max(V, v), T = Math.min(S, z), E = Math.max(S, z), A = _ - D, O = E - T, I = Math.min(A, O), B = Math.min(_, E) - Math.max(D, T), R = B < 0 ? -B : 0, W = B > 0 ? B : 0, C = I > 0 ? W / I : 0, L = uo(
|
|
302
302
|
n,
|
|
303
303
|
t,
|
|
304
304
|
e,
|
|
305
305
|
o
|
|
306
|
-
), H = w <= s &&
|
|
306
|
+
), H = w <= s && g < a;
|
|
307
307
|
let X;
|
|
308
308
|
return H ? X = C > 0.5 ? "collinear_overlap" : "collinear_gap" : w <= r && (X = "parallel_offset"), {
|
|
309
309
|
type: X,
|
|
310
310
|
angleDeg: x,
|
|
311
|
-
avgPerpendicularDistance:
|
|
311
|
+
avgPerpendicularDistance: g,
|
|
312
312
|
maxPerpendicularDistance: b,
|
|
313
|
-
gap:
|
|
313
|
+
gap: R,
|
|
314
314
|
overlap: W,
|
|
315
|
-
closestDistance:
|
|
315
|
+
closestDistance: L
|
|
316
316
|
};
|
|
317
317
|
};
|
|
318
|
-
function
|
|
318
|
+
function Je(n, t, e) {
|
|
319
319
|
const o = new y.Vector3().subVectors(n, t), i = o.dot(e), r = e.clone().multiplyScalar(i);
|
|
320
320
|
return new y.Vector3().subVectors(o, r).length();
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function uo(n, t, e, o) {
|
|
323
323
|
const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = new y.Vector3().subVectors(e, n), a = i.dot(i), l = i.dot(r), c = r.dot(r), h = i.dot(s), f = r.dot(s), u = a * c - l * l;
|
|
324
|
-
let
|
|
325
|
-
u < 1e-10 ? (
|
|
326
|
-
const x = n.clone().add(i.clone().multiplyScalar(
|
|
324
|
+
let p, w;
|
|
325
|
+
u < 1e-10 ? (p = 0, w = c !== 0 ? f / c : 0) : (p = (l * f - c * h) / u, w = (a * f - l * h) / u), p = y.MathUtils.clamp(p, 0, 1), w = c !== 0 ? y.MathUtils.clamp((l * p + f) / c, 0, 1) : 0, p = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
|
|
326
|
+
const x = n.clone().add(i.clone().multiplyScalar(p)), P = e.clone().add(r.clone().multiplyScalar(w));
|
|
327
327
|
return x.distanceTo(P);
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
let t = new y.Vector3(n.start.x, n.start.y, n.start.z), e = new y.Vector3(n.end.x, n.end.y, n.end.z), o = t.distanceTo(e), i = n.rooftopPz - n.start.z, r =
|
|
329
|
+
const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ho = (n) => {
|
|
330
|
+
let t = new y.Vector3(n.start.x, n.start.y, n.start.z), e = new y.Vector3(n.end.x, n.end.y, n.end.z), o = t.distanceTo(e), i = n.rooftopPz - n.start.z, r = tn(o, 100), s = tn(i, 70), a = i / s, l = /* @__PURE__ */ new Map();
|
|
331
331
|
for (let x = 0; x < s; x++)
|
|
332
332
|
l.set((x + 1) * a, { count: 0, minZ: 1 / 0, maxZ: -1 / 0 });
|
|
333
333
|
let c = new y.Line3(t, e);
|
|
@@ -337,11 +337,11 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
337
337
|
let m = c.closestPointToPoint(P, !0, f).distanceTo(P);
|
|
338
338
|
const d = Math.floor(m / a);
|
|
339
339
|
if (d < s) {
|
|
340
|
-
const
|
|
341
|
-
|
|
340
|
+
const g = l.get((d + 1) * a);
|
|
341
|
+
g.count++, P.z < g.minZ && (g.minZ = P.z), P.z > g.maxZ && (g.maxZ = P.z);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
let u,
|
|
344
|
+
let u, p, w = r / 2;
|
|
345
345
|
for (const [x, P] of l)
|
|
346
346
|
if (P.count >= w) {
|
|
347
347
|
u = P.minZ;
|
|
@@ -349,11 +349,11 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
349
349
|
}
|
|
350
350
|
for (const [x, P] of [...l.entries()].reverse())
|
|
351
351
|
if (P.count >= w) {
|
|
352
|
-
|
|
352
|
+
p = P.maxZ;
|
|
353
353
|
break;
|
|
354
354
|
}
|
|
355
|
-
return { minZ: u, maxZ:
|
|
356
|
-
},
|
|
355
|
+
return { minZ: u, maxZ: p };
|
|
356
|
+
}, ze = (n, t, e) => {
|
|
357
357
|
let o = new y.Plane();
|
|
358
358
|
const i = new y.Vector3(n.x, n.y, n.z), r = new y.Vector3(t.x, t.y, t.z), s = new y.Vector3(t.x, t.y, t.z + 5);
|
|
359
359
|
o.setFromCoplanarPoints(i, r, s);
|
|
@@ -364,14 +364,14 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
364
364
|
});
|
|
365
365
|
let c = new y.Vector3(), h = new y.Vector3();
|
|
366
366
|
o.projectPoint(i, c), o.projectPoint(r, h);
|
|
367
|
-
const f = new y.Line3(c, h), u = [],
|
|
367
|
+
const f = new y.Line3(c, h), u = [], p = [], w = [];
|
|
368
368
|
let x = new y.Vector3();
|
|
369
369
|
return a.forEach((P, M) => {
|
|
370
|
-
f.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (u.push(e[M]),
|
|
371
|
-
}), { newOriginalPoints: u, newProjectPoints: w, newOnLinePoints:
|
|
372
|
-
},
|
|
370
|
+
f.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (u.push(e[M]), p.push(l[M])) : w.push(P);
|
|
371
|
+
}), { newOriginalPoints: u, newProjectPoints: w, newOnLinePoints: p };
|
|
372
|
+
}, fo = (n) => {
|
|
373
373
|
function t(e, o, i, r, s, a, l, c, h) {
|
|
374
|
-
let f = new y.Line3(e, o), u = /* @__PURE__ */ new Map(),
|
|
374
|
+
let f = new y.Line3(e, o), u = /* @__PURE__ */ new Map(), p = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
|
|
375
375
|
for (; ; ) {
|
|
376
376
|
let M = /* @__PURE__ */ new Map(), m = 0;
|
|
377
377
|
for (let d = 0; d < h.checkResults.length; d++)
|
|
@@ -381,7 +381,7 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
381
381
|
continue;
|
|
382
382
|
let V = h.checkResults[d].allCenterPoints[b];
|
|
383
383
|
V = new y.Vector3(V.x, V.y, V.z);
|
|
384
|
-
let v = f.closestPointToPoint(V, !0,
|
|
384
|
+
let v = f.closestPointToPoint(V, !0, p), S = V.distanceTo(v);
|
|
385
385
|
Math.abs(S - s) < 0.01 && (m++, M.has(d) ? M.get(d).removePtsIndex.push(b) : M.set(d, {
|
|
386
386
|
index: d,
|
|
387
387
|
removePtsIndex: [b]
|
|
@@ -396,17 +396,17 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
396
396
|
break;
|
|
397
397
|
} else {
|
|
398
398
|
P++;
|
|
399
|
-
for (const [d,
|
|
400
|
-
u.has(d) ? u.get(d).removePtsIndex.push(...
|
|
399
|
+
for (const [d, g] of M)
|
|
400
|
+
u.has(d) ? u.get(d).removePtsIndex.push(...g.removePtsIndex) : u.set(d, g);
|
|
401
401
|
M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), f.set(e, o);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
if (u.size > 0 && P != l)
|
|
405
405
|
for (const [M, m] of u) {
|
|
406
|
-
let d = [],
|
|
406
|
+
let d = [], g = [];
|
|
407
407
|
for (let b = 0; b < h.checkResults[M].allCenterPoints.length; b++)
|
|
408
|
-
m.removePtsIndex.includes(b) || (d.push(h.checkResults[M].allCenterPoints[b]),
|
|
409
|
-
h.checkResults[M].allCenterPoints = d, h.checkResults[M].originalVertices =
|
|
408
|
+
m.removePtsIndex.includes(b) || (d.push(h.checkResults[M].allCenterPoints[b]), g.push(h.checkResults[M].originalVertices[b]));
|
|
409
|
+
h.checkResults[M].allCenterPoints = d, h.checkResults[M].originalVertices = g;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -418,26 +418,26 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
418
418
|
continue;
|
|
419
419
|
if (o.checkResults[0].originalVertices && o.checkResults[0].originalVertices.length > 0) {
|
|
420
420
|
const S = o.checkResults[0].originalVertices[0];
|
|
421
|
-
let [z, D, _,
|
|
422
|
-
z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z),
|
|
423
|
-
let
|
|
421
|
+
let [z, D, _, T] = S;
|
|
422
|
+
z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), T = new y.Vector3(T.x, T.y, T.z), i = z.distanceTo(D), r = z.distanceTo(T);
|
|
423
|
+
let E = new y.Vector3().subVectors(z, D).normalize(), A = oe(E, new y.Vector3(0, 0, 1));
|
|
424
424
|
A && A.parallel && ([r, i] = [i, r]);
|
|
425
425
|
}
|
|
426
426
|
if (i < 0 || r < 0)
|
|
427
427
|
continue;
|
|
428
428
|
let s = new y.Vector3(o.start.x, o.start.y, o.start.z), a = new y.Vector3(o.end.x, o.end.y, o.end.z);
|
|
429
429
|
const l = s.distanceTo(a), c = o.rooftopPz - o.start.z, h = Math.ceil(l / i), f = Math.ceil(c / r);
|
|
430
|
-
let u = s.clone(),
|
|
430
|
+
let u = s.clone(), p = a.clone(), w = p.clone().add(new y.Vector3(0, 0, c)), x = u.clone().add(new y.Vector3(0, 0, c)), P = new y.Vector3().subVectors(p, u).normalize(), M = P.clone().negate();
|
|
431
431
|
new y.Vector3().subVectors(w, u).normalize().clone().negate();
|
|
432
|
-
let d = i / 2,
|
|
433
|
-
t(u, x, P, i, d, f, h, V, o), t(
|
|
434
|
-
const { newOriginalPoints: v } =
|
|
432
|
+
let d = i / 2, g = l * c, b = i * r, V = g / b;
|
|
433
|
+
t(u, x, P, i, d, f, h, V, o), t(p, w, M, i, d, f, h, V, o), o.start = u, o.end = p;
|
|
434
|
+
const { newOriginalPoints: v } = ze(u, p, o.originalPoints);
|
|
435
435
|
o.originalPoints = v;
|
|
436
436
|
}
|
|
437
|
-
},
|
|
437
|
+
}, Rt = (n, t) => new y.Vector3(n.x, n.y, 0).distanceTo(new y.Vector3(t.x, t.y, 0)), mo = (n, t, e = 1e-6) => {
|
|
438
438
|
const o = new y.Vector3();
|
|
439
439
|
return n.closestPointToPoint(t, !0, o), o.distanceTo(t) < e;
|
|
440
|
-
},
|
|
440
|
+
}, Se = (n) => {
|
|
441
441
|
let t = 0, e = [];
|
|
442
442
|
for (let o = 0; o < n.length; o++)
|
|
443
443
|
for (let i = o + 1; i < n.length; i++) {
|
|
@@ -445,10 +445,10 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
445
445
|
r > t && (t = r, e = [n[o], n[i]]);
|
|
446
446
|
}
|
|
447
447
|
return e;
|
|
448
|
-
},
|
|
448
|
+
}, kt = (n, t, e = 0.03) => Math.abs(n.x - t.x) < e && Math.abs(n.y - t.y) < e && Math.abs(n.z - t.z) < e, go = () => {
|
|
449
449
|
const n = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0"), t = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0"), e = Math.floor(Math.random() * 75 + 180).toString(16).padStart(2, "0");
|
|
450
450
|
return `#${n}${t}${e}`;
|
|
451
|
-
},
|
|
451
|
+
}, po = (n, t = 1e-3) => {
|
|
452
452
|
const e = /* @__PURE__ */ new Map(), o = [];
|
|
453
453
|
for (const i of n) {
|
|
454
454
|
const r = Math.round(i.x / t), s = Math.round(i.y / t), a = Math.round(i.z / t), l = `${r},${s},${a}`;
|
|
@@ -456,12 +456,12 @@ const Ue = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), a
|
|
|
456
456
|
}
|
|
457
457
|
return o;
|
|
458
458
|
};
|
|
459
|
-
class
|
|
459
|
+
class yo {
|
|
460
460
|
// 空白区域聚类结果
|
|
461
461
|
constructor() {
|
|
462
|
-
|
|
462
|
+
Fe(this, "results");
|
|
463
463
|
// 点分布分析结果
|
|
464
|
-
|
|
464
|
+
Fe(this, "clusterResults");
|
|
465
465
|
this.results = null;
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
@@ -535,8 +535,8 @@ class fo {
|
|
|
535
535
|
// 左上
|
|
536
536
|
]);
|
|
537
537
|
c.setAttribute("position", new y.BufferAttribute(h, 3)), c.setAttribute("uv", new y.BufferAttribute(u, 2)), c.setIndex(f), c.computeVertexNormals();
|
|
538
|
-
const
|
|
539
|
-
return s.add(x),
|
|
538
|
+
const p = new y.Mesh(c, r), w = new y.EdgesGeometry(c), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
|
|
539
|
+
return s.add(x), p;
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
542
|
* 将一面墙体按 rows×cols 细分成小格 Mesh,每格存入 wallGroup。
|
|
@@ -553,15 +553,15 @@ class fo {
|
|
|
553
553
|
for (let m = 0; m < f.length; m++)
|
|
554
554
|
if (!this.isValidVector3(f[m]))
|
|
555
555
|
return console.error(`墙体基础点${m}无效:`, f[m]), s;
|
|
556
|
-
const u = a.distanceTo(l),
|
|
557
|
-
if (u === 0 ||
|
|
556
|
+
const u = a.distanceTo(l), p = Math.abs(t.rooftopPz - t.start.z);
|
|
557
|
+
if (u === 0 || p === 0)
|
|
558
558
|
return console.error("墙体宽度或高度为0"), console.log("line.rooftopPz", t.rooftopPz), console.log("bottomLeft", a), console.log("bottomRight", l), console.log(t.length), s;
|
|
559
|
-
const w = u / o, x =
|
|
559
|
+
const w = u / o, x = p / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
|
|
560
560
|
for (let m = 0; m < e; m++)
|
|
561
561
|
for (let d = 0; d < o; d++)
|
|
562
562
|
try {
|
|
563
|
-
const
|
|
564
|
-
points: [
|
|
563
|
+
const g = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar(m * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar(m * x)), V = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar((m + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar((m + 1) * x)), S = {
|
|
564
|
+
points: [g, b, V, v],
|
|
565
565
|
userData: {}
|
|
566
566
|
};
|
|
567
567
|
S.userData = {
|
|
@@ -572,8 +572,8 @@ class fo {
|
|
|
572
572
|
width: w,
|
|
573
573
|
height: x
|
|
574
574
|
}, s.push(S);
|
|
575
|
-
} catch (
|
|
576
|
-
console.error(`创建墙体小平面(${m}, ${d})时出错:`,
|
|
575
|
+
} catch (g) {
|
|
576
|
+
console.error(`创建墙体小平面(${m}, ${d})时出错:`, g);
|
|
577
577
|
}
|
|
578
578
|
return s;
|
|
579
579
|
}
|
|
@@ -873,23 +873,23 @@ class fo {
|
|
|
873
873
|
}), this.results.totalSegments = r.length;
|
|
874
874
|
for (const s of r) {
|
|
875
875
|
if (s.vertices.length < 4) continue;
|
|
876
|
-
const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [c, h, f, u] = s.vertices,
|
|
876
|
+
const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [c, h, f, u] = s.vertices, p = new y.Vector3().subVectors(h, c).normalize(), w = new y.Vector3().subVectors(u, c).normalize(), x = c.distanceTo(h), P = c.distanceTo(u), M = new y.Plane();
|
|
877
877
|
M.setFromCoplanarPoints(c, h, u);
|
|
878
878
|
const m = x / 2, d = P / 2;
|
|
879
|
-
for (let
|
|
879
|
+
for (let g = 0; g < e.length; g++)
|
|
880
880
|
this.isPointInWallSegmentOptimized(
|
|
881
|
-
e[
|
|
881
|
+
e[g],
|
|
882
882
|
a,
|
|
883
883
|
M,
|
|
884
884
|
c,
|
|
885
|
-
|
|
885
|
+
p,
|
|
886
886
|
w,
|
|
887
887
|
x,
|
|
888
888
|
P,
|
|
889
889
|
m,
|
|
890
890
|
d,
|
|
891
891
|
o
|
|
892
|
-
) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(
|
|
892
|
+
) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(g));
|
|
893
893
|
}
|
|
894
894
|
return r.forEach((s) => {
|
|
895
895
|
const a = `row${s.userData.row}_col${s.userData.col}`, l = this.results.pointsInSegments.has(a) ? this.results.pointsInSegments.get(a).length : 0;
|
|
@@ -914,11 +914,11 @@ class fo {
|
|
|
914
914
|
isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, c, h, f) {
|
|
915
915
|
if (Math.abs(o.distanceToPoint(t)) > f)
|
|
916
916
|
return !1;
|
|
917
|
-
const
|
|
917
|
+
const p = new y.Vector3().subVectors(t, e), w = Math.abs(p.dot(r)), x = Math.abs(p.dot(s));
|
|
918
918
|
if (w > c && x > h)
|
|
919
919
|
return !1;
|
|
920
|
-
const P = new y.Vector3().subVectors(t, i), M = P.dot(r), m = P.dot(s), d = M >= -f && M <= a + f,
|
|
921
|
-
return d &&
|
|
920
|
+
const P = new y.Vector3().subVectors(t, i), M = P.dot(r), m = P.dot(s), d = M >= -f && M <= a + f, g = m >= -f && m <= l + f;
|
|
921
|
+
return d && g;
|
|
922
922
|
}
|
|
923
923
|
// 判断点是否在细分墙体平面内
|
|
924
924
|
isPointInWallSegment(t, e, o, i = 0.1) {
|
|
@@ -937,7 +937,7 @@ class fo {
|
|
|
937
937
|
return !1;
|
|
938
938
|
const f = new y.Vector3().subVectors(s, r).normalize(), u = new y.Vector3().subVectors(l, r).normalize();
|
|
939
939
|
new y.Vector3().crossVectors(f, u).normalize();
|
|
940
|
-
const
|
|
940
|
+
const p = new y.Vector3().subVectors(e, r), w = p.dot(f), x = p.dot(u), P = r.distanceTo(s), M = r.distanceTo(l), m = w >= -i && w <= P + i, d = x >= -i && x <= M + i;
|
|
941
941
|
return m && d && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
|
|
942
942
|
}
|
|
943
943
|
// 优化顶点获取(添加缓存)
|
|
@@ -1020,9 +1020,9 @@ class fo {
|
|
|
1020
1020
|
});
|
|
1021
1021
|
}), t.forEach((u) => {
|
|
1022
1022
|
if (u.userData && u.userData.type === "wallSegment") {
|
|
1023
|
-
const
|
|
1023
|
+
const p = `row${u.userData.row}_col${u.userData.col}`, w = r.has(p);
|
|
1024
1024
|
s.has(u.userData.row) || s.set(u.userData.row, /* @__PURE__ */ new Map()), s.get(u.userData.row).has(u.userData.col) || s.get(u.userData.row).set(u.userData.col, {
|
|
1025
|
-
segmentKey:
|
|
1025
|
+
segmentKey: p,
|
|
1026
1026
|
isEmpty: w,
|
|
1027
1027
|
visited: !1
|
|
1028
1028
|
});
|
|
@@ -1038,15 +1038,15 @@ class fo {
|
|
|
1038
1038
|
[-1, 0]
|
|
1039
1039
|
// 上
|
|
1040
1040
|
];
|
|
1041
|
-
for (const [u,
|
|
1042
|
-
const w = (f = s.get(
|
|
1041
|
+
for (const [u, p] of r) {
|
|
1042
|
+
const w = (f = s.get(p.row)) == null ? void 0 : f.get(p.col);
|
|
1043
1043
|
if (w && !w.visited) {
|
|
1044
|
-
const x = [], P = [[
|
|
1044
|
+
const x = [], P = [[p.row, p.col]];
|
|
1045
1045
|
for (w.visited = !0; P.length > 0; ) {
|
|
1046
1046
|
const [M, m] = P.shift(), d = `row${M}_col${m}`;
|
|
1047
1047
|
r.has(d) && x.push(r.get(d));
|
|
1048
|
-
for (const [
|
|
1049
|
-
const V = M +
|
|
1048
|
+
for (const [g, b] of l) {
|
|
1049
|
+
const V = M + g, v = m + b;
|
|
1050
1050
|
if (s.has(V) && s.get(V).has(v)) {
|
|
1051
1051
|
const S = s.get(V).get(v);
|
|
1052
1052
|
!S.visited && S.isEmpty && (S.visited = !0, P.push([V, v]));
|
|
@@ -1058,7 +1058,7 @@ class fo {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
const c = this.createClusterMaterials(a.length), h = [];
|
|
1060
1060
|
return this.clusterResults = {
|
|
1061
|
-
clusters: a.sort((u,
|
|
1061
|
+
clusters: a.sort((u, p) => p.length - u.length),
|
|
1062
1062
|
highlightedMeshes: h,
|
|
1063
1063
|
clusterMaterials: c,
|
|
1064
1064
|
totalClusters: a.length,
|
|
@@ -1083,10 +1083,10 @@ class fo {
|
|
|
1083
1083
|
for (let x = e; x <= o; x++)
|
|
1084
1084
|
t.has(x) && t.get(x).has(f) || (u = !1);
|
|
1085
1085
|
u && s++;
|
|
1086
|
-
const
|
|
1086
|
+
const p = r;
|
|
1087
1087
|
let w = !0;
|
|
1088
1088
|
for (let x = e; x <= o; x++)
|
|
1089
|
-
t.has(x) && t.get(x).has(
|
|
1089
|
+
t.has(x) && t.get(x).has(p) || (w = !1);
|
|
1090
1090
|
return w && s++, s / 4;
|
|
1091
1091
|
}
|
|
1092
1092
|
// 计算聚类质量分数
|
|
@@ -1099,16 +1099,16 @@ class fo {
|
|
|
1099
1099
|
var f, u;
|
|
1100
1100
|
if (t.length === 0) return { width: 0, height: 0 };
|
|
1101
1101
|
const e = [];
|
|
1102
|
-
if (t.forEach((
|
|
1103
|
-
|
|
1102
|
+
if (t.forEach((p) => {
|
|
1103
|
+
p.vertices && p.vertices.length > 0 && e.push(...p.vertices);
|
|
1104
1104
|
}), e.length === 0) {
|
|
1105
|
-
const
|
|
1105
|
+
const p = [...new Set(t.map((x) => x.row))];
|
|
1106
1106
|
return {
|
|
1107
1107
|
width: [...new Set(t.map((x) => x.col))].length * (((f = t[0].bounds) == null ? void 0 : f.width) || 1),
|
|
1108
|
-
height:
|
|
1108
|
+
height: p.length * (((u = t[0].bounds) == null ? void 0 : u.height) || 1)
|
|
1109
1109
|
};
|
|
1110
1110
|
}
|
|
1111
|
-
const o = Math.min(...e.map((
|
|
1111
|
+
const o = Math.min(...e.map((p) => p.x)), i = Math.max(...e.map((p) => p.x)), r = Math.min(...e.map((p) => p.y)), s = Math.max(...e.map((p) => p.y)), a = Math.min(...e.map((p) => p.z)), l = Math.max(...e.map((p) => p.z)), c = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
|
|
1112
1112
|
return { width: c, height: h };
|
|
1113
1113
|
}
|
|
1114
1114
|
// 创建不同颜色的聚类材质
|
|
@@ -1211,28 +1211,28 @@ class fo {
|
|
|
1211
1211
|
o.forEach((a, l) => {
|
|
1212
1212
|
a.applyMatrix4(e[l].matrixWorld);
|
|
1213
1213
|
});
|
|
1214
|
-
const i =
|
|
1214
|
+
const i = io(o), r = e[0].material.clone(), s = new y.Mesh(i, r);
|
|
1215
1215
|
return s.name = "mergedWalls", s;
|
|
1216
1216
|
} catch (o) {
|
|
1217
1217
|
return console.error("合并网格时出错:", o), null;
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
const
|
|
1221
|
+
const xo = (n) => {
|
|
1222
1222
|
let t = {};
|
|
1223
1223
|
const e = [], o = [], i = [];
|
|
1224
1224
|
return n[0].width, n[0].height, n.forEach((r) => {
|
|
1225
1225
|
o.push(...r.vertices), i.push(r.center), e.push(r.vertices);
|
|
1226
1226
|
}), t.originalVertices = e, t.allCenterPoints = i, t;
|
|
1227
|
-
},
|
|
1228
|
-
const t = new
|
|
1229
|
-
new
|
|
1227
|
+
}, wo = (n) => {
|
|
1228
|
+
const t = new zt().copy(n.start).add(n.end).multiplyScalar(0.5), e = new zt().subVectors(
|
|
1229
|
+
new zt(t.x, t.y, t.z + 1),
|
|
1230
1230
|
t
|
|
1231
|
-
).normalize(), o = new
|
|
1231
|
+
).normalize(), o = new zt(n.direction.x, n.direction.y, 0);
|
|
1232
1232
|
o.applyAxisAngle(e, Math.PI / 2);
|
|
1233
|
-
const i = new
|
|
1233
|
+
const i = new zt().copy(t).add(o.clone().multiplyScalar(n.length)), r = new zt().copy(t).sub(o.clone().multiplyScalar(n.length));
|
|
1234
1234
|
return t.z = n.start.z, i.z = n.start.z, r.z = n.start.z, { start: i, end: r, center: t, direction: o };
|
|
1235
|
-
},
|
|
1235
|
+
}, ui = (n, t, e = !0) => {
|
|
1236
1236
|
let o = [];
|
|
1237
1237
|
if (!n)
|
|
1238
1238
|
return [];
|
|
@@ -1242,74 +1242,74 @@ const mo = (n) => {
|
|
|
1242
1242
|
let s = new y.Vector3(r.start.x, r.start.y, r.start.z);
|
|
1243
1243
|
s.applyEuler(new y.Euler(-Math.PI / 2, 0, 0));
|
|
1244
1244
|
let a = new y.Vector3(r.end.x, r.end.y, r.end.z);
|
|
1245
|
-
if (a.applyEuler(new y.Euler(-Math.PI / 2, 0, 0)), t.add(
|
|
1246
|
-
const l = new
|
|
1245
|
+
if (a.applyEuler(new y.Euler(-Math.PI / 2, 0, 0)), t.add(ao(String(i), new y.Vector3((s.x + a.x) / 2, (s.y + a.y) / 2, (s.z + a.z) / 2))), (r.isBayWindow || r.isWindow) && e) continue;
|
|
1246
|
+
const l = new no().setFromCoplanarPoints(new zt(r.start.x, r.start.y, r.start.z), new zt(r.end.x, r.end.y, r.end.z), new zt(r.start.x, r.start.y, r.rooftopPz)), c = [];
|
|
1247
1247
|
r.originalPoints.forEach((v, S) => {
|
|
1248
|
-
const z = new
|
|
1248
|
+
const z = new zt();
|
|
1249
1249
|
l.projectPoint(v, z), c.push(z);
|
|
1250
1250
|
});
|
|
1251
|
-
const h = new
|
|
1251
|
+
const h = new zt(r.start.x, r.start.y, r.start.z).distanceTo(new zt(r.end.x, r.end.y, r.end.z)), f = Math.abs(r.rooftopPz - r.start.z), u = new y.MeshBasicMaterial({
|
|
1252
1252
|
color: "red",
|
|
1253
1253
|
side: y.DoubleSide,
|
|
1254
1254
|
wireframe: !1,
|
|
1255
1255
|
transparent: !0,
|
|
1256
1256
|
opacity: 0.5
|
|
1257
|
-
}),
|
|
1257
|
+
}), p = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, f), M = w.createSubdividedWallPlane(r, P, x, u, p);
|
|
1258
1258
|
w.analyzePointDistribution(M, c, 0.01);
|
|
1259
1259
|
const m = new y.MeshBasicMaterial({
|
|
1260
1260
|
color: "black",
|
|
1261
1261
|
transparent: !0,
|
|
1262
1262
|
opacity: 0.8,
|
|
1263
1263
|
side: y.DoubleSide
|
|
1264
|
-
}), d = w.highlightEmptySegments(M, m,
|
|
1264
|
+
}), d = w.highlightEmptySegments(M, m, p), g = [];
|
|
1265
1265
|
for (const v of d.clusters) {
|
|
1266
|
-
const S =
|
|
1267
|
-
S &&
|
|
1266
|
+
const S = xo(v);
|
|
1267
|
+
S && g.push(S);
|
|
1268
1268
|
}
|
|
1269
|
-
const V =
|
|
1270
|
-
r.checkResults =
|
|
1269
|
+
const V = wo(r).direction;
|
|
1270
|
+
r.checkResults = g, r.verticalDirection = V, r.originaIndex = i, o.push(r);
|
|
1271
1271
|
}
|
|
1272
1272
|
return o;
|
|
1273
|
-
},
|
|
1273
|
+
}, hi = (n, t) => {
|
|
1274
1274
|
console.log("lines", n);
|
|
1275
1275
|
for (let e = 0; e < n.length; e++) {
|
|
1276
1276
|
const o = n[e], i = [];
|
|
1277
1277
|
o.originalPoints.forEach((d) => {
|
|
1278
|
-
let
|
|
1278
|
+
let g = new y.Vector3(d.x, d.y, 0), b = !1;
|
|
1279
1279
|
for (let V = 0; V < i.length; V++)
|
|
1280
|
-
if (
|
|
1280
|
+
if (kt(g, i[V], 0.01)) {
|
|
1281
1281
|
b = !0;
|
|
1282
1282
|
break;
|
|
1283
1283
|
}
|
|
1284
|
-
b || i.push(
|
|
1284
|
+
b || i.push(g);
|
|
1285
1285
|
});
|
|
1286
1286
|
const r = Math.round(Math.max(5, Math.min(350, 20 * Math.sqrt(o.length)))), s = 1;
|
|
1287
1287
|
let a = new y.Vector3(o.start.x, o.start.y, o.start.z), l = new y.Vector3(o.end.x, o.end.y, o.end.z), c = new y.Vector3().subVectors(l, a).normalize(), h = c.clone().cross(new y.Vector3(0, 0, 1)).normalize(), f = h.clone().negate(), u = [];
|
|
1288
|
-
const
|
|
1288
|
+
const p = [];
|
|
1289
1289
|
let w = o.length / r;
|
|
1290
1290
|
console.log(w);
|
|
1291
1291
|
for (let d = 0; d < r; d++) {
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1292
|
+
const g = [];
|
|
1293
|
+
g.push(a.clone().addScaledVector(h, s)), g.push(g[0].clone().addScaledVector(c, w)), g.push(g[1].clone().addScaledVector(f, s * 2)), g.push(a.clone().addScaledVector(f, w));
|
|
1294
1294
|
let b = [];
|
|
1295
1295
|
for (let V = 0; V < i.length; V++)
|
|
1296
|
-
u.includes(V) ||
|
|
1297
|
-
b.length > 0 &&
|
|
1296
|
+
u.includes(V) || Po(i[V], g) && (u.push(V), b.push(i[V]));
|
|
1297
|
+
b.length > 0 && p.push(Mo(b)), a = a.addScaledVector(c, w);
|
|
1298
1298
|
}
|
|
1299
1299
|
const x = new Float32Array(i.length * 3);
|
|
1300
|
-
i.forEach((d,
|
|
1301
|
-
x[
|
|
1300
|
+
i.forEach((d, g) => {
|
|
1301
|
+
x[g * 3] = d.x, x[g * 3 + 1] = d.y, x[g * 3 + 2] = d.z;
|
|
1302
1302
|
});
|
|
1303
1303
|
const P = new y.BufferGeometry();
|
|
1304
|
-
P.setAttribute("position", new y.BufferAttribute(x, 3)), P.rotateX(-Math.PI / 2), t.add(new y.Points(P, new y.PointsMaterial({ color:
|
|
1305
|
-
const [M, m] =
|
|
1304
|
+
P.setAttribute("position", new y.BufferAttribute(x, 3)), P.rotateX(-Math.PI / 2), t.add(new y.Points(P, new y.PointsMaterial({ color: go(), size: 0.02 })));
|
|
1305
|
+
const [M, m] = vo(p, {
|
|
1306
1306
|
plane: "xy",
|
|
1307
1307
|
trimRatio: 0
|
|
1308
1308
|
});
|
|
1309
|
-
|
|
1309
|
+
so(M, m, t);
|
|
1310
1310
|
}
|
|
1311
1311
|
};
|
|
1312
|
-
function
|
|
1312
|
+
function en(n, t = "xy") {
|
|
1313
1313
|
if (t === "xy")
|
|
1314
1314
|
return { x: n.x, y: n.y };
|
|
1315
1315
|
if (t === "xz")
|
|
@@ -1318,23 +1318,23 @@ function Ke(n, t = "xy") {
|
|
|
1318
1318
|
return { x: n.y, y: n.z };
|
|
1319
1319
|
throw new Error(`Unsupported plane: ${t}`);
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function bo(n, t, e) {
|
|
1322
1322
|
const o = t.x - n.x, i = t.y - n.y, r = e.x - n.x, s = e.y - n.y;
|
|
1323
1323
|
return o * s - i * r;
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1325
|
+
function Po(n, t, e = "xy") {
|
|
1326
1326
|
if (!t || t.length !== 4)
|
|
1327
1327
|
throw new Error("rectPoints must contain 4 points");
|
|
1328
|
-
const o =
|
|
1328
|
+
const o = en(n, e), i = t.map((a) => en(a, e));
|
|
1329
1329
|
let r = !1, s = !1;
|
|
1330
1330
|
for (let a = 0; a < 4; a++) {
|
|
1331
|
-
const l = i[a], c = i[(a + 1) % 4], h =
|
|
1331
|
+
const l = i[a], c = i[(a + 1) % 4], h = bo(l, c, o);
|
|
1332
1332
|
if (h > 1e-9 && (r = !0), h < -1e-9 && (s = !0), r && s)
|
|
1333
1333
|
return !1;
|
|
1334
1334
|
}
|
|
1335
1335
|
return !0;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Mo(n) {
|
|
1338
1338
|
if (!n || n.length === 0)
|
|
1339
1339
|
return null;
|
|
1340
1340
|
const t = new y.Vector3(0, 0, 0);
|
|
@@ -1342,11 +1342,11 @@ function xo(n) {
|
|
|
1342
1342
|
Array.isArray(e) ? (t.x += e[0], t.y += e[1], t.z += e[2]) : (t.x += e.x, t.y += e.y, t.z += e.z);
|
|
1343
1343
|
return t.divideScalar(n.length), t;
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1345
|
+
function zo(n) {
|
|
1346
1346
|
return n instanceof y.Vector3 ? n.clone() : Array.isArray(n) ? new y.Vector3(n[0], n[1], n[2]) : new y.Vector3(n.x, n.y, n.z);
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1349
|
-
const e =
|
|
1348
|
+
function Vo(n, t = "xy") {
|
|
1349
|
+
const e = zo(n);
|
|
1350
1350
|
if (t === "xy")
|
|
1351
1351
|
return {
|
|
1352
1352
|
x: e.x,
|
|
@@ -1367,7 +1367,7 @@ function bo(n, t = "xy") {
|
|
|
1367
1367
|
};
|
|
1368
1368
|
throw new Error(`Unsupported plane: ${t}`);
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function nn(n, t, e, o = "xy") {
|
|
1371
1371
|
if (o === "xy")
|
|
1372
1372
|
return new y.Vector3(n, t, e);
|
|
1373
1373
|
if (o === "xz")
|
|
@@ -1376,7 +1376,7 @@ function Qe(n, t, e, o = "xy") {
|
|
|
1376
1376
|
return new y.Vector3(e, n, t);
|
|
1377
1377
|
throw new Error(`Unsupported plane: ${o}`);
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1379
|
+
function So(n, t, e) {
|
|
1380
1380
|
if (Math.abs(t) < 1e-12)
|
|
1381
1381
|
return n >= e ? { x: 1, y: 0 } : { x: 0, y: 1 };
|
|
1382
1382
|
const i = n + e, r = n * e - t * t, s = Math.sqrt(Math.max(0, i * i * 0.25 - r)), a = i * 0.5 + s;
|
|
@@ -1387,7 +1387,7 @@ function Po(n, t, e) {
|
|
|
1387
1387
|
y: c / h
|
|
1388
1388
|
};
|
|
1389
1389
|
}
|
|
1390
|
-
function
|
|
1390
|
+
function vo(n, t = {}) {
|
|
1391
1391
|
const {
|
|
1392
1392
|
plane: e = "xy",
|
|
1393
1393
|
// 0 表示完全取最远两端
|
|
@@ -1396,53 +1396,53 @@ function Mo(n, t = {}) {
|
|
|
1396
1396
|
} = t;
|
|
1397
1397
|
if (!n || n.length < 2)
|
|
1398
1398
|
return null;
|
|
1399
|
-
const i = n.map((B) =>
|
|
1399
|
+
const i = n.map((B) => Vo(B, e));
|
|
1400
1400
|
let r = 0, s = 0, a = 0;
|
|
1401
1401
|
for (const B of i)
|
|
1402
1402
|
r += B.x, s += B.y, a += B.up;
|
|
1403
1403
|
r /= i.length, s /= i.length, a /= i.length;
|
|
1404
1404
|
let l = 0, c = 0, h = 0;
|
|
1405
1405
|
for (const B of i) {
|
|
1406
|
-
const
|
|
1407
|
-
l +=
|
|
1406
|
+
const R = B.x - r, W = B.y - s;
|
|
1407
|
+
l += R * R, c += R * W, h += W * W;
|
|
1408
1408
|
}
|
|
1409
1409
|
l /= i.length, c /= i.length, h /= i.length;
|
|
1410
|
-
const f =
|
|
1410
|
+
const f = So(l, c, h), u = {
|
|
1411
1411
|
x: -f.y,
|
|
1412
1412
|
y: f.x
|
|
1413
|
-
},
|
|
1413
|
+
}, p = [];
|
|
1414
1414
|
for (const B of i) {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1415
|
+
const R = B.x - r, W = B.y - s, C = R * f.x + W * f.y, L = R * u.x + W * u.y;
|
|
1416
|
+
p.push({
|
|
1417
1417
|
s: C,
|
|
1418
|
-
t:
|
|
1418
|
+
t: L,
|
|
1419
1419
|
up: B.up
|
|
1420
1420
|
});
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1423
|
-
const w =
|
|
1422
|
+
p.sort((B, R) => B.s - R.s);
|
|
1423
|
+
const w = p.length;
|
|
1424
1424
|
let x = Math.floor(w * o), P = Math.ceil(w * (1 - o)) - 1;
|
|
1425
1425
|
x = Math.max(0, Math.min(w - 1, x)), P = Math.max(0, Math.min(w - 1, P));
|
|
1426
|
-
const M =
|
|
1427
|
-
const B =
|
|
1428
|
-
return B.length % 2 === 0 ? (B[
|
|
1429
|
-
})(),
|
|
1430
|
-
const B =
|
|
1431
|
-
return B.length % 2 === 0 ? (B[
|
|
1432
|
-
})(), b = M.s, V = m.s, v = d, S = d, z =
|
|
1426
|
+
const M = p[x], m = p[P], d = (() => {
|
|
1427
|
+
const B = p.map((W) => W.t).sort((W, C) => W - C), R = Math.floor(B.length / 2);
|
|
1428
|
+
return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
|
|
1429
|
+
})(), g = (() => {
|
|
1430
|
+
const B = p.map((W) => W.up).sort((W, C) => W - C), R = Math.floor(B.length / 2);
|
|
1431
|
+
return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
|
|
1432
|
+
})(), b = M.s, V = m.s, v = d, S = d, z = g, D = g, _ = r + f.x * b + u.x * v, T = s + f.y * b + u.y * v, E = r + f.x * V + u.x * S, A = s + f.y * V + u.y * S, O = nn(_, T, z, e), I = nn(E, A, D, e);
|
|
1433
1433
|
return [O, I];
|
|
1434
1434
|
}
|
|
1435
|
-
const
|
|
1435
|
+
const fi = async (n, t, e, o, i) => {
|
|
1436
1436
|
if (o && o.length > 0)
|
|
1437
1437
|
for (let d = 0; d < o.length; d++) {
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1438
|
+
const g = o[d];
|
|
1439
|
+
g.isLine2 = !0, n.push(g);
|
|
1440
1440
|
}
|
|
1441
|
-
if (
|
|
1441
|
+
if (fo(n), n.length <= 0 || t.length <= 0)
|
|
1442
1442
|
return n;
|
|
1443
1443
|
e || (e = []);
|
|
1444
1444
|
for (const d of n) {
|
|
1445
|
-
let
|
|
1445
|
+
let g = [];
|
|
1446
1446
|
if (!(!d.checkResults || d.checkResults.length <= 0)) {
|
|
1447
1447
|
for (let b = 0; b < d.checkResults.length; b++) {
|
|
1448
1448
|
let D = function(A) {
|
|
@@ -1470,7 +1470,7 @@ const li = async (n, t, e, o, i) => {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
1472
|
const _ = /* @__PURE__ */ new Map();
|
|
1473
|
-
let
|
|
1473
|
+
let T = -1, E = -1;
|
|
1474
1474
|
for (let A = 0; A < S; A++) {
|
|
1475
1475
|
const O = D(A);
|
|
1476
1476
|
_.has(O) || _.set(O, {
|
|
@@ -1483,54 +1483,54 @@ const li = async (n, t, e, o, i) => {
|
|
|
1483
1483
|
centerPts: []
|
|
1484
1484
|
});
|
|
1485
1485
|
const I = _.get(O);
|
|
1486
|
-
let [B,
|
|
1487
|
-
const
|
|
1488
|
-
if (I.points.push(...v[A]), I.area += B.distanceTo(
|
|
1489
|
-
let H = new y.Vector3().subVectors(B,
|
|
1490
|
-
|
|
1491
|
-
let X =
|
|
1492
|
-
X && X.parallel && ([
|
|
1486
|
+
let [B, R, W, C] = v[A];
|
|
1487
|
+
const L = new y.Vector3().add(B).add(R).add(W).add(C).multiplyScalar(0.25);
|
|
1488
|
+
if (I.points.push(...v[A]), I.area += B.distanceTo(R) * B.distanceTo(C), I.originalVertices.push(v[A]), I.index = b, I.centerPts.push(L), T == -1 || E == -1) {
|
|
1489
|
+
let H = new y.Vector3().subVectors(B, R).normalize();
|
|
1490
|
+
E = B.distanceTo(C), T = B.distanceTo(R);
|
|
1491
|
+
let X = oe(H, new y.Vector3(0, 0, 1));
|
|
1492
|
+
X && X.parallel && ([E, T] = [T, E]);
|
|
1493
1493
|
}
|
|
1494
|
-
I.gridWidth =
|
|
1494
|
+
I.gridWidth = T, I.gridHeight = E;
|
|
1495
1495
|
}
|
|
1496
|
-
|
|
1496
|
+
g.push(..._.values());
|
|
1497
1497
|
}
|
|
1498
|
-
d.mergeCheckRegion =
|
|
1498
|
+
d.mergeCheckRegion = g;
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
1501
|
let r = /* @__PURE__ */ new Map();
|
|
1502
1502
|
for (const d of n) {
|
|
1503
1503
|
if (d.length < 0.3) continue;
|
|
1504
|
-
let
|
|
1504
|
+
let g = d.rooftopPz - d.start.z, b = Math.floor(d.rooftopPz - d.start.z);
|
|
1505
1505
|
r.has(b) ? r.set(b, {
|
|
1506
1506
|
num: r.get(b).num + 1,
|
|
1507
|
-
totalHeight: r.get(b).totalHeight +
|
|
1507
|
+
totalHeight: r.get(b).totalHeight + g
|
|
1508
1508
|
}) : r.set(b, {
|
|
1509
1509
|
num: 1,
|
|
1510
|
-
totalHeight:
|
|
1510
|
+
totalHeight: g
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
1513
1513
|
let s = [...r.entries()].reduce(
|
|
1514
|
-
(d,
|
|
1514
|
+
(d, g) => g[1].num > d[1].num ? g : d
|
|
1515
1515
|
);
|
|
1516
1516
|
s[0], s[1].totalHeight / s[1].num;
|
|
1517
1517
|
const a = [];
|
|
1518
1518
|
for (let d = 0; d < e.length; d++) {
|
|
1519
|
-
const
|
|
1520
|
-
if (
|
|
1519
|
+
const g = e[d];
|
|
1520
|
+
if (g.isFindBeam = !1, g.category == "door") {
|
|
1521
1521
|
let b = [];
|
|
1522
|
-
|
|
1522
|
+
g.coordinatesByArea.coordinates.forEach((D) => {
|
|
1523
1523
|
b.push(new y.Vector3(D.x, D.y, D.z));
|
|
1524
1524
|
}), b[0].equals(b[b.length - 1]) && b.pop();
|
|
1525
1525
|
let V = b[0].distanceTo(b[1]), v = b[0].distanceTo(b[3]);
|
|
1526
1526
|
v > V && ([V, v] = [v, V], b = [b[0], b[3], b[2], b[1]]);
|
|
1527
|
-
let S =
|
|
1527
|
+
let S = ee(b[0], b[3], !0), z = ee(b[1], b[2], !0);
|
|
1528
1528
|
a.push({
|
|
1529
1529
|
doorStartPt: S,
|
|
1530
1530
|
doorEndPt: z,
|
|
1531
1531
|
boxPoints: b,
|
|
1532
|
-
minZ:
|
|
1533
|
-
maxZ:
|
|
1532
|
+
minZ: g.coordinatesByArea.heightData.minZ,
|
|
1533
|
+
maxZ: g.coordinatesByArea.heightData.maxZ,
|
|
1534
1534
|
index: d,
|
|
1535
1535
|
isFind: !1,
|
|
1536
1536
|
inWall: !1
|
|
@@ -1539,36 +1539,36 @@ const li = async (n, t, e, o, i) => {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
for (let d = 0; d < a.length; d++) {
|
|
1542
|
-
const
|
|
1542
|
+
const g = a[d];
|
|
1543
1543
|
for (let b = 0; b < n.length; b++) {
|
|
1544
1544
|
if (n[b].length < 0.5) continue;
|
|
1545
1545
|
let V = [];
|
|
1546
|
-
const v =
|
|
1547
|
-
V.push(v), V.push(
|
|
1546
|
+
const v = ee(n[b].start, n[b].end, !0);
|
|
1547
|
+
V.push(v), V.push(ee(v, n[b].start, !0)), V.push(ee(v, n[b].end, !0));
|
|
1548
1548
|
let S = !1;
|
|
1549
|
-
const z =
|
|
1549
|
+
const z = g.boxPoints.length;
|
|
1550
1550
|
for (let D = 0; D < V.length; D++) {
|
|
1551
|
-
const _ = V[D].x,
|
|
1552
|
-
for (let
|
|
1553
|
-
const O =
|
|
1554
|
-
I >
|
|
1551
|
+
const _ = V[D].x, T = V[D].y;
|
|
1552
|
+
for (let E = 0, A = z - 1; E < z; A = E++) {
|
|
1553
|
+
const O = g.boxPoints[E].x, I = g.boxPoints[E].y, B = g.boxPoints[A].x, R = g.boxPoints[A].y;
|
|
1554
|
+
I > T != R > T && _ < (B - O) * (T - I) / (R - I) + O && (S = !S);
|
|
1555
1555
|
}
|
|
1556
1556
|
if (S) break;
|
|
1557
1557
|
}
|
|
1558
1558
|
if (S) {
|
|
1559
|
-
let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0),
|
|
1560
|
-
if (Math.abs(
|
|
1561
|
-
|
|
1559
|
+
let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0), T = g.doorStartPt.distanceTo(g.doorEndPt), E = D.distanceTo(_), A = Jt(g.doorStartPt, g.doorEndPt, D, _);
|
|
1560
|
+
if (Math.abs(E - T) < 0.5 && A && A.angleDeg < 15) {
|
|
1561
|
+
g.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), g.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
|
|
1562
1562
|
break;
|
|
1563
|
-
} else if (Math.abs(
|
|
1564
|
-
let O =
|
|
1563
|
+
} else if (Math.abs(E - T) > 1.3 && A && A.angleDeg < 15) {
|
|
1564
|
+
let O = ne(g.doorStartPt, g.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = g.doorStartPt.distanceTo(D), B = g.doorStartPt.distanceTo(_), R = g.doorEndPt.distanceTo(D), W = g.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || R < 0.2 || W < 0.2;
|
|
1565
1565
|
if (O && O.type == "collinear_overlap" && O.maxPerpendicularDistance < 0.1 && !C) {
|
|
1566
|
-
|
|
1566
|
+
g.inWall = !0;
|
|
1567
1567
|
break;
|
|
1568
1568
|
} else {
|
|
1569
|
-
let
|
|
1570
|
-
if (
|
|
1571
|
-
|
|
1569
|
+
let L = new y.Line3(D, _), H = L.closestPointToPoint(g.doorStartPt, !0, new y.Vector3()), X = L.closestPointToPoint(g.doorEndPt, !0, new y.Vector3()), ot = H.distanceTo(g.doorStartPt), K = X.distanceTo(g.doorEndPt);
|
|
1570
|
+
if (ot < 0.1 || K < 0.1) {
|
|
1571
|
+
g.inWall = !0;
|
|
1572
1572
|
break;
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
@@ -1579,413 +1579,447 @@ const li = async (n, t, e, o, i) => {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
let l = 0, c = [], h = [], f = [];
|
|
1581
1581
|
const u = [];
|
|
1582
|
-
let
|
|
1582
|
+
let p = 0.15;
|
|
1583
1583
|
for (let d = 0; d < n.length; d++) {
|
|
1584
|
-
const
|
|
1585
|
-
if (
|
|
1584
|
+
const g = n[d];
|
|
1585
|
+
if (g.noDetection || (g.doorAndBeamData = [], !g.mergeCheckRegion || g.mergeCheckRegion.length == 0))
|
|
1586
1586
|
continue;
|
|
1587
|
-
|
|
1587
|
+
g.completePointAreaPercentage = -1;
|
|
1588
1588
|
let b = new y.Box3();
|
|
1589
|
-
b.setFromPoints(
|
|
1589
|
+
b.setFromPoints(g.originalPoints);
|
|
1590
1590
|
let V = b.max.z;
|
|
1591
1591
|
b.min.z;
|
|
1592
|
-
const v = new y.Vector3(
|
|
1593
|
-
let z =
|
|
1594
|
-
for (const
|
|
1595
|
-
const { facePoints:
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1592
|
+
const v = new y.Vector3(g.start.x, g.start.y, g.start.z), S = new y.Vector3(g.end.x, g.end.y, g.end.z);
|
|
1593
|
+
let z = g.rooftopPz - g.start.z, D = 0;
|
|
1594
|
+
for (const T of g.mergeCheckRegion) {
|
|
1595
|
+
const { facePoints: E, boxArea: A, totalInPlaneNum: O } = co(
|
|
1596
|
+
T.points,
|
|
1597
|
+
T.gridWidth,
|
|
1598
|
+
T.gridHeight,
|
|
1599
|
+
T.centerPts
|
|
1600
1600
|
);
|
|
1601
|
-
if (!
|
|
1601
|
+
if (!E || E.length <= 0)
|
|
1602
1602
|
continue;
|
|
1603
|
-
|
|
1604
|
-
let I =
|
|
1605
|
-
const B =
|
|
1606
|
-
let
|
|
1607
|
-
const C = new y.Line3(
|
|
1603
|
+
E[0].distanceTo(E[1]);
|
|
1604
|
+
let I = E[0].distanceTo(E[3]);
|
|
1605
|
+
const B = T.gridHeight * (I / T.gridHeight / 3 * 2) + T.gridHeight / 2;
|
|
1606
|
+
let R = new y.Vector3(E[0].x, E[0].y, E[0].z + B), W = new y.Vector3(E[1].x, E[1].y, E[1].z + B);
|
|
1607
|
+
const C = new y.Line3(R, W), L = [];
|
|
1608
1608
|
let H = new y.Vector3();
|
|
1609
|
-
|
|
1610
|
-
C.closestPointToPoint(
|
|
1609
|
+
T.points.forEach((rt) => {
|
|
1610
|
+
C.closestPointToPoint(rt, !0, H).distanceTo(rt) < T.gridHeight + 0.01 && L.push(rt);
|
|
1611
1611
|
});
|
|
1612
|
-
let X = [],
|
|
1612
|
+
let X = [], ot = [];
|
|
1613
1613
|
for (; ; ) {
|
|
1614
|
-
let
|
|
1615
|
-
for (let F = 0; F <
|
|
1616
|
-
|
|
1617
|
-
for (let F = 0; F <
|
|
1618
|
-
if (!
|
|
1619
|
-
for (let Y = 0; Y <
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1614
|
+
let rt = [];
|
|
1615
|
+
for (let F = 0; F < L.length; F++)
|
|
1616
|
+
ot.includes(F) || rt.length == 0 && (rt.push(L[F]), ot.push(F));
|
|
1617
|
+
for (let F = 0; F < L.length; F++)
|
|
1618
|
+
if (!ot.includes(F)) {
|
|
1619
|
+
for (let Y = 0; Y < rt.length; Y++)
|
|
1620
|
+
if (L[F].distanceTo(rt[Y]) < T.gridWidth + 0.01) {
|
|
1621
|
+
rt.push(L[F]), ot.push(F), F = -1;
|
|
1622
1622
|
break;
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
|
-
if (
|
|
1625
|
+
if (rt.length == 0)
|
|
1626
1626
|
break;
|
|
1627
|
-
X.push(
|
|
1627
|
+
X.push(rt);
|
|
1628
1628
|
}
|
|
1629
|
-
const
|
|
1630
|
-
for (let
|
|
1629
|
+
const K = [];
|
|
1630
|
+
for (let rt = 0; rt < X.length; rt++) {
|
|
1631
1631
|
const F = {
|
|
1632
1632
|
lineSt: new y.Vector3(),
|
|
1633
1633
|
lineEd: new y.Vector3(),
|
|
1634
1634
|
facePoints: []
|
|
1635
1635
|
};
|
|
1636
|
-
let Y =
|
|
1637
|
-
Array.isArray(Y) && Y.length == 2 && (F.lineSt = Y[0], F.lineEd = Y[1], F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y,
|
|
1636
|
+
let Y = Se(X[rt]);
|
|
1637
|
+
Array.isArray(Y) && Y.length == 2 && (F.lineSt = Y[0], F.lineEd = Y[1], F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, E[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, E[0].z)), F.facePoints.push(new y.Vector3(Y[1].x, Y[1].y, E[2].z)), F.facePoints.push(new y.Vector3(Y[0].x, Y[0].y, E[2].z)), K.push(F));
|
|
1638
1638
|
}
|
|
1639
|
-
D +=
|
|
1640
|
-
let
|
|
1641
|
-
if (O != 0 && (
|
|
1642
|
-
for (let
|
|
1643
|
-
const F =
|
|
1644
|
-
let Y = F.facePoints[0].distanceTo(F.facePoints[1]),
|
|
1645
|
-
if (
|
|
1639
|
+
D += T.area;
|
|
1640
|
+
let G = 0;
|
|
1641
|
+
if (O != 0 && (G = T.gridHeight * T.gridWidth * O), (T.area - G) / A * 100 > 70 && K.length == 1 || K.length > 1)
|
|
1642
|
+
for (let rt = 0; rt < K.length; rt++) {
|
|
1643
|
+
const F = K[rt];
|
|
1644
|
+
let Y = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = Y / g.length * 100, Nt = g.rooftopPz - F.facePoints[2].z;
|
|
1645
|
+
if (Mt < 1.5 || V < F.facePoints[2].z || Nt > z / 3 * 2)
|
|
1646
1646
|
continue;
|
|
1647
|
-
let
|
|
1648
|
-
if (Math.abs(F.facePoints[0].z -
|
|
1649
|
-
if (Y > 0.17 &&
|
|
1650
|
-
let
|
|
1651
|
-
const
|
|
1652
|
-
if (
|
|
1653
|
-
const { newOriginalPoints:
|
|
1654
|
-
if (
|
|
1655
|
-
|
|
1647
|
+
let Lt = !1, _t = !1, Tt = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), q = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Wt = !1, Et = -1;
|
|
1648
|
+
if (Math.abs(F.facePoints[0].z - g.start.z) < 0.25) {
|
|
1649
|
+
if (Y > 0.17 && g.length > 0.5) {
|
|
1650
|
+
let qt = Rt(v, q), J = Rt(v, j), ct = Rt(S, q), N = Rt(S, j);
|
|
1651
|
+
const bt = 0.1, Vt = 10;
|
|
1652
|
+
if (qt < bt || J < bt) {
|
|
1653
|
+
const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
|
|
1654
|
+
if (Ut.forEach((Q) => {
|
|
1655
|
+
Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
|
|
1656
1656
|
}), at.length > 10) {
|
|
1657
|
-
const
|
|
1658
|
-
let
|
|
1659
|
-
for (let
|
|
1660
|
-
if (
|
|
1661
|
-
const
|
|
1662
|
-
let
|
|
1663
|
-
if (
|
|
1664
|
-
if (
|
|
1665
|
-
let
|
|
1666
|
-
if (
|
|
1667
|
-
ft = !0, ht = 1 / 0,
|
|
1657
|
+
const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(Q, gt).normalize();
|
|
1658
|
+
let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
|
|
1659
|
+
for (let U = 0; U < n.length; U++) {
|
|
1660
|
+
if (U == d) continue;
|
|
1661
|
+
const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
|
|
1662
|
+
let St = re(Q, gt, it, dt);
|
|
1663
|
+
if (Ct != null) {
|
|
1664
|
+
if (St && St.angle > 85) {
|
|
1665
|
+
let At = Ct.point.distanceTo(Q);
|
|
1666
|
+
if (Ct.point.distanceTo(gt), At < 0.3) {
|
|
1667
|
+
ft = !0, ht = 1 / 0, Z = -1;
|
|
1668
1668
|
break;
|
|
1669
1669
|
}
|
|
1670
1670
|
}
|
|
1671
1671
|
continue;
|
|
1672
1672
|
}
|
|
1673
|
-
if (
|
|
1674
|
-
const
|
|
1675
|
-
let pt =
|
|
1673
|
+
if (St && St.angle > 85) {
|
|
1674
|
+
const $ = new y.Line3(it, dt).closestPointToPoint(Q, !0, Gt);
|
|
1675
|
+
let pt = Jt(Q, gt, $, Q);
|
|
1676
1676
|
if (!pt || pt.direction != "same") continue;
|
|
1677
|
-
const
|
|
1678
|
-
let xt = new y.Vector3().subVectors(dt,
|
|
1679
|
-
const
|
|
1680
|
-
if (
|
|
1681
|
-
let
|
|
1682
|
-
|
|
1683
|
-
} else if (
|
|
1684
|
-
const
|
|
1685
|
-
let pt =
|
|
1686
|
-
|
|
1687
|
-
|
|
1677
|
+
const et = Q.clone().addScaledVector(Pt, Vt), st = gt.clone().addScaledVector(Pt.clone().negate(), Vt);
|
|
1678
|
+
let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
|
|
1679
|
+
const wt = te(et, st, vt, Bt);
|
|
1680
|
+
if (wt == null) continue;
|
|
1681
|
+
let Xt = Q.distanceTo(wt.point);
|
|
1682
|
+
Xt < ht && (ht = Xt, Z = U);
|
|
1683
|
+
} else if (St && St.angle < 5) {
|
|
1684
|
+
const At = new y.Vector3(q.x, q.y, 0), $ = new y.Vector3(j.x, j.y, 0);
|
|
1685
|
+
let pt = Rt(At, it), et = Rt(At, dt), st = Rt($, it), xt = Rt($, dt), vt = Jt(Q, gt, it, At), Bt = !1;
|
|
1686
|
+
for (let wt = 0; wt < n[U].checkResults.length; wt++) {
|
|
1687
|
+
let Xt = [];
|
|
1688
|
+
for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
|
|
1689
|
+
Xt.push(new y.Vector3(
|
|
1690
|
+
n[U].checkResults[wt].allCenterPoints[Kt].x,
|
|
1691
|
+
n[U].checkResults[wt].allCenterPoints[Kt].y,
|
|
1692
|
+
0
|
|
1693
|
+
));
|
|
1694
|
+
let Ht = Se(Xt);
|
|
1695
|
+
if (Ht.length == 2) {
|
|
1696
|
+
let Kt = Rt(At, Ht[0]), Ce = Rt(At, Ht[1]), Re = Rt($, Ht[0]), Le = Rt($, Ht[1]);
|
|
1697
|
+
if (Kt < 0.2 || Ce < 0.2 || Re < 0.2 || Le < 0.2) {
|
|
1698
|
+
Bt = !0;
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
|
|
1704
|
+
k = !0, ht = 1 / 0, Z = -1;
|
|
1688
1705
|
break;
|
|
1689
1706
|
}
|
|
1690
1707
|
}
|
|
1691
1708
|
}
|
|
1692
|
-
if (ht != 1 / 0 && ht < 2 &&
|
|
1693
|
-
n[
|
|
1709
|
+
if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
|
|
1710
|
+
n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, qt < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
|
|
1694
1711
|
else {
|
|
1695
|
-
if (!k && !ft &&
|
|
1712
|
+
if (!k && !ft && g.length - Y > 0.1)
|
|
1696
1713
|
continue;
|
|
1697
|
-
if (!k && !ft &&
|
|
1714
|
+
if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
|
|
1698
1715
|
continue;
|
|
1699
1716
|
}
|
|
1700
1717
|
} else
|
|
1701
1718
|
continue;
|
|
1702
1719
|
}
|
|
1703
|
-
if (ct <
|
|
1704
|
-
const { newOriginalPoints:
|
|
1705
|
-
if (
|
|
1706
|
-
|
|
1720
|
+
if (ct < bt || N < bt) {
|
|
1721
|
+
const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
|
|
1722
|
+
if (Ut.forEach((Q) => {
|
|
1723
|
+
Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
|
|
1707
1724
|
}), at.length > 10) {
|
|
1708
|
-
const
|
|
1709
|
-
let
|
|
1710
|
-
for (let
|
|
1711
|
-
if (
|
|
1712
|
-
const
|
|
1713
|
-
let
|
|
1714
|
-
if (
|
|
1715
|
-
if (
|
|
1716
|
-
ft = !0, ht = 1 / 0,
|
|
1725
|
+
const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(gt, Q).normalize();
|
|
1726
|
+
let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
|
|
1727
|
+
for (let U = 0; U < n.length; U++) {
|
|
1728
|
+
if (U == d) continue;
|
|
1729
|
+
const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
|
|
1730
|
+
let St = re(Q, gt, it, dt);
|
|
1731
|
+
if (Ct != null) {
|
|
1732
|
+
if (St && St.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
|
|
1733
|
+
ft = !0, ht = 1 / 0, Z = -1;
|
|
1717
1734
|
break;
|
|
1718
1735
|
}
|
|
1719
1736
|
continue;
|
|
1720
1737
|
}
|
|
1721
|
-
if (
|
|
1722
|
-
const
|
|
1723
|
-
let pt =
|
|
1738
|
+
if (St && St.angle > 85) {
|
|
1739
|
+
const $ = new y.Line3(it, dt).closestPointToPoint(gt, !0, Gt);
|
|
1740
|
+
let pt = Jt(gt, Q, $, gt);
|
|
1724
1741
|
if (!pt || pt.direction != "same") continue;
|
|
1725
|
-
const
|
|
1726
|
-
let xt = new y.Vector3().subVectors(dt,
|
|
1727
|
-
const
|
|
1728
|
-
if (
|
|
1729
|
-
let
|
|
1730
|
-
|
|
1731
|
-
} else if (
|
|
1732
|
-
const
|
|
1733
|
-
let pt =
|
|
1734
|
-
|
|
1735
|
-
|
|
1742
|
+
const et = Q.clone().addScaledVector(Pt.clone().negate(), Vt), st = gt.clone().addScaledVector(Pt, Vt);
|
|
1743
|
+
let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
|
|
1744
|
+
const wt = te(et, st, vt, Bt);
|
|
1745
|
+
if (wt == null) continue;
|
|
1746
|
+
let Xt = gt.distanceTo(wt.point);
|
|
1747
|
+
Xt < ht && (ht = Xt, Z = U);
|
|
1748
|
+
} else if (St && St.angle < 5) {
|
|
1749
|
+
const At = new y.Vector3(q.x, q.y, 0), $ = new y.Vector3(j.x, j.y, 0);
|
|
1750
|
+
let pt = Rt(At, it), et = Rt(At, dt), st = Rt($, it), xt = Rt($, dt), vt = Jt(gt, Q, it, At), Bt = !1;
|
|
1751
|
+
for (let wt = 0; wt < n[U].checkResults.length; wt++) {
|
|
1752
|
+
let Xt = [];
|
|
1753
|
+
for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
|
|
1754
|
+
Xt.push(new y.Vector3(
|
|
1755
|
+
n[U].checkResults[wt].allCenterPoints[Kt].x,
|
|
1756
|
+
n[U].checkResults[wt].allCenterPoints[Kt].y,
|
|
1757
|
+
0
|
|
1758
|
+
));
|
|
1759
|
+
let Ht = Se(Xt);
|
|
1760
|
+
if (Ht.length == 2) {
|
|
1761
|
+
let Kt = Rt(At, Ht[0]), Ce = Rt(At, Ht[1]), Re = Rt($, Ht[0]), Le = Rt($, Ht[1]);
|
|
1762
|
+
if (Kt < 0.2 || Ce < 0.2 || Re < 0.2 || Le < 0.2) {
|
|
1763
|
+
Bt = !0;
|
|
1764
|
+
break;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
|
|
1769
|
+
k = !0, ht = 1 / 0, Z = -1;
|
|
1736
1770
|
break;
|
|
1737
1771
|
}
|
|
1738
1772
|
}
|
|
1739
1773
|
}
|
|
1740
|
-
if (ht != 1 / 0 && ht < 2 &&
|
|
1741
|
-
n[
|
|
1774
|
+
if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
|
|
1775
|
+
n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, ct < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
|
|
1742
1776
|
else {
|
|
1743
|
-
if (!k && !ft &&
|
|
1777
|
+
if (!k && !ft && g.length - Y > 0.1)
|
|
1744
1778
|
continue;
|
|
1745
|
-
if (!k && !ft &&
|
|
1779
|
+
if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
|
|
1746
1780
|
continue;
|
|
1747
1781
|
}
|
|
1748
1782
|
} else
|
|
1749
1783
|
continue;
|
|
1750
1784
|
}
|
|
1751
|
-
Y = lt.distanceTo(
|
|
1785
|
+
Y = lt.distanceTo(tt);
|
|
1752
1786
|
}
|
|
1753
|
-
if (
|
|
1754
|
-
let
|
|
1755
|
-
for (let
|
|
1756
|
-
let ct =
|
|
1787
|
+
if (Zt < 85 && Y > 0.3 || Y > 0.7 && Mt > z - z / 3) {
|
|
1788
|
+
let qt = !1;
|
|
1789
|
+
for (let J = 0; J < t.length; J++) {
|
|
1790
|
+
let ct = J + 1;
|
|
1757
1791
|
if (ct >= t.length)
|
|
1758
1792
|
continue;
|
|
1759
|
-
let N = new y.Vector3(t[
|
|
1760
|
-
if (
|
|
1793
|
+
let N = new y.Vector3(t[J].x, t[J].y, t[J].z), bt = new y.Vector3(t[ct].x, t[ct].y, t[ct].z);
|
|
1794
|
+
if (te(
|
|
1761
1795
|
new y.Vector3(N.x, N.y, 0),
|
|
1762
|
-
new y.Vector3(
|
|
1796
|
+
new y.Vector3(bt.x, bt.y, 0),
|
|
1763
1797
|
new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0),
|
|
1764
1798
|
new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0),
|
|
1765
1799
|
0.1
|
|
1766
1800
|
) != null) {
|
|
1767
|
-
|
|
1801
|
+
qt = !0;
|
|
1768
1802
|
break;
|
|
1769
1803
|
}
|
|
1770
1804
|
}
|
|
1771
|
-
for (let
|
|
1772
|
-
let ct = new y.Vector3(a[
|
|
1773
|
-
if (Math.abs(F.facePoints[2].z - a[
|
|
1774
|
-
let at =
|
|
1805
|
+
for (let J = 0; J < a.length; J++) {
|
|
1806
|
+
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), N = new y.Vector3(a[J].doorEndPt.x, a[J].doorEndPt.y, 0), bt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), Vt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), Ut = F.facePoints[2].z < a[J].maxZ || Math.abs(F.facePoints[2].z - a[J].maxZ) < 0.3;
|
|
1807
|
+
if (Math.abs(F.facePoints[2].z - a[J].maxZ) > 0.2, Ut) {
|
|
1808
|
+
let at = ne(ct.clone(), N.clone(), bt.clone(), Vt.clone(), {
|
|
1775
1809
|
distanceThreshold: 2
|
|
1776
1810
|
});
|
|
1777
1811
|
if (at && at.type == "collinear_gap") {
|
|
1778
|
-
let
|
|
1779
|
-
if (
|
|
1780
|
-
let
|
|
1781
|
-
if (
|
|
1782
|
-
let
|
|
1783
|
-
if (
|
|
1812
|
+
let Q = ee(ct, N), gt = new y.Line3(new y.Vector3(g.start.x, g.start.y, 0), new y.Vector3(g.end.x, g.end.y, 0)), Pt = new y.Vector3(), Gt = gt.closestPointToPoint(Q, !0, Pt);
|
|
1813
|
+
if (Q.distanceTo(Gt) < 0.15) {
|
|
1814
|
+
let Z = bt.distanceTo(ct), k = Vt.distanceTo(ct);
|
|
1815
|
+
if (Z > 0.25 && k > 0.25) {
|
|
1816
|
+
let it = bt.distanceTo(N), dt = Vt.distanceTo(N);
|
|
1817
|
+
if (it > 0.2 && dt > 0.2)
|
|
1784
1818
|
continue;
|
|
1785
1819
|
}
|
|
1786
|
-
|
|
1787
|
-
let ft = new y.Vector3().subVectors(
|
|
1788
|
-
k <
|
|
1820
|
+
_t = !0, Tt = !0, Ft.push(a[J].index), a[J].isFind = !0, Et = J, e[a[J].index].isFindBeam = !0;
|
|
1821
|
+
let ft = new y.Vector3().subVectors(bt, Vt).normalize(), U = ct.distanceTo(N) - at.overlap;
|
|
1822
|
+
k < Z && ft.negate(), Z > k ? (tt = F.facePoints[2].clone().addScaledVector(ft, U), lt = F.facePoints[3].clone(), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(ft, U), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z);
|
|
1789
1823
|
}
|
|
1790
1824
|
} else if (at && at.type == "collinear_overlap" && at.maxPerpendicularDistance < 0.35) {
|
|
1791
|
-
let
|
|
1792
|
-
if (Math.abs(
|
|
1793
|
-
if (gt >
|
|
1794
|
-
let
|
|
1795
|
-
k < ft ? (
|
|
1825
|
+
let Q = bt.distanceTo(Vt), gt = N.distanceTo(ct);
|
|
1826
|
+
if (Math.abs(Q - at.overlap) < 0.25 || Math.abs(gt - at.overlap) < 0.25) {
|
|
1827
|
+
if (gt > Q && Math.abs(gt - at.overlap) > 1) {
|
|
1828
|
+
let Pt = bt.distanceTo(ct), Gt = bt.distanceTo(N), ht = Vt.distanceTo(ct), Z = Vt.distanceTo(N), k = Pt < Gt ? Pt : Gt, ft = ht < Z ? ht : Z, U = new y.Vector3().subVectors(bt, Vt).normalize(), it = gt - at.overlap;
|
|
1829
|
+
k < ft ? (U.negate(), tt = F.facePoints[2].clone().addScaledVector(U, it), lt = F.facePoints[3].clone(), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(U, it), q = lt.clone(), j = tt.clone(), q.z = j.z = F.facePoints[0].z);
|
|
1796
1830
|
}
|
|
1797
|
-
|
|
1831
|
+
_t = !0, Tt = !0, Ft.push(a[J].index), a[J].isFind = !0, e[a[J].index].isFindBeam = !0, Et = J;
|
|
1798
1832
|
}
|
|
1799
1833
|
}
|
|
1800
1834
|
}
|
|
1801
1835
|
}
|
|
1802
|
-
if (!
|
|
1803
|
-
for (let
|
|
1804
|
-
if (a[
|
|
1805
|
-
let ct = new y.Vector3(a[
|
|
1806
|
-
(ft <
|
|
1836
|
+
if (!Tt && Y < 1.5)
|
|
1837
|
+
for (let J = 0; J < a.length; J++) {
|
|
1838
|
+
if (a[J].inWall) continue;
|
|
1839
|
+
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), N = new y.Vector3(a[J].doorEndPt.x, a[J].doorEndPt.y, 0), bt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), Vt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), Ut = new y.Vector3().subVectors(ct, N).normalize(), at = new y.Vector3().subVectors(bt, Vt).normalize(), Q = 0.25, gt = ct.clone().addScaledVector(Ut, Q), Pt = N.clone().addScaledVector(Ut.clone().negate(), Q), Gt = bt.clone().addScaledVector(at, Q), ht = Vt.clone().addScaledVector(at.clone().negate(), Q), Z = te(gt, Pt, Gt, ht), k = !0, ft = ct.distanceTo(bt), U = ct.distanceTo(Vt), it = N.distanceTo(bt), dt = N.distanceTo(Vt);
|
|
1840
|
+
(ft < p || U < p || it < p || dt < p || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Et = J);
|
|
1807
1841
|
}
|
|
1808
|
-
(
|
|
1842
|
+
(_t || qt || Math.abs(Mt - z) > 0.1 && Mt > z / 2 && Y > 0.3) && (Lt = !0);
|
|
1809
1843
|
}
|
|
1810
1844
|
}
|
|
1811
|
-
if (
|
|
1812
|
-
let
|
|
1813
|
-
for (let
|
|
1814
|
-
let k =
|
|
1845
|
+
if (Lt) {
|
|
1846
|
+
let qt = !1;
|
|
1847
|
+
for (let Z = 0; Z < f.length; Z++) {
|
|
1848
|
+
let k = ne(f[Z].start, f[Z].end, q, j);
|
|
1815
1849
|
if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < 0.01) {
|
|
1816
|
-
|
|
1850
|
+
qt = !0;
|
|
1817
1851
|
break;
|
|
1818
1852
|
}
|
|
1819
1853
|
}
|
|
1820
|
-
if (
|
|
1821
|
-
|
|
1854
|
+
if (qt) {
|
|
1855
|
+
Et != -1 && (e[a[Et].index].isFindBeam = !1, a[Et].isFind = !1);
|
|
1822
1856
|
continue;
|
|
1823
1857
|
}
|
|
1824
1858
|
f.push({
|
|
1825
1859
|
start: q,
|
|
1826
|
-
end:
|
|
1860
|
+
end: j
|
|
1827
1861
|
});
|
|
1828
1862
|
{
|
|
1829
1863
|
new y.PointsMaterial({ color: 65535, size: 0.01 });
|
|
1830
|
-
let
|
|
1831
|
-
const
|
|
1832
|
-
let
|
|
1833
|
-
if (
|
|
1834
|
-
if (
|
|
1835
|
-
let
|
|
1836
|
-
|
|
1864
|
+
let Z = new y.Vector3().subVectors(q, j), k = new y.Vector3().subVectors(j, q), ft = 1 / 0, U = 1 / 0, it = q.clone(), dt = j.clone();
|
|
1865
|
+
const Ct = [], St = [];
|
|
1866
|
+
let At = new y.Line3(tt, lt), $ = new y.Vector3(), pt = 999999;
|
|
1867
|
+
if (g.originalPoints.forEach((et) => {
|
|
1868
|
+
if (et.z - q.z < Mt / 2 + 0.1 && et.z - q.z > Mt / 2 - 0.1 && Ct.push(et), et.z > tt.z) {
|
|
1869
|
+
let st = At.closestPointToPoint(et, !0, $), xt = new y.Vector3().subVectors(st, tt), vt = new y.Vector3().subVectors(st, lt), Bt = oe(Z, vt), wt = oe(k, xt);
|
|
1870
|
+
Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && St.push(et);
|
|
1837
1871
|
}
|
|
1838
|
-
}),
|
|
1839
|
-
const { newProjectPoints:
|
|
1840
|
-
for (const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
let xt = new y.Vector3(
|
|
1844
|
-
if (
|
|
1845
|
-
let
|
|
1846
|
-
|
|
1847
|
-
} else if (
|
|
1848
|
-
let
|
|
1849
|
-
|
|
1872
|
+
}), Ct.length > 0) {
|
|
1873
|
+
const { newProjectPoints: et } = ze(q, j, Ct);
|
|
1874
|
+
for (const st of et)
|
|
1875
|
+
st.z = q.z;
|
|
1876
|
+
et.forEach((st) => {
|
|
1877
|
+
let xt = new y.Vector3(st.x, st.y, q.z), vt = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, q), wt = oe(Z, Bt), Xt = oe(k, vt);
|
|
1878
|
+
if (wt && wt.parallel && wt.sameDirection) {
|
|
1879
|
+
let Ht = xt.distanceTo(q);
|
|
1880
|
+
Ht < ft && (ft = Ht, it = xt);
|
|
1881
|
+
} else if (Xt && Xt.parallel && Xt.sameDirection) {
|
|
1882
|
+
let Ht = xt.distanceTo(j);
|
|
1883
|
+
Ht < U && (U = Ht, dt = xt);
|
|
1850
1884
|
}
|
|
1851
1885
|
});
|
|
1852
1886
|
}
|
|
1853
|
-
if (
|
|
1854
|
-
const { newOnLinePoints:
|
|
1855
|
-
for (let
|
|
1856
|
-
let
|
|
1857
|
-
|
|
1887
|
+
if (it.equals(q) || (q = it, lt = new y.Vector3(q.x, q.y, lt.z)), dt.equals(j) || (j = dt, tt = new y.Vector3(j.x, j.y, tt.z)), St.length > 10) {
|
|
1888
|
+
const { newOnLinePoints: et } = ze(lt, tt, St);
|
|
1889
|
+
for (let st = 0; st < et.length; st++) {
|
|
1890
|
+
let vt = At.closestPointToPoint(et[st], !0, $).distanceTo(et[st]);
|
|
1891
|
+
vt > 0.02 && pt > vt && (pt = vt);
|
|
1858
1892
|
}
|
|
1859
|
-
|
|
1893
|
+
tt.z += pt, lt.z += pt, Mt += pt;
|
|
1860
1894
|
}
|
|
1861
1895
|
}
|
|
1862
|
-
let
|
|
1863
|
-
if (
|
|
1896
|
+
let J = j.distanceTo(q);
|
|
1897
|
+
if (J < 0.4 && !_t || J < 0.3 && _t)
|
|
1864
1898
|
continue;
|
|
1865
|
-
h.includes(d) || h.push(d),
|
|
1899
|
+
h.includes(d) || h.push(d), g.checkResults[T.index].isDoor = !0;
|
|
1866
1900
|
let ct = "", N = {
|
|
1867
1901
|
id: l,
|
|
1868
|
-
beamStart:
|
|
1902
|
+
beamStart: tt,
|
|
1869
1903
|
beamEnd: lt,
|
|
1870
|
-
beamHeight:
|
|
1904
|
+
beamHeight: g.rooftopPz - tt.z,
|
|
1871
1905
|
doorStart: q,
|
|
1872
|
-
doorEnd:
|
|
1873
|
-
doorHeight:
|
|
1906
|
+
doorEnd: j,
|
|
1907
|
+
doorHeight: Mt,
|
|
1874
1908
|
nearId: -1,
|
|
1875
1909
|
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
1876
1910
|
type: ct,
|
|
1877
|
-
isExtend:
|
|
1878
|
-
isDoor:
|
|
1879
|
-
isPullOutDoor:
|
|
1880
|
-
pcbDoorIndexs:
|
|
1911
|
+
isExtend: Wt,
|
|
1912
|
+
isDoor: _t,
|
|
1913
|
+
isPullOutDoor: Tt,
|
|
1914
|
+
pcbDoorIndexs: Ft,
|
|
1881
1915
|
beamNearWallVec: new y.Vector3(0, 0, 0)
|
|
1882
|
-
},
|
|
1883
|
-
for (let
|
|
1884
|
-
const k = n[c[
|
|
1916
|
+
}, bt = !1, Vt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
|
|
1917
|
+
for (let Z = 0; Z < c.length; Z++) {
|
|
1918
|
+
const k = n[c[Z].linesIndex].doorAndBeamData[c[Z].doorIndex];
|
|
1885
1919
|
if (k.nearId != -1)
|
|
1886
1920
|
continue;
|
|
1887
|
-
let ft =
|
|
1888
|
-
|
|
1921
|
+
let ft = Jt(
|
|
1922
|
+
tt.clone(),
|
|
1889
1923
|
lt.clone(),
|
|
1890
1924
|
k.beamStart.clone(),
|
|
1891
1925
|
k.beamEnd.clone()
|
|
1892
1926
|
);
|
|
1893
1927
|
if (ft && ft.isParallel) {
|
|
1894
|
-
let
|
|
1928
|
+
let U = tt.distanceTo(lt), it = k.beamStart.distanceTo(k.beamEnd), dt = new y.Line3(tt.clone(), lt.clone());
|
|
1895
1929
|
dt.start.z = 0, dt.end.z = 0;
|
|
1896
|
-
let
|
|
1897
|
-
|
|
1898
|
-
let
|
|
1899
|
-
if (
|
|
1930
|
+
let Ct = ee(k.beamStart, k.beamEnd, !0);
|
|
1931
|
+
it > U && (dt.start = new y.Vector3(k.beamStart.x, k.beamStart.y, 0), dt.end = new y.Vector3(k.beamEnd.x, k.beamEnd.y, 0), Ct = ee(tt, lt, !0));
|
|
1932
|
+
let St = new y.Vector3(), At = dt.closestPointToPoint(Ct, !0, St), $ = At.distanceTo(Ct), pt = new y.Vector3().subVectors(Ct, At).normalize(), et = pt.clone().negate(), st = Ct.clone().addScaledVector(et, $ + 0.1), xt = te(dt.start, dt.end, Ct, st), vt = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
|
|
1933
|
+
if ($ < 0.4 && xt != null && !vt) {
|
|
1900
1934
|
k.nearId = l, N.nearId = k.id;
|
|
1901
|
-
let
|
|
1935
|
+
let Bt = 0.8;
|
|
1902
1936
|
(k.isDoor || N.isDoor) && (k.isDoor = !0, N.isDoor = !0);
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1937
|
+
const wt = Ft.some((Xt) => k.pcbDoorIndexs.includes(Xt));
|
|
1938
|
+
U < it ? U > Bt && !k.isPullOutDoor ? (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Tt || Tt && k.isPullOutDoor && wt ? (N.beamStart = k.beamStart.clone().addScaledVector(pt, $), N.beamEnd = k.beamEnd.clone().addScaledVector(pt, $), N.doorStart = k.doorStart.clone().addScaledVector(pt, $), N.doorEnd = k.doorEnd.clone().addScaledVector(pt, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : U > it && (it > Bt && !Tt ? (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : !k.isPullOutDoor || Tt && k.isPullOutDoor && wt ? (k.beamStart = tt.clone().addScaledVector(pt, $), k.beamEnd = lt.clone().addScaledVector(pt, $), k.doorStart = q.clone().addScaledVector(pt, $), k.doorEnd = j.clone().addScaledVector(pt, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight)), at = N.nearId, Vt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = c[Z].linesIndex, gt = c[Z].doorIndex;
|
|
1905
1939
|
break;
|
|
1906
1940
|
}
|
|
1907
1941
|
}
|
|
1908
1942
|
}
|
|
1909
|
-
let
|
|
1910
|
-
if (!
|
|
1911
|
-
let
|
|
1943
|
+
let Pt = !1;
|
|
1944
|
+
if (!bt) {
|
|
1945
|
+
let Z = new y.Line3(q.clone(), j.clone());
|
|
1912
1946
|
for (let k = 0; k < n.length; k++) {
|
|
1913
1947
|
if (n[k].length < 0.5 || k == d) continue;
|
|
1914
|
-
let ft = new y.Vector3(n[k].start.x, n[k].start.y, n[k].start.z),
|
|
1915
|
-
const
|
|
1916
|
-
if (
|
|
1948
|
+
let ft = new y.Vector3(n[k].start.x, n[k].start.y, n[k].start.z), U = new y.Vector3(n[k].end.x, n[k].end.y, n[k].end.z), it = ne(ft, U, q, j), dt = Jt(ft, U, q, j);
|
|
1949
|
+
const Ct = ho(n[k]);
|
|
1950
|
+
if (it && it.maxPerpendicularDistance < 0.5) {
|
|
1917
1951
|
if (dt && dt.isParallel) {
|
|
1918
|
-
let
|
|
1919
|
-
|
|
1952
|
+
let st = new y.Line3(ft, U), xt = new y.Vector3(q.x, q.y, ft.z), vt = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(vt, xt, q, j);
|
|
1953
|
+
Bt && Bt.angle > 85 && (N.beamNearWallVec = new y.Vector3().subVectors(vt, xt).normalize());
|
|
1920
1954
|
}
|
|
1921
|
-
const
|
|
1922
|
-
n[k].originalPoints.forEach((
|
|
1923
|
-
|
|
1955
|
+
const St = [];
|
|
1956
|
+
n[k].originalPoints.forEach((st) => {
|
|
1957
|
+
st.z > q.z + 0.2 && st.z < q.z + Mt / 2 && St.push(new y.Vector3(st.x, st.y, q.z));
|
|
1924
1958
|
});
|
|
1925
|
-
const
|
|
1926
|
-
let
|
|
1927
|
-
for (let
|
|
1928
|
-
let xt =
|
|
1929
|
-
xt.distanceTo(
|
|
1959
|
+
const At = new y.Vector3();
|
|
1960
|
+
let $ = [], pt = [];
|
|
1961
|
+
for (let st = 0; st < St.length; st++) {
|
|
1962
|
+
let xt = Z.closestPointToPoint(St[st], !0, At);
|
|
1963
|
+
xt.distanceTo(St[st]) < 0.15 && ($.push(St[st]), pt.push(xt.clone()));
|
|
1930
1964
|
}
|
|
1931
|
-
for (let
|
|
1932
|
-
|
|
1933
|
-
if (
|
|
1934
|
-
let
|
|
1935
|
-
if (
|
|
1936
|
-
let
|
|
1937
|
-
if (Math.abs(
|
|
1938
|
-
let xt = new y.Line3(ft,
|
|
1939
|
-
if (N.beamNearWallVec = new y.Vector3().subVectors(
|
|
1940
|
-
|
|
1941
|
-
else if (
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1965
|
+
for (let st = 0; st < pt.length; st++)
|
|
1966
|
+
mo(Z, pt[st]) && $.push(pt[st]);
|
|
1967
|
+
if ($ = pt, $ = po($), $.length < 150) continue;
|
|
1968
|
+
let et = Se($);
|
|
1969
|
+
if (et.length == 2) {
|
|
1970
|
+
let st = et[0].distanceTo(et[1]);
|
|
1971
|
+
if (Math.abs(st - Z.distance()) < 0.3) {
|
|
1972
|
+
let xt = new y.Line3(ft, U), vt = new y.Vector3(q.x, q.y, ft.z), Bt = xt.closestPointToPoint(vt, !0, new y.Vector3());
|
|
1973
|
+
if (N.beamNearWallVec = new y.Vector3().subVectors(Bt, vt).normalize(), N.beamStart.z > Ct.maxZ - 0.03 && Y > 1)
|
|
1974
|
+
Pt = !0;
|
|
1975
|
+
else if (qt = !0, Et != -1 && (e[a[Et].index].isFindBeam = !1, a[Et].isFind = !1), Q != -1 && gt != -1) {
|
|
1976
|
+
const wt = n[Q].doorAndBeamData[gt];
|
|
1977
|
+
wt.nearId = -1;
|
|
1944
1978
|
}
|
|
1945
1979
|
break;
|
|
1946
1980
|
}
|
|
1947
1981
|
}
|
|
1948
|
-
if (
|
|
1982
|
+
if (qt)
|
|
1949
1983
|
break;
|
|
1950
|
-
} else
|
|
1984
|
+
} else it && it.type == "collinear_overlap" && it.maxPerpendicularDistance > 0.3 && it.maxPerpendicularDistance < 0.7 && (Pt = !0);
|
|
1951
1985
|
}
|
|
1952
|
-
if (
|
|
1986
|
+
if (qt) {
|
|
1953
1987
|
if (Y < 1.8)
|
|
1954
1988
|
continue;
|
|
1955
|
-
|
|
1989
|
+
Pt = !0;
|
|
1956
1990
|
}
|
|
1957
1991
|
}
|
|
1958
|
-
let
|
|
1992
|
+
let Gt = !1;
|
|
1959
1993
|
if (at != -1)
|
|
1960
|
-
for (let
|
|
1994
|
+
for (let Z = 0; Z < u.length && !(u[Z].length == 1 && (u[Z][0].id == l ? (u[Z].push({ id: at, beamStart: Vt, beamEnd: Ut }), Gt = !0) : u[Z][0].id == at && (u[Z].push({ id: l, beamStart: tt, beamEnd: lt }), Gt = !0), Gt)); Z++)
|
|
1961
1995
|
;
|
|
1962
|
-
|
|
1996
|
+
Gt || u.push([{ id: l, beamStart: tt, beamEnd: lt }]);
|
|
1963
1997
|
const ht = N.doorStart.distanceTo(N.doorEnd);
|
|
1964
|
-
if (
|
|
1965
|
-
let
|
|
1998
|
+
if (_t ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = Pt && ht > 1 ? "beam" : "hole", N.type = ct, N.nearId != -1 && ct == "hole") {
|
|
1999
|
+
let Z = !1;
|
|
1966
2000
|
for (let k = 0; k < n.length; k++)
|
|
1967
2001
|
if (n[k].doorAndBeamData) {
|
|
1968
2002
|
for (let ft = 0; ft < n[k].doorAndBeamData.length; ft++)
|
|
1969
2003
|
if (n[k].doorAndBeamData[ft].nearId == l && n[k].doorAndBeamData[ft].type == "beam") {
|
|
1970
|
-
n[k].doorAndBeamData[ft].type = ct,
|
|
2004
|
+
n[k].doorAndBeamData[ft].type = ct, Z = !0;
|
|
1971
2005
|
break;
|
|
1972
2006
|
}
|
|
1973
|
-
if (
|
|
2007
|
+
if (Z) break;
|
|
1974
2008
|
}
|
|
1975
2009
|
}
|
|
1976
|
-
if (
|
|
2010
|
+
if (g.doorAndBeamData.push(N), c.push({
|
|
1977
2011
|
linesIndex: d,
|
|
1978
|
-
doorIndex:
|
|
1979
|
-
}), l++,
|
|
2012
|
+
doorIndex: g.doorAndBeamData.length - 1
|
|
2013
|
+
}), l++, Tt && Y < 2) break;
|
|
1980
2014
|
}
|
|
1981
2015
|
}
|
|
1982
2016
|
}
|
|
1983
|
-
let _ =
|
|
1984
|
-
|
|
2017
|
+
let _ = g.length * (g.rooftopPz - g.start.z);
|
|
2018
|
+
g.completePointAreaPercentage = D / _ * 100;
|
|
1985
2019
|
}
|
|
1986
2020
|
if (h.length > 1)
|
|
1987
2021
|
for (let d = 0; d < h.length; d++) {
|
|
1988
|
-
let
|
|
2022
|
+
let g = [];
|
|
1989
2023
|
for (let b = 0; b < n[h[d]].doorAndBeamData.length; b++) {
|
|
1990
2024
|
let V = !1;
|
|
1991
2025
|
if (n[h[d]].doorAndBeamData[b].type === "beam" && n[h[d]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[d]].doorAndBeamData[b].nearId == -1 && (V = !0), !V) {
|
|
@@ -1995,65 +2029,65 @@ const li = async (n, t, e, o, i) => {
|
|
|
1995
2029
|
for (let D = 0; D < h.length; D++)
|
|
1996
2030
|
if (d != D)
|
|
1997
2031
|
for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
|
|
1998
|
-
let
|
|
1999
|
-
|
|
2000
|
-
let A =
|
|
2032
|
+
let T = n[h[D]].doorAndBeamData[_].doorStart.clone(), E = n[h[D]].doorAndBeamData[_].doorEnd.clone();
|
|
2033
|
+
T.z = E.z = 0, T.distanceTo(E);
|
|
2034
|
+
let A = ne(v, S, T, E);
|
|
2001
2035
|
if (A.type == "collinear_overlap" && A.maxPerpendicularDistance < 0.2) {
|
|
2002
|
-
let O = new y.Line3(
|
|
2003
|
-
if (Math.abs(z - A.overlap) < 0.1 &&
|
|
2036
|
+
let O = new y.Line3(T, E), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
|
|
2037
|
+
if (Math.abs(z - A.overlap) < 0.1 && R < 0.04) {
|
|
2004
2038
|
n[h[D]].doorAndBeamData[_].nearId == n[h[d]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), V = !0;
|
|
2005
2039
|
break;
|
|
2006
2040
|
}
|
|
2007
2041
|
}
|
|
2008
2042
|
}
|
|
2009
2043
|
}
|
|
2010
|
-
V ||
|
|
2044
|
+
V || g.push(n[h[d]].doorAndBeamData[b]);
|
|
2011
2045
|
}
|
|
2012
|
-
|
|
2046
|
+
g.length != n[h[d]].doorAndBeamData.length && (n[h[d]].doorAndBeamData = g);
|
|
2013
2047
|
}
|
|
2014
2048
|
let w = 0.65, x = 2, P = [], M = [];
|
|
2015
2049
|
for (let d = 0; d < a.length; d++) {
|
|
2016
2050
|
if (a[d].isFind || a[d].inWall)
|
|
2017
2051
|
continue;
|
|
2018
|
-
let
|
|
2052
|
+
let g = new y.Vector3(a[d].doorStartPt.x, a[d].doorStartPt.y, 0), b = new y.Vector3(a[d].doorEndPt.x, a[d].doorEndPt.y, 0), V = new y.Vector3().subVectors(g, b).normalize();
|
|
2019
2053
|
for (let v = 0; v < n.length; v++) {
|
|
2020
2054
|
if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
|
|
2021
2055
|
continue;
|
|
2022
|
-
let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3,
|
|
2023
|
-
|
|
2024
|
-
let I =
|
|
2025
|
-
E,
|
|
2056
|
+
let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3, T = g.clone().addScaledVector(V, _), E = b.clone().addScaledVector(V.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = z.clone().addScaledVector(D.clone().negate(), _);
|
|
2057
|
+
te(T, E, A, O);
|
|
2058
|
+
let I = Jt(
|
|
2026
2059
|
T,
|
|
2060
|
+
E,
|
|
2027
2061
|
A,
|
|
2028
2062
|
O
|
|
2029
|
-
), B =
|
|
2030
|
-
if ((
|
|
2031
|
-
let
|
|
2032
|
-
for (let
|
|
2033
|
-
if (
|
|
2063
|
+
), B = g.distanceTo(S) > b.distanceTo(S) ? b : g, R = B.distanceTo(S), W = B.distanceTo(z);
|
|
2064
|
+
if ((R < p || W < p) && I && !I.isParallel) {
|
|
2065
|
+
let L = g.distanceTo(S), H = g.distanceTo(z), X = L < H ? S : z, ot = !1;
|
|
2066
|
+
for (let K = 0; K < n.length; K++) {
|
|
2067
|
+
if (K == v || P.includes(K) || n[K].length < 0.7)
|
|
2034
2068
|
continue;
|
|
2035
|
-
let
|
|
2036
|
-
if (
|
|
2037
|
-
let
|
|
2038
|
-
if (q >
|
|
2039
|
-
|
|
2040
|
-
else if (q <
|
|
2041
|
-
|
|
2069
|
+
let G = new y.Vector3(n[K].start.x, n[K].start.y, 0), ut = new y.Vector3(n[K].end.x, n[K].end.y, 0), rt = new y.Vector3().subVectors(G, ut).normalize(), F = rt.clone().negate(), Y = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, z, G, ut), Nt = ne(S, z, G, ut), Lt = te(S, z, Y, Mt), _t = !0;
|
|
2070
|
+
if (Lt != null && (_t = Lt.point.distanceTo(S) < p || Lt.point.distanceTo(z) < p), (Zt && Zt.angle > 85 || Nt && Nt.type == "collinear_gap") && _t) {
|
|
2071
|
+
let Tt = new y.Line3(S, z), Ft = new y.Vector3(), tt = Tt.closestPointToPoint(G, !0, Ft), lt = Tt.closestPointToPoint(ut, !0, Ft), q = tt.distanceTo(G), j = lt.distanceTo(ut), Wt, Et;
|
|
2072
|
+
if (q > j && j > w)
|
|
2073
|
+
Wt = ut, Et = lt;
|
|
2074
|
+
else if (q < j && q > w)
|
|
2075
|
+
Wt = G, Et = tt;
|
|
2042
2076
|
else
|
|
2043
2077
|
continue;
|
|
2044
|
-
if (q = X.distanceTo(
|
|
2078
|
+
if (q = X.distanceTo(G), j = X.distanceTo(ut), q > x && j > x)
|
|
2045
2079
|
continue;
|
|
2046
|
-
let
|
|
2047
|
-
if (
|
|
2080
|
+
let qt = Jt(Wt, Et, G, ut), J = Jt(Wt, Et, T, E);
|
|
2081
|
+
if (J && J.isParallel || !qt || !qt.isParallel)
|
|
2048
2082
|
continue;
|
|
2049
|
-
let ct =
|
|
2083
|
+
let ct = ne(g, b, Wt, Et);
|
|
2050
2084
|
if (ct && ct.type == "collinear_overlap" && ct.maxPerpendicularDistance < 0.2)
|
|
2051
2085
|
continue;
|
|
2052
|
-
|
|
2086
|
+
Wt.z = Et.z = n[K].start.z;
|
|
2053
2087
|
let N = !1;
|
|
2054
2088
|
for (let at = 0; at < M.length; at++) {
|
|
2055
|
-
let
|
|
2056
|
-
if (
|
|
2089
|
+
let Q = ne(M[at].start, M[at].end, Wt, Et);
|
|
2090
|
+
if (Q && Q.type == "collinear_overlap" && Q.maxPerpendicularDistance < 0.2) {
|
|
2057
2091
|
N = !0;
|
|
2058
2092
|
break;
|
|
2059
2093
|
}
|
|
@@ -2062,8 +2096,8 @@ const li = async (n, t, e, o, i) => {
|
|
|
2062
2096
|
continue;
|
|
2063
2097
|
for (let at = 0; at < n.length; at++) {
|
|
2064
2098
|
if (n[at].length < 0.5) continue;
|
|
2065
|
-
let
|
|
2066
|
-
if (
|
|
2099
|
+
let Q = new y.Vector3(n[at].start.x, n[at].start.y, n[at].start.z), gt = new y.Vector3(n[at].end.x, n[at].end.y, n[at].end.z), Pt = ne(Q, gt, Wt, Et);
|
|
2100
|
+
if (Pt && Pt.type == "collinear_overlap" && Pt.maxPerpendicularDistance < 0.1) {
|
|
2067
2101
|
N = !0;
|
|
2068
2102
|
break;
|
|
2069
2103
|
}
|
|
@@ -2071,27 +2105,27 @@ const li = async (n, t, e, o, i) => {
|
|
|
2071
2105
|
if (N)
|
|
2072
2106
|
continue;
|
|
2073
2107
|
M.push({
|
|
2074
|
-
start:
|
|
2075
|
-
end:
|
|
2076
|
-
}), P.push(
|
|
2077
|
-
let
|
|
2078
|
-
n[
|
|
2108
|
+
start: Wt,
|
|
2109
|
+
end: Et
|
|
2110
|
+
}), P.push(K);
|
|
2111
|
+
let bt = n[K].rooftopPz - n[K].start.z, Vt = n[v].rooftopPz - n[v].start.z, Ut = bt < Vt ? bt : Vt;
|
|
2112
|
+
n[K].doorAndBeamData || (n[K].doorAndBeamData = []), n[K].doorAndBeamData.push({
|
|
2079
2113
|
id: l,
|
|
2080
|
-
beamStart:
|
|
2081
|
-
beamEnd:
|
|
2082
|
-
beamHeight:
|
|
2083
|
-
doorStart:
|
|
2084
|
-
doorEnd:
|
|
2085
|
-
doorHeight:
|
|
2114
|
+
beamStart: Wt,
|
|
2115
|
+
beamEnd: Et,
|
|
2116
|
+
beamHeight: Ut,
|
|
2117
|
+
doorStart: Wt,
|
|
2118
|
+
doorEnd: Et,
|
|
2119
|
+
doorHeight: Ut,
|
|
2086
2120
|
nearId: -1,
|
|
2087
2121
|
type: "onlyDoor",
|
|
2088
2122
|
isDoor: !0,
|
|
2089
2123
|
beamNearWallVec: new y.Vector3(0, 0, 0)
|
|
2090
|
-
}), e[a[d].index].isFindBeam = !0, e[a[d].index].isFindOnlyDoor = !0, u.push([{ id: l, beamStart:
|
|
2124
|
+
}), e[a[d].index].isFindBeam = !0, e[a[d].index].isFindOnlyDoor = !0, u.push([{ id: l, beamStart: Wt, beamEnd: Et }]), l++, ot = !0;
|
|
2091
2125
|
break;
|
|
2092
2126
|
}
|
|
2093
2127
|
}
|
|
2094
|
-
if (
|
|
2128
|
+
if (ot) break;
|
|
2095
2129
|
}
|
|
2096
2130
|
}
|
|
2097
2131
|
}
|
|
@@ -2099,7 +2133,7 @@ const li = async (n, t, e, o, i) => {
|
|
|
2099
2133
|
for (let d = 0; d < n.length; d++)
|
|
2100
2134
|
n[d].isLine2 || m.push(n[d]), n[d].isLine2 && n[d].doorAndBeamData.length != 0 && m.push(n[d]);
|
|
2101
2135
|
return n.length = 0, n.push(...m), { lines: n, beamGroup: u };
|
|
2102
|
-
},
|
|
2136
|
+
}, di = (n, t) => {
|
|
2103
2137
|
if (!n || n.length <= 0) return;
|
|
2104
2138
|
let e = {
|
|
2105
2139
|
rectangles: [],
|
|
@@ -2120,43 +2154,43 @@ const li = async (n, t, e, o, i) => {
|
|
|
2120
2154
|
let d = n[m].length;
|
|
2121
2155
|
if (m == l || d < i || d > r)
|
|
2122
2156
|
continue;
|
|
2123
|
-
let
|
|
2157
|
+
let g = new y.Vector3(n[m].start.x, n[m].start.y, n[m].start.z), b = new y.Vector3(n[m].end.x, n[m].end.y, n[m].end.z), V = re(f, u, g, b);
|
|
2124
2158
|
if (!V || V.angle < 85)
|
|
2125
2159
|
continue;
|
|
2126
|
-
let v =
|
|
2160
|
+
let v = kt(g, f), S = kt(g, u), z = kt(b, f), D = kt(b, u);
|
|
2127
2161
|
if (!(!v && !S && !z && !D)) {
|
|
2128
|
-
v || S ? (x =
|
|
2162
|
+
v || S ? (x = g.clone(), P = b.clone()) : (x = b.clone(), P = g.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
|
|
2129
2163
|
for (let _ = 0; _ < n.length; _++) {
|
|
2130
|
-
let
|
|
2131
|
-
if (_ == l || _ == m ||
|
|
2164
|
+
let T = n[_].length;
|
|
2165
|
+
if (_ == l || _ == m || T < i || T > r)
|
|
2132
2166
|
continue;
|
|
2133
|
-
let
|
|
2167
|
+
let E = new y.Vector3(n[_].start.x, n[_].start.y, n[_].start.z), A = new y.Vector3(n[_].end.x, n[_].end.y, n[_].end.z), O = re(g, b, E, A);
|
|
2134
2168
|
if (!O || O.angle < 85)
|
|
2135
2169
|
continue;
|
|
2136
|
-
let I =
|
|
2170
|
+
let I = kt(E, P), B = kt(A, P);
|
|
2137
2171
|
if (!I && !B) continue;
|
|
2138
2172
|
new y.Vector3();
|
|
2139
|
-
let
|
|
2140
|
-
I ? (W = new y.Vector3().subVectors(A,
|
|
2141
|
-
let C =
|
|
2173
|
+
let R = new y.Vector3(), W = new y.Vector3();
|
|
2174
|
+
I ? (W = new y.Vector3().subVectors(A, E).normalize(), E.clone(), R = A.clone()) : (W = new y.Vector3().subVectors(E, A).normalize(), A.clone(), R = E.clone());
|
|
2175
|
+
let C = oe(w, W, 0.1);
|
|
2142
2176
|
if (!(!C || !C.parallel || !C.sameDirection)) {
|
|
2143
|
-
for (let
|
|
2144
|
-
let H = n[
|
|
2145
|
-
if (
|
|
2177
|
+
for (let L = 0; L < n.length; L++) {
|
|
2178
|
+
let H = n[L].length;
|
|
2179
|
+
if (L == l || L == m || L == _ || H < i || H > r)
|
|
2146
2180
|
continue;
|
|
2147
|
-
let X = new y.Vector3(n[
|
|
2148
|
-
if (!
|
|
2181
|
+
let X = new y.Vector3(n[L].start.x, n[L].start.y, n[L].start.z), ot = new y.Vector3(n[L].end.x, n[L].end.y, n[L].end.z), K = re(X, ot, E, A);
|
|
2182
|
+
if (!K || K.angle < 85)
|
|
2149
2183
|
continue;
|
|
2150
|
-
let
|
|
2151
|
-
if (
|
|
2184
|
+
let G = kt(X, R), ut = kt(ot, R);
|
|
2185
|
+
if (!G && !ut) continue;
|
|
2152
2186
|
new y.Vector3();
|
|
2153
|
-
let
|
|
2154
|
-
|
|
2155
|
-
let F =
|
|
2187
|
+
let rt = new y.Vector3();
|
|
2188
|
+
G ? (X.clone(), rt = ot.clone()) : (ot.clone(), rt = X.clone());
|
|
2189
|
+
let F = kt(rt, f), Y = kt(rt, u);
|
|
2156
2190
|
if (!F && !Y) continue;
|
|
2157
|
-
let
|
|
2158
|
-
if (!(
|
|
2159
|
-
h = [n[l].uuid, n[m].uuid, n[_].uuid, n[
|
|
2191
|
+
let Mt = c * d;
|
|
2192
|
+
if (!(Mt < s || Mt > a)) {
|
|
2193
|
+
h = [n[l].uuid, n[m].uuid, n[_].uuid, n[L].uuid];
|
|
2160
2194
|
break;
|
|
2161
2195
|
}
|
|
2162
2196
|
}
|
|
@@ -2180,49 +2214,49 @@ const li = async (n, t, e, o, i) => {
|
|
|
2180
2214
|
start: new y.Vector3(),
|
|
2181
2215
|
end: new y.Vector3()
|
|
2182
2216
|
}
|
|
2183
|
-
}, f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z),
|
|
2217
|
+
}, f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), p = !0, w = !0;
|
|
2184
2218
|
for (let M = 0; M < n.length; M++) {
|
|
2185
2219
|
if (M == l || n[M].length < i)
|
|
2186
2220
|
continue;
|
|
2187
|
-
let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), d = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z),
|
|
2188
|
-
if (
|
|
2221
|
+
let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), d = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), g = kt(m, f), b = kt(d, f), V = kt(m, u), v = kt(d, u);
|
|
2222
|
+
if (g || b ? p = !1 : (V || v) && (w = !1), !p && !w) break;
|
|
2189
2223
|
}
|
|
2190
|
-
if (!
|
|
2224
|
+
if (!p && !w) continue;
|
|
2191
2225
|
let x = new y.Vector3();
|
|
2192
|
-
|
|
2226
|
+
p || ([f, u] = [u, f]), x = new y.Vector3().subVectors(u, f).normalize();
|
|
2193
2227
|
let P = x.clone().negate();
|
|
2194
2228
|
for (let M = 0; M < n.length; M++) {
|
|
2195
2229
|
let m = n[M].length;
|
|
2196
2230
|
if (M == l || o.has(M) || m < i || m > r)
|
|
2197
2231
|
continue;
|
|
2198
|
-
let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z),
|
|
2232
|
+
let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), g = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = re(f, u, d, g);
|
|
2199
2233
|
if (!b || b.angle < 85)
|
|
2200
2234
|
continue;
|
|
2201
|
-
let V =
|
|
2235
|
+
let V = kt(d, u), v = kt(g, u);
|
|
2202
2236
|
if (!V && !v) continue;
|
|
2203
2237
|
new y.Vector3();
|
|
2204
2238
|
let S = new y.Vector3();
|
|
2205
|
-
V ? (d.clone(), S =
|
|
2239
|
+
V ? (d.clone(), S = g.clone()) : (g.clone(), S = d.clone());
|
|
2206
2240
|
for (let z = 0; z < n.length; z++) {
|
|
2207
2241
|
let D = n[z].length;
|
|
2208
2242
|
if (z == l || z == M || o.has(z) || D < i || D > r)
|
|
2209
2243
|
continue;
|
|
2210
|
-
let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z),
|
|
2211
|
-
if (!
|
|
2244
|
+
let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z), T = new y.Vector3(n[z].end.x, n[z].end.y, n[z].end.z), E = re(d, g, _, T);
|
|
2245
|
+
if (!E || E.angle < 85)
|
|
2212
2246
|
continue;
|
|
2213
|
-
let A =
|
|
2247
|
+
let A = kt(_, S), O = kt(T, S);
|
|
2214
2248
|
if (!A && !O) continue;
|
|
2215
2249
|
let I = new y.Vector3(), B = new y.Vector3();
|
|
2216
|
-
A ? (I = _.clone(), B =
|
|
2217
|
-
let
|
|
2250
|
+
A ? (I = _.clone(), B = T.clone()) : (I = T.clone(), B = _.clone());
|
|
2251
|
+
let R = new y.Vector3().subVectors(B, I).normalize(), W = oe(P, R, 0.1);
|
|
2218
2252
|
if (!W || !W.parallel || !W.sameDirection) continue;
|
|
2219
|
-
let C = !0,
|
|
2253
|
+
let C = !0, L = !0;
|
|
2220
2254
|
for (let X = 0; X < n.length; X++) {
|
|
2221
2255
|
if (X == z || n[X].length < i) continue;
|
|
2222
|
-
let
|
|
2223
|
-
if (
|
|
2256
|
+
let ot = new y.Vector3(n[X].start.x, n[X].start.y, n[X].start.z), K = new y.Vector3(n[X].end.x, n[X].end.y, n[X].end.z), G = kt(ot, _), ut = kt(K, _), rt = kt(ot, T), F = kt(K, T);
|
|
2257
|
+
if (G || ut ? C = !1 : (rt || F) && (L = !1), !C && !L) break;
|
|
2224
2258
|
}
|
|
2225
|
-
if (!C && !
|
|
2259
|
+
if (!C && !L) continue;
|
|
2226
2260
|
let H = c * m;
|
|
2227
2261
|
if (!(H < s || H > a)) {
|
|
2228
2262
|
h.indexs = [n[l].uuid, n[M].uuid, n[z].uuid], h.missingEdge.start = B, h.missingEdge.end = f;
|
|
@@ -2234,49 +2268,49 @@ const li = async (n, t, e, o, i) => {
|
|
|
2234
2268
|
h.indexs.length == 3 && (h.indexs.forEach((M) => o.add(M)), e.threeEdgeRect.push(h));
|
|
2235
2269
|
}
|
|
2236
2270
|
return e;
|
|
2237
|
-
},
|
|
2238
|
-
function
|
|
2271
|
+
}, ae = 11102230246251565e-32, $t = 134217729, Do = (3 + 8 * ae) * ae;
|
|
2272
|
+
function We(n, t, e, o, i) {
|
|
2239
2273
|
let r, s, a, l, c = t[0], h = o[0], f = 0, u = 0;
|
|
2240
2274
|
h > c == h > -c ? (r = c, c = t[++f]) : (r = h, h = o[++u]);
|
|
2241
|
-
let
|
|
2275
|
+
let p = 0;
|
|
2242
2276
|
if (f < n && u < e)
|
|
2243
|
-
for (h > c == h > -c ? (s = c + r, a = r - (s - c), c = t[++f]) : (s = h + r, a = r - (s - h), h = o[++u]), r = s, a !== 0 && (i[
|
|
2244
|
-
h > c == h > -c ? (s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u]), r = s, a !== 0 && (i[
|
|
2277
|
+
for (h > c == h > -c ? (s = c + r, a = r - (s - c), c = t[++f]) : (s = h + r, a = r - (s - h), h = o[++u]), r = s, a !== 0 && (i[p++] = a); f < n && u < e; )
|
|
2278
|
+
h > c == h > -c ? (s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u]), r = s, a !== 0 && (i[p++] = a);
|
|
2245
2279
|
for (; f < n; )
|
|
2246
|
-
s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f], r = s, a !== 0 && (i[
|
|
2280
|
+
s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f], r = s, a !== 0 && (i[p++] = a);
|
|
2247
2281
|
for (; u < e; )
|
|
2248
|
-
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u], r = s, a !== 0 && (i[
|
|
2249
|
-
return (r !== 0 ||
|
|
2282
|
+
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u], r = s, a !== 0 && (i[p++] = a);
|
|
2283
|
+
return (r !== 0 || p === 0) && (i[p++] = r), p;
|
|
2250
2284
|
}
|
|
2251
|
-
function
|
|
2285
|
+
function _o(n, t) {
|
|
2252
2286
|
let e = t[0];
|
|
2253
2287
|
for (let o = 1; o < n; o++) e += t[o];
|
|
2254
2288
|
return e;
|
|
2255
2289
|
}
|
|
2256
|
-
function
|
|
2290
|
+
function Ve(n) {
|
|
2257
2291
|
return new Float64Array(n);
|
|
2258
2292
|
}
|
|
2259
|
-
const
|
|
2260
|
-
function
|
|
2261
|
-
let a, l, c, h, f, u,
|
|
2262
|
-
const z = n - i, D = e - i, _ = t - r,
|
|
2263
|
-
|
|
2264
|
-
let
|
|
2265
|
-
if (
|
|
2266
|
-
|
|
2267
|
-
const O =
|
|
2268
|
-
|
|
2269
|
-
const I =
|
|
2270
|
-
|
|
2271
|
-
const B =
|
|
2272
|
-
return
|
|
2273
|
-
}
|
|
2274
|
-
function
|
|
2293
|
+
const To = (3 + 16 * ae) * ae, Eo = (2 + 12 * ae) * ae, Ao = (9 + 64 * ae) * ae * ae, me = Ve(4), on = Ve(8), rn = Ve(12), sn = Ve(16), jt = Ve(4);
|
|
2294
|
+
function Bo(n, t, e, o, i, r, s) {
|
|
2295
|
+
let a, l, c, h, f, u, p, w, x, P, M, m, d, g, b, V, v, S;
|
|
2296
|
+
const z = n - i, D = e - i, _ = t - r, T = o - r;
|
|
2297
|
+
g = z * T, u = $t * z, p = u - (u - z), w = z - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = _ * D, u = $t * _, p = u - (u - _), w = _ - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, me[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, me[1] = d - (M + f) + (f - V), S = m + M, f = S - m, me[2] = m - (S - f) + (M - f), me[3] = S;
|
|
2298
|
+
let E = _o(4, me), A = Eo * s;
|
|
2299
|
+
if (E >= A || -E >= A || (f = n - z, a = n - (z + f) + (f - i), f = e - D, c = e - (D + f) + (f - i), f = t - _, l = t - (_ + f) + (f - r), f = o - T, h = o - (T + f) + (f - r), a === 0 && l === 0 && c === 0 && h === 0) || (A = Ao * s + Do * Math.abs(E), E += z * h + T * a - (_ * c + D * l), E >= A || -E >= A)) return E;
|
|
2300
|
+
g = a * T, u = $t * a, p = u - (u - a), w = a - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = l * D, u = $t * l, p = u - (u - l), w = l - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
|
|
2301
|
+
const O = We(4, me, 4, jt, on);
|
|
2302
|
+
g = z * h, u = $t * z, p = u - (u - z), w = z - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = _ * c, u = $t * _, p = u - (u - _), w = _ - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
|
|
2303
|
+
const I = We(O, on, 4, jt, rn);
|
|
2304
|
+
g = a * h, u = $t * a, p = u - (u - a), w = a - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = l * c, u = $t * l, p = u - (u - l), w = l - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
|
|
2305
|
+
const B = We(I, rn, 4, jt, sn);
|
|
2306
|
+
return sn[B - 1];
|
|
2307
|
+
}
|
|
2308
|
+
function ve(n, t, e, o, i, r) {
|
|
2275
2309
|
const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, c = Math.abs(s + a);
|
|
2276
|
-
return Math.abs(l) >=
|
|
2310
|
+
return Math.abs(l) >= To * c ? l : -Bo(n, t, e, o, i, r, c);
|
|
2277
2311
|
}
|
|
2278
|
-
const
|
|
2279
|
-
class
|
|
2312
|
+
const an = Math.pow(2, -52), De = new Uint32Array(512);
|
|
2313
|
+
class Be {
|
|
2280
2314
|
/**
|
|
2281
2315
|
* Constructs a delaunay triangulation object given an array of points (`[x, y]` by default).
|
|
2282
2316
|
* `getX` and `getY` are optional functions of the form `(point) => value` for custom point formats.
|
|
@@ -2287,13 +2321,13 @@ class Te {
|
|
|
2287
2321
|
* @param {(p: P) => number} [getY]
|
|
2288
2322
|
*/
|
|
2289
2323
|
// @ts-expect-error TS2322
|
|
2290
|
-
static from(t, e =
|
|
2324
|
+
static from(t, e = Lo, o = Fo) {
|
|
2291
2325
|
const i = t.length, r = new Float64Array(i * 2);
|
|
2292
2326
|
for (let s = 0; s < i; s++) {
|
|
2293
2327
|
const a = t[s];
|
|
2294
2328
|
r[2 * s] = e(a), r[2 * s + 1] = o(a);
|
|
2295
2329
|
}
|
|
2296
|
-
return new
|
|
2330
|
+
return new Be(r);
|
|
2297
2331
|
}
|
|
2298
2332
|
/**
|
|
2299
2333
|
* Constructs a delaunay triangulation object given an array of point coordinates of the form:
|
|
@@ -2320,71 +2354,71 @@ class Te {
|
|
|
2320
2354
|
D < a && (a = D), _ < l && (l = _), D > c && (c = D), _ > h && (h = _), this._ids[z] = z;
|
|
2321
2355
|
}
|
|
2322
2356
|
const f = (a + c) / 2, u = (l + h) / 2;
|
|
2323
|
-
let
|
|
2357
|
+
let p = 0, w = 0, x = 0;
|
|
2324
2358
|
for (let z = 0, D = 1 / 0; z < s; z++) {
|
|
2325
|
-
const _ =
|
|
2326
|
-
_ < D && (
|
|
2359
|
+
const _ = Ne(f, u, t[2 * z], t[2 * z + 1]);
|
|
2360
|
+
_ < D && (p = z, D = _);
|
|
2327
2361
|
}
|
|
2328
|
-
const P = t[2 *
|
|
2362
|
+
const P = t[2 * p], M = t[2 * p + 1];
|
|
2329
2363
|
for (let z = 0, D = 1 / 0; z < s; z++) {
|
|
2330
|
-
if (z ===
|
|
2331
|
-
const _ =
|
|
2364
|
+
if (z === p) continue;
|
|
2365
|
+
const _ = Ne(P, M, t[2 * z], t[2 * z + 1]);
|
|
2332
2366
|
_ < D && _ > 0 && (w = z, D = _);
|
|
2333
2367
|
}
|
|
2334
|
-
let m = t[2 * w], d = t[2 * w + 1],
|
|
2368
|
+
let m = t[2 * w], d = t[2 * w + 1], g = 1 / 0;
|
|
2335
2369
|
for (let z = 0; z < s; z++) {
|
|
2336
|
-
if (z ===
|
|
2337
|
-
const D =
|
|
2338
|
-
D <
|
|
2370
|
+
if (z === p || z === w) continue;
|
|
2371
|
+
const D = Co(P, M, m, d, t[2 * z], t[2 * z + 1]);
|
|
2372
|
+
D < g && (x = z, g = D);
|
|
2339
2373
|
}
|
|
2340
2374
|
let b = t[2 * x], V = t[2 * x + 1];
|
|
2341
|
-
if (
|
|
2375
|
+
if (g === 1 / 0) {
|
|
2342
2376
|
for (let _ = 0; _ < s; _++)
|
|
2343
2377
|
this._dists[_] = t[2 * _] - t[0] || t[2 * _ + 1] - t[1];
|
|
2344
|
-
|
|
2378
|
+
ye(this._ids, this._dists, 0, s - 1);
|
|
2345
2379
|
const z = new Uint32Array(s);
|
|
2346
2380
|
let D = 0;
|
|
2347
|
-
for (let _ = 0,
|
|
2348
|
-
const
|
|
2349
|
-
A >
|
|
2381
|
+
for (let _ = 0, T = -1 / 0; _ < s; _++) {
|
|
2382
|
+
const E = this._ids[_], A = this._dists[E];
|
|
2383
|
+
A > T && (z[D++] = E, T = A);
|
|
2350
2384
|
}
|
|
2351
2385
|
this.hull = z.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
|
|
2352
2386
|
return;
|
|
2353
2387
|
}
|
|
2354
|
-
if (
|
|
2388
|
+
if (ve(P, M, m, d, b, V) < 0) {
|
|
2355
2389
|
const z = w, D = m, _ = d;
|
|
2356
2390
|
w = x, m = b, d = V, x = z, b = D, V = _;
|
|
2357
2391
|
}
|
|
2358
|
-
const v =
|
|
2392
|
+
const v = Ro(P, M, m, d, b, V);
|
|
2359
2393
|
this._cx = v.x, this._cy = v.y;
|
|
2360
2394
|
for (let z = 0; z < s; z++)
|
|
2361
|
-
this._dists[z] =
|
|
2362
|
-
|
|
2395
|
+
this._dists[z] = Ne(t[2 * z], t[2 * z + 1], v.x, v.y);
|
|
2396
|
+
ye(this._ids, this._dists, 0, s - 1), this._hullStart = p;
|
|
2363
2397
|
let S = 3;
|
|
2364
|
-
o[
|
|
2398
|
+
o[p] = e[x] = w, o[w] = e[p] = x, o[x] = e[w] = p, i[p] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = p, r[this._hashKey(m, d)] = w, r[this._hashKey(b, V)] = x, this.trianglesLen = 0, this._addTriangle(p, w, x, -1, -1, -1);
|
|
2365
2399
|
for (let z = 0, D = 0, _ = 0; z < this._ids.length; z++) {
|
|
2366
|
-
const
|
|
2367
|
-
if (z > 0 && Math.abs(
|
|
2400
|
+
const T = this._ids[z], E = t[2 * T], A = t[2 * T + 1];
|
|
2401
|
+
if (z > 0 && Math.abs(E - D) <= an && Math.abs(A - _) <= an || (D = E, _ = A, T === p || T === w || T === x)) continue;
|
|
2368
2402
|
let O = 0;
|
|
2369
|
-
for (let C = 0,
|
|
2403
|
+
for (let C = 0, L = this._hashKey(E, A); C < this._hashSize && (O = r[(L + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
|
|
2370
2404
|
;
|
|
2371
2405
|
O = e[O];
|
|
2372
2406
|
let I = O, B;
|
|
2373
|
-
for (; B = o[I],
|
|
2407
|
+
for (; B = o[I], ve(E, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
|
|
2374
2408
|
if (I = B, I === O) {
|
|
2375
2409
|
I = -1;
|
|
2376
2410
|
break;
|
|
2377
2411
|
}
|
|
2378
2412
|
if (I === -1) continue;
|
|
2379
|
-
let
|
|
2380
|
-
i[
|
|
2413
|
+
let R = this._addTriangle(I, T, o[I], -1, -1, i[I]);
|
|
2414
|
+
i[T] = this._legalize(R + 2), i[I] = R, S++;
|
|
2381
2415
|
let W = o[I];
|
|
2382
|
-
for (; B = o[W],
|
|
2383
|
-
|
|
2416
|
+
for (; B = o[W], ve(E, A, t[2 * W], t[2 * W + 1], t[2 * B], t[2 * B + 1]) < 0; )
|
|
2417
|
+
R = this._addTriangle(W, T, B, i[T], -1, i[W]), i[T] = this._legalize(R + 2), o[W] = W, S--, W = B;
|
|
2384
2418
|
if (I === O)
|
|
2385
|
-
for (; B = e[I],
|
|
2386
|
-
|
|
2387
|
-
this._hullStart = e[
|
|
2419
|
+
for (; B = e[I], ve(E, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
|
|
2420
|
+
R = this._addTriangle(B, T, I, -1, i[I], i[B]), this._legalize(R + 2), i[B] = R, o[I] = I, S--, I = B;
|
|
2421
|
+
this._hullStart = e[T] = I, o[I] = e[W] = T, o[T] = W, r[this._hashKey(E, A)] = T, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
|
|
2388
2422
|
}
|
|
2389
2423
|
this.hull = new Uint32Array(S);
|
|
2390
2424
|
for (let z = 0, D = this._hullStart; z < S; z++)
|
|
@@ -2399,7 +2433,7 @@ class Te {
|
|
|
2399
2433
|
* @private
|
|
2400
2434
|
*/
|
|
2401
2435
|
_hashKey(t, e) {
|
|
2402
|
-
return Math.floor(
|
|
2436
|
+
return Math.floor(Io(t - this._cx, e - this._cy) * this._hashSize) % this._hashSize;
|
|
2403
2437
|
}
|
|
2404
2438
|
/**
|
|
2405
2439
|
* Flip an edge in a pair of triangles if it doesn't satisfy the Delaunay condition.
|
|
@@ -2414,15 +2448,15 @@ class Te {
|
|
|
2414
2448
|
const a = o[t], l = t - t % 3;
|
|
2415
2449
|
if (s = l + (t + 2) % 3, a === -1) {
|
|
2416
2450
|
if (r === 0) break;
|
|
2417
|
-
t =
|
|
2451
|
+
t = De[--r];
|
|
2418
2452
|
continue;
|
|
2419
2453
|
}
|
|
2420
|
-
const c = a - a % 3, h = l + (t + 1) % 3, f = c + (a + 2) % 3, u = e[s],
|
|
2421
|
-
if (
|
|
2454
|
+
const c = a - a % 3, h = l + (t + 1) % 3, f = c + (a + 2) % 3, u = e[s], p = e[t], w = e[h], x = e[f];
|
|
2455
|
+
if (ko(
|
|
2422
2456
|
i[2 * u],
|
|
2423
2457
|
i[2 * u + 1],
|
|
2424
|
-
i[2 *
|
|
2425
|
-
i[2 *
|
|
2458
|
+
i[2 * p],
|
|
2459
|
+
i[2 * p + 1],
|
|
2426
2460
|
i[2 * w],
|
|
2427
2461
|
i[2 * w + 1],
|
|
2428
2462
|
i[2 * x],
|
|
@@ -2442,10 +2476,10 @@ class Te {
|
|
|
2442
2476
|
}
|
|
2443
2477
|
this._link(t, M), this._link(a, o[s]), this._link(s, f);
|
|
2444
2478
|
const m = c + (a + 1) % 3;
|
|
2445
|
-
r <
|
|
2479
|
+
r < De.length && (De[r++] = m);
|
|
2446
2480
|
} else {
|
|
2447
2481
|
if (r === 0) break;
|
|
2448
|
-
t =
|
|
2482
|
+
t = De[--r];
|
|
2449
2483
|
}
|
|
2450
2484
|
}
|
|
2451
2485
|
return s;
|
|
@@ -2475,27 +2509,27 @@ class Te {
|
|
|
2475
2509
|
return this._triangles[a] = t, this._triangles[a + 1] = e, this._triangles[a + 2] = o, this._link(a, i), this._link(a + 1, r), this._link(a + 2, s), this.trianglesLen += 3, a;
|
|
2476
2510
|
}
|
|
2477
2511
|
}
|
|
2478
|
-
function
|
|
2512
|
+
function Io(n, t) {
|
|
2479
2513
|
const e = n / (Math.abs(n) + Math.abs(t));
|
|
2480
2514
|
return (t > 0 ? 3 - e : 1 + e) / 4;
|
|
2481
2515
|
}
|
|
2482
|
-
function
|
|
2516
|
+
function Ne(n, t, e, o) {
|
|
2483
2517
|
const i = n - e, r = t - o;
|
|
2484
2518
|
return i * i + r * r;
|
|
2485
2519
|
}
|
|
2486
|
-
function
|
|
2487
|
-
const l = n - s, c = t - a, h = e - s, f = o - a, u = i - s,
|
|
2488
|
-
return l * (f * P - x *
|
|
2520
|
+
function ko(n, t, e, o, i, r, s, a) {
|
|
2521
|
+
const l = n - s, c = t - a, h = e - s, f = o - a, u = i - s, p = r - a, w = l * l + c * c, x = h * h + f * f, P = u * u + p * p;
|
|
2522
|
+
return l * (f * P - x * p) - c * (h * P - x * u) + w * (h * p - f * u) < 0;
|
|
2489
2523
|
}
|
|
2490
|
-
function
|
|
2491
|
-
const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l),
|
|
2492
|
-
return
|
|
2524
|
+
function Co(n, t, e, o, i, r) {
|
|
2525
|
+
const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = (c * h - a * f) * u, w = (s * f - l * h) * u;
|
|
2526
|
+
return p * p + w * w;
|
|
2493
2527
|
}
|
|
2494
|
-
function
|
|
2495
|
-
const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l),
|
|
2496
|
-
return { x:
|
|
2528
|
+
function Ro(n, t, e, o, i, r) {
|
|
2529
|
+
const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = n + (c * h - a * f) * u, w = t + (s * f - l * h) * u;
|
|
2530
|
+
return { x: p, y: w };
|
|
2497
2531
|
}
|
|
2498
|
-
function
|
|
2532
|
+
function ye(n, t, e, o) {
|
|
2499
2533
|
if (o - e <= 20)
|
|
2500
2534
|
for (let i = e + 1; i <= o; i++) {
|
|
2501
2535
|
const r = n[i], s = t[r];
|
|
@@ -2506,7 +2540,7 @@ function ge(n, t, e, o) {
|
|
|
2506
2540
|
else {
|
|
2507
2541
|
const i = e + o >> 1;
|
|
2508
2542
|
let r = e + 1, s = o;
|
|
2509
|
-
|
|
2543
|
+
Me(n, i, r), t[n[e]] > t[n[o]] && Me(n, e, o), t[n[r]] > t[n[o]] && Me(n, r, o), t[n[e]] > t[n[r]] && Me(n, e, r);
|
|
2510
2544
|
const a = n[r], l = t[a];
|
|
2511
2545
|
for (; ; ) {
|
|
2512
2546
|
do
|
|
@@ -2516,23 +2550,23 @@ function ge(n, t, e, o) {
|
|
|
2516
2550
|
s--;
|
|
2517
2551
|
while (t[n[s]] > l);
|
|
2518
2552
|
if (s < r) break;
|
|
2519
|
-
|
|
2553
|
+
Me(n, r, s);
|
|
2520
2554
|
}
|
|
2521
|
-
n[e + 1] = n[s], n[s] = a, o - r + 1 >= s - e ? (
|
|
2555
|
+
n[e + 1] = n[s], n[s] = a, o - r + 1 >= s - e ? (ye(n, t, r, o), ye(n, t, e, s - 1)) : (ye(n, t, e, s - 1), ye(n, t, r, o));
|
|
2522
2556
|
}
|
|
2523
2557
|
}
|
|
2524
|
-
function
|
|
2558
|
+
function Me(n, t, e) {
|
|
2525
2559
|
const o = n[t];
|
|
2526
2560
|
n[t] = n[e], n[e] = o;
|
|
2527
2561
|
}
|
|
2528
|
-
function
|
|
2562
|
+
function Lo(n) {
|
|
2529
2563
|
return n[0];
|
|
2530
2564
|
}
|
|
2531
|
-
function
|
|
2565
|
+
function Fo(n) {
|
|
2532
2566
|
return n[1];
|
|
2533
2567
|
}
|
|
2534
|
-
const
|
|
2535
|
-
class
|
|
2568
|
+
const ln = 1e-6;
|
|
2569
|
+
class de {
|
|
2536
2570
|
constructor() {
|
|
2537
2571
|
this._x0 = this._y0 = // start of current subpath
|
|
2538
2572
|
this._x1 = this._y1 = null, this._ = "";
|
|
@@ -2550,7 +2584,7 @@ class he {
|
|
|
2550
2584
|
t = +t, e = +e, o = +o;
|
|
2551
2585
|
const i = t + o, r = e;
|
|
2552
2586
|
if (o < 0) throw new Error("negative radius");
|
|
2553
|
-
this._x1 === null ? this._ += `M${i},${r}` : (Math.abs(this._x1 - i) >
|
|
2587
|
+
this._x1 === null ? this._ += `M${i},${r}` : (Math.abs(this._x1 - i) > ln || Math.abs(this._y1 - r) > ln) && (this._ += "L" + i + "," + r), o && (this._ += `A${o},${o},0,1,1,${t - o},${e}A${o},${o},0,1,1,${this._x1 = i},${this._y1 = r}`);
|
|
2554
2588
|
}
|
|
2555
2589
|
rect(t, e, o, i) {
|
|
2556
2590
|
this._ += `M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}h${+o}v${+i}h${-o}Z`;
|
|
@@ -2559,7 +2593,7 @@ class he {
|
|
|
2559
2593
|
return this._ || null;
|
|
2560
2594
|
}
|
|
2561
2595
|
}
|
|
2562
|
-
class
|
|
2596
|
+
class Ge {
|
|
2563
2597
|
constructor() {
|
|
2564
2598
|
this._ = [];
|
|
2565
2599
|
}
|
|
@@ -2576,7 +2610,7 @@ class qe {
|
|
|
2576
2610
|
return this._.length ? this._ : null;
|
|
2577
2611
|
}
|
|
2578
2612
|
}
|
|
2579
|
-
class
|
|
2613
|
+
class Oo {
|
|
2580
2614
|
constructor(t, [e, o, i, r] = [0, 0, 960, 500]) {
|
|
2581
2615
|
if (!((i = +i) >= (e = +e)) || !((r = +r) >= (o = +o))) throw new Error("invalid bounds");
|
|
2582
2616
|
this.delaunay = t, this._circumcenters = new Float64Array(t.points.length * 2), this.vectors = new Float64Array(t.points.length * 2), this.xmax = i, this.xmin = e, this.ymax = r, this.ymin = o, this._init();
|
|
@@ -2589,49 +2623,49 @@ class Co {
|
|
|
2589
2623
|
let r, s;
|
|
2590
2624
|
const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
|
|
2591
2625
|
for (let x = 0, P = 0, M = o.length, m, d; x < M; x += 3, P += 2) {
|
|
2592
|
-
const
|
|
2626
|
+
const g = o[x] * 2, b = o[x + 1] * 2, V = o[x + 2] * 2, v = t[g], S = t[g + 1], z = t[b], D = t[b + 1], _ = t[V], T = t[V + 1], E = z - v, A = D - S, O = _ - v, I = T - S, B = (E * I - A * O) * 2;
|
|
2593
2627
|
if (Math.abs(B) < 1e-9) {
|
|
2594
2628
|
if (r === void 0) {
|
|
2595
2629
|
r = s = 0;
|
|
2596
2630
|
for (const W of e) r += t[W * 2], s += t[W * 2 + 1];
|
|
2597
2631
|
r /= e.length, s /= e.length;
|
|
2598
2632
|
}
|
|
2599
|
-
const
|
|
2600
|
-
m = (v + _) / 2 -
|
|
2633
|
+
const R = 1e9 * Math.sign((r - v) * I - (s - S) * O);
|
|
2634
|
+
m = (v + _) / 2 - R * I, d = (S + T) / 2 + R * O;
|
|
2601
2635
|
} else {
|
|
2602
|
-
const
|
|
2603
|
-
m = v + (I * W - A * C) *
|
|
2636
|
+
const R = 1 / B, W = E * E + A * A, C = O * O + I * I;
|
|
2637
|
+
m = v + (I * W - A * C) * R, d = S + (E * C - O * W) * R;
|
|
2604
2638
|
}
|
|
2605
2639
|
a[P] = m, a[P + 1] = d;
|
|
2606
2640
|
}
|
|
2607
|
-
let l = e[e.length - 1], c, h = l * 4, f, u = t[2 * l],
|
|
2641
|
+
let l = e[e.length - 1], c, h = l * 4, f, u = t[2 * l], p, w = t[2 * l + 1];
|
|
2608
2642
|
i.fill(0);
|
|
2609
2643
|
for (let x = 0; x < e.length; ++x)
|
|
2610
|
-
l = e[x], c = h, f = u,
|
|
2644
|
+
l = e[x], c = h, f = u, p = w, h = l * 4, u = t[2 * l], w = t[2 * l + 1], i[c + 2] = i[h] = p - w, i[c + 3] = i[h + 1] = u - f;
|
|
2611
2645
|
}
|
|
2612
2646
|
render(t) {
|
|
2613
|
-
const e = t == null ? t = new
|
|
2647
|
+
const e = t == null ? t = new de() : void 0, { delaunay: { halfedges: o, inedges: i, hull: r }, circumcenters: s, vectors: a } = this;
|
|
2614
2648
|
if (r.length <= 1) return null;
|
|
2615
2649
|
for (let h = 0, f = o.length; h < f; ++h) {
|
|
2616
2650
|
const u = o[h];
|
|
2617
2651
|
if (u < h) continue;
|
|
2618
|
-
const
|
|
2652
|
+
const p = Math.floor(h / 3) * 2, w = Math.floor(u / 3) * 2, x = s[p], P = s[p + 1], M = s[w], m = s[w + 1];
|
|
2619
2653
|
this._renderSegment(x, P, M, m, t);
|
|
2620
2654
|
}
|
|
2621
2655
|
let l, c = r[r.length - 1];
|
|
2622
2656
|
for (let h = 0; h < r.length; ++h) {
|
|
2623
2657
|
l = c, c = r[h];
|
|
2624
|
-
const f = Math.floor(i[c] / 3) * 2, u = s[f],
|
|
2625
|
-
x && this._renderSegment(u,
|
|
2658
|
+
const f = Math.floor(i[c] / 3) * 2, u = s[f], p = s[f + 1], w = l * 4, x = this._project(u, p, a[w + 2], a[w + 3]);
|
|
2659
|
+
x && this._renderSegment(u, p, x[0], x[1], t);
|
|
2626
2660
|
}
|
|
2627
2661
|
return e && e.value();
|
|
2628
2662
|
}
|
|
2629
2663
|
renderBounds(t) {
|
|
2630
|
-
const e = t == null ? t = new
|
|
2664
|
+
const e = t == null ? t = new de() : void 0;
|
|
2631
2665
|
return t.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin), e && e.value();
|
|
2632
2666
|
}
|
|
2633
2667
|
renderCell(t, e) {
|
|
2634
|
-
const o = e == null ? e = new
|
|
2668
|
+
const o = e == null ? e = new de() : void 0, i = this._clip(t);
|
|
2635
2669
|
if (i === null || !i.length) return;
|
|
2636
2670
|
e.moveTo(i[0], i[1]);
|
|
2637
2671
|
let r = i.length;
|
|
@@ -2648,7 +2682,7 @@ class Co {
|
|
|
2648
2682
|
}
|
|
2649
2683
|
}
|
|
2650
2684
|
cellPolygon(t) {
|
|
2651
|
-
const e = new
|
|
2685
|
+
const e = new Ge();
|
|
2652
2686
|
return this.renderCell(t, e), e.value();
|
|
2653
2687
|
}
|
|
2654
2688
|
_renderSegment(t, e, o, i, r) {
|
|
@@ -2696,8 +2730,8 @@ class Co {
|
|
|
2696
2730
|
_clipFinite(t, e) {
|
|
2697
2731
|
const o = e.length;
|
|
2698
2732
|
let i = null, r, s, a = e[o - 2], l = e[o - 1], c, h = this._regioncode(a, l), f, u = 0;
|
|
2699
|
-
for (let
|
|
2700
|
-
if (r = a, s = l, a = e[
|
|
2733
|
+
for (let p = 0; p < o; p += 2)
|
|
2734
|
+
if (r = a, s = l, a = e[p], l = e[p + 1], c = h, h = this._regioncode(a, l), c === 0 && h === 0)
|
|
2701
2735
|
f = u, u = 0, i ? i.push(a, l) : i = [a, l];
|
|
2702
2736
|
else {
|
|
2703
2737
|
let w, x, P, M, m;
|
|
@@ -2801,14 +2835,14 @@ class Co {
|
|
|
2801
2835
|
return t;
|
|
2802
2836
|
}
|
|
2803
2837
|
}
|
|
2804
|
-
const
|
|
2805
|
-
function
|
|
2838
|
+
const Wo = 2 * Math.PI, ge = Math.pow;
|
|
2839
|
+
function No(n) {
|
|
2806
2840
|
return n[0];
|
|
2807
2841
|
}
|
|
2808
|
-
function
|
|
2842
|
+
function qo(n) {
|
|
2809
2843
|
return n[1];
|
|
2810
2844
|
}
|
|
2811
|
-
function
|
|
2845
|
+
function Xo(n) {
|
|
2812
2846
|
const { triangles: t, coords: e } = n;
|
|
2813
2847
|
for (let o = 0; o < t.length; o += 3) {
|
|
2814
2848
|
const i = 2 * t[o], r = 2 * t[o + 1], s = 2 * t[o + 2];
|
|
@@ -2816,29 +2850,29 @@ function Oo(n) {
|
|
|
2816
2850
|
}
|
|
2817
2851
|
return !0;
|
|
2818
2852
|
}
|
|
2819
|
-
function
|
|
2853
|
+
function Ho(n, t, e) {
|
|
2820
2854
|
return [n + Math.sin(n + t) * e, t + Math.cos(n - t) * e];
|
|
2821
2855
|
}
|
|
2822
|
-
class
|
|
2823
|
-
static from(t, e =
|
|
2824
|
-
return new
|
|
2856
|
+
class Ue {
|
|
2857
|
+
static from(t, e = No, o = qo, i) {
|
|
2858
|
+
return new Ue("length" in t ? Yo(t, e, o, i) : Float64Array.from($o(t, e, o, i)));
|
|
2825
2859
|
}
|
|
2826
2860
|
constructor(t) {
|
|
2827
|
-
this._delaunator = new
|
|
2861
|
+
this._delaunator = new Be(t), this.inedges = new Int32Array(t.length / 2), this._hullIndex = new Int32Array(t.length / 2), this.points = this._delaunator.coords, this._init();
|
|
2828
2862
|
}
|
|
2829
2863
|
update() {
|
|
2830
2864
|
return this._delaunator.update(), this._init(), this;
|
|
2831
2865
|
}
|
|
2832
2866
|
_init() {
|
|
2833
2867
|
const t = this._delaunator, e = this.points;
|
|
2834
|
-
if (t.hull && t.hull.length > 2 &&
|
|
2835
|
-
this.collinear = Int32Array.from({ length: e.length / 2 }, (u,
|
|
2868
|
+
if (t.hull && t.hull.length > 2 && Xo(t)) {
|
|
2869
|
+
this.collinear = Int32Array.from({ length: e.length / 2 }, (u, p) => p).sort((u, p) => e[2 * u] - e[2 * p] || e[2 * u + 1] - e[2 * p + 1]);
|
|
2836
2870
|
const l = this.collinear[0], c = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * c], e[2 * c + 1]], f = 1e-8 * Math.hypot(h[3] - h[1], h[2] - h[0]);
|
|
2837
|
-
for (let u = 0,
|
|
2838
|
-
const w =
|
|
2871
|
+
for (let u = 0, p = e.length / 2; u < p; ++u) {
|
|
2872
|
+
const w = Ho(e[2 * u], e[2 * u + 1], f);
|
|
2839
2873
|
e[2 * u] = w[0], e[2 * u + 1] = w[1];
|
|
2840
2874
|
}
|
|
2841
|
-
this._delaunator = new
|
|
2875
|
+
this._delaunator = new Be(e);
|
|
2842
2876
|
} else
|
|
2843
2877
|
delete this.collinear;
|
|
2844
2878
|
const o = this.halfedges = this._delaunator.halfedges, i = this.hull = this._delaunator.hull, r = this.triangles = this._delaunator.triangles, s = this.inedges.fill(-1), a = this._hullIndex.fill(-1);
|
|
@@ -2851,7 +2885,7 @@ class He {
|
|
|
2851
2885
|
i.length <= 2 && i.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = i[0], s[i[0]] = 1, i.length === 2 && (s[i[1]] = 0, this.triangles[1] = i[1], this.triangles[2] = i[1]));
|
|
2852
2886
|
}
|
|
2853
2887
|
voronoi(t) {
|
|
2854
|
-
return new
|
|
2888
|
+
return new Oo(this, t);
|
|
2855
2889
|
}
|
|
2856
2890
|
*neighbors(t) {
|
|
2857
2891
|
const { inedges: e, hull: o, _hullIndex: i, halfedges: r, triangles: s, collinear: a } = this;
|
|
@@ -2882,23 +2916,23 @@ class He {
|
|
|
2882
2916
|
_step(t, e, o) {
|
|
2883
2917
|
const { inedges: i, hull: r, _hullIndex: s, halfedges: a, triangles: l, points: c } = this;
|
|
2884
2918
|
if (i[t] === -1 || !c.length) return (t + 1) % (c.length >> 1);
|
|
2885
|
-
let h = t, f =
|
|
2919
|
+
let h = t, f = ge(e - c[t * 2], 2) + ge(o - c[t * 2 + 1], 2);
|
|
2886
2920
|
const u = i[t];
|
|
2887
|
-
let
|
|
2921
|
+
let p = u;
|
|
2888
2922
|
do {
|
|
2889
|
-
let w = l[
|
|
2890
|
-
const x =
|
|
2891
|
-
if (x < f && (f = x, h = w),
|
|
2892
|
-
if (
|
|
2893
|
-
if (
|
|
2894
|
-
return
|
|
2923
|
+
let w = l[p];
|
|
2924
|
+
const x = ge(e - c[w * 2], 2) + ge(o - c[w * 2 + 1], 2);
|
|
2925
|
+
if (x < f && (f = x, h = w), p = p % 3 === 2 ? p - 2 : p + 1, l[p] !== t) break;
|
|
2926
|
+
if (p = a[p], p === -1) {
|
|
2927
|
+
if (p = r[(s[t] + 1) % r.length], p !== w && ge(e - c[p * 2], 2) + ge(o - c[p * 2 + 1], 2) < f)
|
|
2928
|
+
return p;
|
|
2895
2929
|
break;
|
|
2896
2930
|
}
|
|
2897
|
-
} while (
|
|
2931
|
+
} while (p !== u);
|
|
2898
2932
|
return h;
|
|
2899
2933
|
}
|
|
2900
2934
|
render(t) {
|
|
2901
|
-
const e = t == null ? t = new
|
|
2935
|
+
const e = t == null ? t = new de() : void 0, { points: o, halfedges: i, triangles: r } = this;
|
|
2902
2936
|
for (let s = 0, a = i.length; s < a; ++s) {
|
|
2903
2937
|
const l = i[s];
|
|
2904
2938
|
if (l < s) continue;
|
|
@@ -2909,15 +2943,15 @@ class He {
|
|
|
2909
2943
|
}
|
|
2910
2944
|
renderPoints(t, e) {
|
|
2911
2945
|
e === void 0 && (!t || typeof t.moveTo != "function") && (e = t, t = null), e = e == null ? 2 : +e;
|
|
2912
|
-
const o = t == null ? t = new
|
|
2946
|
+
const o = t == null ? t = new de() : void 0, { points: i } = this;
|
|
2913
2947
|
for (let r = 0, s = i.length; r < s; r += 2) {
|
|
2914
2948
|
const a = i[r], l = i[r + 1];
|
|
2915
|
-
t.moveTo(a + e, l), t.arc(a, l, e, 0,
|
|
2949
|
+
t.moveTo(a + e, l), t.arc(a, l, e, 0, Wo);
|
|
2916
2950
|
}
|
|
2917
2951
|
return o && o.value();
|
|
2918
2952
|
}
|
|
2919
2953
|
renderHull(t) {
|
|
2920
|
-
const e = t == null ? t = new
|
|
2954
|
+
const e = t == null ? t = new de() : void 0, { hull: o, points: i } = this, r = o[0] * 2, s = o.length;
|
|
2921
2955
|
t.moveTo(i[r], i[r + 1]);
|
|
2922
2956
|
for (let a = 1; a < s; ++a) {
|
|
2923
2957
|
const l = 2 * o[a];
|
|
@@ -2926,11 +2960,11 @@ class He {
|
|
|
2926
2960
|
return t.closePath(), e && e.value();
|
|
2927
2961
|
}
|
|
2928
2962
|
hullPolygon() {
|
|
2929
|
-
const t = new
|
|
2963
|
+
const t = new Ge();
|
|
2930
2964
|
return this.renderHull(t), t.value();
|
|
2931
2965
|
}
|
|
2932
2966
|
renderTriangle(t, e) {
|
|
2933
|
-
const o = e == null ? e = new
|
|
2967
|
+
const o = e == null ? e = new de() : void 0, { points: i, triangles: r } = this, s = r[t *= 3] * 2, a = r[t + 1] * 2, l = r[t + 2] * 2;
|
|
2934
2968
|
return e.moveTo(i[s], i[s + 1]), e.lineTo(i[a], i[a + 1]), e.lineTo(i[l], i[l + 1]), e.closePath(), o && o.value();
|
|
2935
2969
|
}
|
|
2936
2970
|
*trianglePolygons() {
|
|
@@ -2939,11 +2973,11 @@ class He {
|
|
|
2939
2973
|
yield this.trianglePolygon(e);
|
|
2940
2974
|
}
|
|
2941
2975
|
trianglePolygon(t) {
|
|
2942
|
-
const e = new
|
|
2976
|
+
const e = new Ge();
|
|
2943
2977
|
return this.renderTriangle(t, e), e.value();
|
|
2944
2978
|
}
|
|
2945
2979
|
}
|
|
2946
|
-
function
|
|
2980
|
+
function Yo(n, t, e, o) {
|
|
2947
2981
|
const i = n.length, r = new Float64Array(i * 2);
|
|
2948
2982
|
for (let s = 0; s < i; ++s) {
|
|
2949
2983
|
const a = n[s];
|
|
@@ -2951,19 +2985,19 @@ function No(n, t, e, o) {
|
|
|
2951
2985
|
}
|
|
2952
2986
|
return r;
|
|
2953
2987
|
}
|
|
2954
|
-
function*
|
|
2988
|
+
function* $o(n, t, e, o) {
|
|
2955
2989
|
let i = 0;
|
|
2956
2990
|
for (const r of n)
|
|
2957
2991
|
yield t.call(o, r, i, n), yield e.call(o, r, i, n), ++i;
|
|
2958
2992
|
}
|
|
2959
|
-
function
|
|
2993
|
+
function Go(n, t, e, o) {
|
|
2960
2994
|
return 1 + (n[t][0] === 0 || n[e][0] === 0 || n[o][0] === 0 ? 1 : 0);
|
|
2961
2995
|
}
|
|
2962
|
-
function
|
|
2996
|
+
function jo(n, t, e, o, i, r) {
|
|
2963
2997
|
const s = Math.hypot(e - i, o - r), a = Math.hypot(n - i, t - r), l = Math.hypot(n - e, t - o), c = Math.abs((e - n) * (r - t) - (i - n) * (o - t)) / 2;
|
|
2964
2998
|
return c === 0 ? 1 / 0 : s * a * l / (4 * c);
|
|
2965
2999
|
}
|
|
2966
|
-
function
|
|
3000
|
+
function cn(n) {
|
|
2967
3001
|
if (!n || n.length < 3) return [];
|
|
2968
3002
|
const t = /* @__PURE__ */ new Set(), e = [];
|
|
2969
3003
|
for (const w of n) {
|
|
@@ -2971,15 +3005,15 @@ function rn(n) {
|
|
|
2971
3005
|
t.has(x) || (t.add(x), e.push(w));
|
|
2972
3006
|
}
|
|
2973
3007
|
if (e.length < 3) return [];
|
|
2974
|
-
const o = new
|
|
3008
|
+
const o = new Ue(Float64Array.from(e.flat())), { triangles: i } = o;
|
|
2975
3009
|
if (!i.length) return [];
|
|
2976
3010
|
const r = /* @__PURE__ */ new Map(), s = (w, x) => w < x ? `${w}_${x}` : `${x}_${w}`;
|
|
2977
3011
|
for (let w = 0; w < i.length; w += 3) {
|
|
2978
|
-
const x = i[w], P = i[w + 1], M = i[w + 2], [m, d] = e[x], [
|
|
3012
|
+
const x = i[w], P = i[w + 1], M = i[w + 2], [m, d] = e[x], [g, b] = e[P], [V, v] = e[M], S = jo(m, d, g, b, V, v), z = Go(e, x, P, M);
|
|
2979
3013
|
if (S <= 1 / z)
|
|
2980
3014
|
for (const [D, _] of [[x, P], [P, M], [M, x]]) {
|
|
2981
|
-
const
|
|
2982
|
-
r.set(
|
|
3015
|
+
const T = s(D, _);
|
|
3016
|
+
r.set(T, (r.get(T) || 0) + 1);
|
|
2983
3017
|
}
|
|
2984
3018
|
}
|
|
2985
3019
|
const a = [];
|
|
@@ -2989,32 +3023,32 @@ function rn(n) {
|
|
|
2989
3023
|
for (const [w, x] of a)
|
|
2990
3024
|
(l.get(w) || l.set(w, []).get(w)).push(x), (l.get(x) || l.set(x, []).get(x)).push(w);
|
|
2991
3025
|
const c = a[0][0], h = [], f = /* @__PURE__ */ new Set();
|
|
2992
|
-
let u = c,
|
|
3026
|
+
let u = c, p = -1;
|
|
2993
3027
|
do {
|
|
2994
3028
|
h.push(e[u]), f.add(u);
|
|
2995
3029
|
const w = l.get(u) || [];
|
|
2996
|
-
let x = w.find((P) => P !==
|
|
2997
|
-
if (x === void 0 && (x = w.find((P) => P !==
|
|
2998
|
-
|
|
3030
|
+
let x = w.find((P) => P !== p && !f.has(P));
|
|
3031
|
+
if (x === void 0 && (x = w.find((P) => P !== p)), x === void 0) break;
|
|
3032
|
+
p = u, u = x;
|
|
2999
3033
|
} while (u !== c && h.length <= a.length + 1);
|
|
3000
3034
|
return h;
|
|
3001
3035
|
}
|
|
3002
3036
|
const mt = {
|
|
3003
3037
|
c: null,
|
|
3004
3038
|
// center
|
|
3005
|
-
u: [new
|
|
3039
|
+
u: [new zt(), new zt(), new zt()],
|
|
3006
3040
|
// basis vectors
|
|
3007
3041
|
e: []
|
|
3008
3042
|
// half width
|
|
3009
3043
|
}, yt = {
|
|
3010
3044
|
c: null,
|
|
3011
3045
|
// center
|
|
3012
|
-
u: [new
|
|
3046
|
+
u: [new zt(), new zt(), new zt()],
|
|
3013
3047
|
// basis vectors
|
|
3014
3048
|
e: []
|
|
3015
3049
|
// half width
|
|
3016
|
-
},
|
|
3017
|
-
let
|
|
3050
|
+
}, It = [[], [], []], nt = [[], [], []], Dt = [], ce = new zt(), ue = new zt(), he = new zt(), Ot = new zt(), un = new zt(), hn = new zt(), Qt = new Tn(), fn = new oo(), _e = new En(), dn = new En(), mn = new ro();
|
|
3051
|
+
let An = class {
|
|
3018
3052
|
/**
|
|
3019
3053
|
* Constructs a new OBB.
|
|
3020
3054
|
*
|
|
@@ -3022,7 +3056,7 @@ let Dn = class {
|
|
|
3022
3056
|
* @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis.
|
|
3023
3057
|
* @param {Matrix3} [rotation] - The rotation of the OBB.
|
|
3024
3058
|
*/
|
|
3025
|
-
constructor(t = new
|
|
3059
|
+
constructor(t = new zt(), e = new zt(), o = new Tn()) {
|
|
3026
3060
|
this.center = t, this.halfSize = e, this.rotation = o;
|
|
3027
3061
|
}
|
|
3028
3062
|
/**
|
|
@@ -3071,13 +3105,13 @@ let Dn = class {
|
|
|
3071
3105
|
*/
|
|
3072
3106
|
clampPoint(t, e) {
|
|
3073
3107
|
const o = this.halfSize;
|
|
3074
|
-
|
|
3075
|
-
const i =
|
|
3076
|
-
e.add(
|
|
3077
|
-
const r =
|
|
3078
|
-
e.add(
|
|
3079
|
-
const s =
|
|
3080
|
-
return e.add(
|
|
3108
|
+
Ot.subVectors(t, this.center), this.rotation.extractBasis(ce, ue, he), e.copy(this.center);
|
|
3109
|
+
const i = Oe.clamp(Ot.dot(ce), -o.x, o.x);
|
|
3110
|
+
e.add(ce.multiplyScalar(i));
|
|
3111
|
+
const r = Oe.clamp(Ot.dot(ue), -o.y, o.y);
|
|
3112
|
+
e.add(ue.multiplyScalar(r));
|
|
3113
|
+
const s = Oe.clamp(Ot.dot(he), -o.z, o.z);
|
|
3114
|
+
return e.add(he.multiplyScalar(s)), e;
|
|
3081
3115
|
}
|
|
3082
3116
|
/**
|
|
3083
3117
|
* Returns `true` if the given point lies within this OBB.
|
|
@@ -3086,7 +3120,7 @@ let Dn = class {
|
|
|
3086
3120
|
* @returns {boolean} - Whether the given point lies within this OBB or not.
|
|
3087
3121
|
*/
|
|
3088
3122
|
containsPoint(t) {
|
|
3089
|
-
return
|
|
3123
|
+
return Ot.subVectors(t, this.center), this.rotation.extractBasis(ce, ue, he), Math.abs(Ot.dot(ce)) <= this.halfSize.x && Math.abs(Ot.dot(ue)) <= this.halfSize.y && Math.abs(Ot.dot(he)) <= this.halfSize.z;
|
|
3090
3124
|
}
|
|
3091
3125
|
/**
|
|
3092
3126
|
* Returns `true` if the given AABB intersects this OBB.
|
|
@@ -3095,7 +3129,7 @@ let Dn = class {
|
|
|
3095
3129
|
* @returns {boolean} - Whether the given AABB intersects this OBB or not.
|
|
3096
3130
|
*/
|
|
3097
3131
|
intersectsBox3(t) {
|
|
3098
|
-
return this.intersectsOBB(
|
|
3132
|
+
return this.intersectsOBB(Uo.fromBox3(t));
|
|
3099
3133
|
}
|
|
3100
3134
|
/**
|
|
3101
3135
|
* Returns `true` if the given bounding sphere intersects this OBB.
|
|
@@ -3104,7 +3138,7 @@ let Dn = class {
|
|
|
3104
3138
|
* @returns {boolean} - Whether the given bounding sphere intersects this OBB or not.
|
|
3105
3139
|
*/
|
|
3106
3140
|
intersectsSphere(t) {
|
|
3107
|
-
return this.clampPoint(t.center,
|
|
3141
|
+
return this.clampPoint(t.center, hn), hn.distanceToSquared(t.center) <= t.radius * t.radius;
|
|
3108
3142
|
}
|
|
3109
3143
|
/**
|
|
3110
3144
|
* Returns `true` if the given OBB intersects this OBB.
|
|
@@ -3117,17 +3151,17 @@ let Dn = class {
|
|
|
3117
3151
|
mt.c = this.center, mt.e[0] = this.halfSize.x, mt.e[1] = this.halfSize.y, mt.e[2] = this.halfSize.z, this.rotation.extractBasis(mt.u[0], mt.u[1], mt.u[2]), yt.c = t.center, yt.e[0] = t.halfSize.x, yt.e[1] = t.halfSize.y, yt.e[2] = t.halfSize.z, t.rotation.extractBasis(yt.u[0], yt.u[1], yt.u[2]);
|
|
3118
3152
|
for (let r = 0; r < 3; r++)
|
|
3119
3153
|
for (let s = 0; s < 3; s++)
|
|
3120
|
-
|
|
3121
|
-
|
|
3154
|
+
It[r][s] = mt.u[r].dot(yt.u[s]);
|
|
3155
|
+
Ot.subVectors(yt.c, mt.c), Dt[0] = Ot.dot(mt.u[0]), Dt[1] = Ot.dot(mt.u[1]), Dt[2] = Ot.dot(mt.u[2]);
|
|
3122
3156
|
for (let r = 0; r < 3; r++)
|
|
3123
3157
|
for (let s = 0; s < 3; s++)
|
|
3124
|
-
|
|
3158
|
+
nt[r][s] = Math.abs(It[r][s]) + e;
|
|
3125
3159
|
let o, i;
|
|
3126
3160
|
for (let r = 0; r < 3; r++)
|
|
3127
|
-
if (o = mt.e[r], i = yt.e[0] *
|
|
3161
|
+
if (o = mt.e[r], i = yt.e[0] * nt[r][0] + yt.e[1] * nt[r][1] + yt.e[2] * nt[r][2], Math.abs(Dt[r]) > o + i) return !1;
|
|
3128
3162
|
for (let r = 0; r < 3; r++)
|
|
3129
|
-
if (o = mt.e[0] *
|
|
3130
|
-
return o = mt.e[1] *
|
|
3163
|
+
if (o = mt.e[0] * nt[0][r] + mt.e[1] * nt[1][r] + mt.e[2] * nt[2][r], i = yt.e[r], Math.abs(Dt[0] * It[0][r] + Dt[1] * It[1][r] + Dt[2] * It[2][r]) > o + i) return !1;
|
|
3164
|
+
return o = mt.e[1] * nt[2][0] + mt.e[2] * nt[1][0], i = yt.e[1] * nt[0][2] + yt.e[2] * nt[0][1], !(Math.abs(Dt[2] * It[1][0] - Dt[1] * It[2][0]) > o + i || (o = mt.e[1] * nt[2][1] + mt.e[2] * nt[1][1], i = yt.e[0] * nt[0][2] + yt.e[2] * nt[0][0], Math.abs(Dt[2] * It[1][1] - Dt[1] * It[2][1]) > o + i) || (o = mt.e[1] * nt[2][2] + mt.e[2] * nt[1][2], i = yt.e[0] * nt[0][1] + yt.e[1] * nt[0][0], Math.abs(Dt[2] * It[1][2] - Dt[1] * It[2][2]) > o + i) || (o = mt.e[0] * nt[2][0] + mt.e[2] * nt[0][0], i = yt.e[1] * nt[1][2] + yt.e[2] * nt[1][1], Math.abs(Dt[0] * It[2][0] - Dt[2] * It[0][0]) > o + i) || (o = mt.e[0] * nt[2][1] + mt.e[2] * nt[0][1], i = yt.e[0] * nt[1][2] + yt.e[2] * nt[1][0], Math.abs(Dt[0] * It[2][1] - Dt[2] * It[0][1]) > o + i) || (o = mt.e[0] * nt[2][2] + mt.e[2] * nt[0][2], i = yt.e[0] * nt[1][1] + yt.e[1] * nt[1][0], Math.abs(Dt[0] * It[2][2] - Dt[2] * It[0][2]) > o + i) || (o = mt.e[0] * nt[1][0] + mt.e[1] * nt[0][0], i = yt.e[1] * nt[2][2] + yt.e[2] * nt[2][1], Math.abs(Dt[1] * It[0][0] - Dt[0] * It[1][0]) > o + i) || (o = mt.e[0] * nt[1][1] + mt.e[1] * nt[0][1], i = yt.e[0] * nt[2][2] + yt.e[2] * nt[2][0], Math.abs(Dt[1] * It[0][1] - Dt[0] * It[1][1]) > o + i) || (o = mt.e[0] * nt[1][2] + mt.e[1] * nt[0][2], i = yt.e[0] * nt[2][1] + yt.e[1] * nt[2][0], Math.abs(Dt[1] * It[0][2] - Dt[0] * It[1][2]) > o + i));
|
|
3131
3165
|
}
|
|
3132
3166
|
/**
|
|
3133
3167
|
* Returns `true` if the given plane intersects this OBB.
|
|
@@ -3136,8 +3170,8 @@ let Dn = class {
|
|
|
3136
3170
|
* @returns {boolean} Whether the given plane intersects this OBB or not.
|
|
3137
3171
|
*/
|
|
3138
3172
|
intersectsPlane(t) {
|
|
3139
|
-
this.rotation.extractBasis(
|
|
3140
|
-
const e = this.halfSize.x * Math.abs(t.normal.dot(
|
|
3173
|
+
this.rotation.extractBasis(ce, ue, he);
|
|
3174
|
+
const e = this.halfSize.x * Math.abs(t.normal.dot(ce)) + this.halfSize.y * Math.abs(t.normal.dot(ue)) + this.halfSize.z * Math.abs(t.normal.dot(he)), o = t.normal.dot(this.center) - t.constant;
|
|
3141
3175
|
return Math.abs(o) <= e;
|
|
3142
3176
|
}
|
|
3143
3177
|
/**
|
|
@@ -3149,7 +3183,7 @@ let Dn = class {
|
|
|
3149
3183
|
* @return {?Vector3} The intersection point. If no intersection is detected, `null` is returned.
|
|
3150
3184
|
*/
|
|
3151
3185
|
intersectRay(t, e) {
|
|
3152
|
-
return this.getSize(
|
|
3186
|
+
return this.getSize(un), fn.setFromCenterAndSize(Ot.set(0, 0, 0), un), _e.setFromMatrix3(this.rotation), _e.setPosition(this.center), dn.copy(_e).invert(), mn.copy(t).applyMatrix4(dn), mn.intersectBox(fn, e) ? e.applyMatrix4(_e) : null;
|
|
3153
3187
|
}
|
|
3154
3188
|
/**
|
|
3155
3189
|
* Returns `true` if the given ray intersects this OBB.
|
|
@@ -3158,7 +3192,7 @@ let Dn = class {
|
|
|
3158
3192
|
* @returns {boolean} Whether the given ray intersects this OBB or not.
|
|
3159
3193
|
*/
|
|
3160
3194
|
intersectsRay(t) {
|
|
3161
|
-
return this.intersectRay(t,
|
|
3195
|
+
return this.intersectRay(t, Ot) !== null;
|
|
3162
3196
|
}
|
|
3163
3197
|
/**
|
|
3164
3198
|
* Defines an OBB based on the given AABB.
|
|
@@ -3188,50 +3222,50 @@ let Dn = class {
|
|
|
3188
3222
|
*/
|
|
3189
3223
|
applyMatrix4(t) {
|
|
3190
3224
|
const e = t.elements;
|
|
3191
|
-
let o =
|
|
3192
|
-
const i =
|
|
3193
|
-
t.determinant() < 0 && (o = -o),
|
|
3225
|
+
let o = Ot.set(e[0], e[1], e[2]).length();
|
|
3226
|
+
const i = Ot.set(e[4], e[5], e[6]).length(), r = Ot.set(e[8], e[9], e[10]).length();
|
|
3227
|
+
t.determinant() < 0 && (o = -o), Qt.setFromMatrix4(t);
|
|
3194
3228
|
const a = 1 / o, l = 1 / i, c = 1 / r;
|
|
3195
|
-
return
|
|
3229
|
+
return Qt.elements[0] *= a, Qt.elements[1] *= a, Qt.elements[2] *= a, Qt.elements[3] *= l, Qt.elements[4] *= l, Qt.elements[5] *= l, Qt.elements[6] *= c, Qt.elements[7] *= c, Qt.elements[8] *= c, this.rotation.multiply(Qt), this.halfSize.x *= o, this.halfSize.y *= i, this.halfSize.z *= r, Ot.setFromMatrixPosition(t), this.center.add(Ot), this;
|
|
3196
3230
|
}
|
|
3197
3231
|
};
|
|
3198
|
-
const
|
|
3199
|
-
var
|
|
3200
|
-
centimeters:
|
|
3201
|
-
centimetres:
|
|
3232
|
+
const Uo = new An();
|
|
3233
|
+
var Yt = 63710088e-1, Bn = {
|
|
3234
|
+
centimeters: Yt * 100,
|
|
3235
|
+
centimetres: Yt * 100,
|
|
3202
3236
|
degrees: 360 / (2 * Math.PI),
|
|
3203
|
-
feet:
|
|
3204
|
-
inches:
|
|
3205
|
-
kilometers:
|
|
3206
|
-
kilometres:
|
|
3207
|
-
meters:
|
|
3208
|
-
metres:
|
|
3209
|
-
miles:
|
|
3210
|
-
millimeters:
|
|
3211
|
-
millimetres:
|
|
3212
|
-
nauticalmiles:
|
|
3237
|
+
feet: Yt * 3.28084,
|
|
3238
|
+
inches: Yt * 39.37,
|
|
3239
|
+
kilometers: Yt / 1e3,
|
|
3240
|
+
kilometres: Yt / 1e3,
|
|
3241
|
+
meters: Yt,
|
|
3242
|
+
metres: Yt,
|
|
3243
|
+
miles: Yt / 1609.344,
|
|
3244
|
+
millimeters: Yt * 1e3,
|
|
3245
|
+
millimetres: Yt * 1e3,
|
|
3246
|
+
nauticalmiles: Yt / 1852,
|
|
3213
3247
|
radians: 1,
|
|
3214
|
-
yards:
|
|
3248
|
+
yards: Yt * 1.0936
|
|
3215
3249
|
};
|
|
3216
|
-
function
|
|
3250
|
+
function In(n, t, e = {}) {
|
|
3217
3251
|
const o = { type: "Feature" };
|
|
3218
3252
|
return (e.id === 0 || e.id) && (o.id = e.id), e.bbox && (o.bbox = e.bbox), o.properties = t || {}, o.geometry = n, o;
|
|
3219
3253
|
}
|
|
3220
|
-
function
|
|
3254
|
+
function kn(n, t, e = {}) {
|
|
3221
3255
|
if (!n)
|
|
3222
3256
|
throw new Error("coordinates is required");
|
|
3223
3257
|
if (!Array.isArray(n))
|
|
3224
3258
|
throw new Error("coordinates must be an Array");
|
|
3225
3259
|
if (n.length < 2)
|
|
3226
3260
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
3227
|
-
if (!
|
|
3261
|
+
if (!gn(n[0]) || !gn(n[1]))
|
|
3228
3262
|
throw new Error("coordinates must contain numbers");
|
|
3229
|
-
return
|
|
3263
|
+
return In({
|
|
3230
3264
|
type: "Point",
|
|
3231
3265
|
coordinates: n
|
|
3232
3266
|
}, t, e);
|
|
3233
3267
|
}
|
|
3234
|
-
function
|
|
3268
|
+
function Cn(n, t, e = {}) {
|
|
3235
3269
|
for (const i of n) {
|
|
3236
3270
|
if (i.length < 4)
|
|
3237
3271
|
throw new Error(
|
|
@@ -3243,43 +3277,43 @@ function An(n, t, e = {}) {
|
|
|
3243
3277
|
if (i[i.length - 1][r] !== i[0][r])
|
|
3244
3278
|
throw new Error("First and last Position are not equivalent.");
|
|
3245
3279
|
}
|
|
3246
|
-
return
|
|
3280
|
+
return In({
|
|
3247
3281
|
type: "Polygon",
|
|
3248
3282
|
coordinates: n
|
|
3249
3283
|
}, t, e);
|
|
3250
3284
|
}
|
|
3251
|
-
function
|
|
3252
|
-
const e =
|
|
3285
|
+
function Zo(n, t = "kilometers") {
|
|
3286
|
+
const e = Bn[t];
|
|
3253
3287
|
if (!e)
|
|
3254
3288
|
throw new Error(t + " units is invalid");
|
|
3255
3289
|
return n * e;
|
|
3256
3290
|
}
|
|
3257
|
-
function
|
|
3258
|
-
const e =
|
|
3291
|
+
function Ko(n, t = "kilometers") {
|
|
3292
|
+
const e = Bn[t];
|
|
3259
3293
|
if (!e)
|
|
3260
3294
|
throw new Error(t + " units is invalid");
|
|
3261
3295
|
return n / e;
|
|
3262
3296
|
}
|
|
3263
|
-
function
|
|
3297
|
+
function Rn(n) {
|
|
3264
3298
|
return n % (2 * Math.PI) * 180 / Math.PI;
|
|
3265
3299
|
}
|
|
3266
|
-
function
|
|
3300
|
+
function ie(n) {
|
|
3267
3301
|
return n % 360 * Math.PI / 180;
|
|
3268
3302
|
}
|
|
3269
|
-
function
|
|
3303
|
+
function Ln(n, t = "kilometers", e = "kilometers") {
|
|
3270
3304
|
if (!(n >= 0))
|
|
3271
3305
|
throw new Error("length must be a positive number");
|
|
3272
|
-
return
|
|
3306
|
+
return Zo(Ko(n, t), e);
|
|
3273
3307
|
}
|
|
3274
|
-
function
|
|
3308
|
+
function gn(n) {
|
|
3275
3309
|
return !isNaN(n) && n !== null && !Array.isArray(n);
|
|
3276
3310
|
}
|
|
3277
|
-
function
|
|
3311
|
+
function Qo(n) {
|
|
3278
3312
|
return n !== null && typeof n == "object" && !Array.isArray(n);
|
|
3279
3313
|
}
|
|
3280
|
-
function
|
|
3314
|
+
function Pe(n, t, e) {
|
|
3281
3315
|
if (n !== null)
|
|
3282
|
-
for (var o, i, r, s, a, l, c, h = 0, f = 0, u,
|
|
3316
|
+
for (var o, i, r, s, a, l, c, h = 0, f = 0, u, p = n.type, w = p === "FeatureCollection", x = p === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
|
|
3283
3317
|
c = w ? (
|
|
3284
3318
|
// @ts-expect-error: Known type conflict
|
|
3285
3319
|
n.features[M].geometry
|
|
@@ -3288,7 +3322,7 @@ function we(n, t, e) {
|
|
|
3288
3322
|
n.geometry
|
|
3289
3323
|
) : n, u = c ? c.type === "GeometryCollection" : !1, a = u ? c.geometries.length : 1;
|
|
3290
3324
|
for (var m = 0; m < a; m++) {
|
|
3291
|
-
var d = 0,
|
|
3325
|
+
var d = 0, g = 0;
|
|
3292
3326
|
if (s = u ? c.geometries[m] : c, s !== null) {
|
|
3293
3327
|
l = s.coordinates;
|
|
3294
3328
|
var b = s.type;
|
|
@@ -3303,7 +3337,7 @@ function we(n, t, e) {
|
|
|
3303
3337
|
f,
|
|
3304
3338
|
M,
|
|
3305
3339
|
d,
|
|
3306
|
-
|
|
3340
|
+
g
|
|
3307
3341
|
) === !1
|
|
3308
3342
|
)
|
|
3309
3343
|
return !1;
|
|
@@ -3319,7 +3353,7 @@ function we(n, t, e) {
|
|
|
3319
3353
|
f,
|
|
3320
3354
|
M,
|
|
3321
3355
|
d,
|
|
3322
|
-
|
|
3356
|
+
g
|
|
3323
3357
|
) === !1
|
|
3324
3358
|
)
|
|
3325
3359
|
return !1;
|
|
@@ -3338,19 +3372,19 @@ function we(n, t, e) {
|
|
|
3338
3372
|
f,
|
|
3339
3373
|
M,
|
|
3340
3374
|
d,
|
|
3341
|
-
|
|
3375
|
+
g
|
|
3342
3376
|
) === !1
|
|
3343
3377
|
)
|
|
3344
3378
|
return !1;
|
|
3345
3379
|
f++;
|
|
3346
3380
|
}
|
|
3347
|
-
b === "MultiLineString" && d++, b === "Polygon" &&
|
|
3381
|
+
b === "MultiLineString" && d++, b === "Polygon" && g++;
|
|
3348
3382
|
}
|
|
3349
3383
|
b === "Polygon" && d++;
|
|
3350
3384
|
break;
|
|
3351
3385
|
case "MultiPolygon":
|
|
3352
3386
|
for (o = 0; o < l.length; o++) {
|
|
3353
|
-
for (
|
|
3387
|
+
for (g = 0, i = 0; i < l[o].length; i++) {
|
|
3354
3388
|
for (r = 0; r < l[o][i].length - h; r++) {
|
|
3355
3389
|
if (
|
|
3356
3390
|
// @ts-expect-error: Known type conflict
|
|
@@ -3359,13 +3393,13 @@ function we(n, t, e) {
|
|
|
3359
3393
|
f,
|
|
3360
3394
|
M,
|
|
3361
3395
|
d,
|
|
3362
|
-
|
|
3396
|
+
g
|
|
3363
3397
|
) === !1
|
|
3364
3398
|
)
|
|
3365
3399
|
return !1;
|
|
3366
3400
|
f++;
|
|
3367
3401
|
}
|
|
3368
|
-
|
|
3402
|
+
g++;
|
|
3369
3403
|
}
|
|
3370
3404
|
d++;
|
|
3371
3405
|
}
|
|
@@ -3374,7 +3408,7 @@ function we(n, t, e) {
|
|
|
3374
3408
|
for (o = 0; o < s.geometries.length; o++)
|
|
3375
3409
|
if (
|
|
3376
3410
|
// @ts-expect-error: Known type conflict
|
|
3377
|
-
|
|
3411
|
+
Pe(s.geometries[o], t, e) === !1
|
|
3378
3412
|
)
|
|
3379
3413
|
return !1;
|
|
3380
3414
|
break;
|
|
@@ -3385,34 +3419,34 @@ function we(n, t, e) {
|
|
|
3385
3419
|
}
|
|
3386
3420
|
}
|
|
3387
3421
|
}
|
|
3388
|
-
function
|
|
3422
|
+
function Jo(n) {
|
|
3389
3423
|
var t = [];
|
|
3390
|
-
return
|
|
3424
|
+
return Pe(n, function(e) {
|
|
3391
3425
|
t.push(e);
|
|
3392
3426
|
}), t;
|
|
3393
3427
|
}
|
|
3394
|
-
function
|
|
3395
|
-
var e, o, i, r, s, a, l, c, h, f, u = 0,
|
|
3428
|
+
function tr(n, t) {
|
|
3429
|
+
var e, o, i, r, s, a, l, c, h, f, u = 0, p = n.type === "FeatureCollection", w = n.type === "Feature", x = p ? n.features.length : 1;
|
|
3396
3430
|
for (e = 0; e < x; e++) {
|
|
3397
|
-
for (a =
|
|
3431
|
+
for (a = p ? (
|
|
3398
3432
|
// @ts-expect-error: Known type conflict
|
|
3399
3433
|
n.features[e].geometry
|
|
3400
3434
|
) : w ? (
|
|
3401
3435
|
// @ts-expect-error: Known type conflict
|
|
3402
3436
|
n.geometry
|
|
3403
|
-
) : n, c =
|
|
3437
|
+
) : n, c = p ? (
|
|
3404
3438
|
// @ts-expect-error: Known type conflict
|
|
3405
3439
|
n.features[e].properties
|
|
3406
3440
|
) : w ? (
|
|
3407
3441
|
// @ts-expect-error: Known type conflict
|
|
3408
3442
|
n.properties
|
|
3409
|
-
) : {}, h =
|
|
3443
|
+
) : {}, h = p ? (
|
|
3410
3444
|
// @ts-expect-error: Known type conflict
|
|
3411
3445
|
n.features[e].bbox
|
|
3412
3446
|
) : w ? (
|
|
3413
3447
|
// @ts-expect-error: Known type conflict
|
|
3414
3448
|
n.bbox
|
|
3415
|
-
) : void 0, f =
|
|
3449
|
+
) : void 0, f = p ? (
|
|
3416
3450
|
// @ts-expect-error: Known type conflict
|
|
3417
3451
|
n.features[e].id
|
|
3418
3452
|
) : w ? (
|
|
@@ -3476,9 +3510,9 @@ function Zo(n, t) {
|
|
|
3476
3510
|
u++;
|
|
3477
3511
|
}
|
|
3478
3512
|
}
|
|
3479
|
-
function
|
|
3513
|
+
function er(n, t, e) {
|
|
3480
3514
|
var o = e;
|
|
3481
|
-
return
|
|
3515
|
+
return tr(
|
|
3482
3516
|
n,
|
|
3483
3517
|
function(i, r, s, a, l) {
|
|
3484
3518
|
r === 0 && e === void 0 ? o = i : o = t(
|
|
@@ -3493,11 +3527,11 @@ function Ko(n, t, e) {
|
|
|
3493
3527
|
}
|
|
3494
3528
|
), o;
|
|
3495
3529
|
}
|
|
3496
|
-
var
|
|
3497
|
-
function
|
|
3530
|
+
var Fn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3531
|
+
function nr(n) {
|
|
3498
3532
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
3499
3533
|
}
|
|
3500
|
-
function
|
|
3534
|
+
function or(n) {
|
|
3501
3535
|
if (n.__esModule) return n;
|
|
3502
3536
|
var t = n.default;
|
|
3503
3537
|
if (typeof t == "function") {
|
|
@@ -3516,30 +3550,30 @@ function Jo(n) {
|
|
|
3516
3550
|
});
|
|
3517
3551
|
}), e;
|
|
3518
3552
|
}
|
|
3519
|
-
var
|
|
3553
|
+
var Ze = { exports: {} }, On = { exports: {} };
|
|
3520
3554
|
(function(n, t) {
|
|
3521
3555
|
(function(e, o) {
|
|
3522
3556
|
n.exports = o();
|
|
3523
|
-
})(
|
|
3524
|
-
function e(m, d,
|
|
3525
|
-
(function v(S, z, D, _,
|
|
3557
|
+
})(Fn, function() {
|
|
3558
|
+
function e(m, d, g, b, V) {
|
|
3559
|
+
(function v(S, z, D, _, T) {
|
|
3526
3560
|
for (; _ > D; ) {
|
|
3527
3561
|
if (_ - D > 600) {
|
|
3528
|
-
var
|
|
3529
|
-
v(S, z,
|
|
3562
|
+
var E = _ - D + 1, A = z - D + 1, O = Math.log(E), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (E - I) / E) * (A - E / 2 < 0 ? -1 : 1), R = Math.max(D, Math.floor(z - A * I / E + B)), W = Math.min(_, Math.floor(z + (E - A) * I / E + B));
|
|
3563
|
+
v(S, z, R, W, T);
|
|
3530
3564
|
}
|
|
3531
|
-
var C = S[z],
|
|
3532
|
-
for (o(S, D, z),
|
|
3533
|
-
for (o(S,
|
|
3534
|
-
for (;
|
|
3565
|
+
var C = S[z], L = D, H = _;
|
|
3566
|
+
for (o(S, D, z), T(S[_], C) > 0 && o(S, D, _); L < H; ) {
|
|
3567
|
+
for (o(S, L, H), L++, H--; T(S[L], C) < 0; ) L++;
|
|
3568
|
+
for (; T(S[H], C) > 0; ) H--;
|
|
3535
3569
|
}
|
|
3536
|
-
|
|
3570
|
+
T(S[D], C) === 0 ? o(S, D, H) : o(S, ++H, _), H <= z && (D = H + 1), z <= H && (_ = H - 1);
|
|
3537
3571
|
}
|
|
3538
|
-
})(m, d,
|
|
3572
|
+
})(m, d, g || 0, b || m.length - 1, V || i);
|
|
3539
3573
|
}
|
|
3540
|
-
function o(m, d,
|
|
3574
|
+
function o(m, d, g) {
|
|
3541
3575
|
var b = m[d];
|
|
3542
|
-
m[d] = m[
|
|
3576
|
+
m[d] = m[g], m[g] = b;
|
|
3543
3577
|
}
|
|
3544
3578
|
function i(m, d) {
|
|
3545
3579
|
return m < d ? -1 : m > d ? 1 : 0;
|
|
@@ -3547,17 +3581,17 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3547
3581
|
var r = function(m) {
|
|
3548
3582
|
m === void 0 && (m = 9), this._maxEntries = Math.max(4, m), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
3549
3583
|
};
|
|
3550
|
-
function s(m, d,
|
|
3551
|
-
if (!
|
|
3552
|
-
for (var b = 0; b < d.length; b++) if (
|
|
3584
|
+
function s(m, d, g) {
|
|
3585
|
+
if (!g) return d.indexOf(m);
|
|
3586
|
+
for (var b = 0; b < d.length; b++) if (g(m, d[b])) return b;
|
|
3553
3587
|
return -1;
|
|
3554
3588
|
}
|
|
3555
3589
|
function a(m, d) {
|
|
3556
3590
|
l(m, 0, m.children.length, d, m);
|
|
3557
3591
|
}
|
|
3558
|
-
function l(m, d,
|
|
3592
|
+
function l(m, d, g, b, V) {
|
|
3559
3593
|
V || (V = P(null)), V.minX = 1 / 0, V.minY = 1 / 0, V.maxX = -1 / 0, V.maxY = -1 / 0;
|
|
3560
|
-
for (var v = d; v <
|
|
3594
|
+
for (var v = d; v < g; v++) {
|
|
3561
3595
|
var S = m.children[v];
|
|
3562
3596
|
c(V, m.leaf ? b(S) : S);
|
|
3563
3597
|
}
|
|
@@ -3575,7 +3609,7 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3575
3609
|
function u(m) {
|
|
3576
3610
|
return (m.maxX - m.minX) * (m.maxY - m.minY);
|
|
3577
3611
|
}
|
|
3578
|
-
function
|
|
3612
|
+
function p(m) {
|
|
3579
3613
|
return m.maxX - m.minX + (m.maxY - m.minY);
|
|
3580
3614
|
}
|
|
3581
3615
|
function w(m, d) {
|
|
@@ -3587,37 +3621,37 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3587
3621
|
function P(m) {
|
|
3588
3622
|
return { children: m, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
3589
3623
|
}
|
|
3590
|
-
function M(m, d,
|
|
3591
|
-
for (var v = [d,
|
|
3592
|
-
var S = d + Math.ceil((
|
|
3593
|
-
e(m, S, d,
|
|
3624
|
+
function M(m, d, g, b, V) {
|
|
3625
|
+
for (var v = [d, g]; v.length; ) if (!((g = v.pop()) - (d = v.pop()) <= b)) {
|
|
3626
|
+
var S = d + Math.ceil((g - d) / b / 2) * b;
|
|
3627
|
+
e(m, S, d, g, V), v.push(d, S, S, g);
|
|
3594
3628
|
}
|
|
3595
3629
|
}
|
|
3596
3630
|
return r.prototype.all = function() {
|
|
3597
3631
|
return this._all(this.data, []);
|
|
3598
3632
|
}, r.prototype.search = function(m) {
|
|
3599
|
-
var d = this.data,
|
|
3600
|
-
if (!x(m, d)) return
|
|
3633
|
+
var d = this.data, g = [];
|
|
3634
|
+
if (!x(m, d)) return g;
|
|
3601
3635
|
for (var b = this.toBBox, V = []; d; ) {
|
|
3602
3636
|
for (var v = 0; v < d.children.length; v++) {
|
|
3603
3637
|
var S = d.children[v], z = d.leaf ? b(S) : S;
|
|
3604
|
-
x(m, z) && (d.leaf ?
|
|
3638
|
+
x(m, z) && (d.leaf ? g.push(S) : w(m, z) ? this._all(S, g) : V.push(S));
|
|
3605
3639
|
}
|
|
3606
3640
|
d = V.pop();
|
|
3607
3641
|
}
|
|
3608
|
-
return
|
|
3642
|
+
return g;
|
|
3609
3643
|
}, r.prototype.collides = function(m) {
|
|
3610
3644
|
var d = this.data;
|
|
3611
3645
|
if (!x(m, d)) return !1;
|
|
3612
|
-
for (var
|
|
3646
|
+
for (var g = []; d; ) {
|
|
3613
3647
|
for (var b = 0; b < d.children.length; b++) {
|
|
3614
3648
|
var V = d.children[b], v = d.leaf ? this.toBBox(V) : V;
|
|
3615
3649
|
if (x(m, v)) {
|
|
3616
3650
|
if (d.leaf || w(m, v)) return !0;
|
|
3617
|
-
|
|
3651
|
+
g.push(V);
|
|
3618
3652
|
}
|
|
3619
3653
|
}
|
|
3620
|
-
d =
|
|
3654
|
+
d = g.pop();
|
|
3621
3655
|
}
|
|
3622
3656
|
return !1;
|
|
3623
3657
|
}, r.prototype.load = function(m) {
|
|
@@ -3626,16 +3660,16 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3626
3660
|
for (var d = 0; d < m.length; d++) this.insert(m[d]);
|
|
3627
3661
|
return this;
|
|
3628
3662
|
}
|
|
3629
|
-
var
|
|
3630
|
-
if (this.data.children.length) if (this.data.height ===
|
|
3663
|
+
var g = this._build(m.slice(), 0, m.length - 1, 0);
|
|
3664
|
+
if (this.data.children.length) if (this.data.height === g.height) this._splitRoot(this.data, g);
|
|
3631
3665
|
else {
|
|
3632
|
-
if (this.data.height <
|
|
3666
|
+
if (this.data.height < g.height) {
|
|
3633
3667
|
var b = this.data;
|
|
3634
|
-
this.data =
|
|
3668
|
+
this.data = g, g = b;
|
|
3635
3669
|
}
|
|
3636
|
-
this._insert(
|
|
3670
|
+
this._insert(g, this.data.height - g.height - 1, !0);
|
|
3637
3671
|
}
|
|
3638
|
-
else this.data =
|
|
3672
|
+
else this.data = g;
|
|
3639
3673
|
return this;
|
|
3640
3674
|
}, r.prototype.insert = function(m) {
|
|
3641
3675
|
return m && this._insert(m, this.data.height - 1), this;
|
|
@@ -3643,12 +3677,12 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3643
3677
|
return this.data = P([]), this;
|
|
3644
3678
|
}, r.prototype.remove = function(m, d) {
|
|
3645
3679
|
if (!m) return this;
|
|
3646
|
-
for (var
|
|
3647
|
-
if (v || (v = z.pop(), b = z[z.length - 1],
|
|
3680
|
+
for (var g, b, V, v = this.data, S = this.toBBox(m), z = [], D = []; v || z.length; ) {
|
|
3681
|
+
if (v || (v = z.pop(), b = z[z.length - 1], g = D.pop(), V = !0), v.leaf) {
|
|
3648
3682
|
var _ = s(m, v.children, d);
|
|
3649
3683
|
if (_ !== -1) return v.children.splice(_, 1), z.push(v), this._condense(z), this;
|
|
3650
3684
|
}
|
|
3651
|
-
V || v.leaf || !w(v, S) ? b ? (
|
|
3685
|
+
V || v.leaf || !w(v, S) ? b ? (g++, v = b.children[g], V = !1) : v = null : (z.push(v), D.push(g), g = 0, b = v, v = v.children[0]);
|
|
3652
3686
|
}
|
|
3653
3687
|
return this;
|
|
3654
3688
|
}, r.prototype.toBBox = function(m) {
|
|
@@ -3662,74 +3696,74 @@ var Ye = { exports: {} }, Cn = { exports: {} };
|
|
|
3662
3696
|
}, r.prototype.fromJSON = function(m) {
|
|
3663
3697
|
return this.data = m, this;
|
|
3664
3698
|
}, r.prototype._all = function(m, d) {
|
|
3665
|
-
for (var
|
|
3699
|
+
for (var g = []; m; ) m.leaf ? d.push.apply(d, m.children) : g.push.apply(g, m.children), m = g.pop();
|
|
3666
3700
|
return d;
|
|
3667
|
-
}, r.prototype._build = function(m, d,
|
|
3668
|
-
var V, v =
|
|
3669
|
-
if (v <= S) return a(V = P(m.slice(d,
|
|
3701
|
+
}, r.prototype._build = function(m, d, g, b) {
|
|
3702
|
+
var V, v = g - d + 1, S = this._maxEntries;
|
|
3703
|
+
if (v <= S) return a(V = P(m.slice(d, g + 1)), this.toBBox), V;
|
|
3670
3704
|
b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (V = P([])).leaf = !1, V.height = b;
|
|
3671
3705
|
var z = Math.ceil(v / S), D = z * Math.ceil(Math.sqrt(S));
|
|
3672
|
-
M(m, d,
|
|
3673
|
-
for (var _ = d; _ <=
|
|
3674
|
-
var
|
|
3675
|
-
M(m, _,
|
|
3676
|
-
for (var
|
|
3677
|
-
var A = Math.min(
|
|
3678
|
-
V.children.push(this._build(m,
|
|
3706
|
+
M(m, d, g, D, this.compareMinX);
|
|
3707
|
+
for (var _ = d; _ <= g; _ += D) {
|
|
3708
|
+
var T = Math.min(_ + D - 1, g);
|
|
3709
|
+
M(m, _, T, z, this.compareMinY);
|
|
3710
|
+
for (var E = _; E <= T; E += z) {
|
|
3711
|
+
var A = Math.min(E + z - 1, T);
|
|
3712
|
+
V.children.push(this._build(m, E, A, b - 1));
|
|
3679
3713
|
}
|
|
3680
3714
|
}
|
|
3681
3715
|
return a(V, this.toBBox), V;
|
|
3682
|
-
}, r.prototype._chooseSubtree = function(m, d,
|
|
3683
|
-
for (; b.push(d), !d.leaf && b.length - 1 !==
|
|
3716
|
+
}, r.prototype._chooseSubtree = function(m, d, g, b) {
|
|
3717
|
+
for (; b.push(d), !d.leaf && b.length - 1 !== g; ) {
|
|
3684
3718
|
for (var V = 1 / 0, v = 1 / 0, S = void 0, z = 0; z < d.children.length; z++) {
|
|
3685
|
-
var D = d.children[z], _ = u(D),
|
|
3686
|
-
|
|
3719
|
+
var D = d.children[z], _ = u(D), T = (E = m, A = D, (Math.max(A.maxX, E.maxX) - Math.min(A.minX, E.minX)) * (Math.max(A.maxY, E.maxY) - Math.min(A.minY, E.minY)) - _);
|
|
3720
|
+
T < v ? (v = T, V = _ < V ? _ : V, S = D) : T === v && _ < V && (V = _, S = D);
|
|
3687
3721
|
}
|
|
3688
3722
|
d = S || d.children[0];
|
|
3689
3723
|
}
|
|
3690
|
-
var
|
|
3724
|
+
var E, A;
|
|
3691
3725
|
return d;
|
|
3692
|
-
}, r.prototype._insert = function(m, d,
|
|
3693
|
-
var b =
|
|
3726
|
+
}, r.prototype._insert = function(m, d, g) {
|
|
3727
|
+
var b = g ? m : this.toBBox(m), V = [], v = this._chooseSubtree(b, this.data, d, V);
|
|
3694
3728
|
for (v.children.push(m), c(v, b); d >= 0 && V[d].children.length > this._maxEntries; ) this._split(V, d), d--;
|
|
3695
3729
|
this._adjustParentBBoxes(b, V, d);
|
|
3696
3730
|
}, r.prototype._split = function(m, d) {
|
|
3697
|
-
var
|
|
3698
|
-
this._chooseSplitAxis(
|
|
3699
|
-
var v = this._chooseSplitIndex(
|
|
3700
|
-
S.height =
|
|
3731
|
+
var g = m[d], b = g.children.length, V = this._minEntries;
|
|
3732
|
+
this._chooseSplitAxis(g, V, b);
|
|
3733
|
+
var v = this._chooseSplitIndex(g, V, b), S = P(g.children.splice(v, g.children.length - v));
|
|
3734
|
+
S.height = g.height, S.leaf = g.leaf, a(g, this.toBBox), a(S, this.toBBox), d ? m[d - 1].children.push(S) : this._splitRoot(g, S);
|
|
3701
3735
|
}, r.prototype._splitRoot = function(m, d) {
|
|
3702
3736
|
this.data = P([m, d]), this.data.height = m.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
|
|
3703
|
-
}, r.prototype._chooseSplitIndex = function(m, d,
|
|
3704
|
-
for (var b, V, v, S, z, D, _,
|
|
3705
|
-
var O = l(m, 0, A, this.toBBox), I = l(m, A,
|
|
3706
|
-
B <
|
|
3737
|
+
}, r.prototype._chooseSplitIndex = function(m, d, g) {
|
|
3738
|
+
for (var b, V, v, S, z, D, _, T = 1 / 0, E = 1 / 0, A = d; A <= g - d; A++) {
|
|
3739
|
+
var O = l(m, 0, A, this.toBBox), I = l(m, A, g, this.toBBox), B = (V = O, v = I, S = void 0, z = void 0, D = void 0, _ = void 0, S = Math.max(V.minX, v.minX), z = Math.max(V.minY, v.minY), D = Math.min(V.maxX, v.maxX), _ = Math.min(V.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - z)), R = u(O) + u(I);
|
|
3740
|
+
B < T ? (T = B, b = A, E = R < E ? R : E) : B === T && R < E && (E = R, b = A);
|
|
3707
3741
|
}
|
|
3708
|
-
return b ||
|
|
3709
|
-
}, r.prototype._chooseSplitAxis = function(m, d,
|
|
3742
|
+
return b || g - d;
|
|
3743
|
+
}, r.prototype._chooseSplitAxis = function(m, d, g) {
|
|
3710
3744
|
var b = m.leaf ? this.compareMinX : h, V = m.leaf ? this.compareMinY : f;
|
|
3711
|
-
this._allDistMargin(m, d,
|
|
3712
|
-
}, r.prototype._allDistMargin = function(m, d,
|
|
3745
|
+
this._allDistMargin(m, d, g, b) < this._allDistMargin(m, d, g, V) && m.children.sort(b);
|
|
3746
|
+
}, r.prototype._allDistMargin = function(m, d, g, b) {
|
|
3713
3747
|
m.children.sort(b);
|
|
3714
|
-
for (var V = this.toBBox, v = l(m, 0, d, V), S = l(m,
|
|
3748
|
+
for (var V = this.toBBox, v = l(m, 0, d, V), S = l(m, g - d, g, V), z = p(v) + p(S), D = d; D < g - d; D++) {
|
|
3715
3749
|
var _ = m.children[D];
|
|
3716
|
-
c(v, m.leaf ? V(_) : _), z +=
|
|
3750
|
+
c(v, m.leaf ? V(_) : _), z += p(v);
|
|
3717
3751
|
}
|
|
3718
|
-
for (var
|
|
3719
|
-
var
|
|
3720
|
-
c(S, m.leaf ? V(
|
|
3752
|
+
for (var T = g - d - 1; T >= d; T--) {
|
|
3753
|
+
var E = m.children[T];
|
|
3754
|
+
c(S, m.leaf ? V(E) : E), z += p(S);
|
|
3721
3755
|
}
|
|
3722
3756
|
return z;
|
|
3723
|
-
}, r.prototype._adjustParentBBoxes = function(m, d,
|
|
3724
|
-
for (var b =
|
|
3757
|
+
}, r.prototype._adjustParentBBoxes = function(m, d, g) {
|
|
3758
|
+
for (var b = g; b >= 0; b--) c(d[b], m);
|
|
3725
3759
|
}, r.prototype._condense = function(m) {
|
|
3726
|
-
for (var d = m.length - 1,
|
|
3760
|
+
for (var d = m.length - 1, g = void 0; d >= 0; d--) m[d].children.length === 0 ? d > 0 ? (g = m[d - 1].children).splice(g.indexOf(m[d]), 1) : this.clear() : a(m[d], this.toBBox);
|
|
3727
3761
|
}, r;
|
|
3728
3762
|
});
|
|
3729
|
-
})(
|
|
3730
|
-
var
|
|
3731
|
-
class
|
|
3732
|
-
constructor(t = [], e =
|
|
3763
|
+
})(On);
|
|
3764
|
+
var rr = On.exports;
|
|
3765
|
+
class ir {
|
|
3766
|
+
constructor(t = [], e = sr) {
|
|
3733
3767
|
if (this.data = t, this.length = this.data.length, this.compare = e, this.length > 0)
|
|
3734
3768
|
for (let o = (this.length >> 1) - 1; o >= 0; o--) this._down(o);
|
|
3735
3769
|
}
|
|
@@ -3764,88 +3798,88 @@ class er {
|
|
|
3764
3798
|
e[t] = r;
|
|
3765
3799
|
}
|
|
3766
3800
|
}
|
|
3767
|
-
function
|
|
3801
|
+
function sr(n, t) {
|
|
3768
3802
|
return n < t ? -1 : n > t ? 1 : 0;
|
|
3769
3803
|
}
|
|
3770
|
-
const
|
|
3804
|
+
const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3771
3805
|
__proto__: null,
|
|
3772
|
-
default:
|
|
3773
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3774
|
-
var
|
|
3806
|
+
default: ir
|
|
3807
|
+
}, Symbol.toStringTag, { value: "Module" })), lr = /* @__PURE__ */ or(ar);
|
|
3808
|
+
var ke = { exports: {} }, cr = function(t, e, o, i) {
|
|
3775
3809
|
var r = t[0], s = t[1], a = !1;
|
|
3776
3810
|
o === void 0 && (o = 0), i === void 0 && (i = e.length);
|
|
3777
3811
|
for (var l = (i - o) / 2, c = 0, h = l - 1; c < l; h = c++) {
|
|
3778
|
-
var f = e[o + c * 2 + 0], u = e[o + c * 2 + 1],
|
|
3812
|
+
var f = e[o + c * 2 + 0], u = e[o + c * 2 + 1], p = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
|
|
3779
3813
|
x && (a = !a);
|
|
3780
3814
|
}
|
|
3781
3815
|
return a;
|
|
3782
|
-
},
|
|
3816
|
+
}, ur = function(t, e, o, i) {
|
|
3783
3817
|
var r = t[0], s = t[1], a = !1;
|
|
3784
3818
|
o === void 0 && (o = 0), i === void 0 && (i = e.length);
|
|
3785
3819
|
for (var l = i - o, c = 0, h = l - 1; c < l; h = c++) {
|
|
3786
|
-
var f = e[c + o][0], u = e[c + o][1],
|
|
3820
|
+
var f = e[c + o][0], u = e[c + o][1], p = e[h + o][0], w = e[h + o][1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
|
|
3787
3821
|
x && (a = !a);
|
|
3788
3822
|
}
|
|
3789
3823
|
return a;
|
|
3790
|
-
},
|
|
3791
|
-
|
|
3792
|
-
return e.length > 0 && Array.isArray(e[0]) ?
|
|
3824
|
+
}, Wn = cr, Nn = ur;
|
|
3825
|
+
ke.exports = function(t, e, o, i) {
|
|
3826
|
+
return e.length > 0 && Array.isArray(e[0]) ? Nn(t, e, o, i) : Wn(t, e, o, i);
|
|
3793
3827
|
};
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
var
|
|
3828
|
+
ke.exports.nested = Nn;
|
|
3829
|
+
ke.exports.flat = Wn;
|
|
3830
|
+
var hr = ke.exports, je = { exports: {} };
|
|
3797
3831
|
(function(n, t) {
|
|
3798
3832
|
(function(e, o) {
|
|
3799
3833
|
o(t);
|
|
3800
|
-
})(
|
|
3834
|
+
})(Fn, function(e) {
|
|
3801
3835
|
const i = 33306690738754706e-32;
|
|
3802
3836
|
function r(x, P, M, m, d) {
|
|
3803
|
-
let
|
|
3804
|
-
z > S == z > -S ? (
|
|
3805
|
-
let
|
|
3806
|
-
if (D < x && _ < M) for (z > S == z > -S ? (V =
|
|
3807
|
-
for (; D < x; ) V =
|
|
3808
|
-
for (; _ < M; ) V =
|
|
3809
|
-
return
|
|
3837
|
+
let g, b, V, v, S = P[0], z = m[0], D = 0, _ = 0;
|
|
3838
|
+
z > S == z > -S ? (g = S, S = P[++D]) : (g = z, z = m[++_]);
|
|
3839
|
+
let T = 0;
|
|
3840
|
+
if (D < x && _ < M) for (z > S == z > -S ? (V = g - ((b = S + g) - S), S = P[++D]) : (V = g - ((b = z + g) - z), z = m[++_]), g = b, V !== 0 && (d[T++] = V); D < x && _ < M; ) z > S == z > -S ? (V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D]) : (V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_]), g = b, V !== 0 && (d[T++] = V);
|
|
3841
|
+
for (; D < x; ) V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D], g = b, V !== 0 && (d[T++] = V);
|
|
3842
|
+
for (; _ < M; ) V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_], g = b, V !== 0 && (d[T++] = V);
|
|
3843
|
+
return g === 0 && T !== 0 || (d[T++] = g), T;
|
|
3810
3844
|
}
|
|
3811
3845
|
function s(x) {
|
|
3812
3846
|
return new Float64Array(x);
|
|
3813
3847
|
}
|
|
3814
|
-
const a = 33306690738754716e-32, l = 22204460492503146e-32, c = 11093356479670487e-47, h = s(4), f = s(8), u = s(12),
|
|
3815
|
-
e.orient2d = function(x, P, M, m, d,
|
|
3816
|
-
const b = (P -
|
|
3848
|
+
const a = 33306690738754716e-32, l = 22204460492503146e-32, c = 11093356479670487e-47, h = s(4), f = s(8), u = s(12), p = s(16), w = s(4);
|
|
3849
|
+
e.orient2d = function(x, P, M, m, d, g) {
|
|
3850
|
+
const b = (P - g) * (M - d), V = (x - d) * (m - g), v = b - V;
|
|
3817
3851
|
if (b === 0 || V === 0 || b > 0 != V > 0) return v;
|
|
3818
3852
|
const S = Math.abs(b + V);
|
|
3819
|
-
return Math.abs(v) >= a * S ? v : -function(z, D, _,
|
|
3820
|
-
let I, B,
|
|
3821
|
-
const
|
|
3822
|
-
C = (Y = (X =
|
|
3823
|
-
let
|
|
3824
|
-
let
|
|
3825
|
-
for (let ct = 1; ct <
|
|
3826
|
-
return
|
|
3853
|
+
return Math.abs(v) >= a * S ? v : -function(z, D, _, T, E, A, O) {
|
|
3854
|
+
let I, B, R, W, C, L, H, X, ot, K, G, ut, rt, F, Y, Mt, Zt, Nt;
|
|
3855
|
+
const Lt = z - E, _t = _ - E, Tt = D - A, Ft = T - A;
|
|
3856
|
+
C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = Lt * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = Tt * _t) - H * ot - X * ot - H * K))), h[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), h[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, h[2] = ut - (Nt - C) + (G - C), h[3] = Nt;
|
|
3857
|
+
let tt = function(Et, qt) {
|
|
3858
|
+
let J = qt[0];
|
|
3859
|
+
for (let ct = 1; ct < Et; ct++) J += qt[ct];
|
|
3860
|
+
return J;
|
|
3827
3861
|
}(4, h), lt = l * O;
|
|
3828
|
-
if (
|
|
3829
|
-
C = (Y = (X = I - (H = (
|
|
3862
|
+
if (tt >= lt || -tt >= lt || (I = z - (Lt + (C = z - Lt)) + (C - E), R = _ - (_t + (C = _ - _t)) + (C - E), B = D - (Tt + (C = D - Tt)) + (C - A), W = T - (Ft + (C = T - Ft)) + (C - A), I === 0 && B === 0 && R === 0 && W === 0) || (lt = c * O + i * Math.abs(tt), (tt += Lt * W + Ft * I - (Tt * R + _t * B)) >= lt || -tt >= lt)) return tt;
|
|
3863
|
+
C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = I * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = B * _t) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
|
|
3830
3864
|
const q = r(4, h, 4, w, f);
|
|
3831
|
-
C = (Y = (X =
|
|
3832
|
-
const
|
|
3833
|
-
C = (Y = (X = I - (H = (
|
|
3834
|
-
const
|
|
3835
|
-
return
|
|
3836
|
-
}(x, P, M, m, d,
|
|
3837
|
-
}, e.orient2dfast = function(x, P, M, m, d,
|
|
3838
|
-
return (P -
|
|
3865
|
+
C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = Lt * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = Tt * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
|
|
3866
|
+
const j = r(q, f, 4, w, u);
|
|
3867
|
+
C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = I * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = B * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
|
|
3868
|
+
const Wt = r(j, u, 4, w, p);
|
|
3869
|
+
return p[Wt - 1];
|
|
3870
|
+
}(x, P, M, m, d, g, S);
|
|
3871
|
+
}, e.orient2dfast = function(x, P, M, m, d, g) {
|
|
3872
|
+
return (P - g) * (M - d) - (x - d) * (m - g);
|
|
3839
3873
|
}, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3840
3874
|
});
|
|
3841
|
-
})(
|
|
3842
|
-
var
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
function
|
|
3875
|
+
})(je, je.exports);
|
|
3876
|
+
var fr = je.exports, pn = rr, Ae = lr, dr = hr, mr = fr.orient2d;
|
|
3877
|
+
Ae.default && (Ae = Ae.default);
|
|
3878
|
+
Ze.exports = qn;
|
|
3879
|
+
Ze.exports.default = qn;
|
|
3880
|
+
function qn(n, t, e) {
|
|
3847
3881
|
t = Math.max(0, t === void 0 ? 2 : t), e = e || 0;
|
|
3848
|
-
var o =
|
|
3882
|
+
var o = wr(n), i = new pn(16);
|
|
3849
3883
|
i.toBBox = function(m) {
|
|
3850
3884
|
return {
|
|
3851
3885
|
minX: m[0],
|
|
@@ -3860,15 +3894,15 @@ function Fn(n, t, e) {
|
|
|
3860
3894
|
}, i.load(n);
|
|
3861
3895
|
for (var r = [], s = 0, a; s < o.length; s++) {
|
|
3862
3896
|
var l = o[s];
|
|
3863
|
-
i.remove(l), a =
|
|
3897
|
+
i.remove(l), a = wn(l, a), r.push(a);
|
|
3864
3898
|
}
|
|
3865
|
-
var c = new
|
|
3866
|
-
for (s = 0; s < r.length; s++) c.insert(
|
|
3899
|
+
var c = new pn(16);
|
|
3900
|
+
for (s = 0; s < r.length; s++) c.insert(qe(r[s]));
|
|
3867
3901
|
for (var h = t * t, f = e * e; r.length; ) {
|
|
3868
|
-
var u = r.shift(),
|
|
3902
|
+
var u = r.shift(), p = u.p, w = u.next.p, x = Xe(p, w);
|
|
3869
3903
|
if (!(x < f)) {
|
|
3870
3904
|
var P = x / h;
|
|
3871
|
-
l =
|
|
3905
|
+
l = gr(i, u.prev.p, p, w, u.next.next.p, P, c), l && Math.min(Xe(l, p), Xe(l, w)) <= P && (r.push(u), r.push(wn(l, u)), i.remove(l), c.remove(u), c.insert(qe(u)), c.insert(qe(u.next)));
|
|
3872
3906
|
}
|
|
3873
3907
|
}
|
|
3874
3908
|
u = a;
|
|
@@ -3878,66 +3912,66 @@ function Fn(n, t, e) {
|
|
|
3878
3912
|
while (u !== a);
|
|
3879
3913
|
return M.push(u.p), M;
|
|
3880
3914
|
}
|
|
3881
|
-
function
|
|
3882
|
-
for (var a = new
|
|
3915
|
+
function gr(n, t, e, o, i, r, s) {
|
|
3916
|
+
for (var a = new Ae([], pr), l = n.data; l; ) {
|
|
3883
3917
|
for (var c = 0; c < l.children.length; c++) {
|
|
3884
|
-
var h = l.children[c], f = l.leaf ?
|
|
3918
|
+
var h = l.children[c], f = l.leaf ? He(h, e, o) : yr(e, o, h);
|
|
3885
3919
|
f > r || a.push({
|
|
3886
3920
|
node: h,
|
|
3887
3921
|
dist: f
|
|
3888
3922
|
});
|
|
3889
3923
|
}
|
|
3890
3924
|
for (; a.length && !a.peek().node.children; ) {
|
|
3891
|
-
var u = a.pop(),
|
|
3892
|
-
if (u.dist < w && u.dist < x &&
|
|
3925
|
+
var u = a.pop(), p = u.node, w = He(p, t, e), x = He(p, o, i);
|
|
3926
|
+
if (u.dist < w && u.dist < x && xn(e, p, s) && xn(o, p, s)) return p;
|
|
3893
3927
|
}
|
|
3894
3928
|
l = a.pop(), l && (l = l.node);
|
|
3895
3929
|
}
|
|
3896
3930
|
return null;
|
|
3897
3931
|
}
|
|
3898
|
-
function
|
|
3932
|
+
function pr(n, t) {
|
|
3899
3933
|
return n.dist - t.dist;
|
|
3900
3934
|
}
|
|
3901
|
-
function
|
|
3902
|
-
if (
|
|
3903
|
-
var o =
|
|
3935
|
+
function yr(n, t, e) {
|
|
3936
|
+
if (yn(n, e) || yn(t, e)) return 0;
|
|
3937
|
+
var o = Te(n[0], n[1], t[0], t[1], e.minX, e.minY, e.maxX, e.minY);
|
|
3904
3938
|
if (o === 0) return 0;
|
|
3905
|
-
var i =
|
|
3939
|
+
var i = Te(n[0], n[1], t[0], t[1], e.minX, e.minY, e.minX, e.maxY);
|
|
3906
3940
|
if (i === 0) return 0;
|
|
3907
|
-
var r =
|
|
3941
|
+
var r = Te(n[0], n[1], t[0], t[1], e.maxX, e.minY, e.maxX, e.maxY);
|
|
3908
3942
|
if (r === 0) return 0;
|
|
3909
|
-
var s =
|
|
3943
|
+
var s = Te(n[0], n[1], t[0], t[1], e.minX, e.maxY, e.maxX, e.maxY);
|
|
3910
3944
|
return s === 0 ? 0 : Math.min(o, i, r, s);
|
|
3911
3945
|
}
|
|
3912
|
-
function
|
|
3946
|
+
function yn(n, t) {
|
|
3913
3947
|
return n[0] >= t.minX && n[0] <= t.maxX && n[1] >= t.minY && n[1] <= t.maxY;
|
|
3914
3948
|
}
|
|
3915
|
-
function
|
|
3949
|
+
function xn(n, t, e) {
|
|
3916
3950
|
for (var o = Math.min(n[0], t[0]), i = Math.min(n[1], t[1]), r = Math.max(n[0], t[0]), s = Math.max(n[1], t[1]), a = e.search({ minX: o, minY: i, maxX: r, maxY: s }), l = 0; l < a.length; l++)
|
|
3917
|
-
if (
|
|
3951
|
+
if (xr(a[l].p, a[l].next.p, n, t)) return !1;
|
|
3918
3952
|
return !0;
|
|
3919
3953
|
}
|
|
3920
|
-
function
|
|
3921
|
-
return
|
|
3954
|
+
function xe(n, t, e) {
|
|
3955
|
+
return mr(n[0], n[1], t[0], t[1], e[0], e[1]);
|
|
3922
3956
|
}
|
|
3923
|
-
function
|
|
3924
|
-
return n !== o && t !== e &&
|
|
3957
|
+
function xr(n, t, e, o) {
|
|
3958
|
+
return n !== o && t !== e && xe(n, t, e) > 0 != xe(n, t, o) > 0 && xe(e, o, n) > 0 != xe(e, o, t) > 0;
|
|
3925
3959
|
}
|
|
3926
|
-
function
|
|
3960
|
+
function qe(n) {
|
|
3927
3961
|
var t = n.p, e = n.next.p;
|
|
3928
3962
|
return n.minX = Math.min(t[0], e[0]), n.minY = Math.min(t[1], e[1]), n.maxX = Math.max(t[0], e[0]), n.maxY = Math.max(t[1], e[1]), n;
|
|
3929
3963
|
}
|
|
3930
|
-
function
|
|
3964
|
+
function wr(n) {
|
|
3931
3965
|
for (var t = n[0], e = n[0], o = n[0], i = n[0], r = 0; r < n.length; r++) {
|
|
3932
3966
|
var s = n[r];
|
|
3933
3967
|
s[0] < t[0] && (t = s), s[0] > o[0] && (o = s), s[1] < e[1] && (e = s), s[1] > i[1] && (i = s);
|
|
3934
3968
|
}
|
|
3935
3969
|
var a = [t, e, o, i], l = a.slice();
|
|
3936
3970
|
for (r = 0; r < n.length; r++)
|
|
3937
|
-
|
|
3938
|
-
return
|
|
3971
|
+
dr(n[r], a) || l.push(n[r]);
|
|
3972
|
+
return Pr(l);
|
|
3939
3973
|
}
|
|
3940
|
-
function
|
|
3974
|
+
function wn(n, t) {
|
|
3941
3975
|
var e = {
|
|
3942
3976
|
p: n,
|
|
3943
3977
|
prev: null,
|
|
@@ -3949,11 +3983,11 @@ function gn(n, t) {
|
|
|
3949
3983
|
};
|
|
3950
3984
|
return t ? (e.next = t.next, e.prev = t, t.next.prev = e, t.next = e) : (e.prev = e, e.next = e), e;
|
|
3951
3985
|
}
|
|
3952
|
-
function
|
|
3986
|
+
function Xe(n, t) {
|
|
3953
3987
|
var e = n[0] - t[0], o = n[1] - t[1];
|
|
3954
3988
|
return e * e + o * o;
|
|
3955
3989
|
}
|
|
3956
|
-
function
|
|
3990
|
+
function He(n, t, e) {
|
|
3957
3991
|
var o = t[0], i = t[1], r = e[0] - o, s = e[1] - i;
|
|
3958
3992
|
if (r !== 0 || s !== 0) {
|
|
3959
3993
|
var a = ((n[0] - o) * r + (n[1] - i) * s) / (r * r + s * s);
|
|
@@ -3961,52 +3995,52 @@ function Oe(n, t, e) {
|
|
|
3961
3995
|
}
|
|
3962
3996
|
return r = n[0] - o, s = n[1] - i, r * r + s * s;
|
|
3963
3997
|
}
|
|
3964
|
-
function
|
|
3965
|
-
var l = e - n, c = o - t, h = s - i, f = a - r, u = n - i,
|
|
3966
|
-
d === 0 ? (b = 0, S = 1, v = m, z = P) : (b = x * m - P * M, v = w * m - x * M, b < 0 ? (b = 0, v = m, z = P) : b > S && (b = S, v = m + x, z = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > z && (v = z, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)),
|
|
3967
|
-
var D = (1 -
|
|
3998
|
+
function Te(n, t, e, o, i, r, s, a) {
|
|
3999
|
+
var l = e - n, c = o - t, h = s - i, f = a - r, u = n - i, p = t - r, w = l * l + c * c, x = l * h + c * f, P = h * h + f * f, M = l * u + c * p, m = h * u + f * p, d = w * P - x * x, g, b, V, v, S = d, z = d;
|
|
4000
|
+
d === 0 ? (b = 0, S = 1, v = m, z = P) : (b = x * m - P * M, v = w * m - x * M, b < 0 ? (b = 0, v = m, z = P) : b > S && (b = S, v = m + x, z = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > z && (v = z, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), g = b === 0 ? 0 : b / S, V = v === 0 ? 0 : v / z;
|
|
4001
|
+
var D = (1 - g) * n + g * e, _ = (1 - g) * t + g * o, T = (1 - V) * i + V * s, E = (1 - V) * r + V * a, A = T - D, O = E - _;
|
|
3968
4002
|
return A * A + O * O;
|
|
3969
4003
|
}
|
|
3970
|
-
function
|
|
4004
|
+
function br(n, t) {
|
|
3971
4005
|
return n[0] === t[0] ? n[1] - t[1] : n[0] - t[0];
|
|
3972
4006
|
}
|
|
3973
|
-
function
|
|
3974
|
-
n.sort(
|
|
4007
|
+
function Pr(n) {
|
|
4008
|
+
n.sort(br);
|
|
3975
4009
|
for (var t = [], e = 0; e < n.length; e++) {
|
|
3976
|
-
for (; t.length >= 2 &&
|
|
4010
|
+
for (; t.length >= 2 && xe(t[t.length - 2], t[t.length - 1], n[e]) <= 0; )
|
|
3977
4011
|
t.pop();
|
|
3978
4012
|
t.push(n[e]);
|
|
3979
4013
|
}
|
|
3980
4014
|
for (var o = [], i = n.length - 1; i >= 0; i--) {
|
|
3981
|
-
for (; o.length >= 2 &&
|
|
4015
|
+
for (; o.length >= 2 && xe(o[o.length - 2], o[o.length - 1], n[i]) <= 0; )
|
|
3982
4016
|
o.pop();
|
|
3983
4017
|
o.push(n[i]);
|
|
3984
4018
|
}
|
|
3985
4019
|
return o.pop(), t.pop(), t.concat(o);
|
|
3986
4020
|
}
|
|
3987
|
-
var
|
|
3988
|
-
const
|
|
3989
|
-
function
|
|
4021
|
+
var Mr = Ze.exports;
|
|
4022
|
+
const zr = /* @__PURE__ */ nr(Mr);
|
|
4023
|
+
function Vr(n, t = {}) {
|
|
3990
4024
|
t.concavity = t.concavity || 1 / 0;
|
|
3991
4025
|
const e = [];
|
|
3992
|
-
if (
|
|
4026
|
+
if (Pe(n, (i) => {
|
|
3993
4027
|
e.push([i[0], i[1]]);
|
|
3994
4028
|
}), !e.length)
|
|
3995
4029
|
return null;
|
|
3996
|
-
const o =
|
|
3997
|
-
return o.length > 3 ?
|
|
4030
|
+
const o = zr(e, t.concavity);
|
|
4031
|
+
return o.length > 3 ? Cn([o]) : null;
|
|
3998
4032
|
}
|
|
3999
|
-
function
|
|
4033
|
+
function Xn(n, t = {}) {
|
|
4000
4034
|
let e = 0, o = 0, i = 0;
|
|
4001
|
-
return
|
|
4035
|
+
return Pe(
|
|
4002
4036
|
n,
|
|
4003
4037
|
function(r) {
|
|
4004
4038
|
e += r[0], o += r[1], i++;
|
|
4005
4039
|
},
|
|
4006
4040
|
!0
|
|
4007
|
-
),
|
|
4041
|
+
), kn([e / i, o / i], t.properties);
|
|
4008
4042
|
}
|
|
4009
|
-
function
|
|
4043
|
+
function se(n) {
|
|
4010
4044
|
if (!n)
|
|
4011
4045
|
throw new Error("coord is required");
|
|
4012
4046
|
if (!Array.isArray(n)) {
|
|
@@ -4019,7 +4053,7 @@ function oe(n) {
|
|
|
4019
4053
|
return [...n];
|
|
4020
4054
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
4021
4055
|
}
|
|
4022
|
-
function
|
|
4056
|
+
function Sr(n) {
|
|
4023
4057
|
if (Array.isArray(n))
|
|
4024
4058
|
return n;
|
|
4025
4059
|
if (n.type === "Feature") {
|
|
@@ -4031,27 +4065,27 @@ function Pr(n) {
|
|
|
4031
4065
|
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
4032
4066
|
);
|
|
4033
4067
|
}
|
|
4034
|
-
function
|
|
4068
|
+
function vr(n, t, e = {}) {
|
|
4035
4069
|
let o;
|
|
4036
|
-
return e.final ? o =
|
|
4070
|
+
return e.final ? o = bn(se(t), se(n)) : o = bn(se(n), se(t)), o > 180 ? -(360 - o) : o;
|
|
4037
4071
|
}
|
|
4038
|
-
function
|
|
4039
|
-
const e =
|
|
4040
|
-
let i =
|
|
4072
|
+
function bn(n, t) {
|
|
4073
|
+
const e = ie(n[1]), o = ie(t[1]);
|
|
4074
|
+
let i = ie(t[0] - n[0]);
|
|
4041
4075
|
i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);
|
|
4042
4076
|
const r = Math.log(
|
|
4043
4077
|
Math.tan(o / 2 + Math.PI / 4) / Math.tan(e / 2 + Math.PI / 4)
|
|
4044
4078
|
), s = Math.atan2(i, r);
|
|
4045
|
-
return (
|
|
4079
|
+
return (Rn(s) + 360) % 360;
|
|
4046
4080
|
}
|
|
4047
|
-
function
|
|
4048
|
-
const o =
|
|
4081
|
+
function Dr(n, t, e = {}) {
|
|
4082
|
+
const o = se(n), i = se(t);
|
|
4049
4083
|
i[0] += i[0] - o[0] > 180 ? -360 : o[0] - i[0] > 180 ? 360 : 0;
|
|
4050
|
-
const r =
|
|
4051
|
-
return
|
|
4084
|
+
const r = _r(o, i);
|
|
4085
|
+
return Ln(r, "meters", e.units);
|
|
4052
4086
|
}
|
|
4053
|
-
function
|
|
4054
|
-
e = e === void 0 ?
|
|
4087
|
+
function _r(n, t, e) {
|
|
4088
|
+
e = e === void 0 ? Yt : Number(e);
|
|
4055
4089
|
const o = e, i = n[1] * Math.PI / 180, r = t[1] * Math.PI / 180, s = r - i;
|
|
4056
4090
|
let a = Math.abs(t[0] - n[0]) * Math.PI / 180;
|
|
4057
4091
|
a > Math.PI && (a -= 2 * Math.PI);
|
|
@@ -4062,24 +4096,24 @@ function Vr(n, t, e) {
|
|
|
4062
4096
|
s * s + c * c * a * a
|
|
4063
4097
|
) * o;
|
|
4064
4098
|
}
|
|
4065
|
-
function
|
|
4099
|
+
function Tr(n, t, e, o = {}) {
|
|
4066
4100
|
const i = t < 0;
|
|
4067
|
-
let r =
|
|
4101
|
+
let r = Ln(
|
|
4068
4102
|
Math.abs(t),
|
|
4069
4103
|
o.units,
|
|
4070
4104
|
"meters"
|
|
4071
4105
|
);
|
|
4072
4106
|
i && (r = -Math.abs(r));
|
|
4073
|
-
const s =
|
|
4107
|
+
const s = se(n), a = Er(
|
|
4074
4108
|
s,
|
|
4075
4109
|
r,
|
|
4076
4110
|
e
|
|
4077
4111
|
);
|
|
4078
|
-
return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0,
|
|
4112
|
+
return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0, kn(a, o.properties);
|
|
4079
4113
|
}
|
|
4080
|
-
function
|
|
4081
|
-
o = o === void 0 ?
|
|
4082
|
-
const i = t / o, r = n[0] * Math.PI / 180, s =
|
|
4114
|
+
function Er(n, t, e, o) {
|
|
4115
|
+
o = o === void 0 ? Yt : Number(o);
|
|
4116
|
+
const i = t / o, r = n[0] * Math.PI / 180, s = ie(n[1]), a = ie(e), l = i * Math.cos(a);
|
|
4083
4117
|
let c = s + l;
|
|
4084
4118
|
Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);
|
|
4085
4119
|
const h = Math.log(
|
|
@@ -4090,14 +4124,14 @@ function vr(n, t, e, o) {
|
|
|
4090
4124
|
c * 180 / Math.PI
|
|
4091
4125
|
];
|
|
4092
4126
|
}
|
|
4093
|
-
function
|
|
4127
|
+
function Ar(n) {
|
|
4094
4128
|
if (!n)
|
|
4095
4129
|
throw new Error("geojson is required");
|
|
4096
4130
|
switch (n.type) {
|
|
4097
4131
|
case "Feature":
|
|
4098
|
-
return
|
|
4132
|
+
return Hn(n);
|
|
4099
4133
|
case "FeatureCollection":
|
|
4100
|
-
return
|
|
4134
|
+
return Br(n);
|
|
4101
4135
|
case "Point":
|
|
4102
4136
|
case "LineString":
|
|
4103
4137
|
case "Polygon":
|
|
@@ -4105,12 +4139,12 @@ function Dr(n) {
|
|
|
4105
4139
|
case "MultiLineString":
|
|
4106
4140
|
case "MultiPolygon":
|
|
4107
4141
|
case "GeometryCollection":
|
|
4108
|
-
return
|
|
4142
|
+
return Ke(n);
|
|
4109
4143
|
default:
|
|
4110
4144
|
throw new Error("unknown GeoJSON type");
|
|
4111
4145
|
}
|
|
4112
4146
|
}
|
|
4113
|
-
function
|
|
4147
|
+
function Hn(n) {
|
|
4114
4148
|
const t = { type: "Feature" };
|
|
4115
4149
|
return Object.keys(n).forEach((e) => {
|
|
4116
4150
|
switch (e) {
|
|
@@ -4121,16 +4155,16 @@ function Wn(n) {
|
|
|
4121
4155
|
default:
|
|
4122
4156
|
t[e] = n[e];
|
|
4123
4157
|
}
|
|
4124
|
-
}), t.properties =
|
|
4158
|
+
}), t.properties = Yn(n.properties), n.geometry == null ? t.geometry = null : t.geometry = Ke(n.geometry), t;
|
|
4125
4159
|
}
|
|
4126
|
-
function
|
|
4160
|
+
function Yn(n) {
|
|
4127
4161
|
const t = {};
|
|
4128
4162
|
return n && Object.keys(n).forEach((e) => {
|
|
4129
4163
|
const o = n[e];
|
|
4130
|
-
typeof o == "object" ? o === null ? t[e] = null : Array.isArray(o) ? t[e] = o.map((i) => i) : t[e] =
|
|
4164
|
+
typeof o == "object" ? o === null ? t[e] = null : Array.isArray(o) ? t[e] = o.map((i) => i) : t[e] = Yn(o) : t[e] = o;
|
|
4131
4165
|
}), t;
|
|
4132
4166
|
}
|
|
4133
|
-
function
|
|
4167
|
+
function Br(n) {
|
|
4134
4168
|
const t = { type: "FeatureCollection" };
|
|
4135
4169
|
return Object.keys(n).forEach((e) => {
|
|
4136
4170
|
switch (e) {
|
|
@@ -4140,80 +4174,80 @@ function _r(n) {
|
|
|
4140
4174
|
default:
|
|
4141
4175
|
t[e] = n[e];
|
|
4142
4176
|
}
|
|
4143
|
-
}), t.features = n.features.map((e) =>
|
|
4177
|
+
}), t.features = n.features.map((e) => Hn(e)), t;
|
|
4144
4178
|
}
|
|
4145
|
-
function
|
|
4179
|
+
function Ke(n) {
|
|
4146
4180
|
const t = { type: n.type };
|
|
4147
|
-
return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) =>
|
|
4181
|
+
return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) => Ke(e)), t) : (t.coordinates = $n(n.coordinates), t);
|
|
4148
4182
|
}
|
|
4149
|
-
function
|
|
4183
|
+
function $n(n) {
|
|
4150
4184
|
const t = n;
|
|
4151
|
-
return typeof t[0] != "object" ? t.slice() : t.map((e) =>
|
|
4185
|
+
return typeof t[0] != "object" ? t.slice() : t.map((e) => $n(e));
|
|
4152
4186
|
}
|
|
4153
|
-
function
|
|
4154
|
-
if (e = e || {}, !
|
|
4187
|
+
function Pn(n, t, e) {
|
|
4188
|
+
if (e = e || {}, !Qo(e)) throw new Error("options is invalid");
|
|
4155
4189
|
const o = e.pivot, i = e.mutate;
|
|
4156
4190
|
if (!n) throw new Error("geojson is required");
|
|
4157
4191
|
if (t == null || isNaN(t))
|
|
4158
4192
|
throw new Error("angle is required");
|
|
4159
4193
|
if (t === 0) return n;
|
|
4160
|
-
const r = o ??
|
|
4161
|
-
return (i === !1 || i === void 0) && (n =
|
|
4162
|
-
const l =
|
|
4163
|
-
|
|
4194
|
+
const r = o ?? Xn(n);
|
|
4195
|
+
return (i === !1 || i === void 0) && (n = Ar(n)), Pe(n, function(s) {
|
|
4196
|
+
const l = vr(r, s) + t, c = Dr(r, s), h = Sr(
|
|
4197
|
+
Tr(r, c, l)
|
|
4164
4198
|
);
|
|
4165
4199
|
s[0] = h[0], s[1] = h[1];
|
|
4166
4200
|
}), n;
|
|
4167
4201
|
}
|
|
4168
|
-
function
|
|
4202
|
+
function Gn(n, t, e = {}) {
|
|
4169
4203
|
if (e.final === !0)
|
|
4170
|
-
return
|
|
4171
|
-
const o =
|
|
4172
|
-
return
|
|
4204
|
+
return Ir(n, t);
|
|
4205
|
+
const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), c = Math.sin(s - r) * Math.cos(l), h = Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - r);
|
|
4206
|
+
return Rn(Math.atan2(c, h));
|
|
4173
4207
|
}
|
|
4174
|
-
function
|
|
4175
|
-
let e =
|
|
4208
|
+
function Ir(n, t) {
|
|
4209
|
+
let e = Gn(t, n);
|
|
4176
4210
|
return e = (e + 180) % 360, e;
|
|
4177
4211
|
}
|
|
4178
|
-
function
|
|
4212
|
+
function kr(n, t = {}) {
|
|
4179
4213
|
if (n.bbox != null && t.recompute !== !0)
|
|
4180
4214
|
return n.bbox;
|
|
4181
4215
|
const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
4182
|
-
return
|
|
4216
|
+
return Pe(n, (o) => {
|
|
4183
4217
|
e[0] > o[0] && (e[0] = o[0]), e[1] > o[1] && (e[1] = o[1]), e[2] < o[0] && (e[2] = o[0]), e[3] < o[1] && (e[3] = o[1]);
|
|
4184
4218
|
}), e;
|
|
4185
4219
|
}
|
|
4186
|
-
function
|
|
4220
|
+
function Cr(n, t = {}) {
|
|
4187
4221
|
const e = Number(n[0]), o = Number(n[1]), i = Number(n[2]), r = Number(n[3]);
|
|
4188
4222
|
if (n.length === 6)
|
|
4189
4223
|
throw new Error(
|
|
4190
4224
|
"@turf/bbox-polygon does not support BBox with 6 positions"
|
|
4191
4225
|
);
|
|
4192
4226
|
const s = [e, o];
|
|
4193
|
-
return
|
|
4227
|
+
return Cn(
|
|
4194
4228
|
[[s, [i, o], [i, r], [e, r], s]],
|
|
4195
4229
|
t.properties,
|
|
4196
4230
|
{ bbox: n, id: t.id }
|
|
4197
4231
|
);
|
|
4198
4232
|
}
|
|
4199
|
-
function
|
|
4200
|
-
return
|
|
4233
|
+
function Rr(n) {
|
|
4234
|
+
return Cr(kr(n));
|
|
4201
4235
|
}
|
|
4202
|
-
function
|
|
4203
|
-
return
|
|
4236
|
+
function Lr(n) {
|
|
4237
|
+
return er(
|
|
4204
4238
|
n,
|
|
4205
|
-
(t, e) => t +
|
|
4239
|
+
(t, e) => t + Fr(e),
|
|
4206
4240
|
0
|
|
4207
4241
|
);
|
|
4208
4242
|
}
|
|
4209
|
-
function
|
|
4243
|
+
function Fr(n) {
|
|
4210
4244
|
let t = 0, e;
|
|
4211
4245
|
switch (n.type) {
|
|
4212
4246
|
case "Polygon":
|
|
4213
|
-
return
|
|
4247
|
+
return Mn(n.coordinates);
|
|
4214
4248
|
case "MultiPolygon":
|
|
4215
4249
|
for (e = 0; e < n.coordinates.length; e++)
|
|
4216
|
-
t +=
|
|
4250
|
+
t += Mn(n.coordinates[e]);
|
|
4217
4251
|
return t;
|
|
4218
4252
|
case "Point":
|
|
4219
4253
|
case "MultiPoint":
|
|
@@ -4223,69 +4257,69 @@ function kr(n) {
|
|
|
4223
4257
|
}
|
|
4224
4258
|
return 0;
|
|
4225
4259
|
}
|
|
4226
|
-
function
|
|
4260
|
+
function Mn(n) {
|
|
4227
4261
|
let t = 0;
|
|
4228
4262
|
if (n && n.length > 0) {
|
|
4229
|
-
t += Math.abs(
|
|
4263
|
+
t += Math.abs(zn(n[0]));
|
|
4230
4264
|
for (let e = 1; e < n.length; e++)
|
|
4231
|
-
t -= Math.abs(
|
|
4265
|
+
t -= Math.abs(zn(n[e]));
|
|
4232
4266
|
}
|
|
4233
4267
|
return t;
|
|
4234
4268
|
}
|
|
4235
|
-
var
|
|
4236
|
-
function
|
|
4269
|
+
var Or = Yt * Yt / 2, Ye = Math.PI / 180;
|
|
4270
|
+
function zn(n) {
|
|
4237
4271
|
const t = n.length - 1;
|
|
4238
4272
|
if (t <= 2) return 0;
|
|
4239
4273
|
let e = 0, o = 0;
|
|
4240
4274
|
for (; o < t; ) {
|
|
4241
|
-
const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] *
|
|
4275
|
+
const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] * Ye, l = r[1] * Ye, c = s[0] * Ye;
|
|
4242
4276
|
e += (c - a) * Math.sin(l), o++;
|
|
4243
4277
|
}
|
|
4244
|
-
return e *
|
|
4278
|
+
return e * Or;
|
|
4245
4279
|
}
|
|
4246
|
-
function
|
|
4247
|
-
const t =
|
|
4280
|
+
function Wr(n) {
|
|
4281
|
+
const t = Vr(n);
|
|
4248
4282
|
if (!t)
|
|
4249
4283
|
throw new Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
|
|
4250
|
-
const e =
|
|
4284
|
+
const e = Xn(t), o = Jo(t);
|
|
4251
4285
|
let i = Number.MAX_SAFE_INTEGER, r = null;
|
|
4252
4286
|
for (let s = 0; s < o.length - 1; s++) {
|
|
4253
|
-
let a =
|
|
4287
|
+
let a = Gn(o[s], o[s + 1]), l = Pn(t, -1 * a, {
|
|
4254
4288
|
pivot: e
|
|
4255
|
-
}), c =
|
|
4256
|
-
h < i && (i = h, r =
|
|
4289
|
+
}), c = Rr(l), h = Lr(c);
|
|
4290
|
+
h < i && (i = h, r = Pn(c, a, {
|
|
4257
4291
|
pivot: e
|
|
4258
4292
|
}));
|
|
4259
4293
|
}
|
|
4260
4294
|
return r;
|
|
4261
4295
|
}
|
|
4262
|
-
function
|
|
4296
|
+
function Vn(n, t) {
|
|
4263
4297
|
const e = t[0] - n[0], o = t[1] - n[1];
|
|
4264
4298
|
return Math.sqrt(e * e + o * o);
|
|
4265
4299
|
}
|
|
4266
|
-
function
|
|
4300
|
+
function Nr(n) {
|
|
4267
4301
|
let t = 1 / 0, e = -1 / 0, o = 1 / 0, i = -1 / 0;
|
|
4268
4302
|
for (const [r, s] of n)
|
|
4269
4303
|
r < t && (t = r), r > e && (e = r), s < o && (o = s), s > i && (i = s);
|
|
4270
4304
|
return [(e + t) * 0.5, (i + o) * 0.5];
|
|
4271
4305
|
}
|
|
4272
|
-
class
|
|
4306
|
+
class Ie extends An {
|
|
4273
4307
|
getBoxMesh() {
|
|
4274
|
-
|
|
4308
|
+
le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Ee, fe, new y.Vector3());
|
|
4275
4309
|
const t = this.halfSize.clone().multiplyScalar(2), e = new y.Mesh(new y.BoxGeometry(t.x, t.y, t.z));
|
|
4276
|
-
return e.position.copy(this.center), e.rotation.setFromQuaternion(
|
|
4310
|
+
return e.position.copy(this.center), e.rotation.setFromQuaternion(fe), e;
|
|
4277
4311
|
}
|
|
4278
4312
|
getBoxEdge(t = 16776960) {
|
|
4279
4313
|
const e = this.getBoxMesh();
|
|
4280
|
-
|
|
4314
|
+
Xr.setFromObject(e);
|
|
4281
4315
|
const o = new y.EdgesGeometry(e.geometry.clone().applyMatrix4(e.matrixWorld));
|
|
4282
4316
|
return new y.LineSegments(o, new y.LineBasicMaterial({ color: t, toneMapped: !1 }));
|
|
4283
4317
|
}
|
|
4284
4318
|
toJson() {
|
|
4285
|
-
return
|
|
4319
|
+
return le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Ee, fe, new y.Vector3()), {
|
|
4286
4320
|
size: this.halfSize.toArray(),
|
|
4287
4321
|
center: this.center.toArray(),
|
|
4288
|
-
quaternion:
|
|
4322
|
+
quaternion: fe.toArray()
|
|
4289
4323
|
};
|
|
4290
4324
|
}
|
|
4291
4325
|
/**
|
|
@@ -4295,11 +4329,11 @@ class Ae extends Dn {
|
|
|
4295
4329
|
* @param obb
|
|
4296
4330
|
* @returns
|
|
4297
4331
|
*/
|
|
4298
|
-
static from(t, e, o, i = new
|
|
4299
|
-
if (o instanceof y.Euler)
|
|
4300
|
-
else if (o instanceof y.Quaternion)
|
|
4332
|
+
static from(t, e, o, i = new Ie()) {
|
|
4333
|
+
if (o instanceof y.Euler) fe.setFromEuler(o);
|
|
4334
|
+
else if (o instanceof y.Quaternion) fe.copy(o);
|
|
4301
4335
|
else throw new Error("传入的旋转不是欧拉角或者四元数");
|
|
4302
|
-
return
|
|
4336
|
+
return le.compose(e, fe, qr), i.center.copy(e), i.halfSize.copy(t.multiplyScalar(0.5)), i.rotation.setFromMatrix4(le), i;
|
|
4303
4337
|
}
|
|
4304
4338
|
/** 通过2d路径创建
|
|
4305
4339
|
* @param path
|
|
@@ -4308,22 +4342,22 @@ class Ae extends Dn {
|
|
|
4308
4342
|
* @param obb_
|
|
4309
4343
|
* @returns
|
|
4310
4344
|
*/
|
|
4311
|
-
static fromByPath2D(t, e, o, i = new
|
|
4312
|
-
const r =
|
|
4345
|
+
static fromByPath2D(t, e, o, i = new Ie()) {
|
|
4346
|
+
const r = Wr({
|
|
4313
4347
|
type: "Polygon",
|
|
4314
|
-
coordinates: [t.map((
|
|
4348
|
+
coordinates: [t.map((p) => [p.x, p.y])]
|
|
4315
4349
|
});
|
|
4316
4350
|
if (!r) throw new Error("2d obb 获取失败");
|
|
4317
|
-
const s = r.geometry.coordinates[0], a =
|
|
4318
|
-
|
|
4319
|
-
const [h, f] =
|
|
4320
|
-
return e.x = h, e.y = f, this.from(
|
|
4351
|
+
const s = r.geometry.coordinates[0], a = Vn(s[0], s[1]), l = Vn(s[1], s[2]), c = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
|
|
4352
|
+
Ee.set(a, l, o), Sn.set(0, 0, c);
|
|
4353
|
+
const [h, f] = Nr(s);
|
|
4354
|
+
return e.x = h, e.y = f, this.from(Ee, e, Sn, i);
|
|
4321
4355
|
}
|
|
4322
4356
|
}
|
|
4323
|
-
const
|
|
4324
|
-
function
|
|
4357
|
+
const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(), qr = new y.Vector3(1, 1, 1), Ee = new y.Vector3(), Xr = new y.Box3();
|
|
4358
|
+
function Hr(n, t, e = 5e-3, o = 0.2) {
|
|
4325
4359
|
if (!n.length || !t.length) return 0;
|
|
4326
|
-
const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (f, u,
|
|
4360
|
+
const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (f, u, p) => `${Math.floor(f / i)},${Math.floor(u / i)},${Math.floor(p / i)}`;
|
|
4327
4361
|
for (const f of t) {
|
|
4328
4362
|
const u = a(f.x, f.y, f.z);
|
|
4329
4363
|
s.has(u) || s.set(u, []), s.get(u).push(f);
|
|
@@ -4332,16 +4366,16 @@ function Wr(n, t, e = 5e-3, o = 0.2) {
|
|
|
4332
4366
|
const c = Math.ceil(e / i) + 1, h = [];
|
|
4333
4367
|
for (let f = -c; f <= c; f++)
|
|
4334
4368
|
for (let u = -c; u <= c; u++)
|
|
4335
|
-
for (let
|
|
4336
|
-
f * f + u * u +
|
|
4369
|
+
for (let p = -c; p <= c; p++)
|
|
4370
|
+
f * f + u * u + p * p <= c * c && h.push([f, u, p]);
|
|
4337
4371
|
for (const f of n) {
|
|
4338
|
-
const u = Math.floor(f.x / i),
|
|
4372
|
+
const u = Math.floor(f.x / i), p = Math.floor(f.y / i), w = Math.floor(f.z / i);
|
|
4339
4373
|
let x = !1;
|
|
4340
4374
|
for (const [P, M, m] of h) {
|
|
4341
|
-
const d = `${u + P},${
|
|
4375
|
+
const d = `${u + P},${p + M},${w + m}`;
|
|
4342
4376
|
if (s.has(d)) {
|
|
4343
|
-
for (const
|
|
4344
|
-
if (f.distanceToSquared(
|
|
4377
|
+
for (const g of s.get(d))
|
|
4378
|
+
if (f.distanceToSquared(g) < r) {
|
|
4345
4379
|
x = !0;
|
|
4346
4380
|
break;
|
|
4347
4381
|
}
|
|
@@ -4353,30 +4387,30 @@ function Wr(n, t, e = 5e-3, o = 0.2) {
|
|
|
4353
4387
|
}
|
|
4354
4388
|
return l / n.length;
|
|
4355
4389
|
}
|
|
4356
|
-
function
|
|
4390
|
+
function pe(n, t, e = 0.5) {
|
|
4357
4391
|
let o = 0, i = 0;
|
|
4358
4392
|
for (const r of n)
|
|
4359
4393
|
if (t.containsPoint(r) && (o++, i = o / n.length, i > e))
|
|
4360
4394
|
break;
|
|
4361
4395
|
return i;
|
|
4362
4396
|
}
|
|
4363
|
-
function
|
|
4397
|
+
function $e(n, t, e, o) {
|
|
4364
4398
|
if (n.intersectsOBB(t))
|
|
4365
4399
|
return !0;
|
|
4366
4400
|
{
|
|
4367
|
-
const r =
|
|
4401
|
+
const r = we(n, o), s = we(t, e);
|
|
4368
4402
|
if (r || s)
|
|
4369
4403
|
return !0;
|
|
4370
4404
|
}
|
|
4371
4405
|
return !1;
|
|
4372
4406
|
}
|
|
4373
|
-
function
|
|
4407
|
+
function vn(n, t) {
|
|
4374
4408
|
const e = new y.Vector3(), o = new y.Vector3();
|
|
4375
4409
|
n.getSize(e), t.getSize(o);
|
|
4376
4410
|
const i = e.x * e.y * e.z, r = o.x * o.y * o.z;
|
|
4377
4411
|
return i > r ? 1 : i < r ? -1 : 0;
|
|
4378
4412
|
}
|
|
4379
|
-
function
|
|
4413
|
+
function we(n, t) {
|
|
4380
4414
|
let e = !0;
|
|
4381
4415
|
for (let o = 0; o < t.length; o++)
|
|
4382
4416
|
if (!n.containsPoint(t[o])) {
|
|
@@ -4385,7 +4419,7 @@ function ye(n, t) {
|
|
|
4385
4419
|
}
|
|
4386
4420
|
return e;
|
|
4387
4421
|
}
|
|
4388
|
-
function
|
|
4422
|
+
function Dn(n) {
|
|
4389
4423
|
if (n.length === 0)
|
|
4390
4424
|
return { x: 0, y: 0, z: 0, h: 0 };
|
|
4391
4425
|
let t = 0, e = 0, o = -1 / 0, i = 1 / 0;
|
|
@@ -4400,7 +4434,7 @@ function zn(n) {
|
|
|
4400
4434
|
h: o - i
|
|
4401
4435
|
};
|
|
4402
4436
|
}
|
|
4403
|
-
function
|
|
4437
|
+
function _n(n, t, e, o) {
|
|
4404
4438
|
const i = [];
|
|
4405
4439
|
for (let s = 0; s < n.length; s++)
|
|
4406
4440
|
i.push(new y.Vector3(
|
|
@@ -4410,10 +4444,10 @@ function Vn(n, t, e, o) {
|
|
|
4410
4444
|
));
|
|
4411
4445
|
if (i.length == 0)
|
|
4412
4446
|
return null;
|
|
4413
|
-
const r =
|
|
4447
|
+
const r = Ie.fromByPath2D(i, t, e);
|
|
4414
4448
|
return r.center.z = o, r;
|
|
4415
4449
|
}
|
|
4416
|
-
const
|
|
4450
|
+
const gi = (n) => {
|
|
4417
4451
|
if (n.length == 0) return [];
|
|
4418
4452
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
4419
4453
|
for (let r = 0; r < n.length; r++) {
|
|
@@ -4435,8 +4469,8 @@ const hi = (n) => {
|
|
|
4435
4469
|
for (let m = 0; m < n[r].points.length; m++) {
|
|
4436
4470
|
let d = n[r].points[m].z;
|
|
4437
4471
|
if (d = Math.floor(d * 10) / 10, P.has(d)) {
|
|
4438
|
-
const
|
|
4439
|
-
|
|
4472
|
+
const g = P.get(d);
|
|
4473
|
+
g.num += 1, g.points.push(n[r].points[m]), P.set(d, g);
|
|
4440
4474
|
} else
|
|
4441
4475
|
P.set(d, { num: 1, points: [n[r].points[m]] });
|
|
4442
4476
|
}
|
|
@@ -4445,13 +4479,13 @@ const hi = (n) => {
|
|
|
4445
4479
|
);
|
|
4446
4480
|
s = [], s = M[1].points.map((m) => [m.x, m.y]), f = [], f = M[1].points.map((m) => new y.Vector3(m.x, m.y, m.z)), u = M[0];
|
|
4447
4481
|
}
|
|
4448
|
-
const
|
|
4482
|
+
const p = Dn(f), w = {
|
|
4449
4483
|
points: f,
|
|
4450
|
-
path:
|
|
4451
|
-
h:
|
|
4452
|
-
minz:
|
|
4453
|
-
maxz:
|
|
4454
|
-
center: { x:
|
|
4484
|
+
path: cn(s),
|
|
4485
|
+
h: p.h,
|
|
4486
|
+
minz: p.minz,
|
|
4487
|
+
maxz: p.maxz,
|
|
4488
|
+
center: { x: p.x, y: p.y, z: p.z },
|
|
4455
4489
|
obj_id: n[r].obj_id,
|
|
4456
4490
|
type: h,
|
|
4457
4491
|
averagePz: n[r].averagePz,
|
|
@@ -4460,7 +4494,7 @@ const hi = (n) => {
|
|
|
4460
4494
|
obj_id: a,
|
|
4461
4495
|
positionArr: [n[r].position]
|
|
4462
4496
|
};
|
|
4463
|
-
if (w.obb =
|
|
4497
|
+
if (w.obb = _n(w.path, w.center, w.h, (w.maxz + w.minz) / 2), w.obb == null) continue;
|
|
4464
4498
|
let x = -1;
|
|
4465
4499
|
for (let P = 0; P < t.length; P++)
|
|
4466
4500
|
if (t[P].type == h) {
|
|
@@ -4507,9 +4541,9 @@ const hi = (n) => {
|
|
|
4507
4541
|
for (let P = 0; P < s[u].points.length; P++)
|
|
4508
4542
|
(s[u].points[P].z > o && s[u].points[P].z - o > 0.1 || f.type == "floor") && f.points.push(s[u].points[P]);
|
|
4509
4543
|
const w = f.points.map((P) => [P.x, P.y]);
|
|
4510
|
-
f.path =
|
|
4511
|
-
const x =
|
|
4512
|
-
f.h = x.h, f.minz = x.minz, f.maxz = x.maxz, f.center = { x: x.x, y: x.y, z: x.z }, f.obb =
|
|
4544
|
+
f.path = cn(w);
|
|
4545
|
+
const x = Dn(f.points);
|
|
4546
|
+
f.h = x.h, f.minz = x.minz, f.maxz = x.maxz, f.center = { x: x.x, y: x.y, z: x.z }, f.obb = _n(f.path, f.center, f.h, (f.maxz + f.minz) / 2), f.positionArr.push(...s[u].positionArr), u = h;
|
|
4513
4547
|
}
|
|
4514
4548
|
}
|
|
4515
4549
|
f.path.length > s[h].path.length && (a.push(h), l.push(f));
|
|
@@ -4531,9 +4565,9 @@ const hi = (n) => {
|
|
|
4531
4565
|
if (s === "window" || s === "door" || s === "tv" || s === "chair" || s === "cabinet" || s === "table") {
|
|
4532
4566
|
const u = new y.Vector3();
|
|
4533
4567
|
c.getSize(u);
|
|
4534
|
-
const
|
|
4568
|
+
const p = [u.x, u.y, u.z];
|
|
4535
4569
|
let w = 0;
|
|
4536
|
-
for (const x of
|
|
4570
|
+
for (const x of p)
|
|
4537
4571
|
if (x < 0.2 && (w++, w === 2)) {
|
|
4538
4572
|
a[l].isDel = !0;
|
|
4539
4573
|
break;
|
|
@@ -4541,70 +4575,70 @@ const hi = (n) => {
|
|
|
4541
4575
|
}
|
|
4542
4576
|
if (!a[l].isDel)
|
|
4543
4577
|
for (let u = r + 1; u < t.length; u++) {
|
|
4544
|
-
const
|
|
4545
|
-
if (
|
|
4578
|
+
const p = t[u].type;
|
|
4579
|
+
if (p === "people" || p === "floor")
|
|
4546
4580
|
continue;
|
|
4547
4581
|
const w = t[u].array;
|
|
4548
4582
|
for (let x = 0; x < w.length; x++) {
|
|
4549
4583
|
if (w[x].isDel) continue;
|
|
4550
4584
|
const P = w[x].obb, M = w[x].minz;
|
|
4551
4585
|
if (w[x].maxz, c.intersectsOBB(P)) {
|
|
4552
|
-
|
|
4553
|
-
const m =
|
|
4586
|
+
pe(w[x].points, c);
|
|
4587
|
+
const m = pe(a[l].points, P), d = vn(c, P);
|
|
4554
4588
|
if (m >= 0.3 && d == -1) {
|
|
4555
4589
|
a[l].isDel = !0;
|
|
4556
4590
|
break;
|
|
4557
4591
|
}
|
|
4558
4592
|
if (s !== "wall" && s !== "floor" && s !== "roof") {
|
|
4559
4593
|
if (s === "window") {
|
|
4560
|
-
if (
|
|
4594
|
+
if (p === "balcony railing" && we(c, w[x].points)) {
|
|
4561
4595
|
w[x].isDel = !0;
|
|
4562
4596
|
continue;
|
|
4563
4597
|
}
|
|
4564
|
-
if (
|
|
4598
|
+
if (p === "balcony railing" && we(P, a[l].points)) {
|
|
4565
4599
|
a[l].isDel = !0;
|
|
4566
4600
|
break;
|
|
4567
4601
|
}
|
|
4568
|
-
if (
|
|
4602
|
+
if (p === "balcony railing" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - f) > 0.3)) {
|
|
4569
4603
|
w[x].isDel = !0;
|
|
4570
4604
|
continue;
|
|
4571
4605
|
}
|
|
4572
4606
|
} else if (s === "balcony railing") {
|
|
4573
|
-
if (
|
|
4607
|
+
if (p === "window" && we(c, w[x].points)) {
|
|
4574
4608
|
w[x].isDel = !0;
|
|
4575
4609
|
continue;
|
|
4576
4610
|
}
|
|
4577
|
-
if (
|
|
4611
|
+
if (p === "window" && we(P, a[l].points)) {
|
|
4578
4612
|
a[l].isDel = !0;
|
|
4579
4613
|
break;
|
|
4580
4614
|
}
|
|
4581
|
-
if (
|
|
4615
|
+
if (p === "window" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - f) > 0.3)) {
|
|
4582
4616
|
a[l].isDel = !0;
|
|
4583
4617
|
break;
|
|
4584
4618
|
}
|
|
4585
4619
|
}
|
|
4586
|
-
let
|
|
4620
|
+
let g = !1, b = [], V = [];
|
|
4587
4621
|
const v = a[l].points, S = w[x].points;
|
|
4588
|
-
if (v.length > S.length ? (
|
|
4589
|
-
if (
|
|
4622
|
+
if (v.length > S.length ? (g = !0, b = v, V = S) : (b = S, V = v), Hr(V, b, 0.03, 0.5) > 0.5)
|
|
4623
|
+
if (g)
|
|
4590
4624
|
w[x].isDel = !0;
|
|
4591
4625
|
else {
|
|
4592
4626
|
a[l].isDel = !0;
|
|
4593
4627
|
break;
|
|
4594
4628
|
}
|
|
4595
|
-
else if (
|
|
4596
|
-
const D =
|
|
4629
|
+
else if ($e(c, P)) {
|
|
4630
|
+
const D = vn(c, P);
|
|
4597
4631
|
if (D === 1 || D === 0) {
|
|
4598
|
-
if (
|
|
4599
|
-
v.length > S.length ?
|
|
4632
|
+
if (p === "switch") continue;
|
|
4633
|
+
v.length > S.length ? pe(V, c) >= 0.5 && (w[x].isDel = !0) : pe(b, c) >= 0.5 && (w[x].isDel = !0);
|
|
4600
4634
|
} else {
|
|
4601
4635
|
if (s === "switch") continue;
|
|
4602
4636
|
if (v.length > S.length) {
|
|
4603
|
-
if (
|
|
4637
|
+
if (pe(b, P) >= 0.5) {
|
|
4604
4638
|
a[l].isDel = !0;
|
|
4605
4639
|
break;
|
|
4606
4640
|
}
|
|
4607
|
-
} else if (
|
|
4641
|
+
} else if (pe(V, P) >= 0.5) {
|
|
4608
4642
|
a[l].isDel = !0;
|
|
4609
4643
|
break;
|
|
4610
4644
|
}
|
|
@@ -4627,12 +4661,12 @@ const hi = (n) => {
|
|
|
4627
4661
|
continue;
|
|
4628
4662
|
}
|
|
4629
4663
|
if (s === "window" || s === "door" || s === "tv") {
|
|
4630
|
-
const
|
|
4631
|
-
(s === "tv" && w < 1.6 || s !== "window" &&
|
|
4664
|
+
const p = Math.abs(c - u), w = Math.abs(h - u);
|
|
4665
|
+
(s === "tv" && w < 1.6 || s !== "window" && p < 1.6) && (a[l].isDel = !0), s === "window" && p < 1 && (a[l].isDel = !0);
|
|
4632
4666
|
}
|
|
4633
4667
|
if (s === "chair") {
|
|
4634
|
-
const
|
|
4635
|
-
a[l].obb.getSize(
|
|
4668
|
+
const p = new y.Vector3();
|
|
4669
|
+
a[l].obb.getSize(p), (p.x < 0.1 || p.y < 0.1 || p.z < 0.2) && (a[l].isDel = !0);
|
|
4636
4670
|
}
|
|
4637
4671
|
s === "balcony railing" && (Math.abs(c - h) < 0.4 && (a[l].isDel = !0), (h < u && Math.abs(h - u) > 1 || h > u && Math.abs(h - u) > 1) && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "people" && (Math.abs(c - h) < 1 && (a[l].isDel = !0), h > u && h - u > 0.3 && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
|
|
4638
4672
|
}
|
|
@@ -4656,11 +4690,11 @@ const hi = (n) => {
|
|
|
4656
4690
|
}
|
|
4657
4691
|
return i;
|
|
4658
4692
|
};
|
|
4659
|
-
function
|
|
4693
|
+
function be(n, t) {
|
|
4660
4694
|
const e = n.x - t.x, o = n.y - t.y;
|
|
4661
4695
|
return Math.sqrt(e * e + o * o);
|
|
4662
4696
|
}
|
|
4663
|
-
function
|
|
4697
|
+
function Yr(n) {
|
|
4664
4698
|
let t = 0, e = 0, o = 0;
|
|
4665
4699
|
for (let i = 0; i < 4; i++) {
|
|
4666
4700
|
const r = n[i], s = n[(i + 1) % 4], a = s.x - r.x, l = s.y - r.y, c = Math.sqrt(a * a + l * l);
|
|
@@ -4668,7 +4702,7 @@ function Nr(n) {
|
|
|
4668
4702
|
}
|
|
4669
4703
|
return { longSide: t, dirX: e, dirY: o };
|
|
4670
4704
|
}
|
|
4671
|
-
function
|
|
4705
|
+
function jn(n, t, e) {
|
|
4672
4706
|
const i = [];
|
|
4673
4707
|
for (const r of n) {
|
|
4674
4708
|
const s = (r.start.x + r.end.x) / 2, a = (r.start.y + r.end.y) / 2, l = s - t, c = a - e;
|
|
@@ -4681,41 +4715,41 @@ function Hn(n, t, e) {
|
|
|
4681
4715
|
}
|
|
4682
4716
|
return i.sort((r, s) => r - s), i[Math.floor(i.length / 2)];
|
|
4683
4717
|
}
|
|
4684
|
-
function
|
|
4718
|
+
function Un(n, t, e, o, i, r) {
|
|
4685
4719
|
const s = i - e, a = r - o, l = s * s + a * a;
|
|
4686
4720
|
if (l < 1e-12)
|
|
4687
4721
|
return { dist: Math.sqrt((n - e) ** 2 + (t - o) ** 2), t: 0 };
|
|
4688
|
-
const c = n - e, h = t - o, f = (c * s + h * a) / l, u = e + f * s,
|
|
4689
|
-
return { dist: Math.sqrt((n - u) ** 2 + (t -
|
|
4722
|
+
const c = n - e, h = t - o, f = (c * s + h * a) / l, u = e + f * s, p = o + f * a;
|
|
4723
|
+
return { dist: Math.sqrt((n - u) ** 2 + (t - p) ** 2), t: f };
|
|
4690
4724
|
}
|
|
4691
|
-
function
|
|
4725
|
+
function $r(n, t, e = 0.15) {
|
|
4692
4726
|
let o = 0, i = 0;
|
|
4693
4727
|
for (const s of t)
|
|
4694
|
-
s !== n && ((
|
|
4728
|
+
s !== n && ((be(n.start, s.start) <= e || be(n.start, s.end) <= e) && o++, (be(n.end, s.start) <= e || be(n.end, s.end) <= e) && i++);
|
|
4695
4729
|
let r = 0;
|
|
4696
4730
|
return o >= 1 && i >= 1 ? r = 5 : (o >= 1 || i >= 1) && (r = 2), { left: o, right: i, score: r };
|
|
4697
4731
|
}
|
|
4698
|
-
function
|
|
4732
|
+
function Gr(n, t) {
|
|
4699
4733
|
const e = [], { start: o, end: i } = n;
|
|
4700
4734
|
for (const a of t) {
|
|
4701
|
-
const { dist: l } =
|
|
4735
|
+
const { dist: l } = Un(a.x, a.y, o.x, o.y, i.x, i.y);
|
|
4702
4736
|
e.push(l);
|
|
4703
4737
|
}
|
|
4704
4738
|
const r = e.reduce((a, l) => a + l, 0) / e.length, s = e.reduce((a, l) => a + (l - r) ** 2, 0) / e.length;
|
|
4705
4739
|
return s < 0.01 ? 3 : s < 0.05 ? 2 : s < 0.1 ? 1 : 0;
|
|
4706
4740
|
}
|
|
4707
|
-
function
|
|
4741
|
+
function jr(n, t, e = 0.15) {
|
|
4708
4742
|
const o = n.end.x - n.start.x, i = n.end.y - n.start.y, r = Math.sqrt(o * o + i * i);
|
|
4709
4743
|
if (r < 1e-12) return 0;
|
|
4710
4744
|
const s = -i / r, a = o / r, l = [[], []];
|
|
4711
4745
|
for (let f = 0; f < 2; f++) {
|
|
4712
4746
|
const u = f === 0 ? n.start : n.end;
|
|
4713
|
-
for (const
|
|
4714
|
-
if (
|
|
4715
|
-
const w =
|
|
4747
|
+
for (const p of t) {
|
|
4748
|
+
if (p === n) continue;
|
|
4749
|
+
const w = be(u, p.start), x = be(u, p.end);
|
|
4716
4750
|
let P = null;
|
|
4717
|
-
if (w <= e ? P =
|
|
4718
|
-
const M =
|
|
4751
|
+
if (w <= e ? P = p.end : x <= e && (P = p.start), !P) continue;
|
|
4752
|
+
const M = p.end.x - p.start.x, m = p.end.y - p.start.y, d = Math.sqrt(M * M + m * m);
|
|
4719
4753
|
if (d < 1e-12 || Math.abs(o * M + i * m) / (r * d) >= 0.342) continue;
|
|
4720
4754
|
const b = (P.x - u.x) * s + (P.y - u.y) * a;
|
|
4721
4755
|
l[f].push(b > 0 ? 1 : -1);
|
|
@@ -4725,16 +4759,16 @@ function Hr(n, t, e = 0.15) {
|
|
|
4725
4759
|
const c = [...l[0], ...l[1]];
|
|
4726
4760
|
return c.every((f) => f === c[0]) ? 2 : 1;
|
|
4727
4761
|
}
|
|
4728
|
-
function
|
|
4729
|
-
const o =
|
|
4762
|
+
function Ur(n, t, e) {
|
|
4763
|
+
const o = $r(n, e), i = Gr(n, t), r = jr(n, e);
|
|
4730
4764
|
return { score: o.score * 3 + i * 2 + r * 2, details: { conn: o.score, variance: i, sameSide: r } };
|
|
4731
4765
|
}
|
|
4732
|
-
function
|
|
4766
|
+
function Zr(n) {
|
|
4733
4767
|
const t = n.end.x - n.start.x, e = n.end.y - n.start.y;
|
|
4734
4768
|
let o = Math.atan2(e, t) * (180 / Math.PI);
|
|
4735
4769
|
return o < 0 && (o += 180), o;
|
|
4736
4770
|
}
|
|
4737
|
-
function
|
|
4771
|
+
function Kr(n, t) {
|
|
4738
4772
|
const e = [];
|
|
4739
4773
|
for (const o of n) {
|
|
4740
4774
|
let i = !1;
|
|
@@ -4749,7 +4783,7 @@ function Gr(n, t) {
|
|
|
4749
4783
|
}
|
|
4750
4784
|
return e;
|
|
4751
4785
|
}
|
|
4752
|
-
function
|
|
4786
|
+
function Qr(n, t = 0.05) {
|
|
4753
4787
|
const e = [];
|
|
4754
4788
|
for (const o of n) {
|
|
4755
4789
|
let i = !1;
|
|
@@ -4762,7 +4796,7 @@ function jr(n, t = 0.05) {
|
|
|
4762
4796
|
}
|
|
4763
4797
|
return e;
|
|
4764
4798
|
}
|
|
4765
|
-
function
|
|
4799
|
+
function Jr(n, t, e, o, i) {
|
|
4766
4800
|
const r = [];
|
|
4767
4801
|
for (const a of n) {
|
|
4768
4802
|
const l = a.seg, c = (l.start.x - t.start.x) * e + (l.start.y - t.start.y) * o, h = (l.end.x - t.start.x) * e + (l.end.y - t.start.y) * o;
|
|
@@ -4780,11 +4814,11 @@ function Ur(n, t, e, o, i) {
|
|
|
4780
4814
|
}
|
|
4781
4815
|
return s;
|
|
4782
4816
|
}
|
|
4783
|
-
function
|
|
4817
|
+
function ti(n, t, e, o, i, r, s) {
|
|
4784
4818
|
const a = e - t, l = { ...n };
|
|
4785
4819
|
return l.start = { x: n.start.x + t * o, y: n.start.y + t * i, z: n.start.z }, l.end = { x: n.start.x + e * o, y: n.start.y + e * i, z: n.start.z }, l.length = a, l.direction = { x: o, y: i, z: 0 }, l.rooftopPz = r, l.buildRosource = s, l.isRebuild = !1, l.doorAndBeamData || (l.doorAndBeamData = []), l.insetionArr || (l.insetionArr = []), l;
|
|
4786
4820
|
}
|
|
4787
|
-
function
|
|
4821
|
+
function ei(n, t) {
|
|
4788
4822
|
let e = !0;
|
|
4789
4823
|
for (; e; ) {
|
|
4790
4824
|
e = !1;
|
|
@@ -4795,64 +4829,64 @@ function Kr(n, t) {
|
|
|
4795
4829
|
continue;
|
|
4796
4830
|
const a = Math.abs(r.end.x - s.start.x) < 1e-3 && Math.abs(r.end.y - s.start.y) < 1e-3, l = Math.abs(r.start.x - s.end.x) < 1e-3 && Math.abs(r.start.y - s.end.y) < 1e-3, c = Math.abs(r.end.x - s.end.x) < 1e-3 && Math.abs(r.end.y - s.end.y) < 1e-3, h = Math.abs(r.start.x - s.start.x) < 1e-3 && Math.abs(r.start.y - s.start.y) < 1e-3;
|
|
4797
4831
|
if (!(a || l || c || h) || r.direction.x * s.direction.x + r.direction.y * s.direction.y < 0.98) continue;
|
|
4798
|
-
let u = r.start,
|
|
4799
|
-
a ?
|
|
4800
|
-
const w = Math.hypot(
|
|
4801
|
-
x.start = u, x.end =
|
|
4832
|
+
let u = r.start, p = r.end;
|
|
4833
|
+
a ? p = s.end : l ? u = s.start : c ? p = s.start : h && (u = s.end);
|
|
4834
|
+
const w = Math.hypot(p.x - u.x, p.y - u.y), x = { ...r };
|
|
4835
|
+
x.start = u, x.end = p, x.length = w, x.direction = { x: (p.x - u.x) / w, y: (p.y - u.y) / w, z: 0 }, x.rooftopPz = r.rooftopPz !== void 0 ? r.rooftopPz : s.rooftopPz, x.buildRosource = r.buildRosource || s.buildRosource, x.isRebuild = !1, x.doorAndBeamData || (x.doorAndBeamData = []), x.insetionArr || (x.insetionArr = []), n[o] = x, t[o] = [.../* @__PURE__ */ new Set([...t[o], ...t[i]])], n.splice(i, 1), t.splice(i, 1), i--, e = !0;
|
|
4802
4836
|
}
|
|
4803
4837
|
}
|
|
4804
4838
|
return { segments: n, sourceMap: t };
|
|
4805
4839
|
}
|
|
4806
|
-
function
|
|
4840
|
+
function Zn(n, t = 5, e = 0.05) {
|
|
4807
4841
|
if (n.length <= 1)
|
|
4808
4842
|
return { segments: n, sourceMap: n.map((l, c) => [c]) };
|
|
4809
|
-
const o = n.map((l, c) => ({ seg: l, angle:
|
|
4843
|
+
const o = n.map((l, c) => ({ seg: l, angle: Zr(l), idx: c }));
|
|
4810
4844
|
o.sort((l, c) => l.angle - c.angle);
|
|
4811
|
-
const i =
|
|
4845
|
+
const i = Kr(o, t), r = [], s = [], a = [];
|
|
4812
4846
|
for (const l of i) {
|
|
4813
4847
|
let c = l[0].seg;
|
|
4814
4848
|
for (const M of l)
|
|
4815
4849
|
M.seg.length > c.length && (c = M.seg);
|
|
4816
4850
|
const h = c.end.x - c.start.x, f = c.end.y - c.start.y, u = Math.sqrt(h * h + f * f);
|
|
4817
4851
|
if (u < 1e-12) continue;
|
|
4818
|
-
const
|
|
4852
|
+
const p = -f / u, w = h / u, x = l.map((M) => {
|
|
4819
4853
|
const m = M.seg.start.x - c.start.x, d = M.seg.start.y - c.start.y;
|
|
4820
|
-
return { seg: M.seg, offset: Math.abs(m *
|
|
4854
|
+
return { seg: M.seg, offset: Math.abs(m * p + d * w), idx: M.idx };
|
|
4821
4855
|
});
|
|
4822
4856
|
x.sort((M, m) => M.offset - m.offset);
|
|
4823
|
-
const P =
|
|
4857
|
+
const P = Qr(x);
|
|
4824
4858
|
for (const M of P) {
|
|
4825
4859
|
let m = M[0].seg;
|
|
4826
|
-
for (const
|
|
4827
|
-
|
|
4828
|
-
const d = m.end.x - m.start.x,
|
|
4860
|
+
for (const T of M)
|
|
4861
|
+
T.seg.length > m.length && (m = T.seg);
|
|
4862
|
+
const d = m.end.x - m.start.x, g = m.end.y - m.start.y, b = Math.sqrt(d * d + g * g);
|
|
4829
4863
|
if (b < 1e-12) continue;
|
|
4830
|
-
const V = d / b, v =
|
|
4864
|
+
const V = d / b, v = g / b, S = M.map((T) => T.seg.rooftopPz ?? 0), z = Math.max(...S), D = [...new Set(S.map((T) => T.toFixed(3)))];
|
|
4831
4865
|
if (D.length > 1) {
|
|
4832
|
-
const
|
|
4833
|
-
idx:
|
|
4834
|
-
start: { x:
|
|
4835
|
-
end: { x:
|
|
4836
|
-
length:
|
|
4837
|
-
rooftopPz:
|
|
4866
|
+
const T = M.map((E) => ({
|
|
4867
|
+
idx: E.idx,
|
|
4868
|
+
start: { x: E.seg.start.x, y: E.seg.start.y, z: E.seg.start.z },
|
|
4869
|
+
end: { x: E.seg.end.x, y: E.seg.end.y, z: E.seg.end.z },
|
|
4870
|
+
length: E.seg.length,
|
|
4871
|
+
rooftopPz: E.seg.rooftopPz ?? 0
|
|
4838
4872
|
}));
|
|
4839
|
-
a.push({ values: [...D], segments:
|
|
4873
|
+
a.push({ values: [...D], segments: T });
|
|
4840
4874
|
}
|
|
4841
|
-
[...new Set(M.map((
|
|
4842
|
-
const _ =
|
|
4843
|
-
for (const { l:
|
|
4844
|
-
if (
|
|
4845
|
-
const O =
|
|
4875
|
+
[...new Set(M.map((T) => String(T.seg.buildRosource)))];
|
|
4876
|
+
const _ = Jr(M, m, V, v, e);
|
|
4877
|
+
for (const { l: T, r: E, srcIdxs: A } of _) {
|
|
4878
|
+
if (E - T < 0.01) continue;
|
|
4879
|
+
const O = ti(m, T, E, V, v, z, m.buildRosource);
|
|
4846
4880
|
r.push(O), s.push(A);
|
|
4847
4881
|
}
|
|
4848
4882
|
}
|
|
4849
4883
|
}
|
|
4850
4884
|
return {
|
|
4851
|
-
...
|
|
4885
|
+
...ei(r, s),
|
|
4852
4886
|
debugRPZGroups: a
|
|
4853
4887
|
};
|
|
4854
4888
|
}
|
|
4855
|
-
function
|
|
4889
|
+
function ni(n) {
|
|
4856
4890
|
return {
|
|
4857
4891
|
minLengthRatio: 0.95,
|
|
4858
4892
|
maxDistance: 0.5,
|
|
@@ -4862,7 +4896,7 @@ function Qr(n) {
|
|
|
4862
4896
|
...n
|
|
4863
4897
|
};
|
|
4864
4898
|
}
|
|
4865
|
-
function
|
|
4899
|
+
function oi(n, t, e) {
|
|
4866
4900
|
return [
|
|
4867
4901
|
{ x: t, y: e, z: 0 },
|
|
4868
4902
|
{ x: n[0].x, y: n[0].y, z: 0 },
|
|
@@ -4871,7 +4905,7 @@ function Jr(n, t, e) {
|
|
|
4871
4905
|
{ x: n[3].x, y: n[3].y, z: 0 }
|
|
4872
4906
|
];
|
|
4873
4907
|
}
|
|
4874
|
-
function
|
|
4908
|
+
function ri(n, t, e, o, i, r, s) {
|
|
4875
4909
|
const a = [
|
|
4876
4910
|
{ margin: r.projectionMargin, maxDist: r.maxDistance, label: "严格" },
|
|
4877
4911
|
{ margin: 0.4, maxDist: 0.65, label: "宽松" }
|
|
@@ -4883,19 +4917,19 @@ function ti(n, t, e, o, i, r, s) {
|
|
|
4883
4917
|
const f = t * r.minLengthRatio;
|
|
4884
4918
|
if (h.length < f)
|
|
4885
4919
|
continue;
|
|
4886
|
-
const { start: u, end:
|
|
4920
|
+
const { start: u, end: p } = h;
|
|
4887
4921
|
let w = !1, x = 1 / 0;
|
|
4888
4922
|
for (const S of i) {
|
|
4889
|
-
const { dist: z, t: D } =
|
|
4923
|
+
const { dist: z, t: D } = Un(S.x, S.y, u.x, u.y, p.x, p.y);
|
|
4890
4924
|
D >= -c.margin && D <= 1 + c.margin && z <= c.maxDist && (w = !0, x = Math.min(x, z));
|
|
4891
4925
|
}
|
|
4892
4926
|
if (!w) {
|
|
4893
4927
|
`${c.maxDist}${(-c.margin).toFixed(1)}${(1 + c.margin).toFixed(1)}`;
|
|
4894
4928
|
continue;
|
|
4895
4929
|
}
|
|
4896
|
-
const P = Math.sqrt((
|
|
4930
|
+
const P = Math.sqrt((p.x - u.x) ** 2 + (p.y - u.y) ** 2);
|
|
4897
4931
|
if (P < 1e-12) continue;
|
|
4898
|
-
const M = (
|
|
4932
|
+
const M = (p.x - u.x) / P, m = (p.y - u.y) / P, d = Math.abs(e * M + o * m), g = Math.abs(-o * M + e * m), b = Math.max(d, g), V = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
|
|
4899
4933
|
if (V > r.angleThreshold) {
|
|
4900
4934
|
`${V.toFixed(1)}${r.angleThreshold}`;
|
|
4901
4935
|
continue;
|
|
@@ -4904,7 +4938,7 @@ function ti(n, t, e, o, i, r, s) {
|
|
|
4904
4938
|
if (P > 0.01) {
|
|
4905
4939
|
const S = [];
|
|
4906
4940
|
for (let _ = 1; _ <= 4; _++) {
|
|
4907
|
-
const
|
|
4941
|
+
const T = i[_], E = T.x - u.x, A = T.y - u.y, O = (E * M + A * m) / P;
|
|
4908
4942
|
S.push(O);
|
|
4909
4943
|
}
|
|
4910
4944
|
const z = Math.min(...S), D = Math.max(...S);
|
|
@@ -4922,66 +4956,66 @@ function ti(n, t, e, o, i, r, s) {
|
|
|
4922
4956
|
}
|
|
4923
4957
|
return l;
|
|
4924
4958
|
}
|
|
4925
|
-
function
|
|
4959
|
+
function ii(n, t, e, o) {
|
|
4926
4960
|
if (n.length <= 1)
|
|
4927
4961
|
return n.length === 1 && (n[0].score = -1), n;
|
|
4928
4962
|
for (const i of n) {
|
|
4929
|
-
const { score: r, details: s } =
|
|
4963
|
+
const { score: r, details: s } = Ur(i.seg, t, e);
|
|
4930
4964
|
i.score = r, i.details = s;
|
|
4931
4965
|
}
|
|
4932
4966
|
return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
|
|
4933
4967
|
}
|
|
4934
|
-
function
|
|
4968
|
+
function si(n, t, e, o) {
|
|
4935
4969
|
const i = n.end.x - n.start.x, r = n.end.y - n.start.y, s = Math.sqrt(i * i + r * r), a = i / s, l = r / s, c = t.map((v) => {
|
|
4936
4970
|
const S = v.x - n.start.x, z = v.y - n.start.y;
|
|
4937
4971
|
return (S * a + z * l) / s;
|
|
4938
|
-
}), h = Math.min(...c), f = Math.max(...c), u = (f - h) * s,
|
|
4972
|
+
}), h = Math.min(...c), f = Math.max(...c), u = (f - h) * s, p = (h + f) / 2, w = n.start.x + p * i, x = n.start.y + p * r, P = e.box.min.z, M = e.box.max.z, m = Math.abs(M - P), d = jn(o, n.start.x, n.start.y), g = Math.max(0, P - d), b = h <= 0 && f >= 1, V = n.start.z + p * (n.end.z - n.start.z);
|
|
4939
4973
|
return {
|
|
4940
4974
|
p: { x: w, y: x, z: V },
|
|
4941
4975
|
width: u,
|
|
4942
4976
|
full: b,
|
|
4943
4977
|
height: m,
|
|
4944
|
-
groundClearance:
|
|
4978
|
+
groundClearance: g
|
|
4945
4979
|
};
|
|
4946
4980
|
}
|
|
4947
|
-
function
|
|
4948
|
-
var h, f, u,
|
|
4981
|
+
function Kn(n, t, e) {
|
|
4982
|
+
var h, f, u, p, w;
|
|
4949
4983
|
const o = t.map((x) => e[x]), i = [], r = [], s = [], a = [], l = [];
|
|
4950
4984
|
let c;
|
|
4951
4985
|
for (const x of o) {
|
|
4952
4986
|
if ((h = x.points) != null && h.length) for (const P of x.points) i.push(P);
|
|
4953
4987
|
if ((f = x.originalPoints) != null && f.length) for (const P of x.originalPoints) r.push(P);
|
|
4954
4988
|
if ((u = x.doorAndBeamData) != null && u.length) for (const P of x.doorAndBeamData) s.push(P);
|
|
4955
|
-
if ((
|
|
4989
|
+
if ((p = x.insetionArr) != null && p.length) for (const P of x.insetionArr) a.push(P);
|
|
4956
4990
|
if ((w = x.drawWindow) != null && w.length) for (const P of x.drawWindow) l.push(P);
|
|
4957
4991
|
x.boxData && !c && (c = x.boxData);
|
|
4958
4992
|
}
|
|
4959
4993
|
i.length && (n.points = i), r.length && (n.originalPoints = r), s.length && (n.doorAndBeamData = s), a.length && (n.insetionArr = a), l.length && (n.drawWindow = l), c && (n.boxData = c);
|
|
4960
4994
|
}
|
|
4961
|
-
function
|
|
4995
|
+
function ai(n, t, e) {
|
|
4962
4996
|
var l;
|
|
4963
|
-
const o =
|
|
4997
|
+
const o = ni(e), i = [], { segments: r, sourceMap: s } = Zn(t), a = r;
|
|
4964
4998
|
for (const c of n) {
|
|
4965
4999
|
const h = (l = c.coordinatesByArea) == null ? void 0 : l.coordinates;
|
|
4966
5000
|
if (!h || h.length < 4)
|
|
4967
5001
|
continue;
|
|
4968
|
-
const f = h.slice(0, 4), u = f.reduce((z, D) => z + D.x, 0) / 4,
|
|
5002
|
+
const f = h.slice(0, 4), u = f.reduce((z, D) => z + D.x, 0) / 4, p = f.reduce((z, D) => z + D.y, 0) / 4, { longSide: w, dirX: x, dirY: P } = Yr(f);
|
|
4969
5003
|
if (w < 0.01)
|
|
4970
5004
|
continue;
|
|
4971
|
-
const M = f.reduce((z, D) => z + D.z, 0) / 4, m =
|
|
5005
|
+
const M = f.reduce((z, D) => z + D.z, 0) / 4, m = jn(t, u, p);
|
|
4972
5006
|
if (M < m - 0.3)
|
|
4973
5007
|
continue;
|
|
4974
|
-
const d =
|
|
5008
|
+
const d = oi(f, u, p);
|
|
4975
5009
|
c.name;
|
|
4976
|
-
let
|
|
4977
|
-
|
|
5010
|
+
let g = ri(a, w, x, P, d, o, c.name);
|
|
5011
|
+
g = ii(g, d, t, c.name);
|
|
4978
5012
|
let b = null, V = 1 / 0, v = 0;
|
|
4979
|
-
if (
|
|
4980
|
-
const z =
|
|
5013
|
+
if (g.length > 0) {
|
|
5014
|
+
const z = g[0];
|
|
4981
5015
|
b = z.seg, V = z.minDist, v = z.ratio;
|
|
4982
5016
|
}
|
|
4983
5017
|
let S;
|
|
4984
|
-
if (b && (S =
|
|
5018
|
+
if (b && (S = si(b, f, c, r), !o.printOnly)) {
|
|
4985
5019
|
const z = b;
|
|
4986
5020
|
z.drawWindow || (z.drawWindow = []), z.drawWindow.push(S);
|
|
4987
5021
|
}
|
|
@@ -4999,18 +5033,18 @@ function oi(n, t, e) {
|
|
|
4999
5033
|
const h = c.wallSegment, f = r.indexOf(h);
|
|
5000
5034
|
if (f === -1) continue;
|
|
5001
5035
|
const u = s[f];
|
|
5002
|
-
!u || u.length <= 1 ||
|
|
5036
|
+
!u || u.length <= 1 || Kn(h, u, t);
|
|
5003
5037
|
}
|
|
5004
5038
|
return i;
|
|
5005
5039
|
}
|
|
5006
|
-
function
|
|
5040
|
+
function pi(n, t, e) {
|
|
5007
5041
|
const o = {
|
|
5008
5042
|
printOnly: !1,
|
|
5009
5043
|
...e
|
|
5010
|
-
}, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], r =
|
|
5044
|
+
}, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], r = ai(i, n, o), { segments: s, sourceMap: a } = Zn(n);
|
|
5011
5045
|
for (let c = 0; c < s.length; c++) {
|
|
5012
5046
|
const h = a[c];
|
|
5013
|
-
h &&
|
|
5047
|
+
h && Kn(s[c], h, n);
|
|
5014
5048
|
}
|
|
5015
5049
|
const l = new Set(r.map((c) => c.windowName));
|
|
5016
5050
|
for (const c of t)
|
|
@@ -5025,14 +5059,14 @@ function fi(n, t, e) {
|
|
|
5025
5059
|
return { segments: s, matches: r, sourceMap: a };
|
|
5026
5060
|
}
|
|
5027
5061
|
export {
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5062
|
+
cn as computeContour,
|
|
5063
|
+
jn as computeLocalFloorZ,
|
|
5064
|
+
ai as findWindowWalls,
|
|
5065
|
+
ui as getAllGeometry,
|
|
5066
|
+
fi as getBeamLine,
|
|
5067
|
+
di as getColLine,
|
|
5068
|
+
gi as getMergeMeaning,
|
|
5069
|
+
Zn as mergeCollinearSegments,
|
|
5070
|
+
pi as processData,
|
|
5071
|
+
hi as updateStEdPoint
|
|
5038
5072
|
};
|