rm-graphical-computing 1.0.64 → 1.0.66
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 +1217 -1107
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
var Qn = Object.defineProperty;
|
|
2
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
|
|
3
|
+
var Oe = (n, t, e) => Jn(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import * as y from "three";
|
|
5
|
-
import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as zt, Matrix3 as
|
|
5
|
+
import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as zt, Matrix3 as En, MathUtils as Ne, Box3 as oo, Matrix4 as Tn, Ray as ro } from "three";
|
|
6
6
|
function io(n, t = !1) {
|
|
7
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 u = 0;
|
|
9
9
|
for (let h = 0; h < n.length; ++h) {
|
|
10
|
-
const
|
|
10
|
+
const d = n[h];
|
|
11
11
|
let c = 0;
|
|
12
|
-
if (e !== (
|
|
12
|
+
if (e !== (d.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 f in d.attributes) {
|
|
15
|
+
if (!o.has(f))
|
|
16
|
+
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + f + '" attribute exists among all geometries, or in none of them.'), null;
|
|
17
|
+
r[f] === void 0 && (r[f] = []), r[f].push(d.attributes[f]), c++;
|
|
18
18
|
}
|
|
19
19
|
if (c !== 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
|
-
if (a !==
|
|
21
|
+
if (a !== d.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 f in d.morphAttributes) {
|
|
24
|
+
if (!i.has(f))
|
|
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[f] === void 0 && (s[f] = []), s[f].push(d.morphAttributes[f]);
|
|
27
27
|
}
|
|
28
28
|
if (t) {
|
|
29
|
-
let
|
|
29
|
+
let f;
|
|
30
30
|
if (e)
|
|
31
|
-
|
|
32
|
-
else if (
|
|
33
|
-
|
|
31
|
+
f = d.index.count;
|
|
32
|
+
else if (d.attributes.position !== void 0)
|
|
33
|
+
f = d.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(u,
|
|
36
|
+
l.addGroup(u, f, h), u += f;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (e) {
|
|
40
40
|
let h = 0;
|
|
41
|
-
const
|
|
41
|
+
const d = [];
|
|
42
42
|
for (let c = 0; c < n.length; ++c) {
|
|
43
|
-
const
|
|
44
|
-
for (let w = 0; w <
|
|
45
|
-
|
|
43
|
+
const f = n[c].index;
|
|
44
|
+
for (let w = 0; w < f.count; ++w)
|
|
45
|
+
d.push(f.getX(w) + h);
|
|
46
46
|
h += n[c].attributes.position.count;
|
|
47
47
|
}
|
|
48
|
-
l.setIndex(
|
|
48
|
+
l.setIndex(d);
|
|
49
49
|
}
|
|
50
50
|
for (const h in r) {
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
51
|
+
const d = Qe(r[h]);
|
|
52
|
+
if (!d)
|
|
53
53
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " attribute."), null;
|
|
54
|
-
l.setAttribute(h,
|
|
54
|
+
l.setAttribute(h, d);
|
|
55
55
|
}
|
|
56
56
|
for (const h in s) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
57
|
+
const d = s[h][0].length;
|
|
58
|
+
if (d === 0) break;
|
|
59
59
|
l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[h] = [];
|
|
60
|
-
for (let c = 0; c <
|
|
61
|
-
const
|
|
60
|
+
for (let c = 0; c < d; ++c) {
|
|
61
|
+
const f = [];
|
|
62
62
|
for (let x = 0; x < s[h].length; ++x)
|
|
63
|
-
|
|
64
|
-
const w = Qe(
|
|
63
|
+
f.push(s[h][x][c]);
|
|
64
|
+
const w = Qe(f);
|
|
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);
|
|
@@ -88,11 +88,11 @@ function Qe(n) {
|
|
|
88
88
|
for (let u = 0; u < n.length; ++u) {
|
|
89
89
|
const h = n[u];
|
|
90
90
|
if (h.isInterleavedBufferAttribute) {
|
|
91
|
-
const
|
|
92
|
-
for (let c = 0,
|
|
91
|
+
const d = l / e;
|
|
92
|
+
for (let c = 0, f = h.count; c < f; c++)
|
|
93
93
|
for (let w = 0; w < e; w++) {
|
|
94
94
|
const x = h.getComponent(c, w);
|
|
95
|
-
a.setComponent(c +
|
|
95
|
+
a.setComponent(c + d, w, x);
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
98
|
s.set(h.array, l);
|
|
@@ -108,8 +108,8 @@ const so = (n, t, e) => {
|
|
|
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, u = r * l - s * a;
|
|
110
110
|
if (Math.abs(u) < i) return null;
|
|
111
|
-
const h = ((e.x - n.x) * l - (e.y - n.y) * a) / u,
|
|
112
|
-
return h < -i || h > 1 + i ||
|
|
111
|
+
const h = ((e.x - n.x) * l - (e.y - n.y) * a) / u, d = ((e.x - n.x) * s - (e.y - n.y) * r) / u;
|
|
112
|
+
return h < -i || h > 1 + i || d < -i || d > 1 + i ? null : {
|
|
113
113
|
point: new y.Vector3(
|
|
114
114
|
n.x + h * r,
|
|
115
115
|
n.y + h * s,
|
|
@@ -128,26 +128,26 @@ const so = (n, t, e) => {
|
|
|
128
128
|
} = e, h = document.createElement("canvas").getContext("2d");
|
|
129
129
|
h.font = `bold ${o}px ${i}`;
|
|
130
130
|
const c = h.measureText(n).width;
|
|
131
|
-
let
|
|
131
|
+
let f = Math.min(c + a * 2, l), w = o + a * 2;
|
|
132
132
|
const x = document.createElement("canvas");
|
|
133
|
-
x.width =
|
|
133
|
+
x.width = f, x.height = w;
|
|
134
134
|
const P = x.getContext("2d");
|
|
135
|
-
P.fillStyle = r, P.fillRect(0, 0,
|
|
136
|
-
const M = new y.CanvasTexture(x),
|
|
135
|
+
P.fillStyle = r, P.fillRect(0, 0, f, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", c > l - a * 2 ? lo(P, n, f / 2, w / 2, l, o) : P.fillText(n, f / 2, w / 2);
|
|
136
|
+
const M = new y.CanvasTexture(x), g = new y.SpriteMaterial({
|
|
137
137
|
map: M,
|
|
138
138
|
depthTest: !1,
|
|
139
139
|
transparent: !0
|
|
140
|
-
}),
|
|
141
|
-
|
|
140
|
+
}), m = new y.Sprite(g);
|
|
141
|
+
m.position.set(t.x, t.y, t.z);
|
|
142
142
|
const p = 5e-3;
|
|
143
|
-
return
|
|
143
|
+
return m.scale.set(f * p, w * p, 1), m;
|
|
144
144
|
};
|
|
145
145
|
function lo(n, t, e, o, i, r) {
|
|
146
146
|
const s = t.split("");
|
|
147
147
|
let a = "", l = r * 1.2, u = o;
|
|
148
148
|
for (let h = 0; h < s.length; h++) {
|
|
149
|
-
const
|
|
150
|
-
n.measureText(
|
|
149
|
+
const d = a + s[h];
|
|
150
|
+
n.measureText(d).width > i && h > 0 ? (n.fillText(a, e, u), a = s[h], u += l) : a = d;
|
|
151
151
|
}
|
|
152
152
|
n.fillText(a, e, u);
|
|
153
153
|
}
|
|
@@ -169,69 +169,69 @@ const oe = (n, t, e = 0.01) => {
|
|
|
169
169
|
let r = [];
|
|
170
170
|
if (o && o.length && (r = o.map((z) => z.clone())), !i || i.length < 4) return {};
|
|
171
171
|
const s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = s.clone().cross(a).normalize();
|
|
172
|
-
let u = 1 / 0, h = -1 / 0,
|
|
172
|
+
let u = 1 / 0, h = -1 / 0, d = 1 / 0, c = -1 / 0;
|
|
173
173
|
for (const z of i) {
|
|
174
174
|
const v = z.dot(s), S = z.dot(a);
|
|
175
|
-
v < u && (u = v), v > h && (h = v), S <
|
|
175
|
+
v < u && (u = v), v > h && (h = v), S < d && (d = S), S > c && (c = S);
|
|
176
176
|
}
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
|
|
177
|
+
const f = i[0].dot(l), w = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(d)).add(l.clone().multiplyScalar(f)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f)), M = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(f));
|
|
178
|
+
let g = [w, x, P, M], m = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
|
|
179
|
+
m && m.parallel && (g = [w, M, P, x]);
|
|
180
180
|
let p = 0;
|
|
181
181
|
if (o.length > 0) {
|
|
182
|
-
const z = new y.Vector3().subVectors(
|
|
183
|
-
let D =
|
|
184
|
-
for (let O = 0; O <
|
|
185
|
-
let I =
|
|
186
|
-
for (let
|
|
187
|
-
let
|
|
182
|
+
const z = new y.Vector3().subVectors(g[1], g[0]).normalize(), v = z.clone().negate(), S = new y.Vector3().subVectors(g[3], g[0]).normalize(), V = S.clone().negate();
|
|
183
|
+
let D = g[0].distanceTo(g[1]), _ = g[0].distanceTo(g[3]), E = D / t, T = _ / e, A = 1e-3;
|
|
184
|
+
for (let O = 0; O < E; O++) {
|
|
185
|
+
let I = g[0], B = 0;
|
|
186
|
+
for (let L = 0; L < T; L++) {
|
|
187
|
+
let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
|
|
188
188
|
for (let X = 0; X < r.length; X++)
|
|
189
|
-
if (r[X].distanceTo(
|
|
189
|
+
if (r[X].distanceTo($) < A) {
|
|
190
190
|
B++;
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
193
|
-
I =
|
|
193
|
+
I = R;
|
|
194
194
|
}
|
|
195
|
-
if (B >=
|
|
195
|
+
if (B >= T / 2)
|
|
196
196
|
break;
|
|
197
|
-
p += B,
|
|
197
|
+
p += B, g[0] = g[0].addScaledVector(z, t), g[3] = g[3].addScaledVector(z, t);
|
|
198
198
|
}
|
|
199
|
-
D =
|
|
200
|
-
for (let O = 0; O <
|
|
201
|
-
let I =
|
|
202
|
-
for (let
|
|
203
|
-
let
|
|
199
|
+
D = g[0].distanceTo(g[1]), E = D / t;
|
|
200
|
+
for (let O = 0; O < E; O++) {
|
|
201
|
+
let I = g[1], B = 0;
|
|
202
|
+
for (let L = 0; L < T; L++) {
|
|
203
|
+
let N = I.clone().addScaledVector(v, t), C = N.clone().addScaledVector(S, e), R = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
|
|
204
204
|
for (let X = 0; X < r.length; X++)
|
|
205
|
-
if (r[X].distanceTo(
|
|
205
|
+
if (r[X].distanceTo($) < A) {
|
|
206
206
|
B++;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
|
-
I =
|
|
209
|
+
I = R;
|
|
210
210
|
}
|
|
211
|
-
if (B >=
|
|
211
|
+
if (B >= T / 2)
|
|
212
212
|
break;
|
|
213
|
-
p += B,
|
|
213
|
+
p += B, g[1] = g[1].addScaledVector(v, t), g[2] = g[2].addScaledVector(v, t);
|
|
214
214
|
}
|
|
215
|
-
D =
|
|
216
|
-
for (let O = 0; O <
|
|
217
|
-
let I =
|
|
218
|
-
for (let
|
|
219
|
-
let
|
|
215
|
+
D = g[0].distanceTo(g[1]), E = D / t;
|
|
216
|
+
for (let O = 0; O < T; O++) {
|
|
217
|
+
let I = g[3], B = 0;
|
|
218
|
+
for (let L = 0; L < E; L++) {
|
|
219
|
+
let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(V, e), R = I.clone().addScaledVector(V, e), $ = new y.Vector3().add(I).add(N).add(C).add(R).multiplyScalar(0.25);
|
|
220
220
|
for (let X = 0; X < r.length; X++)
|
|
221
|
-
if (r[X].distanceTo(
|
|
221
|
+
if (r[X].distanceTo($) < A) {
|
|
222
222
|
B++;
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
|
-
I =
|
|
225
|
+
I = N;
|
|
226
226
|
}
|
|
227
|
-
if (B >=
|
|
227
|
+
if (B >= E / 2)
|
|
228
228
|
break;
|
|
229
|
-
p += B,
|
|
229
|
+
p += B, g[2] = g[2].addScaledVector(V, e), g[3] = g[3].addScaledVector(V, e);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
const b =
|
|
232
|
+
const b = g[0].distanceTo(g[1]) * g[0].distanceTo(g[3]);
|
|
233
233
|
return {
|
|
234
|
-
facePoints:
|
|
234
|
+
facePoints: g,
|
|
235
235
|
boxArea: b,
|
|
236
236
|
totalInPlaneNum: p
|
|
237
237
|
};
|
|
@@ -264,17 +264,17 @@ const oe = (n, t, e = 0.01) => {
|
|
|
264
264
|
if (s === 0 || a === 0)
|
|
265
265
|
return { rate: NaN, angle: NaN, isPerpendicular: !1, isParallel: !1 };
|
|
266
266
|
i.normalize(), r.normalize();
|
|
267
|
-
const l = Math.abs(i.dot(r)), u = Math.min(1, Math.max(0, l)), h = Math.acos(u),
|
|
267
|
+
const l = Math.abs(i.dot(r)), u = Math.min(1, Math.max(0, l)), h = Math.acos(u), d = y.MathUtils.radToDeg(h), c = 1 - u;
|
|
268
268
|
return {
|
|
269
269
|
rate: c,
|
|
270
270
|
// 垂直率 0~1
|
|
271
271
|
percent: `${(c * 100).toFixed(2)}%`,
|
|
272
272
|
// 垂直率百分比
|
|
273
|
-
angle:
|
|
273
|
+
angle: d,
|
|
274
274
|
// 夹角(度,0~90)
|
|
275
|
-
isPerpendicular: Math.abs(
|
|
275
|
+
isPerpendicular: Math.abs(d - 90) < 0.01,
|
|
276
276
|
// 是否垂直
|
|
277
|
-
isParallel:
|
|
277
|
+
isParallel: d < 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 = {}) => {
|
|
@@ -284,9 +284,9 @@ const oe = (n, t, e = 0.01) => {
|
|
|
284
284
|
distanceThreshold: a = 2,
|
|
285
285
|
overlapThreshold: l = 0.01
|
|
286
286
|
// 投影重叠量大于此值才算 overlap
|
|
287
|
-
} = i, u = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e),
|
|
288
|
-
let
|
|
289
|
-
const w = Math.acos(Math.abs(
|
|
287
|
+
} = i, u = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e), d = u.clone().normalize(), c = h.clone().normalize();
|
|
288
|
+
let f = y.MathUtils.clamp(d.dot(c), -1, 1);
|
|
289
|
+
const w = Math.acos(Math.abs(f)), x = y.MathUtils.radToDeg(w);
|
|
290
290
|
if (w > r)
|
|
291
291
|
return {
|
|
292
292
|
type: "not_parallel",
|
|
@@ -297,22 +297,22 @@ const oe = (n, t, e = 0.01) => {
|
|
|
297
297
|
overlap: null,
|
|
298
298
|
closestDistance: null
|
|
299
299
|
};
|
|
300
|
-
|
|
301
|
-
const P = new y.Vector3().addVectors(
|
|
300
|
+
f < 0 && c.negate();
|
|
301
|
+
const P = new y.Vector3().addVectors(d, c).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), g = Je(e, M, d), m = Je(o, M, d), p = (g + m) / 2, b = Math.max(g, m), z = n.dot(P), v = t.dot(P), S = e.dot(P), V = o.dot(P), D = Math.min(z, v), _ = Math.max(z, v), E = Math.min(S, V), T = Math.max(S, V), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), L = B < 0 ? -B : 0, N = B > 0 ? B : 0, C = I > 0 ? N / I : 0, R = uo(
|
|
302
302
|
n,
|
|
303
303
|
t,
|
|
304
304
|
e,
|
|
305
305
|
o
|
|
306
|
-
),
|
|
306
|
+
), $ = w <= s && p < a;
|
|
307
307
|
let X;
|
|
308
|
-
return
|
|
308
|
+
return $ ? X = C > 0.5 ? "collinear_overlap" : "collinear_gap" : w <= r && (X = "parallel_offset"), {
|
|
309
309
|
type: X,
|
|
310
310
|
angleDeg: x,
|
|
311
311
|
avgPerpendicularDistance: p,
|
|
312
312
|
maxPerpendicularDistance: b,
|
|
313
|
-
gap:
|
|
314
|
-
overlap:
|
|
315
|
-
closestDistance:
|
|
313
|
+
gap: L,
|
|
314
|
+
overlap: N,
|
|
315
|
+
closestDistance: R
|
|
316
316
|
};
|
|
317
317
|
};
|
|
318
318
|
function Je(n, t, e) {
|
|
@@ -320,10 +320,10 @@ function Je(n, t, e) {
|
|
|
320
320
|
return new y.Vector3().subVectors(o, r).length();
|
|
321
321
|
}
|
|
322
322
|
function uo(n, t, e, o) {
|
|
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), u = r.dot(r), h = i.dot(s),
|
|
324
|
-
let
|
|
325
|
-
c < 1e-10 ? (
|
|
326
|
-
const x = n.clone().add(i.clone().multiplyScalar(
|
|
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), u = r.dot(r), h = i.dot(s), d = r.dot(s), c = a * u - l * l;
|
|
324
|
+
let f, w;
|
|
325
|
+
c < 1e-10 ? (f = 0, w = u !== 0 ? d / u : 0) : (f = (l * d - u * h) / c, w = (a * d - l * h) / c), f = y.MathUtils.clamp(f, 0, 1), w = u !== 0 ? y.MathUtils.clamp((l * f + d) / u, 0, 1) : 0, f = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
|
|
326
|
+
const x = n.clone().add(i.clone().multiplyScalar(f)), P = e.clone().add(r.clone().multiplyScalar(w));
|
|
327
327
|
return x.distanceTo(P);
|
|
328
328
|
}
|
|
329
329
|
const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ho = (n) => {
|
|
@@ -331,17 +331,17 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
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 u = new y.Line3(t, e);
|
|
334
|
-
const h = n.originalPoints,
|
|
334
|
+
const h = n.originalPoints, d = new y.Vector3();
|
|
335
335
|
for (let x = 0; x < h.length; x++) {
|
|
336
336
|
const P = h[x];
|
|
337
|
-
let
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
340
|
-
const p = l.get((
|
|
337
|
+
let g = u.closestPointToPoint(P, !0, d).distanceTo(P);
|
|
338
|
+
const m = Math.floor(g / a);
|
|
339
|
+
if (m < s) {
|
|
340
|
+
const p = l.get((m + 1) * a);
|
|
341
341
|
p.count++, P.z < p.minZ && (p.minZ = P.z), P.z > p.maxZ && (p.maxZ = P.z);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
let c,
|
|
344
|
+
let c, f, w = r / 2;
|
|
345
345
|
for (const [x, P] of l)
|
|
346
346
|
if (P.count >= w) {
|
|
347
347
|
c = P.minZ;
|
|
@@ -349,10 +349,10 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
349
349
|
}
|
|
350
350
|
for (const [x, P] of [...l.entries()].reverse())
|
|
351
351
|
if (P.count >= w) {
|
|
352
|
-
|
|
352
|
+
f = P.maxZ;
|
|
353
353
|
break;
|
|
354
354
|
}
|
|
355
|
-
return { minZ: c, maxZ:
|
|
355
|
+
return { minZ: c, maxZ: f };
|
|
356
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);
|
|
@@ -364,26 +364,26 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
364
364
|
});
|
|
365
365
|
let u = new y.Vector3(), h = new y.Vector3();
|
|
366
366
|
o.projectPoint(i, u), o.projectPoint(r, h);
|
|
367
|
-
const
|
|
367
|
+
const d = new y.Line3(u, h), c = [], f = [], w = [];
|
|
368
368
|
let x = new y.Vector3();
|
|
369
369
|
return a.forEach((P, M) => {
|
|
370
|
-
|
|
371
|
-
}), { newOriginalPoints: c, newProjectPoints: w, newOnLinePoints:
|
|
370
|
+
d.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (c.push(e[M]), f.push(l[M])) : w.push(P);
|
|
371
|
+
}), { newOriginalPoints: c, newProjectPoints: w, newOnLinePoints: f };
|
|
372
372
|
}, fo = (n) => {
|
|
373
373
|
function t(e, o, i, r, s, a, l, u, h) {
|
|
374
|
-
let
|
|
374
|
+
let d = new y.Line3(e, o), c = /* @__PURE__ */ new Map(), f = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let M = /* @__PURE__ */ new Map(),
|
|
377
|
-
for (let
|
|
378
|
-
if (!(h.checkResults[
|
|
379
|
-
for (let b = 0; b < h.checkResults[
|
|
380
|
-
if (c.has(
|
|
376
|
+
let M = /* @__PURE__ */ new Map(), g = 0;
|
|
377
|
+
for (let m = 0; m < h.checkResults.length; m++)
|
|
378
|
+
if (!(h.checkResults[m].allCenterPoints.length / u * 100 < 1))
|
|
379
|
+
for (let b = 0; b < h.checkResults[m].allCenterPoints.length; b++) {
|
|
380
|
+
if (c.has(m) && c.get(m).removePtsIndex.includes(b))
|
|
381
381
|
continue;
|
|
382
|
-
let z = h.checkResults[
|
|
382
|
+
let z = h.checkResults[m].allCenterPoints[b];
|
|
383
383
|
z = new y.Vector3(z.x, z.y, z.z);
|
|
384
|
-
let v =
|
|
385
|
-
Math.abs(S - s) < 0.01 && (
|
|
386
|
-
index:
|
|
384
|
+
let v = d.closestPointToPoint(z, !0, f), S = z.distanceTo(v);
|
|
385
|
+
Math.abs(S - s) < 0.01 && (g++, M.has(m) ? M.get(m).removePtsIndex.push(b) : M.set(m, {
|
|
386
|
+
index: m,
|
|
387
387
|
removePtsIndex: [b]
|
|
388
388
|
}));
|
|
389
389
|
}
|
|
@@ -391,22 +391,22 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
391
391
|
e = w, o = x;
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
|
-
if (
|
|
394
|
+
if (g < a / 20 * 18 || g == 0) {
|
|
395
395
|
M.clear(), l - P < 5 && (e = w, o = x, c.clear());
|
|
396
396
|
break;
|
|
397
397
|
} else {
|
|
398
398
|
P++;
|
|
399
|
-
for (const [
|
|
400
|
-
c.has(
|
|
401
|
-
M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r),
|
|
399
|
+
for (const [m, p] of M)
|
|
400
|
+
c.has(m) ? c.get(m).removePtsIndex.push(...p.removePtsIndex) : c.set(m, p);
|
|
401
|
+
M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), d.set(e, o);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
if (c.size > 0 && P != l)
|
|
405
|
-
for (const [M,
|
|
406
|
-
let
|
|
405
|
+
for (const [M, g] of c) {
|
|
406
|
+
let m = [], p = [];
|
|
407
407
|
for (let b = 0; b < h.checkResults[M].allCenterPoints.length; b++)
|
|
408
|
-
|
|
409
|
-
h.checkResults[M].allCenterPoints =
|
|
408
|
+
g.removePtsIndex.includes(b) || (m.push(h.checkResults[M].allCenterPoints[b]), p.push(h.checkResults[M].originalVertices[b]));
|
|
409
|
+
h.checkResults[M].allCenterPoints = m, h.checkResults[M].originalVertices = p;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -418,23 +418,23 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
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 [V, D, _,
|
|
422
|
-
V = new y.Vector3(V.x, V.y, V.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z),
|
|
423
|
-
let
|
|
421
|
+
let [V, D, _, E] = S;
|
|
422
|
+
V = new y.Vector3(V.x, V.y, V.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), E = new y.Vector3(E.x, E.y, E.z), i = V.distanceTo(D), r = V.distanceTo(E);
|
|
423
|
+
let T = new y.Vector3().subVectors(V, D).normalize(), A = oe(T, 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
|
-
const l = s.distanceTo(a), u = o.rooftopPz - o.start.z, h = Math.ceil(l / i),
|
|
430
|
-
let c = s.clone(),
|
|
429
|
+
const l = s.distanceTo(a), u = o.rooftopPz - o.start.z, h = Math.ceil(l / i), d = Math.ceil(u / r);
|
|
430
|
+
let c = s.clone(), f = a.clone(), w = f.clone().add(new y.Vector3(0, 0, u)), x = c.clone().add(new y.Vector3(0, 0, u)), P = new y.Vector3().subVectors(f, c).normalize(), M = P.clone().negate();
|
|
431
431
|
new y.Vector3().subVectors(w, c).normalize().clone().negate();
|
|
432
|
-
let
|
|
433
|
-
t(c, x, P, i,
|
|
434
|
-
const { newOriginalPoints: v } = ze(c,
|
|
432
|
+
let m = i / 2, p = l * u, b = i * r, z = p / b;
|
|
433
|
+
t(c, x, P, i, m, d, h, z, o), t(f, w, M, i, m, d, h, z, o), o.start = c, o.end = f;
|
|
434
|
+
const { newOriginalPoints: v } = ze(c, f, o.originalPoints);
|
|
435
435
|
o.originalPoints = v;
|
|
436
436
|
}
|
|
437
|
-
},
|
|
437
|
+
}, Lt = (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) => {
|
|
@@ -459,9 +459,9 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
|
|
|
459
459
|
class yo {
|
|
460
460
|
// 空白区域聚类结果
|
|
461
461
|
constructor() {
|
|
462
|
-
|
|
462
|
+
Oe(this, "results");
|
|
463
463
|
// 点分布分析结果
|
|
464
|
-
|
|
464
|
+
Oe(this, "clusterResults");
|
|
465
465
|
this.results = null;
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
@@ -520,7 +520,7 @@ class yo {
|
|
|
520
520
|
l[3].y,
|
|
521
521
|
l[3].z
|
|
522
522
|
// 左上
|
|
523
|
-
]),
|
|
523
|
+
]), d = [0, 1, 2, 0, 2, 3], c = new Float32Array([
|
|
524
524
|
0,
|
|
525
525
|
0,
|
|
526
526
|
// 左下
|
|
@@ -534,9 +534,9 @@ class yo {
|
|
|
534
534
|
1
|
|
535
535
|
// 左上
|
|
536
536
|
]);
|
|
537
|
-
u.setAttribute("position", new y.BufferAttribute(h, 3)), u.setAttribute("uv", new y.BufferAttribute(c, 2)), u.setIndex(
|
|
538
|
-
const
|
|
539
|
-
return s.add(x),
|
|
537
|
+
u.setAttribute("position", new y.BufferAttribute(h, 3)), u.setAttribute("uv", new y.BufferAttribute(c, 2)), u.setIndex(d), u.computeVertexNormals();
|
|
538
|
+
const f = new y.Mesh(u, r), w = new y.EdgesGeometry(u), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
|
|
539
|
+
return s.add(x), f;
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
542
|
* 将一面墙体按 rows×cols 细分成小格 Mesh,每格存入 wallGroup。
|
|
@@ -549,31 +549,31 @@ class yo {
|
|
|
549
549
|
const s = [];
|
|
550
550
|
if (!t || !t.start || !t.end || isNaN(t.rooftopPz))
|
|
551
551
|
return s;
|
|
552
|
-
const a = new y.Vector3(t.start.x, t.start.y, t.start.z), l = new y.Vector3(t.end.x, t.end.y, t.end.z), u = new y.Vector3(t.end.x, t.end.y, t.rooftopPz), h = new y.Vector3(t.start.x, t.start.y, t.rooftopPz),
|
|
553
|
-
for (let
|
|
554
|
-
if (!this.isValidVector3(g
|
|
555
|
-
return console.error(`墙体基础点${
|
|
556
|
-
const c = a.distanceTo(l),
|
|
557
|
-
if (c === 0 ||
|
|
552
|
+
const a = new y.Vector3(t.start.x, t.start.y, t.start.z), l = new y.Vector3(t.end.x, t.end.y, t.end.z), u = new y.Vector3(t.end.x, t.end.y, t.rooftopPz), h = new y.Vector3(t.start.x, t.start.y, t.rooftopPz), d = [a, l, u, h];
|
|
553
|
+
for (let g = 0; g < d.length; g++)
|
|
554
|
+
if (!this.isValidVector3(d[g]))
|
|
555
|
+
return console.error(`墙体基础点${g}无效:`, d[g]), s;
|
|
556
|
+
const c = a.distanceTo(l), f = Math.abs(t.rooftopPz - t.start.z);
|
|
557
|
+
if (c === 0 || f === 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 = c / o, x =
|
|
560
|
-
for (let
|
|
561
|
-
for (let
|
|
559
|
+
const w = c / o, x = f / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
|
|
560
|
+
for (let g = 0; g < e; g++)
|
|
561
|
+
for (let m = 0; m < o; m++)
|
|
562
562
|
try {
|
|
563
|
-
const p = new y.Vector3().copy(a).add(P.clone().multiplyScalar(
|
|
563
|
+
const p = new y.Vector3().copy(a).add(P.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar(g * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar(g * x)), z = new y.Vector3().copy(a).add(P.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar((g + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar((g + 1) * x)), S = {
|
|
564
564
|
points: [p, b, z, v],
|
|
565
565
|
userData: {}
|
|
566
566
|
};
|
|
567
567
|
S.userData = {
|
|
568
568
|
type: "wallSegment",
|
|
569
|
-
row:
|
|
570
|
-
col:
|
|
569
|
+
row: g,
|
|
570
|
+
col: m,
|
|
571
571
|
originalMaterial: i,
|
|
572
572
|
width: w,
|
|
573
573
|
height: x
|
|
574
574
|
}, s.push(S);
|
|
575
575
|
} catch (p) {
|
|
576
|
-
console.error(`创建墙体小平面(${
|
|
576
|
+
console.error(`创建墙体小平面(${g}, ${m})时出错:`, p);
|
|
577
577
|
}
|
|
578
578
|
return s;
|
|
579
579
|
}
|
|
@@ -814,8 +814,8 @@ class yo {
|
|
|
814
814
|
evaluateSegmentByArea(t, e, o, i) {
|
|
815
815
|
if (e === 0) return !1;
|
|
816
816
|
const r = t.area, s = t.minRequiredPoints, a = t.expectedDensity, l = e / Math.max(r, 1e-3), u = e >= s, h = l >= a * 0.3;
|
|
817
|
-
let
|
|
818
|
-
return r < 0.5 && e > 0 && (
|
|
817
|
+
let d = !0;
|
|
818
|
+
return r < 0.5 && e > 0 && (d = this.checkSmallAreaDistribution(t, o, i)), u && h && d;
|
|
819
819
|
}
|
|
820
820
|
checkSmallAreaDistribution(t, e, o) {
|
|
821
821
|
if (e.length < 2) return !0;
|
|
@@ -873,21 +873,21 @@ class yo {
|
|
|
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}`, [u, h,
|
|
876
|
+
const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [u, h, d, c] = s.vertices, f = new y.Vector3().subVectors(h, u).normalize(), w = new y.Vector3().subVectors(c, u).normalize(), x = u.distanceTo(h), P = u.distanceTo(c), M = new y.Plane();
|
|
877
877
|
M.setFromCoplanarPoints(u, h, c);
|
|
878
|
-
const
|
|
878
|
+
const g = x / 2, m = P / 2;
|
|
879
879
|
for (let p = 0; p < e.length; p++)
|
|
880
880
|
this.isPointInWallSegmentOptimized(
|
|
881
881
|
e[p],
|
|
882
882
|
a,
|
|
883
883
|
M,
|
|
884
884
|
u,
|
|
885
|
-
|
|
885
|
+
f,
|
|
886
886
|
w,
|
|
887
887
|
x,
|
|
888
888
|
P,
|
|
889
|
-
|
|
890
|
-
|
|
889
|
+
g,
|
|
890
|
+
m,
|
|
891
891
|
o
|
|
892
892
|
) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(p));
|
|
893
893
|
}
|
|
@@ -911,14 +911,14 @@ class yo {
|
|
|
911
911
|
}), this.results.analysisTime = performance.now() - i, this.printAnalysisResults(), this.results;
|
|
912
912
|
}
|
|
913
913
|
// 优化后的判断函数(移出重复计算)
|
|
914
|
-
isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, u, h,
|
|
915
|
-
if (Math.abs(o.distanceToPoint(t)) >
|
|
914
|
+
isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, u, h, d) {
|
|
915
|
+
if (Math.abs(o.distanceToPoint(t)) > d)
|
|
916
916
|
return !1;
|
|
917
|
-
const
|
|
917
|
+
const f = new y.Vector3().subVectors(t, e), w = Math.abs(f.dot(r)), x = Math.abs(f.dot(s));
|
|
918
918
|
if (w > u && x > h)
|
|
919
919
|
return !1;
|
|
920
|
-
const P = new y.Vector3().subVectors(t, i), M = P.dot(r),
|
|
921
|
-
return
|
|
920
|
+
const P = new y.Vector3().subVectors(t, i), M = P.dot(r), g = P.dot(s), m = M >= -d && M <= a + d, p = g >= -d && g <= l + d;
|
|
921
|
+
return m && p;
|
|
922
922
|
}
|
|
923
923
|
// 判断点是否在细分墙体平面内
|
|
924
924
|
isPointInWallSegment(t, e, o, i = 0.1) {
|
|
@@ -935,10 +935,10 @@ class yo {
|
|
|
935
935
|
const [r, s, a, l] = t, u = new y.Plane();
|
|
936
936
|
if (u.setFromCoplanarPoints(r, s, l), Math.abs(u.distanceToPoint(e)) > i)
|
|
937
937
|
return !1;
|
|
938
|
-
const
|
|
939
|
-
new y.Vector3().crossVectors(
|
|
940
|
-
const
|
|
941
|
-
return
|
|
938
|
+
const d = new y.Vector3().subVectors(s, r).normalize(), c = new y.Vector3().subVectors(l, r).normalize();
|
|
939
|
+
new y.Vector3().crossVectors(d, c).normalize();
|
|
940
|
+
const f = new y.Vector3().subVectors(e, r), w = f.dot(d), x = f.dot(c), P = r.distanceTo(s), M = r.distanceTo(l), g = w >= -i && w <= P + i, m = x >= -i && x <= M + i;
|
|
941
|
+
return g && m && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
|
|
942
942
|
}
|
|
943
943
|
// 优化顶点获取(添加缓存)
|
|
944
944
|
getWorldVertices(t) {
|
|
@@ -1006,7 +1006,7 @@ class yo {
|
|
|
1006
1006
|
// }
|
|
1007
1007
|
// 高亮没有点的平面并进行聚类
|
|
1008
1008
|
highlightEmptySegments(t, e, o, i = 1) {
|
|
1009
|
-
var
|
|
1009
|
+
var d;
|
|
1010
1010
|
if (!this.results) {
|
|
1011
1011
|
console.warn("请先运行分析函数");
|
|
1012
1012
|
return;
|
|
@@ -1020,9 +1020,9 @@ class yo {
|
|
|
1020
1020
|
});
|
|
1021
1021
|
}), t.forEach((c) => {
|
|
1022
1022
|
if (c.userData && c.userData.type === "wallSegment") {
|
|
1023
|
-
const
|
|
1023
|
+
const f = `row${c.userData.row}_col${c.userData.col}`, w = r.has(f);
|
|
1024
1024
|
s.has(c.userData.row) || s.set(c.userData.row, /* @__PURE__ */ new Map()), s.get(c.userData.row).has(c.userData.col) || s.get(c.userData.row).set(c.userData.col, {
|
|
1025
|
-
segmentKey:
|
|
1025
|
+
segmentKey: f,
|
|
1026
1026
|
isEmpty: w,
|
|
1027
1027
|
visited: !1
|
|
1028
1028
|
});
|
|
@@ -1038,15 +1038,15 @@ class yo {
|
|
|
1038
1038
|
[-1, 0]
|
|
1039
1039
|
// 上
|
|
1040
1040
|
];
|
|
1041
|
-
for (const [c,
|
|
1042
|
-
const w = (
|
|
1041
|
+
for (const [c, f] of r) {
|
|
1042
|
+
const w = (d = s.get(f.row)) == null ? void 0 : d.get(f.col);
|
|
1043
1043
|
if (w && !w.visited) {
|
|
1044
|
-
const x = [], P = [[
|
|
1044
|
+
const x = [], P = [[f.row, f.col]];
|
|
1045
1045
|
for (w.visited = !0; P.length > 0; ) {
|
|
1046
|
-
const [M,
|
|
1047
|
-
r.has(
|
|
1046
|
+
const [M, g] = P.shift(), m = `row${M}_col${g}`;
|
|
1047
|
+
r.has(m) && x.push(r.get(m));
|
|
1048
1048
|
for (const [p, b] of l) {
|
|
1049
|
-
const z = M + p, v =
|
|
1049
|
+
const z = M + p, v = g + b;
|
|
1050
1050
|
if (s.has(z) && s.get(z).has(v)) {
|
|
1051
1051
|
const S = s.get(z).get(v);
|
|
1052
1052
|
!S.visited && S.isEmpty && (S.visited = !0, P.push([z, v]));
|
|
@@ -1058,7 +1058,7 @@ class yo {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
const u = this.createClusterMaterials(a.length), h = [];
|
|
1060
1060
|
return this.clusterResults = {
|
|
1061
|
-
clusters: a.sort((c,
|
|
1061
|
+
clusters: a.sort((c, f) => f.length - c.length),
|
|
1062
1062
|
highlightedMeshes: h,
|
|
1063
1063
|
clusterMaterials: u,
|
|
1064
1064
|
totalClusters: a.length,
|
|
@@ -1078,15 +1078,15 @@ class yo {
|
|
|
1078
1078
|
for (let x = i; x <= r; x++)
|
|
1079
1079
|
t.has(u) && t.get(u).has(x) || (h = !1);
|
|
1080
1080
|
h && s++;
|
|
1081
|
-
const
|
|
1081
|
+
const d = i;
|
|
1082
1082
|
let c = !0;
|
|
1083
1083
|
for (let x = e; x <= o; x++)
|
|
1084
|
-
t.has(x) && t.get(x).has(
|
|
1084
|
+
t.has(x) && t.get(x).has(d) || (c = !1);
|
|
1085
1085
|
c && s++;
|
|
1086
|
-
const
|
|
1086
|
+
const f = 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(f) || (w = !1);
|
|
1090
1090
|
return w && s++, s / 4;
|
|
1091
1091
|
}
|
|
1092
1092
|
// 计算聚类质量分数
|
|
@@ -1096,19 +1096,19 @@ class yo {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
// 计算严格的聚类边界尺寸(基于实际几何)
|
|
1098
1098
|
calculateStrictClusterBounds(t) {
|
|
1099
|
-
var
|
|
1099
|
+
var d, c;
|
|
1100
1100
|
if (t.length === 0) return { width: 0, height: 0 };
|
|
1101
1101
|
const e = [];
|
|
1102
|
-
if (t.forEach((
|
|
1103
|
-
|
|
1102
|
+
if (t.forEach((f) => {
|
|
1103
|
+
f.vertices && f.vertices.length > 0 && e.push(...f.vertices);
|
|
1104
1104
|
}), e.length === 0) {
|
|
1105
|
-
const
|
|
1105
|
+
const f = [...new Set(t.map((x) => x.row))];
|
|
1106
1106
|
return {
|
|
1107
|
-
width: [...new Set(t.map((x) => x.col))].length * (((
|
|
1108
|
-
height:
|
|
1107
|
+
width: [...new Set(t.map((x) => x.col))].length * (((d = t[0].bounds) == null ? void 0 : d.width) || 1),
|
|
1108
|
+
height: f.length * (((c = t[0].bounds) == null ? void 0 : c.height) || 1)
|
|
1109
1109
|
};
|
|
1110
1110
|
}
|
|
1111
|
-
const o = Math.min(...e.map((
|
|
1111
|
+
const o = Math.min(...e.map((f) => f.x)), i = Math.max(...e.map((f) => f.x)), r = Math.min(...e.map((f) => f.y)), s = Math.max(...e.map((f) => f.y)), a = Math.min(...e.map((f) => f.z)), l = Math.max(...e.map((f) => f.z)), u = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
|
|
1112
1112
|
return { width: u, height: h };
|
|
1113
1113
|
}
|
|
1114
1114
|
// 创建不同颜色的聚类材质
|
|
@@ -1182,8 +1182,8 @@ class yo {
|
|
|
1182
1182
|
if (o.userData && o.userData.type === "wallSegment") {
|
|
1183
1183
|
const i = this.getWorldVertices(o);
|
|
1184
1184
|
if (i.length < 4) return;
|
|
1185
|
-
const r = new y.Vector3().add(i[0]).add(i[1]).add(i[2]).add(i[3]).multiplyScalar(0.25), s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = new y.Vector3().crossVectors(s, a).normalize(), u = new y.ArrowHelper(l, r, 0.3, 16711680), h = new y.ArrowHelper(s, r, 0.2, 65280),
|
|
1186
|
-
e.add(u), e.add(h), e.add(
|
|
1185
|
+
const r = new y.Vector3().add(i[0]).add(i[1]).add(i[2]).add(i[3]).multiplyScalar(0.25), s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = new y.Vector3().crossVectors(s, a).normalize(), u = new y.ArrowHelper(l, r, 0.3, 16711680), h = new y.ArrowHelper(s, r, 0.2, 65280), d = new y.ArrowHelper(a, r, 0.2, 255);
|
|
1186
|
+
e.add(u), e.add(h), e.add(d);
|
|
1187
1187
|
}
|
|
1188
1188
|
}), e;
|
|
1189
1189
|
}
|
|
@@ -1232,7 +1232,7 @@ const xo = (n) => {
|
|
|
1232
1232
|
o.applyAxisAngle(e, Math.PI / 2);
|
|
1233
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
|
+
}, yi = (n, t, e = !0) => {
|
|
1236
1236
|
let o = [];
|
|
1237
1237
|
if (!n)
|
|
1238
1238
|
return [];
|
|
@@ -1248,21 +1248,21 @@ const xo = (n) => {
|
|
|
1248
1248
|
const V = new zt();
|
|
1249
1249
|
l.projectPoint(v, V), u.push(V);
|
|
1250
1250
|
});
|
|
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)),
|
|
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)), d = Math.abs(r.rooftopPz - r.start.z), c = 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
|
+
}), f = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, d), M = w.createSubdividedWallPlane(r, P, x, c, f);
|
|
1258
1258
|
w.analyzePointDistribution(M, u, 0.01);
|
|
1259
|
-
const
|
|
1259
|
+
const g = new y.MeshBasicMaterial({
|
|
1260
1260
|
color: "black",
|
|
1261
1261
|
transparent: !0,
|
|
1262
1262
|
opacity: 0.8,
|
|
1263
1263
|
side: y.DoubleSide
|
|
1264
|
-
}),
|
|
1265
|
-
for (const v of
|
|
1264
|
+
}), m = w.highlightEmptySegments(M, g, f), p = [];
|
|
1265
|
+
for (const v of m.clusters) {
|
|
1266
1266
|
const S = xo(v);
|
|
1267
1267
|
S && p.push(S);
|
|
1268
1268
|
}
|
|
@@ -1270,12 +1270,12 @@ const xo = (n) => {
|
|
|
1270
1270
|
r.checkResults = p, r.verticalDirection = z, r.originaIndex = i, o.push(r);
|
|
1271
1271
|
}
|
|
1272
1272
|
return o;
|
|
1273
|
-
},
|
|
1273
|
+
}, xi = (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
|
-
o.originalPoints.forEach((
|
|
1278
|
-
let p = new y.Vector3(
|
|
1277
|
+
o.originalPoints.forEach((m) => {
|
|
1278
|
+
let p = new y.Vector3(m.x, m.y, 0), b = !1;
|
|
1279
1279
|
for (let z = 0; z < i.length; z++)
|
|
1280
1280
|
if (kt(p, i[z], 0.01)) {
|
|
1281
1281
|
b = !0;
|
|
@@ -1284,29 +1284,29 @@ const xo = (n) => {
|
|
|
1284
1284
|
b || i.push(p);
|
|
1285
1285
|
});
|
|
1286
1286
|
const r = Math.round(Math.max(5, Math.min(350, 20 * Math.sqrt(o.length)))), s = 1;
|
|
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), u = new y.Vector3().subVectors(l, a).normalize(), h = u.clone().cross(new y.Vector3(0, 0, 1)).normalize(),
|
|
1288
|
-
const
|
|
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), u = new y.Vector3().subVectors(l, a).normalize(), h = u.clone().cross(new y.Vector3(0, 0, 1)).normalize(), d = h.clone().negate(), c = [];
|
|
1288
|
+
const f = [];
|
|
1289
1289
|
let w = o.length / r;
|
|
1290
1290
|
console.log(w);
|
|
1291
|
-
for (let
|
|
1291
|
+
for (let m = 0; m < r; m++) {
|
|
1292
1292
|
const p = [];
|
|
1293
|
-
p.push(a.clone().addScaledVector(h, s)), p.push(p[0].clone().addScaledVector(u, w)), p.push(p[1].clone().addScaledVector(
|
|
1293
|
+
p.push(a.clone().addScaledVector(h, s)), p.push(p[0].clone().addScaledVector(u, w)), p.push(p[1].clone().addScaledVector(d, s * 2)), p.push(a.clone().addScaledVector(d, w));
|
|
1294
1294
|
let b = [];
|
|
1295
1295
|
for (let z = 0; z < i.length; z++)
|
|
1296
1296
|
c.includes(z) || Po(i[z], p) && (c.push(z), b.push(i[z]));
|
|
1297
|
-
b.length > 0 &&
|
|
1297
|
+
b.length > 0 && f.push(Mo(b)), a = a.addScaledVector(u, w);
|
|
1298
1298
|
}
|
|
1299
1299
|
const x = new Float32Array(i.length * 3);
|
|
1300
|
-
i.forEach((
|
|
1301
|
-
x[p * 3] =
|
|
1300
|
+
i.forEach((m, p) => {
|
|
1301
|
+
x[p * 3] = m.x, x[p * 3 + 1] = m.y, x[p * 3 + 2] = m.z;
|
|
1302
1302
|
});
|
|
1303
1303
|
const P = new y.BufferGeometry();
|
|
1304
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,
|
|
1305
|
+
const [M, g] = vo(f, {
|
|
1306
1306
|
plane: "xy",
|
|
1307
1307
|
trimRatio: 0
|
|
1308
1308
|
});
|
|
1309
|
-
so(M,
|
|
1309
|
+
so(M, g, t);
|
|
1310
1310
|
}
|
|
1311
1311
|
};
|
|
1312
1312
|
function en(n, t = "xy") {
|
|
@@ -1403,54 +1403,54 @@ function vo(n, t = {}) {
|
|
|
1403
1403
|
r /= i.length, s /= i.length, a /= i.length;
|
|
1404
1404
|
let l = 0, u = 0, h = 0;
|
|
1405
1405
|
for (const B of i) {
|
|
1406
|
-
const
|
|
1407
|
-
l +=
|
|
1406
|
+
const L = B.x - r, N = B.y - s;
|
|
1407
|
+
l += L * L, u += L * N, h += N * N;
|
|
1408
1408
|
}
|
|
1409
1409
|
l /= i.length, u /= i.length, h /= i.length;
|
|
1410
|
-
const
|
|
1411
|
-
x: -
|
|
1412
|
-
y:
|
|
1413
|
-
},
|
|
1410
|
+
const d = So(l, u, h), c = {
|
|
1411
|
+
x: -d.y,
|
|
1412
|
+
y: d.x
|
|
1413
|
+
}, f = [];
|
|
1414
1414
|
for (const B of i) {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1415
|
+
const L = B.x - r, N = B.y - s, C = L * d.x + N * d.y, R = L * c.x + N * c.y;
|
|
1416
|
+
f.push({
|
|
1417
1417
|
s: C,
|
|
1418
|
-
t:
|
|
1418
|
+
t: R,
|
|
1419
1419
|
up: B.up
|
|
1420
1420
|
});
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1423
|
-
const w =
|
|
1422
|
+
f.sort((B, L) => B.s - L.s);
|
|
1423
|
+
const w = f.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[
|
|
1426
|
+
const M = f[x], g = f[P], m = (() => {
|
|
1427
|
+
const B = f.map((N) => N.t).sort((N, C) => N - C), L = Math.floor(B.length / 2);
|
|
1428
|
+
return B.length % 2 === 0 ? (B[L - 1] + B[L]) * 0.5 : B[L];
|
|
1429
1429
|
})(), p = (() => {
|
|
1430
|
-
const B =
|
|
1431
|
-
return B.length % 2 === 0 ? (B[
|
|
1432
|
-
})(), b = M.s, z =
|
|
1430
|
+
const B = f.map((N) => N.up).sort((N, C) => N - C), L = Math.floor(B.length / 2);
|
|
1431
|
+
return B.length % 2 === 0 ? (B[L - 1] + B[L]) * 0.5 : B[L];
|
|
1432
|
+
})(), b = M.s, z = g.s, v = m, S = m, V = p, D = p, _ = r + d.x * b + c.x * v, E = s + d.y * b + c.y * v, T = r + d.x * z + c.x * S, A = s + d.y * z + c.y * S, O = nn(_, E, V, e), I = nn(T, A, D, e);
|
|
1433
1433
|
return [O, I];
|
|
1434
1434
|
}
|
|
1435
|
-
const
|
|
1435
|
+
const wi = async (n, t, e, o, i) => {
|
|
1436
1436
|
if (o && o.length > 0)
|
|
1437
|
-
for (let
|
|
1438
|
-
const p = o[
|
|
1437
|
+
for (let m = 0; m < o.length; m++) {
|
|
1438
|
+
const p = o[m];
|
|
1439
1439
|
p.isLine2 = !0, n.push(p);
|
|
1440
1440
|
}
|
|
1441
1441
|
if (fo(n), n.length <= 0 || t.length <= 0)
|
|
1442
1442
|
return n;
|
|
1443
1443
|
e || (e = []);
|
|
1444
|
-
for (const
|
|
1444
|
+
for (const m of n) {
|
|
1445
1445
|
let p = [];
|
|
1446
|
-
if (!(!
|
|
1447
|
-
for (let b = 0; b <
|
|
1446
|
+
if (!(!m.checkResults || m.checkResults.length <= 0)) {
|
|
1447
|
+
for (let b = 0; b < m.checkResults.length; b++) {
|
|
1448
1448
|
let D = function(A) {
|
|
1449
1449
|
for (; V[A] !== A; )
|
|
1450
1450
|
V[A] = V[V[A]], A = V[A];
|
|
1451
1451
|
return A;
|
|
1452
1452
|
};
|
|
1453
|
-
const z =
|
|
1453
|
+
const z = m.checkResults[b];
|
|
1454
1454
|
if (z.isDoor = !1, !z.originalVertices || z.originalVertices.length == 0)
|
|
1455
1455
|
continue;
|
|
1456
1456
|
const v = [];
|
|
@@ -1464,13 +1464,13 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1464
1464
|
for (let A = 0; A < S; A++)
|
|
1465
1465
|
for (let O = A + 1; O < S; O++) {
|
|
1466
1466
|
const I = v[A], B = v[O];
|
|
1467
|
-
if (I.some((
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1467
|
+
if (I.some((N) => B.some((C) => N.equals(C)))) {
|
|
1468
|
+
const N = D(A), C = D(O);
|
|
1469
|
+
N !== C && (V[N] = C);
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
1472
|
const _ = /* @__PURE__ */ new Map();
|
|
1473
|
-
let
|
|
1473
|
+
let E = -1, T = -1;
|
|
1474
1474
|
for (let A = 0; A < S; A++) {
|
|
1475
1475
|
const O = D(A);
|
|
1476
1476
|
_.has(O) || _.set(O, {
|
|
@@ -1483,25 +1483,25 @@ const fi = 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
|
|
1490
|
-
|
|
1491
|
-
let X = oe(
|
|
1492
|
-
X && X.parallel && ([
|
|
1486
|
+
let [B, L, N, C] = v[A];
|
|
1487
|
+
const R = new y.Vector3().add(B).add(L).add(N).add(C).multiplyScalar(0.25);
|
|
1488
|
+
if (I.points.push(...v[A]), I.area += B.distanceTo(L) * B.distanceTo(C), I.originalVertices.push(v[A]), I.index = b, I.centerPts.push(R), E == -1 || T == -1) {
|
|
1489
|
+
let $ = new y.Vector3().subVectors(B, L).normalize();
|
|
1490
|
+
T = B.distanceTo(C), E = B.distanceTo(L);
|
|
1491
|
+
let X = oe($, new y.Vector3(0, 0, 1));
|
|
1492
|
+
X && X.parallel && ([T, E] = [E, T]);
|
|
1493
1493
|
}
|
|
1494
|
-
I.gridWidth =
|
|
1494
|
+
I.gridWidth = E, I.gridHeight = T;
|
|
1495
1495
|
}
|
|
1496
1496
|
p.push(..._.values());
|
|
1497
1497
|
}
|
|
1498
|
-
|
|
1498
|
+
m.mergeCheckRegion = p;
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
1501
|
let r = /* @__PURE__ */ new Map();
|
|
1502
|
-
for (const
|
|
1503
|
-
if (
|
|
1504
|
-
let p =
|
|
1502
|
+
for (const m of n) {
|
|
1503
|
+
if (m.length < 0.3) continue;
|
|
1504
|
+
let p = m.rooftopPz - m.start.z, b = Math.floor(m.rooftopPz - m.start.z);
|
|
1505
1505
|
r.has(b) ? r.set(b, {
|
|
1506
1506
|
num: r.get(b).num + 1,
|
|
1507
1507
|
totalHeight: r.get(b).totalHeight + p
|
|
@@ -1511,12 +1511,12 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
1513
1513
|
let s = [...r.entries()].reduce(
|
|
1514
|
-
(
|
|
1514
|
+
(m, p) => p[1].num > m[1].num ? p : m
|
|
1515
1515
|
);
|
|
1516
1516
|
s[0], s[1].totalHeight / s[1].num;
|
|
1517
1517
|
const a = [];
|
|
1518
|
-
for (let
|
|
1519
|
-
const p = e[
|
|
1518
|
+
for (let m = 0; m < e.length; m++) {
|
|
1519
|
+
const p = e[m];
|
|
1520
1520
|
if (p.isFindBeam = !1, p.category == "door") {
|
|
1521
1521
|
let b = [];
|
|
1522
1522
|
p.coordinatesByArea.coordinates.forEach((D) => {
|
|
@@ -1531,15 +1531,15 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1531
1531
|
boxPoints: b,
|
|
1532
1532
|
minZ: p.coordinatesByArea.heightData.minZ,
|
|
1533
1533
|
maxZ: p.coordinatesByArea.heightData.maxZ,
|
|
1534
|
-
index:
|
|
1534
|
+
index: m,
|
|
1535
1535
|
isFind: !1,
|
|
1536
1536
|
inWall: !1
|
|
1537
1537
|
//是否在墙内
|
|
1538
1538
|
});
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
|
-
for (let
|
|
1542
|
-
const p = a[
|
|
1541
|
+
for (let m = 0; m < a.length; m++) {
|
|
1542
|
+
const p = a[m];
|
|
1543
1543
|
for (let b = 0; b < n.length; b++) {
|
|
1544
1544
|
if (n[b].length < 0.5) continue;
|
|
1545
1545
|
let z = [];
|
|
@@ -1548,25 +1548,25 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1548
1548
|
let S = !1;
|
|
1549
1549
|
const V = p.boxPoints.length;
|
|
1550
1550
|
for (let D = 0; D < z.length; D++) {
|
|
1551
|
-
const _ = z[D].x,
|
|
1552
|
-
for (let
|
|
1553
|
-
const O = p.boxPoints[
|
|
1554
|
-
I >
|
|
1551
|
+
const _ = z[D].x, E = z[D].y;
|
|
1552
|
+
for (let T = 0, A = V - 1; T < V; A = T++) {
|
|
1553
|
+
const O = p.boxPoints[T].x, I = p.boxPoints[T].y, B = p.boxPoints[A].x, L = p.boxPoints[A].y;
|
|
1554
|
+
I > E != L > E && _ < (B - O) * (E - I) / (L - 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(
|
|
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), E = p.doorStartPt.distanceTo(p.doorEndPt), T = D.distanceTo(_), A = Jt(p.doorStartPt, p.doorEndPt, D, _);
|
|
1560
|
+
if (Math.abs(T - E) < 0.5 && A && A.angleDeg < 15) {
|
|
1561
1561
|
p.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), p.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
|
|
1562
1562
|
break;
|
|
1563
|
-
} else if (Math.abs(
|
|
1564
|
-
let O = ne(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_),
|
|
1563
|
+
} else if (Math.abs(T - E) > 1.3 && A && A.angleDeg < 15) {
|
|
1564
|
+
let O = ne(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_), L = p.doorEndPt.distanceTo(D), N = p.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || L < 0.2 || N < 0.2;
|
|
1565
1565
|
if (O && O.type == "collinear_overlap" && O.maxPerpendicularDistance < 0.1 && !C) {
|
|
1566
1566
|
p.inWall = !0;
|
|
1567
1567
|
break;
|
|
1568
1568
|
} else {
|
|
1569
|
-
let
|
|
1569
|
+
let R = new y.Line3(D, _), $ = R.closestPointToPoint(p.doorStartPt, !0, new y.Vector3()), X = R.closestPointToPoint(p.doorEndPt, !0, new y.Vector3()), ot = $.distanceTo(p.doorStartPt), K = X.distanceTo(p.doorEndPt);
|
|
1570
1570
|
if (ot < 0.1 || K < 0.1) {
|
|
1571
1571
|
p.inWall = !0;
|
|
1572
1572
|
break;
|
|
@@ -1577,11 +1577,11 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1577
1577
|
continue;
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
let l = 0, u = [], h = [],
|
|
1580
|
+
let l = 0, u = [], h = [], d = [];
|
|
1581
1581
|
const c = [];
|
|
1582
|
-
let
|
|
1583
|
-
for (let
|
|
1584
|
-
const p = n[
|
|
1582
|
+
let f = 0.15;
|
|
1583
|
+
for (let m = 0; m < n.length; m++) {
|
|
1584
|
+
const p = n[m];
|
|
1585
1585
|
if (p.noDetection || (p.doorAndBeamData = [], !p.mergeCheckRegion || p.mergeCheckRegion.length == 0))
|
|
1586
1586
|
continue;
|
|
1587
1587
|
p.completePointAreaPercentage = -1;
|
|
@@ -1591,34 +1591,34 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1591
1591
|
b.min.z;
|
|
1592
1592
|
const v = new y.Vector3(p.start.x, p.start.y, p.start.z), S = new y.Vector3(p.end.x, p.end.y, p.end.z);
|
|
1593
1593
|
let V = p.rooftopPz - p.start.z, D = 0;
|
|
1594
|
-
for (const
|
|
1595
|
-
const { facePoints:
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1594
|
+
for (const E of p.mergeCheckRegion) {
|
|
1595
|
+
const { facePoints: T, boxArea: A, totalInPlaneNum: O } = co(
|
|
1596
|
+
E.points,
|
|
1597
|
+
E.gridWidth,
|
|
1598
|
+
E.gridHeight,
|
|
1599
|
+
E.centerPts
|
|
1600
1600
|
);
|
|
1601
|
-
if (!
|
|
1601
|
+
if (!T || T.length <= 0)
|
|
1602
1602
|
continue;
|
|
1603
|
-
|
|
1604
|
-
let I =
|
|
1605
|
-
const B =
|
|
1606
|
-
let
|
|
1607
|
-
const C = new y.Line3(
|
|
1608
|
-
let
|
|
1609
|
-
|
|
1610
|
-
C.closestPointToPoint(rt, !0,
|
|
1603
|
+
T[0].distanceTo(T[1]);
|
|
1604
|
+
let I = T[0].distanceTo(T[3]);
|
|
1605
|
+
const B = E.gridHeight * (I / E.gridHeight / 3 * 2) + E.gridHeight / 2;
|
|
1606
|
+
let L = new y.Vector3(T[0].x, T[0].y, T[0].z + B), N = new y.Vector3(T[1].x, T[1].y, T[1].z + B);
|
|
1607
|
+
const C = new y.Line3(L, N), R = [];
|
|
1608
|
+
let $ = new y.Vector3();
|
|
1609
|
+
E.points.forEach((rt) => {
|
|
1610
|
+
C.closestPointToPoint(rt, !0, $).distanceTo(rt) < E.gridHeight + 0.01 && R.push(rt);
|
|
1611
1611
|
});
|
|
1612
1612
|
let X = [], ot = [];
|
|
1613
1613
|
for (; ; ) {
|
|
1614
1614
|
let rt = [];
|
|
1615
|
-
for (let F = 0; F <
|
|
1616
|
-
ot.includes(F) || rt.length == 0 && (rt.push(
|
|
1617
|
-
for (let F = 0; F <
|
|
1615
|
+
for (let F = 0; F < R.length; F++)
|
|
1616
|
+
ot.includes(F) || rt.length == 0 && (rt.push(R[F]), ot.push(F));
|
|
1617
|
+
for (let F = 0; F < R.length; F++)
|
|
1618
1618
|
if (!ot.includes(F)) {
|
|
1619
|
-
for (let
|
|
1620
|
-
if (
|
|
1621
|
-
rt.push(
|
|
1619
|
+
for (let H = 0; H < rt.length; H++)
|
|
1620
|
+
if (R[F].distanceTo(rt[H]) < E.gridWidth + 0.01) {
|
|
1621
|
+
rt.push(R[F]), ot.push(F), F = -1;
|
|
1622
1622
|
break;
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
@@ -1633,31 +1633,31 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1633
1633
|
lineEd: new y.Vector3(),
|
|
1634
1634
|
facePoints: []
|
|
1635
1635
|
};
|
|
1636
|
-
let
|
|
1637
|
-
Array.isArray(
|
|
1636
|
+
let H = Se(X[rt]);
|
|
1637
|
+
Array.isArray(H) && H.length == 2 && (F.lineSt = H[0], F.lineEd = H[1], F.facePoints.push(new y.Vector3(H[0].x, H[0].y, T[0].z)), F.facePoints.push(new y.Vector3(H[1].x, H[1].y, T[0].z)), F.facePoints.push(new y.Vector3(H[1].x, H[1].y, T[2].z)), F.facePoints.push(new y.Vector3(H[0].x, H[0].y, T[2].z)), K.push(F));
|
|
1638
1638
|
}
|
|
1639
|
-
D +=
|
|
1639
|
+
D += E.area;
|
|
1640
1640
|
let G = 0;
|
|
1641
|
-
if (O != 0 && (G =
|
|
1641
|
+
if (O != 0 && (G = E.gridHeight * E.gridWidth * O), (E.area - G) / A * 100 > 70 && K.length == 1 || K.length > 1)
|
|
1642
1642
|
for (let rt = 0; rt < K.length; rt++) {
|
|
1643
1643
|
const F = K[rt];
|
|
1644
|
-
let
|
|
1645
|
-
if (Mt < 1.5 || z < F.facePoints[2].z ||
|
|
1644
|
+
let H = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = H / p.length * 100, qt = p.rooftopPz - F.facePoints[2].z;
|
|
1645
|
+
if (Mt < 1.5 || z < F.facePoints[2].z || qt > V / 3 * 2)
|
|
1646
1646
|
continue;
|
|
1647
|
-
let
|
|
1647
|
+
let Rt = !1, _t = !1, Et = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), W = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Nt = !1, Tt = -1;
|
|
1648
1648
|
if (Math.abs(F.facePoints[0].z - p.start.z) < 0.25) {
|
|
1649
|
-
if (
|
|
1650
|
-
let
|
|
1649
|
+
if (H > 0.17 && p.length > 0.5) {
|
|
1650
|
+
let Wt = Lt(v, W), J = Lt(v, j), ct = Lt(S, W), q = Lt(S, j);
|
|
1651
1651
|
const bt = 0.1, Vt = 10;
|
|
1652
|
-
if (
|
|
1653
|
-
const { newOriginalPoints: Ut } = ze(
|
|
1652
|
+
if (Wt < bt || J < bt) {
|
|
1653
|
+
const { newOriginalPoints: Ut } = ze(W, j, p.originalPoints), at = [];
|
|
1654
1654
|
if (Ut.forEach((Q) => {
|
|
1655
|
-
Q.z >= tt.z ? at.push(Q) : Q.z <=
|
|
1655
|
+
Q.z >= tt.z ? at.push(Q) : Q.z <= W.z;
|
|
1656
1656
|
}), at.length > 10) {
|
|
1657
1657
|
const Q = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), Pt = new y.Vector3().subVectors(Q, gt).normalize();
|
|
1658
1658
|
let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
|
|
1659
1659
|
for (let U = 0; U < n.length; U++) {
|
|
1660
|
-
if (U ==
|
|
1660
|
+
if (U == m) continue;
|
|
1661
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
1662
|
let St = re(Q, gt, it, dt);
|
|
1663
1663
|
if (Ct != null) {
|
|
@@ -1671,8 +1671,8 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1671
1671
|
continue;
|
|
1672
1672
|
}
|
|
1673
1673
|
if (St && St.angle > 85) {
|
|
1674
|
-
const
|
|
1675
|
-
let pt = Jt(Q, gt,
|
|
1674
|
+
const Y = new y.Line3(it, dt).closestPointToPoint(Q, !0, Gt);
|
|
1675
|
+
let pt = Jt(Q, gt, Y, Q);
|
|
1676
1676
|
if (!pt || pt.direction != "same") continue;
|
|
1677
1677
|
const et = Q.clone().addScaledVector(Pt, Vt), st = gt.clone().addScaledVector(Pt.clone().negate(), Vt);
|
|
1678
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);
|
|
@@ -1681,8 +1681,8 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1681
1681
|
let Xt = Q.distanceTo(wt.point);
|
|
1682
1682
|
Xt < ht && (ht = Xt, Z = U);
|
|
1683
1683
|
} else if (St && St.angle < 5) {
|
|
1684
|
-
const At = new y.Vector3(
|
|
1685
|
-
let pt =
|
|
1684
|
+
const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
|
|
1685
|
+
let pt = Lt(At, it), et = Lt(At, dt), st = Lt(Y, it), xt = Lt(Y, dt), vt = Jt(Q, gt, it, At), Bt = !1;
|
|
1686
1686
|
for (let wt = 0; wt < n[U].checkResults.length; wt++) {
|
|
1687
1687
|
let Xt = [];
|
|
1688
1688
|
for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
|
|
@@ -1691,10 +1691,10 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1691
1691
|
n[U].checkResults[wt].allCenterPoints[Kt].y,
|
|
1692
1692
|
0
|
|
1693
1693
|
));
|
|
1694
|
-
let
|
|
1695
|
-
if (
|
|
1696
|
-
let Kt =
|
|
1697
|
-
if (Kt < 0.2 ||
|
|
1694
|
+
let $t = Se(Xt);
|
|
1695
|
+
if ($t.length == 2) {
|
|
1696
|
+
let Kt = Lt(At, $t[0]), Le = Lt(At, $t[1]), Re = Lt(Y, $t[0]), Fe = Lt(Y, $t[1]);
|
|
1697
|
+
if (Kt < 0.2 || Le < 0.2 || Re < 0.2 || Fe < 0.2) {
|
|
1698
1698
|
Bt = !0;
|
|
1699
1699
|
break;
|
|
1700
1700
|
}
|
|
@@ -1706,26 +1706,26 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
1709
|
-
if (ht != 1 / 0 && ht < 2 && (p.length -
|
|
1710
|
-
n[Z].length > 0.25 &&
|
|
1709
|
+
if (ht != 1 / 0 && ht < 2 && (p.length - H > 0.2 || p.length - H < 0.02) && ht < H * 3)
|
|
1710
|
+
n[Z].length > 0.25 && H + ht > 0.5 && (Nt = !0, Wt < bt ? (lt = lt.addScaledVector(Pt, ht), W = W.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
|
|
1711
1711
|
else {
|
|
1712
|
-
if (!k && !ft && p.length -
|
|
1712
|
+
if (!k && !ft && p.length - H > 0.1)
|
|
1713
1713
|
continue;
|
|
1714
|
-
if (!k && !ft && p.length -
|
|
1714
|
+
if (!k && !ft && p.length - H < 0.1 && p.length < 1.8)
|
|
1715
1715
|
continue;
|
|
1716
1716
|
}
|
|
1717
1717
|
} else
|
|
1718
1718
|
continue;
|
|
1719
1719
|
}
|
|
1720
|
-
if (ct < bt ||
|
|
1721
|
-
const { newOriginalPoints: Ut } = ze(
|
|
1720
|
+
if (ct < bt || q < bt) {
|
|
1721
|
+
const { newOriginalPoints: Ut } = ze(W, j, p.originalPoints), at = [];
|
|
1722
1722
|
if (Ut.forEach((Q) => {
|
|
1723
|
-
Q.z >= tt.z ? at.push(Q) : Q.z <=
|
|
1723
|
+
Q.z >= tt.z ? at.push(Q) : Q.z <= W.z;
|
|
1724
1724
|
}), at.length > 10) {
|
|
1725
1725
|
const Q = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), Pt = new y.Vector3().subVectors(gt, Q).normalize();
|
|
1726
1726
|
let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
|
|
1727
1727
|
for (let U = 0; U < n.length; U++) {
|
|
1728
|
-
if (U ==
|
|
1728
|
+
if (U == m) continue;
|
|
1729
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
1730
|
let St = re(Q, gt, it, dt);
|
|
1731
1731
|
if (Ct != null) {
|
|
@@ -1736,8 +1736,8 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1736
1736
|
continue;
|
|
1737
1737
|
}
|
|
1738
1738
|
if (St && St.angle > 85) {
|
|
1739
|
-
const
|
|
1740
|
-
let pt = Jt(gt, Q,
|
|
1739
|
+
const Y = new y.Line3(it, dt).closestPointToPoint(gt, !0, Gt);
|
|
1740
|
+
let pt = Jt(gt, Q, Y, gt);
|
|
1741
1741
|
if (!pt || pt.direction != "same") continue;
|
|
1742
1742
|
const et = Q.clone().addScaledVector(Pt.clone().negate(), Vt), st = gt.clone().addScaledVector(Pt, Vt);
|
|
1743
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);
|
|
@@ -1746,8 +1746,8 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1746
1746
|
let Xt = gt.distanceTo(wt.point);
|
|
1747
1747
|
Xt < ht && (ht = Xt, Z = U);
|
|
1748
1748
|
} else if (St && St.angle < 5) {
|
|
1749
|
-
const At = new y.Vector3(
|
|
1750
|
-
let pt =
|
|
1749
|
+
const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
|
|
1750
|
+
let pt = Lt(At, it), et = Lt(At, dt), st = Lt(Y, it), xt = Lt(Y, dt), vt = Jt(gt, Q, it, At), Bt = !1;
|
|
1751
1751
|
for (let wt = 0; wt < n[U].checkResults.length; wt++) {
|
|
1752
1752
|
let Xt = [];
|
|
1753
1753
|
for (let Kt = 0; Kt < n[U].checkResults[wt].allCenterPoints.length; Kt++)
|
|
@@ -1756,10 +1756,10 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1756
1756
|
n[U].checkResults[wt].allCenterPoints[Kt].y,
|
|
1757
1757
|
0
|
|
1758
1758
|
));
|
|
1759
|
-
let
|
|
1760
|
-
if (
|
|
1761
|
-
let Kt =
|
|
1762
|
-
if (Kt < 0.2 ||
|
|
1759
|
+
let $t = Se(Xt);
|
|
1760
|
+
if ($t.length == 2) {
|
|
1761
|
+
let Kt = Lt(At, $t[0]), Le = Lt(At, $t[1]), Re = Lt(Y, $t[0]), Fe = Lt(Y, $t[1]);
|
|
1762
|
+
if (Kt < 0.2 || Le < 0.2 || Re < 0.2 || Fe < 0.2) {
|
|
1763
1763
|
Bt = !0;
|
|
1764
1764
|
break;
|
|
1765
1765
|
}
|
|
@@ -1771,146 +1771,146 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
|
-
if (ht != 1 / 0 && ht < 2 && (p.length -
|
|
1775
|
-
n[Z].length > 0.25 &&
|
|
1774
|
+
if (ht != 1 / 0 && ht < 2 && (p.length - H > 0.2 || p.length - H < 0.02) && ht < H * 3)
|
|
1775
|
+
n[Z].length > 0.25 && H + ht > 0.5 && (Nt = !0, ct < bt ? (lt = lt.addScaledVector(Pt, ht), W = W.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
|
|
1776
1776
|
else {
|
|
1777
|
-
if (!k && !ft && p.length -
|
|
1777
|
+
if (!k && !ft && p.length - H > 0.1)
|
|
1778
1778
|
continue;
|
|
1779
|
-
if (!k && !ft && p.length -
|
|
1779
|
+
if (!k && !ft && p.length - H < 0.1 && p.length < 1.8)
|
|
1780
1780
|
continue;
|
|
1781
1781
|
}
|
|
1782
1782
|
} else
|
|
1783
1783
|
continue;
|
|
1784
1784
|
}
|
|
1785
|
-
|
|
1785
|
+
H = lt.distanceTo(tt);
|
|
1786
1786
|
}
|
|
1787
|
-
if (Zt < 85 &&
|
|
1788
|
-
let
|
|
1787
|
+
if (Zt < 85 && H > 0.3 || H > 0.7 && Mt > V - V / 3) {
|
|
1788
|
+
let Wt = !1;
|
|
1789
1789
|
for (let J = 0; J < t.length; J++) {
|
|
1790
1790
|
let ct = J + 1;
|
|
1791
1791
|
if (ct >= t.length)
|
|
1792
1792
|
continue;
|
|
1793
|
-
let
|
|
1793
|
+
let q = 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
1794
|
if (te(
|
|
1795
|
-
new y.Vector3(
|
|
1795
|
+
new y.Vector3(q.x, q.y, 0),
|
|
1796
1796
|
new y.Vector3(bt.x, bt.y, 0),
|
|
1797
1797
|
new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0),
|
|
1798
1798
|
new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0),
|
|
1799
1799
|
0.1
|
|
1800
1800
|
) != null) {
|
|
1801
|
-
|
|
1801
|
+
Wt = !0;
|
|
1802
1802
|
break;
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
1805
|
for (let J = 0; J < a.length; J++) {
|
|
1806
|
-
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0),
|
|
1806
|
+
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), q = 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
1807
|
if (Math.abs(F.facePoints[2].z - a[J].maxZ) > 0.2, Ut) {
|
|
1808
|
-
let at = ne(ct.clone(),
|
|
1808
|
+
let at = ne(ct.clone(), q.clone(), bt.clone(), Vt.clone(), {
|
|
1809
1809
|
distanceThreshold: 2
|
|
1810
1810
|
});
|
|
1811
1811
|
if (at && at.type == "collinear_gap") {
|
|
1812
|
-
let Q = ee(ct,
|
|
1812
|
+
let Q = ee(ct, q), gt = new y.Line3(new y.Vector3(p.start.x, p.start.y, 0), new y.Vector3(p.end.x, p.end.y, 0)), Pt = new y.Vector3(), Gt = gt.closestPointToPoint(Q, !0, Pt);
|
|
1813
1813
|
if (Q.distanceTo(Gt) < 0.15) {
|
|
1814
1814
|
let Z = bt.distanceTo(ct), k = Vt.distanceTo(ct);
|
|
1815
1815
|
if (Z > 0.25 && k > 0.25) {
|
|
1816
|
-
let it = bt.distanceTo(
|
|
1816
|
+
let it = bt.distanceTo(q), dt = Vt.distanceTo(q);
|
|
1817
1817
|
if (it > 0.2 && dt > 0.2)
|
|
1818
1818
|
continue;
|
|
1819
1819
|
}
|
|
1820
|
-
_t = !0,
|
|
1821
|
-
let ft = new y.Vector3().subVectors(bt, Vt).normalize(), U = ct.distanceTo(
|
|
1822
|
-
k < Z && ft.negate(), Z > k ? (tt = F.facePoints[2].clone().addScaledVector(ft, U), lt = F.facePoints[3].clone(),
|
|
1820
|
+
_t = !0, Et = !0, Ft.push(a[J].index), a[J].isFind = !0, Tt = J, e[a[J].index].isFindBeam = !0;
|
|
1821
|
+
let ft = new y.Vector3().subVectors(bt, Vt).normalize(), U = ct.distanceTo(q) - at.overlap;
|
|
1822
|
+
k < Z && ft.negate(), Z > k ? (tt = F.facePoints[2].clone().addScaledVector(ft, U), lt = F.facePoints[3].clone(), W = lt.clone(), j = tt.clone(), W.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(ft, U), W = lt.clone(), j = tt.clone(), W.z = j.z = F.facePoints[0].z);
|
|
1823
1823
|
}
|
|
1824
1824
|
} else if (at && at.type == "collinear_overlap" && at.maxPerpendicularDistance < 0.35) {
|
|
1825
|
-
let Q = bt.distanceTo(Vt), gt =
|
|
1825
|
+
let Q = bt.distanceTo(Vt), gt = q.distanceTo(ct);
|
|
1826
1826
|
if (Math.abs(Q - at.overlap) < 0.25 || Math.abs(gt - at.overlap) < 0.25) {
|
|
1827
1827
|
if (gt > Q && Math.abs(gt - at.overlap) > 1) {
|
|
1828
|
-
let Pt = bt.distanceTo(ct), Gt = bt.distanceTo(
|
|
1829
|
-
k < ft ? (U.negate(), tt = F.facePoints[2].clone().addScaledVector(U, it), lt = F.facePoints[3].clone(),
|
|
1828
|
+
let Pt = bt.distanceTo(ct), Gt = bt.distanceTo(q), ht = Vt.distanceTo(ct), Z = Vt.distanceTo(q), 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(), W = lt.clone(), j = tt.clone(), W.z = j.z = F.facePoints[0].z) : (tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone().addScaledVector(U, it), W = lt.clone(), j = tt.clone(), W.z = j.z = F.facePoints[0].z);
|
|
1830
1830
|
}
|
|
1831
|
-
_t = !0,
|
|
1831
|
+
_t = !0, Et = !0, Ft.push(a[J].index), a[J].isFind = !0, e[a[J].index].isFindBeam = !0, Tt = J;
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
if (!
|
|
1836
|
+
if (!Et && H < 1.5)
|
|
1837
1837
|
for (let J = 0; J < a.length; J++) {
|
|
1838
1838
|
if (a[J].inWall) continue;
|
|
1839
|
-
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0),
|
|
1840
|
-
(ft <
|
|
1839
|
+
let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), q = 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, q).normalize(), at = new y.Vector3().subVectors(bt, Vt).normalize(), Q = 0.25, gt = ct.clone().addScaledVector(Ut, Q), Pt = q.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 = q.distanceTo(bt), dt = q.distanceTo(Vt);
|
|
1840
|
+
(ft < f || U < f || it < f || dt < f || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Tt = J);
|
|
1841
1841
|
}
|
|
1842
|
-
(_t ||
|
|
1842
|
+
(_t || Wt || Math.abs(Mt - V) > 0.1 && Mt > V / 2 && H > 0.3) && (Rt = !0);
|
|
1843
1843
|
}
|
|
1844
1844
|
}
|
|
1845
|
-
if (
|
|
1846
|
-
let
|
|
1847
|
-
for (let Z = 0; Z <
|
|
1848
|
-
let k = ne(
|
|
1845
|
+
if (Rt) {
|
|
1846
|
+
let Wt = !1;
|
|
1847
|
+
for (let Z = 0; Z < d.length; Z++) {
|
|
1848
|
+
let k = ne(d[Z].start, d[Z].end, W, j);
|
|
1849
1849
|
if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < 0.01) {
|
|
1850
|
-
|
|
1850
|
+
Wt = !0;
|
|
1851
1851
|
break;
|
|
1852
1852
|
}
|
|
1853
1853
|
}
|
|
1854
|
-
if (
|
|
1855
|
-
|
|
1854
|
+
if (Wt) {
|
|
1855
|
+
Tt != -1 && (e[a[Tt].index].isFindBeam = !1, a[Tt].isFind = !1);
|
|
1856
1856
|
continue;
|
|
1857
1857
|
}
|
|
1858
|
-
|
|
1859
|
-
start:
|
|
1858
|
+
d.push({
|
|
1859
|
+
start: W,
|
|
1860
1860
|
end: j
|
|
1861
1861
|
});
|
|
1862
1862
|
{
|
|
1863
1863
|
new y.PointsMaterial({ color: 65535, size: 0.01 });
|
|
1864
|
-
let Z = new y.Vector3().subVectors(
|
|
1864
|
+
let Z = new y.Vector3().subVectors(W, j), k = new y.Vector3().subVectors(j, W), ft = 1 / 0, U = 1 / 0, it = W.clone(), dt = j.clone();
|
|
1865
1865
|
const Ct = [], St = [];
|
|
1866
|
-
let At = new y.Line3(tt, lt),
|
|
1866
|
+
let At = new y.Line3(tt, lt), Y = new y.Vector3(), pt = 999999;
|
|
1867
1867
|
if (p.originalPoints.forEach((et) => {
|
|
1868
|
-
if (et.z -
|
|
1869
|
-
let st = At.closestPointToPoint(et, !0,
|
|
1868
|
+
if (et.z - W.z < Mt / 2 + 0.1 && et.z - W.z > Mt / 2 - 0.1 && Ct.push(et), et.z > tt.z) {
|
|
1869
|
+
let st = At.closestPointToPoint(et, !0, Y), xt = new y.Vector3().subVectors(st, tt), vt = new y.Vector3().subVectors(st, lt), Bt = oe(Z, vt), wt = oe(k, xt);
|
|
1870
1870
|
Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && St.push(et);
|
|
1871
1871
|
}
|
|
1872
1872
|
}), Ct.length > 0) {
|
|
1873
|
-
const { newProjectPoints: et } = ze(
|
|
1873
|
+
const { newProjectPoints: et } = ze(W, j, Ct);
|
|
1874
1874
|
for (const st of et)
|
|
1875
|
-
st.z =
|
|
1875
|
+
st.z = W.z;
|
|
1876
1876
|
et.forEach((st) => {
|
|
1877
|
-
let xt = new y.Vector3(st.x, st.y,
|
|
1877
|
+
let xt = new y.Vector3(st.x, st.y, W.z), vt = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, W), wt = oe(Z, Bt), Xt = oe(k, vt);
|
|
1878
1878
|
if (wt && wt.parallel && wt.sameDirection) {
|
|
1879
|
-
let
|
|
1880
|
-
|
|
1879
|
+
let $t = xt.distanceTo(W);
|
|
1880
|
+
$t < ft && (ft = $t, it = xt);
|
|
1881
1881
|
} else if (Xt && Xt.parallel && Xt.sameDirection) {
|
|
1882
|
-
let
|
|
1883
|
-
|
|
1882
|
+
let $t = xt.distanceTo(j);
|
|
1883
|
+
$t < U && (U = $t, dt = xt);
|
|
1884
1884
|
}
|
|
1885
1885
|
});
|
|
1886
1886
|
}
|
|
1887
|
-
if (it.equals(
|
|
1887
|
+
if (it.equals(W) || (W = it, lt = new y.Vector3(W.x, W.y, lt.z)), dt.equals(j) || (j = dt, tt = new y.Vector3(j.x, j.y, tt.z)), St.length > 10) {
|
|
1888
1888
|
const { newOnLinePoints: et } = ze(lt, tt, St);
|
|
1889
1889
|
for (let st = 0; st < et.length; st++) {
|
|
1890
|
-
let vt = At.closestPointToPoint(et[st], !0,
|
|
1890
|
+
let vt = At.closestPointToPoint(et[st], !0, Y).distanceTo(et[st]);
|
|
1891
1891
|
vt > 0.02 && pt > vt && (pt = vt);
|
|
1892
1892
|
}
|
|
1893
1893
|
tt.z += pt, lt.z += pt, Mt += pt;
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
|
-
let J = j.distanceTo(
|
|
1896
|
+
let J = j.distanceTo(W);
|
|
1897
1897
|
if (J < 0.4 && !_t || J < 0.3 && _t)
|
|
1898
1898
|
continue;
|
|
1899
|
-
h.includes(
|
|
1900
|
-
let ct = "",
|
|
1899
|
+
h.includes(m) || h.push(m), p.checkResults[E.index].isDoor = !0;
|
|
1900
|
+
let ct = "", q = {
|
|
1901
1901
|
id: l,
|
|
1902
1902
|
beamStart: tt,
|
|
1903
1903
|
beamEnd: lt,
|
|
1904
1904
|
beamHeight: p.rooftopPz - tt.z,
|
|
1905
|
-
doorStart:
|
|
1905
|
+
doorStart: W,
|
|
1906
1906
|
doorEnd: j,
|
|
1907
1907
|
doorHeight: Mt,
|
|
1908
1908
|
nearId: -1,
|
|
1909
1909
|
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
1910
1910
|
type: ct,
|
|
1911
|
-
isExtend:
|
|
1911
|
+
isExtend: Nt,
|
|
1912
1912
|
isDoor: _t,
|
|
1913
|
-
isPullOutDoor:
|
|
1913
|
+
isPullOutDoor: Et,
|
|
1914
1914
|
pcbDoorIndexs: Ft,
|
|
1915
1915
|
beamNearWallVec: new y.Vector3(0, 0, 0)
|
|
1916
1916
|
}, bt = !1, Vt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
|
|
@@ -1929,62 +1929,62 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1929
1929
|
dt.start.z = 0, dt.end.z = 0;
|
|
1930
1930
|
let Ct = ee(k.beamStart, k.beamEnd, !0);
|
|
1931
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),
|
|
1933
|
-
if (
|
|
1934
|
-
k.nearId = l,
|
|
1932
|
+
let St = new y.Vector3(), At = dt.closestPointToPoint(Ct, !0, St), Y = At.distanceTo(Ct), pt = new y.Vector3().subVectors(Ct, At).normalize(), et = pt.clone().negate(), st = Ct.clone().addScaledVector(et, Y + 0.1), xt = te(dt.start, dt.end, Ct, st), vt = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
|
|
1933
|
+
if (Y < 0.4 && xt != null && !vt) {
|
|
1934
|
+
k.nearId = l, q.nearId = k.id;
|
|
1935
1935
|
let Bt = 0.8;
|
|
1936
|
-
(k.isDoor ||
|
|
1936
|
+
(k.isDoor || q.isDoor) && (k.isDoor = !0, q.isDoor = !0);
|
|
1937
1937
|
const wt = Ft.some((Xt) => k.pcbDoorIndexs.includes(Xt));
|
|
1938
|
-
U < it ? U > Bt && !k.isPullOutDoor ? (k.beamStart = tt.clone().addScaledVector(et,
|
|
1938
|
+
U < it ? U > Bt && !k.isPullOutDoor ? (k.beamStart = tt.clone().addScaledVector(et, Y), k.beamEnd = lt.clone().addScaledVector(et, Y), k.doorStart = W.clone().addScaledVector(et, Y), k.doorEnd = j.clone().addScaledVector(et, Y), k.doorHeight = q.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Et || Et && k.isPullOutDoor && wt ? (q.beamStart = k.beamStart.clone().addScaledVector(pt, Y), q.beamEnd = k.beamEnd.clone().addScaledVector(pt, Y), q.doorStart = k.doorStart.clone().addScaledVector(pt, Y), q.doorEnd = k.doorEnd.clone().addScaledVector(pt, Y), q.doorHeight = k.doorHeight, q.beamStart.z = q.beamEnd.z = q.doorStart.z + q.doorHeight) : (k.beamStart = tt.clone().addScaledVector(et, Y), k.beamEnd = lt.clone().addScaledVector(et, Y), k.doorStart = W.clone().addScaledVector(et, Y), k.doorEnd = j.clone().addScaledVector(et, Y), k.doorHeight = q.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : U > it && (it > Bt && !Et ? (q.beamStart = k.beamStart.clone().addScaledVector(et, Y), q.beamEnd = k.beamEnd.clone().addScaledVector(et, Y), q.doorStart = k.doorStart.clone().addScaledVector(et, Y), q.doorEnd = k.doorEnd.clone().addScaledVector(et, Y), q.doorHeight = k.doorHeight, q.beamStart.z = q.beamEnd.z = q.doorStart.z + q.doorHeight) : !k.isPullOutDoor || Et && k.isPullOutDoor && wt ? (k.beamStart = tt.clone().addScaledVector(pt, Y), k.beamEnd = lt.clone().addScaledVector(pt, Y), k.doorStart = W.clone().addScaledVector(pt, Y), k.doorEnd = j.clone().addScaledVector(pt, Y), k.doorHeight = q.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (q.beamStart = k.beamStart.clone().addScaledVector(et, Y), q.beamEnd = k.beamEnd.clone().addScaledVector(et, Y), q.doorStart = k.doorStart.clone().addScaledVector(et, Y), q.doorEnd = k.doorEnd.clone().addScaledVector(et, Y), q.doorHeight = k.doorHeight, q.beamStart.z = q.beamEnd.z = q.doorStart.z + q.doorHeight)), at = q.nearId, Vt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = u[Z].linesIndex, gt = u[Z].doorIndex;
|
|
1939
1939
|
break;
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
1942
|
}
|
|
1943
1943
|
let Pt = !1;
|
|
1944
1944
|
if (!bt) {
|
|
1945
|
-
let Z = new y.Line3(
|
|
1945
|
+
let Z = new y.Line3(W.clone(), j.clone());
|
|
1946
1946
|
for (let k = 0; k < n.length; k++) {
|
|
1947
|
-
if (n[k].length < 0.5 || k ==
|
|
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,
|
|
1947
|
+
if (n[k].length < 0.5 || k == m) continue;
|
|
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, W, j), dt = Jt(ft, U, W, j);
|
|
1949
1949
|
const Ct = ho(n[k]);
|
|
1950
1950
|
if (it && it.maxPerpendicularDistance < 0.5) {
|
|
1951
1951
|
if (dt && dt.isParallel) {
|
|
1952
|
-
let st = new y.Line3(ft, U), xt = new y.Vector3(
|
|
1953
|
-
Bt && Bt.angle > 85 && (
|
|
1952
|
+
let st = new y.Line3(ft, U), xt = new y.Vector3(W.x, W.y, ft.z), vt = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(vt, xt, W, j);
|
|
1953
|
+
Bt && Bt.angle > 85 && (q.beamNearWallVec = new y.Vector3().subVectors(vt, xt).normalize());
|
|
1954
1954
|
}
|
|
1955
1955
|
const St = [];
|
|
1956
1956
|
n[k].originalPoints.forEach((st) => {
|
|
1957
|
-
st.z >
|
|
1957
|
+
st.z > W.z + 0.2 && st.z < W.z + Mt / 2 && St.push(new y.Vector3(st.x, st.y, W.z));
|
|
1958
1958
|
});
|
|
1959
1959
|
const At = new y.Vector3();
|
|
1960
|
-
let
|
|
1960
|
+
let Y = [], pt = [];
|
|
1961
1961
|
for (let st = 0; st < St.length; st++) {
|
|
1962
1962
|
let xt = Z.closestPointToPoint(St[st], !0, At);
|
|
1963
|
-
xt.distanceTo(St[st]) < 0.15 && (
|
|
1963
|
+
xt.distanceTo(St[st]) < 0.15 && (Y.push(St[st]), pt.push(xt.clone()));
|
|
1964
1964
|
}
|
|
1965
1965
|
for (let st = 0; st < pt.length; st++)
|
|
1966
|
-
mo(Z, pt[st]) &&
|
|
1967
|
-
if (
|
|
1968
|
-
let et = Se(
|
|
1966
|
+
mo(Z, pt[st]) && Y.push(pt[st]);
|
|
1967
|
+
if (Y = pt, Y = po(Y), Y.length < 150) continue;
|
|
1968
|
+
let et = Se(Y);
|
|
1969
1969
|
if (et.length == 2) {
|
|
1970
1970
|
let st = et[0].distanceTo(et[1]);
|
|
1971
1971
|
if (Math.abs(st - Z.distance()) < 0.3) {
|
|
1972
|
-
let xt = new y.Line3(ft, U), vt = new y.Vector3(
|
|
1973
|
-
if (
|
|
1972
|
+
let xt = new y.Line3(ft, U), vt = new y.Vector3(W.x, W.y, ft.z), Bt = xt.closestPointToPoint(vt, !0, new y.Vector3());
|
|
1973
|
+
if (q.beamNearWallVec = new y.Vector3().subVectors(Bt, vt).normalize(), q.beamStart.z > Ct.maxZ - 0.03 && H > 1)
|
|
1974
1974
|
Pt = !0;
|
|
1975
|
-
else if (
|
|
1975
|
+
else if (Wt = !0, Tt != -1 && (e[a[Tt].index].isFindBeam = !1, a[Tt].isFind = !1), Q != -1 && gt != -1) {
|
|
1976
1976
|
const wt = n[Q].doorAndBeamData[gt];
|
|
1977
1977
|
wt.nearId = -1;
|
|
1978
1978
|
}
|
|
1979
1979
|
break;
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
if (
|
|
1982
|
+
if (Wt)
|
|
1983
1983
|
break;
|
|
1984
1984
|
} else it && it.type == "collinear_overlap" && it.maxPerpendicularDistance > 0.3 && it.maxPerpendicularDistance < 0.7 && (Pt = !0);
|
|
1985
1985
|
}
|
|
1986
|
-
if (
|
|
1987
|
-
if (
|
|
1986
|
+
if (Wt) {
|
|
1987
|
+
if (H < 1.8)
|
|
1988
1988
|
continue;
|
|
1989
1989
|
Pt = !0;
|
|
1990
1990
|
}
|
|
@@ -1994,8 +1994,8 @@ const fi = async (n, t, e, o, i) => {
|
|
|
1994
1994
|
for (let Z = 0; Z < c.length && !(c[Z].length == 1 && (c[Z][0].id == l ? (c[Z].push({ id: at, beamStart: Vt, beamEnd: Ut }), Gt = !0) : c[Z][0].id == at && (c[Z].push({ id: l, beamStart: tt, beamEnd: lt }), Gt = !0), Gt)); Z++)
|
|
1995
1995
|
;
|
|
1996
1996
|
Gt || c.push([{ id: l, beamStart: tt, beamEnd: lt }]);
|
|
1997
|
-
const ht =
|
|
1998
|
-
if (_t ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = Pt && ht > 1 ? "beam" : "hole",
|
|
1997
|
+
const ht = q.doorStart.distanceTo(q.doorEnd);
|
|
1998
|
+
if (_t ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = Pt && ht > 1 ? "beam" : "hole", q.type = ct, q.nearId != -1 && ct == "hole") {
|
|
1999
1999
|
let Z = !1;
|
|
2000
2000
|
for (let k = 0; k < n.length; k++)
|
|
2001
2001
|
if (n[k].doorAndBeamData) {
|
|
@@ -2007,10 +2007,10 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2007
2007
|
if (Z) break;
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
if (p.doorAndBeamData.push(
|
|
2011
|
-
linesIndex:
|
|
2010
|
+
if (p.doorAndBeamData.push(q), u.push({
|
|
2011
|
+
linesIndex: m,
|
|
2012
2012
|
doorIndex: p.doorAndBeamData.length - 1
|
|
2013
|
-
}), l++,
|
|
2013
|
+
}), l++, Et && H < 2) break;
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
@@ -2018,110 +2018,110 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2018
2018
|
p.completePointAreaPercentage = D / _ * 100;
|
|
2019
2019
|
}
|
|
2020
2020
|
if (h.length > 1)
|
|
2021
|
-
for (let
|
|
2021
|
+
for (let m = 0; m < h.length; m++) {
|
|
2022
2022
|
let p = [];
|
|
2023
|
-
for (let b = 0; b < n[h[
|
|
2023
|
+
for (let b = 0; b < n[h[m]].doorAndBeamData.length; b++) {
|
|
2024
2024
|
let z = !1;
|
|
2025
|
-
if (n[h[
|
|
2026
|
-
let v = n[h[
|
|
2025
|
+
if (n[h[m]].doorAndBeamData[b].type === "beam" && n[h[m]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[m]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[m]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[m]].doorAndBeamData[b].nearId == -1 && (z = !0), !z) {
|
|
2026
|
+
let v = n[h[m]].doorAndBeamData[b].doorStart.clone(), S = n[h[m]].doorAndBeamData[b].doorEnd.clone();
|
|
2027
2027
|
v.z = S.z = 0;
|
|
2028
2028
|
let V = v.distanceTo(S);
|
|
2029
2029
|
for (let D = 0; D < h.length; D++)
|
|
2030
|
-
if (
|
|
2030
|
+
if (m != D)
|
|
2031
2031
|
for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
|
|
2032
|
-
let
|
|
2033
|
-
|
|
2034
|
-
let A = ne(v, S,
|
|
2032
|
+
let E = n[h[D]].doorAndBeamData[_].doorStart.clone(), T = n[h[D]].doorAndBeamData[_].doorEnd.clone();
|
|
2033
|
+
E.z = T.z = 0, E.distanceTo(T);
|
|
2034
|
+
let A = ne(v, S, E, T);
|
|
2035
2035
|
if (A.type == "collinear_overlap" && A.maxPerpendicularDistance < 0.2) {
|
|
2036
|
-
let O = new y.Line3(
|
|
2037
|
-
if (Math.abs(V - A.overlap) < 0.1 &&
|
|
2038
|
-
n[h[D]].doorAndBeamData[_].nearId == n[h[
|
|
2036
|
+
let O = new y.Line3(E, T), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), L = I.distanceTo(B);
|
|
2037
|
+
if (Math.abs(V - A.overlap) < 0.1 && L < 0.04) {
|
|
2038
|
+
n[h[D]].doorAndBeamData[_].nearId == n[h[m]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), z = !0;
|
|
2039
2039
|
break;
|
|
2040
2040
|
}
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
|
-
z || p.push(n[h[
|
|
2044
|
+
z || p.push(n[h[m]].doorAndBeamData[b]);
|
|
2045
2045
|
}
|
|
2046
|
-
p.length != n[h[
|
|
2046
|
+
p.length != n[h[m]].doorAndBeamData.length && (n[h[m]].doorAndBeamData = p);
|
|
2047
2047
|
}
|
|
2048
2048
|
let w = 0.65, x = 2, P = [], M = [];
|
|
2049
|
-
for (let
|
|
2050
|
-
if (a[
|
|
2049
|
+
for (let m = 0; m < a.length; m++) {
|
|
2050
|
+
if (a[m].isFind || a[m].inWall)
|
|
2051
2051
|
continue;
|
|
2052
|
-
let p = new y.Vector3(a[
|
|
2052
|
+
let p = new y.Vector3(a[m].doorStartPt.x, a[m].doorStartPt.y, 0), b = new y.Vector3(a[m].doorEndPt.x, a[m].doorEndPt.y, 0), z = new y.Vector3().subVectors(p, b).normalize();
|
|
2053
2053
|
for (let v = 0; v < n.length; v++) {
|
|
2054
2054
|
if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
|
|
2055
2055
|
continue;
|
|
2056
|
-
let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), V = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, V).normalize(), _ = 0.3,
|
|
2057
|
-
te(
|
|
2056
|
+
let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), V = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, V).normalize(), _ = 0.3, E = p.clone().addScaledVector(z, _), T = b.clone().addScaledVector(z.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = V.clone().addScaledVector(D.clone().negate(), _);
|
|
2057
|
+
te(E, T, A, O);
|
|
2058
2058
|
let I = Jt(
|
|
2059
|
-
T,
|
|
2060
2059
|
E,
|
|
2060
|
+
T,
|
|
2061
2061
|
A,
|
|
2062
2062
|
O
|
|
2063
|
-
), B = p.distanceTo(S) > b.distanceTo(S) ? b : p,
|
|
2064
|
-
if ((
|
|
2065
|
-
let
|
|
2063
|
+
), B = p.distanceTo(S) > b.distanceTo(S) ? b : p, L = B.distanceTo(S), N = B.distanceTo(V);
|
|
2064
|
+
if ((L < f || N < f) && I && !I.isParallel) {
|
|
2065
|
+
let R = p.distanceTo(S), $ = p.distanceTo(V), X = R < $ ? S : V, ot = !1;
|
|
2066
2066
|
for (let K = 0; K < n.length; K++) {
|
|
2067
2067
|
if (K == v || P.includes(K) || n[K].length < 0.7)
|
|
2068
2068
|
continue;
|
|
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(),
|
|
2070
|
-
if (
|
|
2071
|
-
let
|
|
2072
|
-
if (
|
|
2073
|
-
|
|
2074
|
-
else if (
|
|
2075
|
-
|
|
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(), H = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, V, G, ut), qt = ne(S, V, G, ut), Rt = te(S, V, H, Mt), _t = !0;
|
|
2070
|
+
if (Rt != null && (_t = Rt.point.distanceTo(S) < f || Rt.point.distanceTo(V) < f), (Zt && Zt.angle > 85 || qt && qt.type == "collinear_gap") && _t) {
|
|
2071
|
+
let Et = new y.Line3(S, V), Ft = new y.Vector3(), tt = Et.closestPointToPoint(G, !0, Ft), lt = Et.closestPointToPoint(ut, !0, Ft), W = tt.distanceTo(G), j = lt.distanceTo(ut), Nt, Tt;
|
|
2072
|
+
if (W > j && j > w)
|
|
2073
|
+
Nt = ut, Tt = lt;
|
|
2074
|
+
else if (W < j && W > w)
|
|
2075
|
+
Nt = G, Tt = tt;
|
|
2076
2076
|
else
|
|
2077
2077
|
continue;
|
|
2078
|
-
if (
|
|
2078
|
+
if (W = X.distanceTo(G), j = X.distanceTo(ut), W > x && j > x)
|
|
2079
2079
|
continue;
|
|
2080
|
-
let
|
|
2081
|
-
if (J && J.isParallel || !
|
|
2080
|
+
let Wt = Jt(Nt, Tt, G, ut), J = Jt(Nt, Tt, E, T);
|
|
2081
|
+
if (J && J.isParallel || !Wt || !Wt.isParallel)
|
|
2082
2082
|
continue;
|
|
2083
|
-
let ct = ne(p, b,
|
|
2083
|
+
let ct = ne(p, b, Nt, Tt);
|
|
2084
2084
|
if (ct && ct.type == "collinear_overlap" && ct.maxPerpendicularDistance < 0.2)
|
|
2085
2085
|
continue;
|
|
2086
|
-
|
|
2087
|
-
let
|
|
2086
|
+
Nt.z = Tt.z = n[K].start.z;
|
|
2087
|
+
let q = !1;
|
|
2088
2088
|
for (let at = 0; at < M.length; at++) {
|
|
2089
|
-
let Q = ne(M[at].start, M[at].end,
|
|
2089
|
+
let Q = ne(M[at].start, M[at].end, Nt, Tt);
|
|
2090
2090
|
if (Q && Q.type == "collinear_overlap" && Q.maxPerpendicularDistance < 0.2) {
|
|
2091
|
-
|
|
2091
|
+
q = !0;
|
|
2092
2092
|
break;
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
|
-
if (
|
|
2095
|
+
if (q)
|
|
2096
2096
|
continue;
|
|
2097
2097
|
for (let at = 0; at < n.length; at++) {
|
|
2098
2098
|
if (n[at].length < 0.5) continue;
|
|
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,
|
|
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, Nt, Tt);
|
|
2100
2100
|
if (Pt && Pt.type == "collinear_overlap" && Pt.maxPerpendicularDistance < 0.1) {
|
|
2101
|
-
|
|
2101
|
+
q = !0;
|
|
2102
2102
|
break;
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
|
-
if (
|
|
2105
|
+
if (q)
|
|
2106
2106
|
continue;
|
|
2107
2107
|
M.push({
|
|
2108
|
-
start:
|
|
2109
|
-
end:
|
|
2108
|
+
start: Nt,
|
|
2109
|
+
end: Tt
|
|
2110
2110
|
}), P.push(K);
|
|
2111
2111
|
let bt = n[K].rooftopPz - n[K].start.z, Vt = n[v].rooftopPz - n[v].start.z, Ut = bt < Vt ? bt : Vt;
|
|
2112
2112
|
n[K].doorAndBeamData || (n[K].doorAndBeamData = []), n[K].doorAndBeamData.push({
|
|
2113
2113
|
id: l,
|
|
2114
|
-
beamStart:
|
|
2115
|
-
beamEnd:
|
|
2114
|
+
beamStart: Nt,
|
|
2115
|
+
beamEnd: Tt,
|
|
2116
2116
|
beamHeight: Ut,
|
|
2117
|
-
doorStart:
|
|
2118
|
-
doorEnd:
|
|
2117
|
+
doorStart: Nt,
|
|
2118
|
+
doorEnd: Tt,
|
|
2119
2119
|
doorHeight: Ut,
|
|
2120
2120
|
nearId: -1,
|
|
2121
2121
|
type: "onlyDoor",
|
|
2122
2122
|
isDoor: !0,
|
|
2123
2123
|
beamNearWallVec: new y.Vector3(0, 0, 0)
|
|
2124
|
-
}), e[a[
|
|
2124
|
+
}), e[a[m].index].isFindBeam = !0, e[a[m].index].isFindOnlyDoor = !0, c.push([{ id: l, beamStart: Nt, beamEnd: Tt }]), l++, ot = !0;
|
|
2125
2125
|
break;
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
@@ -2129,11 +2129,11 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
}
|
|
2131
2131
|
}
|
|
2132
|
-
let
|
|
2133
|
-
for (let
|
|
2134
|
-
n[
|
|
2135
|
-
return n.length = 0, n.push(...
|
|
2136
|
-
},
|
|
2132
|
+
let g = [];
|
|
2133
|
+
for (let m = 0; m < n.length; m++)
|
|
2134
|
+
n[m].isLine2 || g.push(n[m]), n[m].isLine2 && n[m].doorAndBeamData.length != 0 && g.push(n[m]);
|
|
2135
|
+
return n.length = 0, n.push(...g), { lines: n, beamGroup: c };
|
|
2136
|
+
}, bi = (n, t) => {
|
|
2137
2137
|
if (!n || n.length <= 0) return;
|
|
2138
2138
|
let e = {
|
|
2139
2139
|
rectangles: [],
|
|
@@ -2148,49 +2148,49 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2148
2148
|
let u = n[l].length;
|
|
2149
2149
|
if (o.has(n[l].uuid) || u < i || u > r)
|
|
2150
2150
|
continue;
|
|
2151
|
-
let h = [],
|
|
2151
|
+
let h = [], d = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), w = new y.Vector3().subVectors(c, d).normalize().clone().negate(), x = new y.Vector3(), P = new y.Vector3(), M = new y.Vector3();
|
|
2152
2152
|
new y.Vector3();
|
|
2153
|
-
for (let
|
|
2154
|
-
let
|
|
2155
|
-
if (
|
|
2153
|
+
for (let g = 0; g < n.length; g++) {
|
|
2154
|
+
let m = n[g].length;
|
|
2155
|
+
if (g == l || m < i || m > r)
|
|
2156
2156
|
continue;
|
|
2157
|
-
let p = new y.Vector3(n[
|
|
2157
|
+
let p = new y.Vector3(n[g].start.x, n[g].start.y, n[g].start.z), b = new y.Vector3(n[g].end.x, n[g].end.y, n[g].end.z), z = re(d, c, p, b);
|
|
2158
2158
|
if (!z || z.angle < 85)
|
|
2159
2159
|
continue;
|
|
2160
|
-
let v = kt(p,
|
|
2160
|
+
let v = kt(p, d), S = kt(p, c), V = kt(b, d), D = kt(b, c);
|
|
2161
2161
|
if (!(!v && !S && !V && !D)) {
|
|
2162
2162
|
v || S ? (x = p.clone(), P = b.clone()) : (x = b.clone(), P = p.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
|
|
2163
2163
|
for (let _ = 0; _ < n.length; _++) {
|
|
2164
|
-
let
|
|
2165
|
-
if (_ == l || _ ==
|
|
2164
|
+
let E = n[_].length;
|
|
2165
|
+
if (_ == l || _ == g || E < i || E > r)
|
|
2166
2166
|
continue;
|
|
2167
|
-
let
|
|
2167
|
+
let T = 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(p, b, T, A);
|
|
2168
2168
|
if (!O || O.angle < 85)
|
|
2169
2169
|
continue;
|
|
2170
|
-
let I = kt(
|
|
2170
|
+
let I = kt(T, P), B = kt(A, P);
|
|
2171
2171
|
if (!I && !B) continue;
|
|
2172
2172
|
new y.Vector3();
|
|
2173
|
-
let
|
|
2174
|
-
I ? (
|
|
2175
|
-
let C = oe(w,
|
|
2173
|
+
let L = new y.Vector3(), N = new y.Vector3();
|
|
2174
|
+
I ? (N = new y.Vector3().subVectors(A, T).normalize(), T.clone(), L = A.clone()) : (N = new y.Vector3().subVectors(T, A).normalize(), A.clone(), L = T.clone());
|
|
2175
|
+
let C = oe(w, N, 0.1);
|
|
2176
2176
|
if (!(!C || !C.parallel || !C.sameDirection)) {
|
|
2177
|
-
for (let
|
|
2178
|
-
let
|
|
2179
|
-
if (
|
|
2177
|
+
for (let R = 0; R < n.length; R++) {
|
|
2178
|
+
let $ = n[R].length;
|
|
2179
|
+
if (R == l || R == g || R == _ || $ < i || $ > r)
|
|
2180
2180
|
continue;
|
|
2181
|
-
let X = new y.Vector3(n[
|
|
2181
|
+
let X = new y.Vector3(n[R].start.x, n[R].start.y, n[R].start.z), ot = new y.Vector3(n[R].end.x, n[R].end.y, n[R].end.z), K = re(X, ot, T, A);
|
|
2182
2182
|
if (!K || K.angle < 85)
|
|
2183
2183
|
continue;
|
|
2184
|
-
let G = kt(X,
|
|
2184
|
+
let G = kt(X, L), ut = kt(ot, L);
|
|
2185
2185
|
if (!G && !ut) continue;
|
|
2186
2186
|
new y.Vector3();
|
|
2187
2187
|
let rt = new y.Vector3();
|
|
2188
2188
|
G ? (X.clone(), rt = ot.clone()) : (ot.clone(), rt = X.clone());
|
|
2189
|
-
let F = kt(rt,
|
|
2190
|
-
if (!F && !
|
|
2191
|
-
let Mt = u *
|
|
2189
|
+
let F = kt(rt, d), H = kt(rt, c);
|
|
2190
|
+
if (!F && !H) continue;
|
|
2191
|
+
let Mt = u * m;
|
|
2192
2192
|
if (!(Mt < s || Mt > a)) {
|
|
2193
|
-
h = [n[l].uuid, n[
|
|
2193
|
+
h = [n[l].uuid, n[g].uuid, n[_].uuid, n[R].uuid];
|
|
2194
2194
|
break;
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
@@ -2202,7 +2202,7 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2202
2202
|
break;
|
|
2203
2203
|
}
|
|
2204
2204
|
}
|
|
2205
|
-
h.length == 4 && (h.forEach((
|
|
2205
|
+
h.length == 4 && (h.forEach((g) => o.add(g)), e.rectangles.push(h));
|
|
2206
2206
|
}
|
|
2207
2207
|
for (let l = 0; l < n.length; l++) {
|
|
2208
2208
|
let u = n[l].length;
|
|
@@ -2214,52 +2214,52 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2214
2214
|
start: new y.Vector3(),
|
|
2215
2215
|
end: new y.Vector3()
|
|
2216
2216
|
}
|
|
2217
|
-
},
|
|
2217
|
+
}, d = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), f = !0, w = !0;
|
|
2218
2218
|
for (let M = 0; M < n.length; M++) {
|
|
2219
2219
|
if (M == l || n[M].length < i)
|
|
2220
2220
|
continue;
|
|
2221
|
-
let
|
|
2222
|
-
if (p || b ?
|
|
2221
|
+
let g = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), m = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), p = kt(g, d), b = kt(m, d), z = kt(g, c), v = kt(m, c);
|
|
2222
|
+
if (p || b ? f = !1 : (z || v) && (w = !1), !f && !w) break;
|
|
2223
2223
|
}
|
|
2224
|
-
if (!
|
|
2224
|
+
if (!f && !w) continue;
|
|
2225
2225
|
let x = new y.Vector3();
|
|
2226
|
-
|
|
2226
|
+
f || ([d, c] = [c, d]), x = new y.Vector3().subVectors(c, d).normalize();
|
|
2227
2227
|
let P = x.clone().negate();
|
|
2228
2228
|
for (let M = 0; M < n.length; M++) {
|
|
2229
|
-
let
|
|
2230
|
-
if (M == l || o.has(M) ||
|
|
2229
|
+
let g = n[M].length;
|
|
2230
|
+
if (M == l || o.has(M) || g < i || g > r)
|
|
2231
2231
|
continue;
|
|
2232
|
-
let
|
|
2232
|
+
let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), p = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = re(d, c, m, p);
|
|
2233
2233
|
if (!b || b.angle < 85)
|
|
2234
2234
|
continue;
|
|
2235
|
-
let z = kt(
|
|
2235
|
+
let z = kt(m, c), v = kt(p, c);
|
|
2236
2236
|
if (!z && !v) continue;
|
|
2237
2237
|
new y.Vector3();
|
|
2238
2238
|
let S = new y.Vector3();
|
|
2239
|
-
z ? (
|
|
2239
|
+
z ? (m.clone(), S = p.clone()) : (p.clone(), S = m.clone());
|
|
2240
2240
|
for (let V = 0; V < n.length; V++) {
|
|
2241
2241
|
let D = n[V].length;
|
|
2242
2242
|
if (V == l || V == M || o.has(V) || D < i || D > r)
|
|
2243
2243
|
continue;
|
|
2244
|
-
let _ = new y.Vector3(n[V].start.x, n[V].start.y, n[V].start.z),
|
|
2245
|
-
if (!
|
|
2244
|
+
let _ = new y.Vector3(n[V].start.x, n[V].start.y, n[V].start.z), E = new y.Vector3(n[V].end.x, n[V].end.y, n[V].end.z), T = re(m, p, _, E);
|
|
2245
|
+
if (!T || T.angle < 85)
|
|
2246
2246
|
continue;
|
|
2247
|
-
let A = kt(_, S), O = kt(
|
|
2247
|
+
let A = kt(_, S), O = kt(E, S);
|
|
2248
2248
|
if (!A && !O) continue;
|
|
2249
2249
|
let I = new y.Vector3(), B = new y.Vector3();
|
|
2250
|
-
A ? (I = _.clone(), B =
|
|
2251
|
-
let
|
|
2252
|
-
if (!
|
|
2253
|
-
let C = !0,
|
|
2250
|
+
A ? (I = _.clone(), B = E.clone()) : (I = E.clone(), B = _.clone());
|
|
2251
|
+
let L = new y.Vector3().subVectors(B, I).normalize(), N = oe(P, L, 0.1);
|
|
2252
|
+
if (!N || !N.parallel || !N.sameDirection) continue;
|
|
2253
|
+
let C = !0, R = !0;
|
|
2254
2254
|
for (let X = 0; X < n.length; X++) {
|
|
2255
2255
|
if (X == V || n[X].length < i) continue;
|
|
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,
|
|
2257
|
-
if (G || ut ? C = !1 : (rt || F) && (
|
|
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, E), F = kt(K, E);
|
|
2257
|
+
if (G || ut ? C = !1 : (rt || F) && (R = !1), !C && !R) break;
|
|
2258
2258
|
}
|
|
2259
|
-
if (!C && !
|
|
2260
|
-
let
|
|
2261
|
-
if (!(
|
|
2262
|
-
h.indexs = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end =
|
|
2259
|
+
if (!C && !R) continue;
|
|
2260
|
+
let $ = u * g;
|
|
2261
|
+
if (!($ < s || $ > a)) {
|
|
2262
|
+
h.indexs = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end = d;
|
|
2263
2263
|
break;
|
|
2264
2264
|
}
|
|
2265
2265
|
}
|
|
@@ -2268,19 +2268,19 @@ const fi = async (n, t, e, o, i) => {
|
|
|
2268
2268
|
h.indexs.length == 3 && (h.indexs.forEach((M) => o.add(M)), e.threeEdgeRect.push(h));
|
|
2269
2269
|
}
|
|
2270
2270
|
return e;
|
|
2271
|
-
}, ae = 11102230246251565e-32,
|
|
2272
|
-
function
|
|
2273
|
-
let r, s, a, l, u = t[0], h = o[0],
|
|
2274
|
-
h > u == h > -u ? (r = u, u = t[++
|
|
2275
|
-
let
|
|
2276
|
-
if (
|
|
2277
|
-
for (h > u == h > -u ? (s = u + r, a = r - (s - u), u = t[++
|
|
2278
|
-
h > u == h > -u ? (s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++
|
|
2279
|
-
for (;
|
|
2280
|
-
s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++
|
|
2271
|
+
}, ae = 11102230246251565e-32, Yt = 134217729, Do = (3 + 8 * ae) * ae;
|
|
2272
|
+
function qe(n, t, e, o, i) {
|
|
2273
|
+
let r, s, a, l, u = t[0], h = o[0], d = 0, c = 0;
|
|
2274
|
+
h > u == h > -u ? (r = u, u = t[++d]) : (r = h, h = o[++c]);
|
|
2275
|
+
let f = 0;
|
|
2276
|
+
if (d < n && c < e)
|
|
2277
|
+
for (h > u == h > -u ? (s = u + r, a = r - (s - u), u = t[++d]) : (s = h + r, a = r - (s - h), h = o[++c]), r = s, a !== 0 && (i[f++] = a); d < n && c < e; )
|
|
2278
|
+
h > u == h > -u ? (s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++d]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++c]), r = s, a !== 0 && (i[f++] = a);
|
|
2279
|
+
for (; d < n; )
|
|
2280
|
+
s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++d], r = s, a !== 0 && (i[f++] = a);
|
|
2281
2281
|
for (; c < e; )
|
|
2282
|
-
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++c], r = s, a !== 0 && (i[
|
|
2283
|
-
return (r !== 0 ||
|
|
2282
|
+
s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++c], r = s, a !== 0 && (i[f++] = a);
|
|
2283
|
+
return (r !== 0 || f === 0) && (i[f++] = r), f;
|
|
2284
2284
|
}
|
|
2285
2285
|
function _o(n, t) {
|
|
2286
2286
|
let e = t[0];
|
|
@@ -2290,24 +2290,24 @@ function _o(n, t) {
|
|
|
2290
2290
|
function Ve(n) {
|
|
2291
2291
|
return new Float64Array(n);
|
|
2292
2292
|
}
|
|
2293
|
-
const
|
|
2293
|
+
const Eo = (3 + 16 * ae) * ae, To = (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
2294
|
function Bo(n, t, e, o, i, r, s) {
|
|
2295
|
-
let a, l, u, h,
|
|
2296
|
-
const V = n - i, D = e - i, _ = t - r,
|
|
2297
|
-
p = V *
|
|
2298
|
-
let
|
|
2299
|
-
if (
|
|
2300
|
-
p = a *
|
|
2301
|
-
const O =
|
|
2302
|
-
p = V * h, c =
|
|
2303
|
-
const I =
|
|
2304
|
-
p = a * h, c =
|
|
2305
|
-
const B =
|
|
2295
|
+
let a, l, u, h, d, c, f, w, x, P, M, g, m, p, b, z, v, S;
|
|
2296
|
+
const V = n - i, D = e - i, _ = t - r, E = o - r;
|
|
2297
|
+
p = V * E, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * E, x = c - (c - E), P = E - x, b = w * P - (p - f * x - w * x - f * P), z = _ * D, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * D, x = c - (c - D), P = D - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, me[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, me[1] = m - (M + d) + (d - z), S = g + M, d = S - g, me[2] = g - (S - d) + (M - d), me[3] = S;
|
|
2298
|
+
let T = _o(4, me), A = To * s;
|
|
2299
|
+
if (T >= A || -T >= A || (d = n - V, a = n - (V + d) + (d - i), d = e - D, u = e - (D + d) + (d - i), d = t - _, l = t - (_ + d) + (d - r), d = o - E, h = o - (E + d) + (d - r), a === 0 && l === 0 && u === 0 && h === 0) || (A = Ao * s + Do * Math.abs(T), T += V * h + E * a - (_ * u + D * l), T >= A || -T >= A)) return T;
|
|
2300
|
+
p = a * E, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * E, x = c - (c - E), P = E - x, b = w * P - (p - f * x - w * x - f * P), z = l * D, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * D, x = c - (c - D), P = D - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
|
|
2301
|
+
const O = qe(4, me, 4, jt, on);
|
|
2302
|
+
p = V * h, c = Yt * V, f = c - (c - V), w = V - f, c = Yt * h, x = c - (c - h), P = h - x, b = w * P - (p - f * x - w * x - f * P), z = _ * u, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * u, x = c - (c - u), P = u - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
|
|
2303
|
+
const I = qe(O, on, 4, jt, rn);
|
|
2304
|
+
p = a * h, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * h, x = c - (c - h), P = h - x, b = w * P - (p - f * x - w * x - f * P), z = l * u, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * u, x = c - (c - u), P = u - x, v = w * P - (z - f * x - w * x - f * P), M = b - v, d = b - M, jt[0] = b - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - z, d = m - M, jt[1] = m - (M + d) + (d - z), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
|
|
2305
|
+
const B = qe(I, rn, 4, jt, sn);
|
|
2306
2306
|
return sn[B - 1];
|
|
2307
2307
|
}
|
|
2308
2308
|
function ve(n, t, e, o, i, r) {
|
|
2309
2309
|
const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, u = Math.abs(s + a);
|
|
2310
|
-
return Math.abs(l) >=
|
|
2310
|
+
return Math.abs(l) >= Eo * u ? l : -Bo(n, t, e, o, i, r, u);
|
|
2311
2311
|
}
|
|
2312
2312
|
const an = Math.pow(2, -52), De = new Uint32Array(512);
|
|
2313
2313
|
class Be {
|
|
@@ -2321,7 +2321,7 @@ class Be {
|
|
|
2321
2321
|
* @param {(p: P) => number} [getY]
|
|
2322
2322
|
*/
|
|
2323
2323
|
// @ts-expect-error TS2322
|
|
2324
|
-
static from(t, e =
|
|
2324
|
+
static from(t, e = Ro, o = Fo) {
|
|
2325
2325
|
const i = t.length, r = new Float64Array(i * 2);
|
|
2326
2326
|
for (let s = 0; s < i; s++) {
|
|
2327
2327
|
const a = t[s];
|
|
@@ -2353,22 +2353,22 @@ class Be {
|
|
|
2353
2353
|
const D = t[2 * V], _ = t[2 * V + 1];
|
|
2354
2354
|
D < a && (a = D), _ < l && (l = _), D > u && (u = D), _ > h && (h = _), this._ids[V] = V;
|
|
2355
2355
|
}
|
|
2356
|
-
const
|
|
2357
|
-
let
|
|
2356
|
+
const d = (a + u) / 2, c = (l + h) / 2;
|
|
2357
|
+
let f = 0, w = 0, x = 0;
|
|
2358
2358
|
for (let V = 0, D = 1 / 0; V < s; V++) {
|
|
2359
|
-
const _ =
|
|
2360
|
-
_ < D && (
|
|
2359
|
+
const _ = We(d, c, t[2 * V], t[2 * V + 1]);
|
|
2360
|
+
_ < D && (f = V, D = _);
|
|
2361
2361
|
}
|
|
2362
|
-
const P = t[2 *
|
|
2362
|
+
const P = t[2 * f], M = t[2 * f + 1];
|
|
2363
2363
|
for (let V = 0, D = 1 / 0; V < s; V++) {
|
|
2364
|
-
if (V ===
|
|
2365
|
-
const _ =
|
|
2364
|
+
if (V === f) continue;
|
|
2365
|
+
const _ = We(P, M, t[2 * V], t[2 * V + 1]);
|
|
2366
2366
|
_ < D && _ > 0 && (w = V, D = _);
|
|
2367
2367
|
}
|
|
2368
|
-
let
|
|
2368
|
+
let g = t[2 * w], m = t[2 * w + 1], p = 1 / 0;
|
|
2369
2369
|
for (let V = 0; V < s; V++) {
|
|
2370
|
-
if (V ===
|
|
2371
|
-
const D = Co(P, M,
|
|
2370
|
+
if (V === f || V === w) continue;
|
|
2371
|
+
const D = Co(P, M, g, m, t[2 * V], t[2 * V + 1]);
|
|
2372
2372
|
D < p && (x = V, p = D);
|
|
2373
2373
|
}
|
|
2374
2374
|
let b = t[2 * x], z = t[2 * x + 1];
|
|
@@ -2378,47 +2378,47 @@ class Be {
|
|
|
2378
2378
|
ye(this._ids, this._dists, 0, s - 1);
|
|
2379
2379
|
const V = new Uint32Array(s);
|
|
2380
2380
|
let D = 0;
|
|
2381
|
-
for (let _ = 0,
|
|
2382
|
-
const
|
|
2383
|
-
A >
|
|
2381
|
+
for (let _ = 0, E = -1 / 0; _ < s; _++) {
|
|
2382
|
+
const T = this._ids[_], A = this._dists[T];
|
|
2383
|
+
A > E && (V[D++] = T, E = A);
|
|
2384
2384
|
}
|
|
2385
2385
|
this.hull = V.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
|
|
2386
2386
|
return;
|
|
2387
2387
|
}
|
|
2388
|
-
if (ve(P, M,
|
|
2389
|
-
const V = w, D =
|
|
2390
|
-
w = x,
|
|
2388
|
+
if (ve(P, M, g, m, b, z) < 0) {
|
|
2389
|
+
const V = w, D = g, _ = m;
|
|
2390
|
+
w = x, g = b, m = z, x = V, b = D, z = _;
|
|
2391
2391
|
}
|
|
2392
|
-
const v =
|
|
2392
|
+
const v = Lo(P, M, g, m, b, z);
|
|
2393
2393
|
this._cx = v.x, this._cy = v.y;
|
|
2394
2394
|
for (let V = 0; V < s; V++)
|
|
2395
|
-
this._dists[V] =
|
|
2396
|
-
ye(this._ids, this._dists, 0, s - 1), this._hullStart =
|
|
2395
|
+
this._dists[V] = We(t[2 * V], t[2 * V + 1], v.x, v.y);
|
|
2396
|
+
ye(this._ids, this._dists, 0, s - 1), this._hullStart = f;
|
|
2397
2397
|
let S = 3;
|
|
2398
|
-
o[
|
|
2398
|
+
o[f] = e[x] = w, o[w] = e[f] = x, o[x] = e[w] = f, i[f] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = f, r[this._hashKey(g, m)] = w, r[this._hashKey(b, z)] = x, this.trianglesLen = 0, this._addTriangle(f, w, x, -1, -1, -1);
|
|
2399
2399
|
for (let V = 0, D = 0, _ = 0; V < this._ids.length; V++) {
|
|
2400
|
-
const
|
|
2401
|
-
if (V > 0 && Math.abs(
|
|
2400
|
+
const E = this._ids[V], T = t[2 * E], A = t[2 * E + 1];
|
|
2401
|
+
if (V > 0 && Math.abs(T - D) <= an && Math.abs(A - _) <= an || (D = T, _ = A, E === f || E === w || E === x)) continue;
|
|
2402
2402
|
let O = 0;
|
|
2403
|
-
for (let C = 0,
|
|
2403
|
+
for (let C = 0, R = this._hashKey(T, A); C < this._hashSize && (O = r[(R + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
|
|
2404
2404
|
;
|
|
2405
2405
|
O = e[O];
|
|
2406
2406
|
let I = O, B;
|
|
2407
|
-
for (; B = o[I], ve(
|
|
2407
|
+
for (; B = o[I], ve(T, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
|
|
2408
2408
|
if (I = B, I === O) {
|
|
2409
2409
|
I = -1;
|
|
2410
2410
|
break;
|
|
2411
2411
|
}
|
|
2412
2412
|
if (I === -1) continue;
|
|
2413
|
-
let
|
|
2414
|
-
i[
|
|
2415
|
-
let
|
|
2416
|
-
for (; B = o[
|
|
2417
|
-
|
|
2413
|
+
let L = this._addTriangle(I, E, o[I], -1, -1, i[I]);
|
|
2414
|
+
i[E] = this._legalize(L + 2), i[I] = L, S++;
|
|
2415
|
+
let N = o[I];
|
|
2416
|
+
for (; B = o[N], ve(T, A, t[2 * N], t[2 * N + 1], t[2 * B], t[2 * B + 1]) < 0; )
|
|
2417
|
+
L = this._addTriangle(N, E, B, i[E], -1, i[N]), i[E] = this._legalize(L + 2), o[N] = N, S--, N = B;
|
|
2418
2418
|
if (I === O)
|
|
2419
|
-
for (; B = e[I], ve(
|
|
2420
|
-
|
|
2421
|
-
this._hullStart = e[
|
|
2419
|
+
for (; B = e[I], ve(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
|
|
2420
|
+
L = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(L + 2), i[B] = L, o[I] = I, S--, I = B;
|
|
2421
|
+
this._hullStart = e[E] = I, o[I] = e[N] = E, o[E] = N, r[this._hashKey(T, A)] = E, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
|
|
2422
2422
|
}
|
|
2423
2423
|
this.hull = new Uint32Array(S);
|
|
2424
2424
|
for (let V = 0, D = this._hullStart; V < S; V++)
|
|
@@ -2451,32 +2451,32 @@ class Be {
|
|
|
2451
2451
|
t = De[--r];
|
|
2452
2452
|
continue;
|
|
2453
2453
|
}
|
|
2454
|
-
const u = a - a % 3, h = l + (t + 1) % 3,
|
|
2454
|
+
const u = a - a % 3, h = l + (t + 1) % 3, d = u + (a + 2) % 3, c = e[s], f = e[t], w = e[h], x = e[d];
|
|
2455
2455
|
if (ko(
|
|
2456
2456
|
i[2 * c],
|
|
2457
2457
|
i[2 * c + 1],
|
|
2458
|
-
i[2 *
|
|
2459
|
-
i[2 *
|
|
2458
|
+
i[2 * f],
|
|
2459
|
+
i[2 * f + 1],
|
|
2460
2460
|
i[2 * w],
|
|
2461
2461
|
i[2 * w + 1],
|
|
2462
2462
|
i[2 * x],
|
|
2463
2463
|
i[2 * x + 1]
|
|
2464
2464
|
)) {
|
|
2465
2465
|
e[t] = x, e[a] = c;
|
|
2466
|
-
const M = o[
|
|
2466
|
+
const M = o[d];
|
|
2467
2467
|
if (M === -1) {
|
|
2468
|
-
let
|
|
2468
|
+
let m = this._hullStart;
|
|
2469
2469
|
do {
|
|
2470
|
-
if (this._hullTri[
|
|
2471
|
-
this._hullTri[
|
|
2470
|
+
if (this._hullTri[m] === d) {
|
|
2471
|
+
this._hullTri[m] = t;
|
|
2472
2472
|
break;
|
|
2473
2473
|
}
|
|
2474
|
-
|
|
2475
|
-
} while (
|
|
2474
|
+
m = this._hullPrev[m];
|
|
2475
|
+
} while (m !== this._hullStart);
|
|
2476
2476
|
}
|
|
2477
|
-
this._link(t, M), this._link(a, o[s]), this._link(s,
|
|
2478
|
-
const
|
|
2479
|
-
r < De.length && (De[r++] =
|
|
2477
|
+
this._link(t, M), this._link(a, o[s]), this._link(s, d);
|
|
2478
|
+
const g = u + (a + 1) % 3;
|
|
2479
|
+
r < De.length && (De[r++] = g);
|
|
2480
2480
|
} else {
|
|
2481
2481
|
if (r === 0) break;
|
|
2482
2482
|
t = De[--r];
|
|
@@ -2513,21 +2513,21 @@ function Io(n, t) {
|
|
|
2513
2513
|
const e = n / (Math.abs(n) + Math.abs(t));
|
|
2514
2514
|
return (t > 0 ? 3 - e : 1 + e) / 4;
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function We(n, t, e, o) {
|
|
2517
2517
|
const i = n - e, r = t - o;
|
|
2518
2518
|
return i * i + r * r;
|
|
2519
2519
|
}
|
|
2520
2520
|
function ko(n, t, e, o, i, r, s, a) {
|
|
2521
|
-
const l = n - s, u = t - a, h = e - s,
|
|
2522
|
-
return l * (
|
|
2521
|
+
const l = n - s, u = t - a, h = e - s, d = o - a, c = i - s, f = r - a, w = l * l + u * u, x = h * h + d * d, P = c * c + f * f;
|
|
2522
|
+
return l * (d * P - x * f) - u * (h * P - x * c) + w * (h * f - d * c) < 0;
|
|
2523
2523
|
}
|
|
2524
2524
|
function Co(n, t, e, o, i, r) {
|
|
2525
|
-
const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a,
|
|
2526
|
-
return
|
|
2525
|
+
const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, d = l * l + u * u, c = 0.5 / (s * u - a * l), f = (u * h - a * d) * c, w = (s * d - l * h) * c;
|
|
2526
|
+
return f * f + w * w;
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2529
|
-
const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a,
|
|
2530
|
-
return { x:
|
|
2528
|
+
function Lo(n, t, e, o, i, r) {
|
|
2529
|
+
const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, d = l * l + u * u, c = 0.5 / (s * u - a * l), f = n + (u * h - a * d) * c, w = t + (s * d - l * h) * c;
|
|
2530
|
+
return { x: f, y: w };
|
|
2531
2531
|
}
|
|
2532
2532
|
function ye(n, t, e, o) {
|
|
2533
2533
|
if (o - e <= 20)
|
|
@@ -2559,7 +2559,7 @@ function Me(n, t, e) {
|
|
|
2559
2559
|
const o = n[t];
|
|
2560
2560
|
n[t] = n[e], n[e] = o;
|
|
2561
2561
|
}
|
|
2562
|
-
function
|
|
2562
|
+
function Ro(n) {
|
|
2563
2563
|
return n[0];
|
|
2564
2564
|
}
|
|
2565
2565
|
function Fo(n) {
|
|
@@ -2593,7 +2593,7 @@ class de {
|
|
|
2593
2593
|
return this._ || null;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
|
-
class
|
|
2596
|
+
class je {
|
|
2597
2597
|
constructor() {
|
|
2598
2598
|
this._ = [];
|
|
2599
2599
|
}
|
|
@@ -2622,41 +2622,41 @@ class Oo {
|
|
|
2622
2622
|
const { delaunay: { points: t, hull: e, triangles: o }, vectors: i } = this;
|
|
2623
2623
|
let r, s;
|
|
2624
2624
|
const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
|
|
2625
|
-
for (let x = 0, P = 0, M = o.length,
|
|
2626
|
-
const p = o[x] * 2, b = o[x + 1] * 2, z = o[x + 2] * 2, v = t[p], S = t[p + 1], V = t[b], D = t[b + 1], _ = t[z],
|
|
2625
|
+
for (let x = 0, P = 0, M = o.length, g, m; x < M; x += 3, P += 2) {
|
|
2626
|
+
const p = o[x] * 2, b = o[x + 1] * 2, z = o[x + 2] * 2, v = t[p], S = t[p + 1], V = t[b], D = t[b + 1], _ = t[z], E = t[z + 1], T = V - v, A = D - S, O = _ - v, I = E - S, B = (T * I - A * O) * 2;
|
|
2627
2627
|
if (Math.abs(B) < 1e-9) {
|
|
2628
2628
|
if (r === void 0) {
|
|
2629
2629
|
r = s = 0;
|
|
2630
|
-
for (const
|
|
2630
|
+
for (const N of e) r += t[N * 2], s += t[N * 2 + 1];
|
|
2631
2631
|
r /= e.length, s /= e.length;
|
|
2632
2632
|
}
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2633
|
+
const L = 1e9 * Math.sign((r - v) * I - (s - S) * O);
|
|
2634
|
+
g = (v + _) / 2 - L * I, m = (S + E) / 2 + L * O;
|
|
2635
2635
|
} else {
|
|
2636
|
-
const
|
|
2637
|
-
|
|
2636
|
+
const L = 1 / B, N = T * T + A * A, C = O * O + I * I;
|
|
2637
|
+
g = v + (I * N - A * C) * L, m = S + (T * C - O * N) * L;
|
|
2638
2638
|
}
|
|
2639
|
-
a[P] =
|
|
2639
|
+
a[P] = g, a[P + 1] = m;
|
|
2640
2640
|
}
|
|
2641
|
-
let l = e[e.length - 1], u, h = l * 4,
|
|
2641
|
+
let l = e[e.length - 1], u, h = l * 4, d, c = t[2 * l], f, w = t[2 * l + 1];
|
|
2642
2642
|
i.fill(0);
|
|
2643
2643
|
for (let x = 0; x < e.length; ++x)
|
|
2644
|
-
l = e[x], u = h,
|
|
2644
|
+
l = e[x], u = h, d = c, f = w, h = l * 4, c = t[2 * l], w = t[2 * l + 1], i[u + 2] = i[h] = f - w, i[u + 3] = i[h + 1] = c - d;
|
|
2645
2645
|
}
|
|
2646
2646
|
render(t) {
|
|
2647
2647
|
const e = t == null ? t = new de() : void 0, { delaunay: { halfedges: o, inedges: i, hull: r }, circumcenters: s, vectors: a } = this;
|
|
2648
2648
|
if (r.length <= 1) return null;
|
|
2649
|
-
for (let h = 0,
|
|
2649
|
+
for (let h = 0, d = o.length; h < d; ++h) {
|
|
2650
2650
|
const c = o[h];
|
|
2651
2651
|
if (c < h) continue;
|
|
2652
|
-
const
|
|
2653
|
-
this._renderSegment(x, P, M,
|
|
2652
|
+
const f = Math.floor(h / 3) * 2, w = Math.floor(c / 3) * 2, x = s[f], P = s[f + 1], M = s[w], g = s[w + 1];
|
|
2653
|
+
this._renderSegment(x, P, M, g, t);
|
|
2654
2654
|
}
|
|
2655
2655
|
let l, u = r[r.length - 1];
|
|
2656
2656
|
for (let h = 0; h < r.length; ++h) {
|
|
2657
2657
|
l = u, u = r[h];
|
|
2658
|
-
const
|
|
2659
|
-
x && this._renderSegment(c,
|
|
2658
|
+
const d = Math.floor(i[u] / 3) * 2, c = s[d], f = s[d + 1], w = l * 4, x = this._project(c, f, a[w + 2], a[w + 3]);
|
|
2659
|
+
x && this._renderSegment(c, f, x[0], x[1], t);
|
|
2660
2660
|
}
|
|
2661
2661
|
return e && e.value();
|
|
2662
2662
|
}
|
|
@@ -2682,7 +2682,7 @@ class Oo {
|
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
2684
|
cellPolygon(t) {
|
|
2685
|
-
const e = new
|
|
2685
|
+
const e = new je();
|
|
2686
2686
|
return this.renderCell(t, e), e.value();
|
|
2687
2687
|
}
|
|
2688
2688
|
_renderSegment(t, e, o, i, r) {
|
|
@@ -2729,23 +2729,23 @@ class Oo {
|
|
|
2729
2729
|
}
|
|
2730
2730
|
_clipFinite(t, e) {
|
|
2731
2731
|
const o = e.length;
|
|
2732
|
-
let i = null, r, s, a = e[o - 2], l = e[o - 1], u, h = this._regioncode(a, l),
|
|
2733
|
-
for (let
|
|
2734
|
-
if (r = a, s = l, a = e[
|
|
2735
|
-
|
|
2732
|
+
let i = null, r, s, a = e[o - 2], l = e[o - 1], u, h = this._regioncode(a, l), d, c = 0;
|
|
2733
|
+
for (let f = 0; f < o; f += 2)
|
|
2734
|
+
if (r = a, s = l, a = e[f], l = e[f + 1], u = h, h = this._regioncode(a, l), u === 0 && h === 0)
|
|
2735
|
+
d = c, c = 0, i ? i.push(a, l) : i = [a, l];
|
|
2736
2736
|
else {
|
|
2737
|
-
let w, x, P, M,
|
|
2737
|
+
let w, x, P, M, g;
|
|
2738
2738
|
if (u === 0) {
|
|
2739
2739
|
if ((w = this._clipSegment(r, s, a, l, u, h)) === null) continue;
|
|
2740
|
-
[x, P, M,
|
|
2740
|
+
[x, P, M, g] = w;
|
|
2741
2741
|
} else {
|
|
2742
2742
|
if ((w = this._clipSegment(a, l, r, s, h, u)) === null) continue;
|
|
2743
|
-
[M,
|
|
2743
|
+
[M, g, x, P] = w, d = c, c = this._edgecode(x, P), d && c && this._edge(t, d, c, i, i.length), i ? i.push(x, P) : i = [x, P];
|
|
2744
2744
|
}
|
|
2745
|
-
|
|
2745
|
+
d = c, c = this._edgecode(M, g), d && c && this._edge(t, d, c, i, i.length), i ? i.push(M, g) : i = [M, g];
|
|
2746
2746
|
}
|
|
2747
2747
|
if (i)
|
|
2748
|
-
|
|
2748
|
+
d = c, c = this._edgecode(i[0], i[1]), d && c && this._edge(t, d, c, i, i.length);
|
|
2749
2749
|
else if (this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2))
|
|
2750
2750
|
return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
|
|
2751
2751
|
return i;
|
|
@@ -2762,8 +2762,8 @@ class Oo {
|
|
|
2762
2762
|
_clipInfinite(t, e, o, i, r, s) {
|
|
2763
2763
|
let a = Array.from(e), l;
|
|
2764
2764
|
if ((l = this._project(a[0], a[1], o, i)) && a.unshift(l[0], l[1]), (l = this._project(a[a.length - 2], a[a.length - 1], r, s)) && a.push(l[0], l[1]), a = this._clipFinite(t, a))
|
|
2765
|
-
for (let u = 0, h = a.length,
|
|
2766
|
-
|
|
2765
|
+
for (let u = 0, h = a.length, d, c = this._edgecode(a[h - 2], a[h - 1]); u < h; u += 2)
|
|
2766
|
+
d = c, c = this._edgecode(a[u], a[u + 1]), d && c && (u = this._edge(t, d, c, a, u), h = a.length);
|
|
2767
2767
|
else this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (a = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]);
|
|
2768
2768
|
return a;
|
|
2769
2769
|
}
|
|
@@ -2835,11 +2835,11 @@ class Oo {
|
|
|
2835
2835
|
return t;
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2839
|
-
function
|
|
2838
|
+
const No = 2 * Math.PI, ge = Math.pow;
|
|
2839
|
+
function qo(n) {
|
|
2840
2840
|
return n[0];
|
|
2841
2841
|
}
|
|
2842
|
-
function
|
|
2842
|
+
function Wo(n) {
|
|
2843
2843
|
return n[1];
|
|
2844
2844
|
}
|
|
2845
2845
|
function Xo(n) {
|
|
@@ -2850,12 +2850,12 @@ function Xo(n) {
|
|
|
2850
2850
|
}
|
|
2851
2851
|
return !0;
|
|
2852
2852
|
}
|
|
2853
|
-
function
|
|
2853
|
+
function $o(n, t, e) {
|
|
2854
2854
|
return [n + Math.sin(n + t) * e, t + Math.cos(n - t) * e];
|
|
2855
2855
|
}
|
|
2856
|
-
class
|
|
2857
|
-
static from(t, e =
|
|
2858
|
-
return new
|
|
2856
|
+
class ke {
|
|
2857
|
+
static from(t, e = qo, o = Wo, i) {
|
|
2858
|
+
return new ke("length" in t ? Ho(t, e, o, i) : Float64Array.from(Yo(t, e, o, i)));
|
|
2859
2859
|
}
|
|
2860
2860
|
constructor(t) {
|
|
2861
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();
|
|
@@ -2866,10 +2866,10 @@ class Ue {
|
|
|
2866
2866
|
_init() {
|
|
2867
2867
|
const t = this._delaunator, e = this.points;
|
|
2868
2868
|
if (t.hull && t.hull.length > 2 && Xo(t)) {
|
|
2869
|
-
this.collinear = Int32Array.from({ length: e.length / 2 }, (c,
|
|
2870
|
-
const l = this.collinear[0], u = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * u], e[2 * u + 1]],
|
|
2871
|
-
for (let c = 0,
|
|
2872
|
-
const w =
|
|
2869
|
+
this.collinear = Int32Array.from({ length: e.length / 2 }, (c, f) => f).sort((c, f) => e[2 * c] - e[2 * f] || e[2 * c + 1] - e[2 * f + 1]);
|
|
2870
|
+
const l = this.collinear[0], u = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * u], e[2 * u + 1]], d = 1e-8 * Math.hypot(h[3] - h[1], h[2] - h[0]);
|
|
2871
|
+
for (let c = 0, f = e.length / 2; c < f; ++c) {
|
|
2872
|
+
const w = $o(e[2 * c], e[2 * c + 1], d);
|
|
2873
2873
|
e[2 * c] = w[0], e[2 * c + 1] = w[1];
|
|
2874
2874
|
}
|
|
2875
2875
|
this._delaunator = new Be(e);
|
|
@@ -2890,8 +2890,8 @@ class Ue {
|
|
|
2890
2890
|
*neighbors(t) {
|
|
2891
2891
|
const { inedges: e, hull: o, _hullIndex: i, halfedges: r, triangles: s, collinear: a } = this;
|
|
2892
2892
|
if (a) {
|
|
2893
|
-
const
|
|
2894
|
-
|
|
2893
|
+
const d = a.indexOf(t);
|
|
2894
|
+
d > 0 && (yield a[d - 1]), d < a.length - 1 && (yield a[d + 1]);
|
|
2895
2895
|
return;
|
|
2896
2896
|
}
|
|
2897
2897
|
const l = e[t];
|
|
@@ -2900,8 +2900,8 @@ class Ue {
|
|
|
2900
2900
|
do {
|
|
2901
2901
|
if (yield h = s[u], u = u % 3 === 2 ? u - 2 : u + 1, s[u] !== t) return;
|
|
2902
2902
|
if (u = r[u], u === -1) {
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2903
|
+
const d = o[(i[t] + 1) % o.length];
|
|
2904
|
+
d !== h && (yield d);
|
|
2905
2905
|
return;
|
|
2906
2906
|
}
|
|
2907
2907
|
} while (u !== l);
|
|
@@ -2916,19 +2916,19 @@ class Ue {
|
|
|
2916
2916
|
_step(t, e, o) {
|
|
2917
2917
|
const { inedges: i, hull: r, _hullIndex: s, halfedges: a, triangles: l, points: u } = this;
|
|
2918
2918
|
if (i[t] === -1 || !u.length) return (t + 1) % (u.length >> 1);
|
|
2919
|
-
let h = t,
|
|
2919
|
+
let h = t, d = ge(e - u[t * 2], 2) + ge(o - u[t * 2 + 1], 2);
|
|
2920
2920
|
const c = i[t];
|
|
2921
|
-
let
|
|
2921
|
+
let f = c;
|
|
2922
2922
|
do {
|
|
2923
|
-
let w = l[
|
|
2923
|
+
let w = l[f];
|
|
2924
2924
|
const x = ge(e - u[w * 2], 2) + ge(o - u[w * 2 + 1], 2);
|
|
2925
|
-
if (x <
|
|
2926
|
-
if (
|
|
2927
|
-
if (
|
|
2928
|
-
return
|
|
2925
|
+
if (x < d && (d = x, h = w), f = f % 3 === 2 ? f - 2 : f + 1, l[f] !== t) break;
|
|
2926
|
+
if (f = a[f], f === -1) {
|
|
2927
|
+
if (f = r[(s[t] + 1) % r.length], f !== w && ge(e - u[f * 2], 2) + ge(o - u[f * 2 + 1], 2) < d)
|
|
2928
|
+
return f;
|
|
2929
2929
|
break;
|
|
2930
2930
|
}
|
|
2931
|
-
} while (
|
|
2931
|
+
} while (f !== c);
|
|
2932
2932
|
return h;
|
|
2933
2933
|
}
|
|
2934
2934
|
render(t) {
|
|
@@ -2946,7 +2946,7 @@ class Ue {
|
|
|
2946
2946
|
const o = t == null ? t = new de() : void 0, { points: i } = this;
|
|
2947
2947
|
for (let r = 0, s = i.length; r < s; r += 2) {
|
|
2948
2948
|
const a = i[r], l = i[r + 1];
|
|
2949
|
-
t.moveTo(a + e, l), t.arc(a, l, e, 0,
|
|
2949
|
+
t.moveTo(a + e, l), t.arc(a, l, e, 0, No);
|
|
2950
2950
|
}
|
|
2951
2951
|
return o && o.value();
|
|
2952
2952
|
}
|
|
@@ -2960,7 +2960,7 @@ class Ue {
|
|
|
2960
2960
|
return t.closePath(), e && e.value();
|
|
2961
2961
|
}
|
|
2962
2962
|
hullPolygon() {
|
|
2963
|
-
const t = new
|
|
2963
|
+
const t = new je();
|
|
2964
2964
|
return this.renderHull(t), t.value();
|
|
2965
2965
|
}
|
|
2966
2966
|
renderTriangle(t, e) {
|
|
@@ -2973,11 +2973,11 @@ class Ue {
|
|
|
2973
2973
|
yield this.trianglePolygon(e);
|
|
2974
2974
|
}
|
|
2975
2975
|
trianglePolygon(t) {
|
|
2976
|
-
const e = new
|
|
2976
|
+
const e = new je();
|
|
2977
2977
|
return this.renderTriangle(t, e), e.value();
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
function
|
|
2980
|
+
function Ho(n, t, e, o) {
|
|
2981
2981
|
const i = n.length, r = new Float64Array(i * 2);
|
|
2982
2982
|
for (let s = 0; s < i; ++s) {
|
|
2983
2983
|
const a = n[s];
|
|
@@ -2985,7 +2985,7 @@ function Yo(n, t, e, o) {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
return r;
|
|
2987
2987
|
}
|
|
2988
|
-
function*
|
|
2988
|
+
function* Yo(n, t, e, o) {
|
|
2989
2989
|
let i = 0;
|
|
2990
2990
|
for (const r of n)
|
|
2991
2991
|
yield t.call(o, r, i, n), yield e.call(o, r, i, n), ++i;
|
|
@@ -3005,15 +3005,15 @@ function cn(n) {
|
|
|
3005
3005
|
t.has(x) || (t.add(x), e.push(w));
|
|
3006
3006
|
}
|
|
3007
3007
|
if (e.length < 3) return [];
|
|
3008
|
-
const o = new
|
|
3008
|
+
const o = new ke(Float64Array.from(e.flat())), { triangles: i } = o;
|
|
3009
3009
|
if (!i.length) return [];
|
|
3010
3010
|
const r = /* @__PURE__ */ new Map(), s = (w, x) => w < x ? `${w}_${x}` : `${x}_${w}`;
|
|
3011
3011
|
for (let w = 0; w < i.length; w += 3) {
|
|
3012
|
-
const x = i[w], P = i[w + 1], M = i[w + 2], [
|
|
3012
|
+
const x = i[w], P = i[w + 1], M = i[w + 2], [g, m] = e[x], [p, b] = e[P], [z, v] = e[M], S = jo(g, m, p, b, z, v), V = Go(e, x, P, M);
|
|
3013
3013
|
if (S <= 1 / V)
|
|
3014
3014
|
for (const [D, _] of [[x, P], [P, M], [M, x]]) {
|
|
3015
|
-
const
|
|
3016
|
-
r.set(
|
|
3015
|
+
const E = s(D, _);
|
|
3016
|
+
r.set(E, (r.get(E) || 0) + 1);
|
|
3017
3017
|
}
|
|
3018
3018
|
}
|
|
3019
3019
|
const a = [];
|
|
@@ -3022,14 +3022,14 @@ function cn(n) {
|
|
|
3022
3022
|
const l = /* @__PURE__ */ new Map();
|
|
3023
3023
|
for (const [w, x] of a)
|
|
3024
3024
|
(l.get(w) || l.set(w, []).get(w)).push(x), (l.get(x) || l.set(x, []).get(x)).push(w);
|
|
3025
|
-
const u = a[0][0], h = [],
|
|
3026
|
-
let c = u,
|
|
3025
|
+
const u = a[0][0], h = [], d = /* @__PURE__ */ new Set();
|
|
3026
|
+
let c = u, f = -1;
|
|
3027
3027
|
do {
|
|
3028
|
-
h.push(e[c]),
|
|
3028
|
+
h.push(e[c]), d.add(c);
|
|
3029
3029
|
const w = l.get(c) || [];
|
|
3030
|
-
let x = w.find((P) => P !==
|
|
3031
|
-
if (x === void 0 && (x = w.find((P) => P !==
|
|
3032
|
-
|
|
3030
|
+
let x = w.find((P) => P !== f && !d.has(P));
|
|
3031
|
+
if (x === void 0 && (x = w.find((P) => P !== f)), x === void 0) break;
|
|
3032
|
+
f = c, c = x;
|
|
3033
3033
|
} while (c !== u && h.length <= a.length + 1);
|
|
3034
3034
|
return h;
|
|
3035
3035
|
}
|
|
@@ -3047,7 +3047,7 @@ const mt = {
|
|
|
3047
3047
|
// basis vectors
|
|
3048
3048
|
e: []
|
|
3049
3049
|
// half width
|
|
3050
|
-
}, It = [[], [], []], nt = [[], [], []], Dt = [], ce = new zt(), ue = new zt(), he = new zt(), Ot = new zt(), un = new zt(), hn = new zt(), Qt = new
|
|
3050
|
+
}, It = [[], [], []], nt = [[], [], []], Dt = [], ce = new zt(), ue = new zt(), he = new zt(), Ot = new zt(), un = new zt(), hn = new zt(), Qt = new En(), fn = new oo(), _e = new Tn(), dn = new Tn(), mn = new ro();
|
|
3051
3051
|
let An = class {
|
|
3052
3052
|
/**
|
|
3053
3053
|
* Constructs a new OBB.
|
|
@@ -3056,7 +3056,7 @@ let An = class {
|
|
|
3056
3056
|
* @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis.
|
|
3057
3057
|
* @param {Matrix3} [rotation] - The rotation of the OBB.
|
|
3058
3058
|
*/
|
|
3059
|
-
constructor(t = new zt(), e = new zt(), o = new
|
|
3059
|
+
constructor(t = new zt(), e = new zt(), o = new En()) {
|
|
3060
3060
|
this.center = t, this.halfSize = e, this.rotation = o;
|
|
3061
3061
|
}
|
|
3062
3062
|
/**
|
|
@@ -3106,11 +3106,11 @@ let An = class {
|
|
|
3106
3106
|
clampPoint(t, e) {
|
|
3107
3107
|
const o = this.halfSize;
|
|
3108
3108
|
Ot.subVectors(t, this.center), this.rotation.extractBasis(ce, ue, he), e.copy(this.center);
|
|
3109
|
-
const i =
|
|
3109
|
+
const i = Ne.clamp(Ot.dot(ce), -o.x, o.x);
|
|
3110
3110
|
e.add(ce.multiplyScalar(i));
|
|
3111
|
-
const r =
|
|
3111
|
+
const r = Ne.clamp(Ot.dot(ue), -o.y, o.y);
|
|
3112
3112
|
e.add(ue.multiplyScalar(r));
|
|
3113
|
-
const s =
|
|
3113
|
+
const s = Ne.clamp(Ot.dot(he), -o.z, o.z);
|
|
3114
3114
|
return e.add(he.multiplyScalar(s)), e;
|
|
3115
3115
|
}
|
|
3116
3116
|
/**
|
|
@@ -3230,22 +3230,22 @@ let An = class {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
};
|
|
3232
3232
|
const Uo = new An();
|
|
3233
|
-
var
|
|
3234
|
-
centimeters:
|
|
3235
|
-
centimetres:
|
|
3233
|
+
var Ht = 63710088e-1, Bn = {
|
|
3234
|
+
centimeters: Ht * 100,
|
|
3235
|
+
centimetres: Ht * 100,
|
|
3236
3236
|
degrees: 360 / (2 * Math.PI),
|
|
3237
|
-
feet:
|
|
3238
|
-
inches:
|
|
3239
|
-
kilometers:
|
|
3240
|
-
kilometres:
|
|
3241
|
-
meters:
|
|
3242
|
-
metres:
|
|
3243
|
-
miles:
|
|
3244
|
-
millimeters:
|
|
3245
|
-
millimetres:
|
|
3246
|
-
nauticalmiles:
|
|
3237
|
+
feet: Ht * 3.28084,
|
|
3238
|
+
inches: Ht * 39.37,
|
|
3239
|
+
kilometers: Ht / 1e3,
|
|
3240
|
+
kilometres: Ht / 1e3,
|
|
3241
|
+
meters: Ht,
|
|
3242
|
+
metres: Ht,
|
|
3243
|
+
miles: Ht / 1609.344,
|
|
3244
|
+
millimeters: Ht * 1e3,
|
|
3245
|
+
millimetres: Ht * 1e3,
|
|
3246
|
+
nauticalmiles: Ht / 1852,
|
|
3247
3247
|
radians: 1,
|
|
3248
|
-
yards:
|
|
3248
|
+
yards: Ht * 1.0936
|
|
3249
3249
|
};
|
|
3250
3250
|
function In(n, t, e = {}) {
|
|
3251
3251
|
const o = { type: "Feature" };
|
|
@@ -3294,13 +3294,13 @@ function Ko(n, t = "kilometers") {
|
|
|
3294
3294
|
throw new Error(t + " units is invalid");
|
|
3295
3295
|
return n / e;
|
|
3296
3296
|
}
|
|
3297
|
-
function
|
|
3297
|
+
function Ln(n) {
|
|
3298
3298
|
return n % (2 * Math.PI) * 180 / Math.PI;
|
|
3299
3299
|
}
|
|
3300
3300
|
function ie(n) {
|
|
3301
3301
|
return n % 360 * Math.PI / 180;
|
|
3302
3302
|
}
|
|
3303
|
-
function
|
|
3303
|
+
function Rn(n, t = "kilometers", e = "kilometers") {
|
|
3304
3304
|
if (!(n >= 0))
|
|
3305
3305
|
throw new Error("length must be a positive number");
|
|
3306
3306
|
return Zo(Ko(n, t), e);
|
|
@@ -3313,7 +3313,7 @@ function Qo(n) {
|
|
|
3313
3313
|
}
|
|
3314
3314
|
function Pe(n, t, e) {
|
|
3315
3315
|
if (n !== null)
|
|
3316
|
-
for (var o, i, r, s, a, l, u, h = 0,
|
|
3316
|
+
for (var o, i, r, s, a, l, u, h = 0, d = 0, c, f = n.type, w = f === "FeatureCollection", x = f === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
|
|
3317
3317
|
u = w ? (
|
|
3318
3318
|
// @ts-expect-error: Known type conflict
|
|
3319
3319
|
n.features[M].geometry
|
|
@@ -3321,9 +3321,9 @@ function Pe(n, t, e) {
|
|
|
3321
3321
|
// @ts-expect-error: Known type conflict
|
|
3322
3322
|
n.geometry
|
|
3323
3323
|
) : n, c = u ? u.type === "GeometryCollection" : !1, a = c ? u.geometries.length : 1;
|
|
3324
|
-
for (var
|
|
3325
|
-
var
|
|
3326
|
-
if (s = c ? u.geometries[
|
|
3324
|
+
for (var g = 0; g < a; g++) {
|
|
3325
|
+
var m = 0, p = 0;
|
|
3326
|
+
if (s = c ? u.geometries[g] : u, s !== null) {
|
|
3327
3327
|
l = s.coordinates;
|
|
3328
3328
|
var b = s.type;
|
|
3329
3329
|
switch (h = e && (b === "Polygon" || b === "MultiPolygon") ? 1 : 0, b) {
|
|
@@ -3334,14 +3334,14 @@ function Pe(n, t, e) {
|
|
|
3334
3334
|
// @ts-expect-error: Known type conflict
|
|
3335
3335
|
t(
|
|
3336
3336
|
l,
|
|
3337
|
-
|
|
3337
|
+
d,
|
|
3338
3338
|
M,
|
|
3339
|
-
|
|
3339
|
+
m,
|
|
3340
3340
|
p
|
|
3341
3341
|
) === !1
|
|
3342
3342
|
)
|
|
3343
3343
|
return !1;
|
|
3344
|
-
|
|
3344
|
+
d++, m++;
|
|
3345
3345
|
break;
|
|
3346
3346
|
case "LineString":
|
|
3347
3347
|
case "MultiPoint":
|
|
@@ -3350,16 +3350,16 @@ function Pe(n, t, e) {
|
|
|
3350
3350
|
// @ts-expect-error: Known type conflict
|
|
3351
3351
|
t(
|
|
3352
3352
|
l[o],
|
|
3353
|
-
|
|
3353
|
+
d,
|
|
3354
3354
|
M,
|
|
3355
|
-
|
|
3355
|
+
m,
|
|
3356
3356
|
p
|
|
3357
3357
|
) === !1
|
|
3358
3358
|
)
|
|
3359
3359
|
return !1;
|
|
3360
|
-
|
|
3360
|
+
d++, b === "MultiPoint" && m++;
|
|
3361
3361
|
}
|
|
3362
|
-
b === "LineString" &&
|
|
3362
|
+
b === "LineString" && m++;
|
|
3363
3363
|
break;
|
|
3364
3364
|
case "Polygon":
|
|
3365
3365
|
case "MultiLineString":
|
|
@@ -3369,18 +3369,18 @@ function Pe(n, t, e) {
|
|
|
3369
3369
|
// @ts-expect-error: Known type conflict
|
|
3370
3370
|
t(
|
|
3371
3371
|
l[o][i],
|
|
3372
|
-
|
|
3372
|
+
d,
|
|
3373
3373
|
M,
|
|
3374
|
-
|
|
3374
|
+
m,
|
|
3375
3375
|
p
|
|
3376
3376
|
) === !1
|
|
3377
3377
|
)
|
|
3378
3378
|
return !1;
|
|
3379
|
-
|
|
3379
|
+
d++;
|
|
3380
3380
|
}
|
|
3381
|
-
b === "MultiLineString" &&
|
|
3381
|
+
b === "MultiLineString" && m++, b === "Polygon" && p++;
|
|
3382
3382
|
}
|
|
3383
|
-
b === "Polygon" &&
|
|
3383
|
+
b === "Polygon" && m++;
|
|
3384
3384
|
break;
|
|
3385
3385
|
case "MultiPolygon":
|
|
3386
3386
|
for (o = 0; o < l.length; o++) {
|
|
@@ -3390,18 +3390,18 @@ function Pe(n, t, e) {
|
|
|
3390
3390
|
// @ts-expect-error: Known type conflict
|
|
3391
3391
|
t(
|
|
3392
3392
|
l[o][i][r],
|
|
3393
|
-
|
|
3393
|
+
d,
|
|
3394
3394
|
M,
|
|
3395
|
-
|
|
3395
|
+
m,
|
|
3396
3396
|
p
|
|
3397
3397
|
) === !1
|
|
3398
3398
|
)
|
|
3399
3399
|
return !1;
|
|
3400
|
-
|
|
3400
|
+
d++;
|
|
3401
3401
|
}
|
|
3402
3402
|
p++;
|
|
3403
3403
|
}
|
|
3404
|
-
|
|
3404
|
+
m++;
|
|
3405
3405
|
}
|
|
3406
3406
|
break;
|
|
3407
3407
|
case "GeometryCollection":
|
|
@@ -3426,27 +3426,27 @@ function Jo(n) {
|
|
|
3426
3426
|
}), t;
|
|
3427
3427
|
}
|
|
3428
3428
|
function tr(n, t) {
|
|
3429
|
-
var e, o, i, r, s, a, l, u, h,
|
|
3429
|
+
var e, o, i, r, s, a, l, u, h, d, c = 0, f = n.type === "FeatureCollection", w = n.type === "Feature", x = f ? n.features.length : 1;
|
|
3430
3430
|
for (e = 0; e < x; e++) {
|
|
3431
|
-
for (a =
|
|
3431
|
+
for (a = f ? (
|
|
3432
3432
|
// @ts-expect-error: Known type conflict
|
|
3433
3433
|
n.features[e].geometry
|
|
3434
3434
|
) : w ? (
|
|
3435
3435
|
// @ts-expect-error: Known type conflict
|
|
3436
3436
|
n.geometry
|
|
3437
|
-
) : n, u =
|
|
3437
|
+
) : n, u = f ? (
|
|
3438
3438
|
// @ts-expect-error: Known type conflict
|
|
3439
3439
|
n.features[e].properties
|
|
3440
3440
|
) : w ? (
|
|
3441
3441
|
// @ts-expect-error: Known type conflict
|
|
3442
3442
|
n.properties
|
|
3443
|
-
) : {}, h =
|
|
3443
|
+
) : {}, h = f ? (
|
|
3444
3444
|
// @ts-expect-error: Known type conflict
|
|
3445
3445
|
n.features[e].bbox
|
|
3446
3446
|
) : w ? (
|
|
3447
3447
|
// @ts-expect-error: Known type conflict
|
|
3448
3448
|
n.bbox
|
|
3449
|
-
) : void 0,
|
|
3449
|
+
) : void 0, d = f ? (
|
|
3450
3450
|
// @ts-expect-error: Known type conflict
|
|
3451
3451
|
n.features[e].id
|
|
3452
3452
|
) : w ? (
|
|
@@ -3462,7 +3462,7 @@ function tr(n, t) {
|
|
|
3462
3462
|
c,
|
|
3463
3463
|
u,
|
|
3464
3464
|
h,
|
|
3465
|
-
|
|
3465
|
+
d
|
|
3466
3466
|
) === !1
|
|
3467
3467
|
)
|
|
3468
3468
|
return !1;
|
|
@@ -3482,7 +3482,7 @@ function tr(n, t) {
|
|
|
3482
3482
|
c,
|
|
3483
3483
|
u,
|
|
3484
3484
|
h,
|
|
3485
|
-
|
|
3485
|
+
d
|
|
3486
3486
|
) === !1
|
|
3487
3487
|
)
|
|
3488
3488
|
return !1;
|
|
@@ -3497,7 +3497,7 @@ function tr(n, t) {
|
|
|
3497
3497
|
c,
|
|
3498
3498
|
u,
|
|
3499
3499
|
h,
|
|
3500
|
-
|
|
3500
|
+
d
|
|
3501
3501
|
) === !1
|
|
3502
3502
|
)
|
|
3503
3503
|
return !1;
|
|
@@ -3555,112 +3555,112 @@ var Ze = { exports: {} }, On = { exports: {} };
|
|
|
3555
3555
|
(function(e, o) {
|
|
3556
3556
|
n.exports = o();
|
|
3557
3557
|
})(Fn, function() {
|
|
3558
|
-
function e(
|
|
3559
|
-
(function v(S, V, D, _,
|
|
3558
|
+
function e(g, m, p, b, z) {
|
|
3559
|
+
(function v(S, V, D, _, E) {
|
|
3560
3560
|
for (; _ > D; ) {
|
|
3561
3561
|
if (_ - D > 600) {
|
|
3562
|
-
var
|
|
3563
|
-
v(S, V,
|
|
3562
|
+
var T = _ - D + 1, A = V - D + 1, O = Math.log(T), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (T - I) / T) * (A - T / 2 < 0 ? -1 : 1), L = Math.max(D, Math.floor(V - A * I / T + B)), N = Math.min(_, Math.floor(V + (T - A) * I / T + B));
|
|
3563
|
+
v(S, V, L, N, E);
|
|
3564
3564
|
}
|
|
3565
|
-
var C = S[V],
|
|
3566
|
-
for (o(S, D, V),
|
|
3567
|
-
for (o(S,
|
|
3568
|
-
for (;
|
|
3565
|
+
var C = S[V], R = D, $ = _;
|
|
3566
|
+
for (o(S, D, V), E(S[_], C) > 0 && o(S, D, _); R < $; ) {
|
|
3567
|
+
for (o(S, R, $), R++, $--; E(S[R], C) < 0; ) R++;
|
|
3568
|
+
for (; E(S[$], C) > 0; ) $--;
|
|
3569
3569
|
}
|
|
3570
|
-
|
|
3570
|
+
E(S[D], C) === 0 ? o(S, D, $) : o(S, ++$, _), $ <= V && (D = $ + 1), V <= $ && (_ = $ - 1);
|
|
3571
3571
|
}
|
|
3572
|
-
})(
|
|
3572
|
+
})(g, m, p || 0, b || g.length - 1, z || i);
|
|
3573
3573
|
}
|
|
3574
|
-
function o(
|
|
3575
|
-
var b =
|
|
3576
|
-
|
|
3574
|
+
function o(g, m, p) {
|
|
3575
|
+
var b = g[m];
|
|
3576
|
+
g[m] = g[p], g[p] = b;
|
|
3577
3577
|
}
|
|
3578
|
-
function i(
|
|
3579
|
-
return
|
|
3578
|
+
function i(g, m) {
|
|
3579
|
+
return g < m ? -1 : g > m ? 1 : 0;
|
|
3580
3580
|
}
|
|
3581
|
-
var r = function(
|
|
3582
|
-
|
|
3581
|
+
var r = function(g) {
|
|
3582
|
+
g === void 0 && (g = 9), this._maxEntries = Math.max(4, g), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
3583
3583
|
};
|
|
3584
|
-
function s(
|
|
3585
|
-
if (!p) return
|
|
3586
|
-
for (var b = 0; b <
|
|
3584
|
+
function s(g, m, p) {
|
|
3585
|
+
if (!p) return m.indexOf(g);
|
|
3586
|
+
for (var b = 0; b < m.length; b++) if (p(g, m[b])) return b;
|
|
3587
3587
|
return -1;
|
|
3588
3588
|
}
|
|
3589
|
-
function a(
|
|
3590
|
-
l(
|
|
3589
|
+
function a(g, m) {
|
|
3590
|
+
l(g, 0, g.children.length, m, g);
|
|
3591
3591
|
}
|
|
3592
|
-
function l(
|
|
3592
|
+
function l(g, m, p, b, z) {
|
|
3593
3593
|
z || (z = P(null)), z.minX = 1 / 0, z.minY = 1 / 0, z.maxX = -1 / 0, z.maxY = -1 / 0;
|
|
3594
|
-
for (var v =
|
|
3595
|
-
var S =
|
|
3596
|
-
u(z,
|
|
3594
|
+
for (var v = m; v < p; v++) {
|
|
3595
|
+
var S = g.children[v];
|
|
3596
|
+
u(z, g.leaf ? b(S) : S);
|
|
3597
3597
|
}
|
|
3598
3598
|
return z;
|
|
3599
3599
|
}
|
|
3600
|
-
function u(
|
|
3601
|
-
return
|
|
3600
|
+
function u(g, m) {
|
|
3601
|
+
return g.minX = Math.min(g.minX, m.minX), g.minY = Math.min(g.minY, m.minY), g.maxX = Math.max(g.maxX, m.maxX), g.maxY = Math.max(g.maxY, m.maxY), g;
|
|
3602
3602
|
}
|
|
3603
|
-
function h(
|
|
3604
|
-
return
|
|
3603
|
+
function h(g, m) {
|
|
3604
|
+
return g.minX - m.minX;
|
|
3605
3605
|
}
|
|
3606
|
-
function g
|
|
3607
|
-
return
|
|
3606
|
+
function d(g, m) {
|
|
3607
|
+
return g.minY - m.minY;
|
|
3608
3608
|
}
|
|
3609
|
-
function c(
|
|
3610
|
-
return (
|
|
3609
|
+
function c(g) {
|
|
3610
|
+
return (g.maxX - g.minX) * (g.maxY - g.minY);
|
|
3611
3611
|
}
|
|
3612
|
-
function
|
|
3613
|
-
return
|
|
3612
|
+
function f(g) {
|
|
3613
|
+
return g.maxX - g.minX + (g.maxY - g.minY);
|
|
3614
3614
|
}
|
|
3615
|
-
function w(
|
|
3616
|
-
return
|
|
3615
|
+
function w(g, m) {
|
|
3616
|
+
return g.minX <= m.minX && g.minY <= m.minY && m.maxX <= g.maxX && m.maxY <= g.maxY;
|
|
3617
3617
|
}
|
|
3618
|
-
function x(
|
|
3619
|
-
return
|
|
3618
|
+
function x(g, m) {
|
|
3619
|
+
return m.minX <= g.maxX && m.minY <= g.maxY && m.maxX >= g.minX && m.maxY >= g.minY;
|
|
3620
3620
|
}
|
|
3621
|
-
function P(
|
|
3622
|
-
return { children:
|
|
3621
|
+
function P(g) {
|
|
3622
|
+
return { children: g, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
3623
3623
|
}
|
|
3624
|
-
function M(
|
|
3625
|
-
for (var v = [
|
|
3626
|
-
var S =
|
|
3627
|
-
e(
|
|
3624
|
+
function M(g, m, p, b, z) {
|
|
3625
|
+
for (var v = [m, p]; v.length; ) if (!((p = v.pop()) - (m = v.pop()) <= b)) {
|
|
3626
|
+
var S = m + Math.ceil((p - m) / b / 2) * b;
|
|
3627
|
+
e(g, S, m, p, z), v.push(m, S, S, p);
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
3630
|
return r.prototype.all = function() {
|
|
3631
3631
|
return this._all(this.data, []);
|
|
3632
|
-
}, r.prototype.search = function(
|
|
3633
|
-
var
|
|
3634
|
-
if (!x(
|
|
3635
|
-
for (var b = this.toBBox, z = [];
|
|
3636
|
-
for (var v = 0; v <
|
|
3637
|
-
var S =
|
|
3638
|
-
x(
|
|
3632
|
+
}, r.prototype.search = function(g) {
|
|
3633
|
+
var m = this.data, p = [];
|
|
3634
|
+
if (!x(g, m)) return p;
|
|
3635
|
+
for (var b = this.toBBox, z = []; m; ) {
|
|
3636
|
+
for (var v = 0; v < m.children.length; v++) {
|
|
3637
|
+
var S = m.children[v], V = m.leaf ? b(S) : S;
|
|
3638
|
+
x(g, V) && (m.leaf ? p.push(S) : w(g, V) ? this._all(S, p) : z.push(S));
|
|
3639
3639
|
}
|
|
3640
|
-
|
|
3640
|
+
m = z.pop();
|
|
3641
3641
|
}
|
|
3642
3642
|
return p;
|
|
3643
|
-
}, r.prototype.collides = function(
|
|
3644
|
-
var
|
|
3645
|
-
if (!x(
|
|
3646
|
-
for (var p = [];
|
|
3647
|
-
for (var b = 0; b <
|
|
3648
|
-
var z =
|
|
3649
|
-
if (x(
|
|
3650
|
-
if (
|
|
3643
|
+
}, r.prototype.collides = function(g) {
|
|
3644
|
+
var m = this.data;
|
|
3645
|
+
if (!x(g, m)) return !1;
|
|
3646
|
+
for (var p = []; m; ) {
|
|
3647
|
+
for (var b = 0; b < m.children.length; b++) {
|
|
3648
|
+
var z = m.children[b], v = m.leaf ? this.toBBox(z) : z;
|
|
3649
|
+
if (x(g, v)) {
|
|
3650
|
+
if (m.leaf || w(g, v)) return !0;
|
|
3651
3651
|
p.push(z);
|
|
3652
3652
|
}
|
|
3653
3653
|
}
|
|
3654
|
-
|
|
3654
|
+
m = p.pop();
|
|
3655
3655
|
}
|
|
3656
3656
|
return !1;
|
|
3657
|
-
}, r.prototype.load = function(
|
|
3658
|
-
if (!
|
|
3659
|
-
if (
|
|
3660
|
-
for (var
|
|
3657
|
+
}, r.prototype.load = function(g) {
|
|
3658
|
+
if (!g || !g.length) return this;
|
|
3659
|
+
if (g.length < this._minEntries) {
|
|
3660
|
+
for (var m = 0; m < g.length; m++) this.insert(g[m]);
|
|
3661
3661
|
return this;
|
|
3662
3662
|
}
|
|
3663
|
-
var p = this._build(
|
|
3663
|
+
var p = this._build(g.slice(), 0, g.length - 1, 0);
|
|
3664
3664
|
if (this.data.children.length) if (this.data.height === p.height) this._splitRoot(this.data, p);
|
|
3665
3665
|
else {
|
|
3666
3666
|
if (this.data.height < p.height) {
|
|
@@ -3671,93 +3671,93 @@ var Ze = { exports: {} }, On = { exports: {} };
|
|
|
3671
3671
|
}
|
|
3672
3672
|
else this.data = p;
|
|
3673
3673
|
return this;
|
|
3674
|
-
}, r.prototype.insert = function(
|
|
3675
|
-
return
|
|
3674
|
+
}, r.prototype.insert = function(g) {
|
|
3675
|
+
return g && this._insert(g, this.data.height - 1), this;
|
|
3676
3676
|
}, r.prototype.clear = function() {
|
|
3677
3677
|
return this.data = P([]), this;
|
|
3678
|
-
}, r.prototype.remove = function(
|
|
3679
|
-
if (!
|
|
3680
|
-
for (var p, b, z, v = this.data, S = this.toBBox(
|
|
3678
|
+
}, r.prototype.remove = function(g, m) {
|
|
3679
|
+
if (!g) return this;
|
|
3680
|
+
for (var p, b, z, v = this.data, S = this.toBBox(g), V = [], D = []; v || V.length; ) {
|
|
3681
3681
|
if (v || (v = V.pop(), b = V[V.length - 1], p = D.pop(), z = !0), v.leaf) {
|
|
3682
|
-
var _ = s(
|
|
3682
|
+
var _ = s(g, v.children, m);
|
|
3683
3683
|
if (_ !== -1) return v.children.splice(_, 1), V.push(v), this._condense(V), this;
|
|
3684
3684
|
}
|
|
3685
3685
|
z || v.leaf || !w(v, S) ? b ? (p++, v = b.children[p], z = !1) : v = null : (V.push(v), D.push(p), p = 0, b = v, v = v.children[0]);
|
|
3686
3686
|
}
|
|
3687
3687
|
return this;
|
|
3688
|
-
}, r.prototype.toBBox = function(
|
|
3689
|
-
return
|
|
3690
|
-
}, r.prototype.compareMinX = function(
|
|
3691
|
-
return
|
|
3692
|
-
}, r.prototype.compareMinY = function(
|
|
3693
|
-
return
|
|
3688
|
+
}, r.prototype.toBBox = function(g) {
|
|
3689
|
+
return g;
|
|
3690
|
+
}, r.prototype.compareMinX = function(g, m) {
|
|
3691
|
+
return g.minX - m.minX;
|
|
3692
|
+
}, r.prototype.compareMinY = function(g, m) {
|
|
3693
|
+
return g.minY - m.minY;
|
|
3694
3694
|
}, r.prototype.toJSON = function() {
|
|
3695
3695
|
return this.data;
|
|
3696
|
-
}, r.prototype.fromJSON = function(
|
|
3697
|
-
return this.data =
|
|
3698
|
-
}, r.prototype._all = function(
|
|
3699
|
-
for (var p = [];
|
|
3700
|
-
return
|
|
3701
|
-
}, r.prototype._build = function(
|
|
3702
|
-
var z, v = p -
|
|
3703
|
-
if (v <= S) return a(z = P(
|
|
3696
|
+
}, r.prototype.fromJSON = function(g) {
|
|
3697
|
+
return this.data = g, this;
|
|
3698
|
+
}, r.prototype._all = function(g, m) {
|
|
3699
|
+
for (var p = []; g; ) g.leaf ? m.push.apply(m, g.children) : p.push.apply(p, g.children), g = p.pop();
|
|
3700
|
+
return m;
|
|
3701
|
+
}, r.prototype._build = function(g, m, p, b) {
|
|
3702
|
+
var z, v = p - m + 1, S = this._maxEntries;
|
|
3703
|
+
if (v <= S) return a(z = P(g.slice(m, p + 1)), this.toBBox), z;
|
|
3704
3704
|
b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (z = P([])).leaf = !1, z.height = b;
|
|
3705
3705
|
var V = Math.ceil(v / S), D = V * Math.ceil(Math.sqrt(S));
|
|
3706
|
-
M(
|
|
3707
|
-
for (var _ =
|
|
3708
|
-
var
|
|
3709
|
-
M(
|
|
3710
|
-
for (var
|
|
3711
|
-
var A = Math.min(
|
|
3712
|
-
z.children.push(this._build(
|
|
3706
|
+
M(g, m, p, D, this.compareMinX);
|
|
3707
|
+
for (var _ = m; _ <= p; _ += D) {
|
|
3708
|
+
var E = Math.min(_ + D - 1, p);
|
|
3709
|
+
M(g, _, E, V, this.compareMinY);
|
|
3710
|
+
for (var T = _; T <= E; T += V) {
|
|
3711
|
+
var A = Math.min(T + V - 1, E);
|
|
3712
|
+
z.children.push(this._build(g, T, A, b - 1));
|
|
3713
3713
|
}
|
|
3714
3714
|
}
|
|
3715
3715
|
return a(z, this.toBBox), z;
|
|
3716
|
-
}, r.prototype._chooseSubtree = function(
|
|
3717
|
-
for (; b.push(
|
|
3718
|
-
for (var z = 1 / 0, v = 1 / 0, S = void 0, V = 0; V <
|
|
3719
|
-
var D =
|
|
3720
|
-
|
|
3716
|
+
}, r.prototype._chooseSubtree = function(g, m, p, b) {
|
|
3717
|
+
for (; b.push(m), !m.leaf && b.length - 1 !== p; ) {
|
|
3718
|
+
for (var z = 1 / 0, v = 1 / 0, S = void 0, V = 0; V < m.children.length; V++) {
|
|
3719
|
+
var D = m.children[V], _ = c(D), E = (T = g, A = D, (Math.max(A.maxX, T.maxX) - Math.min(A.minX, T.minX)) * (Math.max(A.maxY, T.maxY) - Math.min(A.minY, T.minY)) - _);
|
|
3720
|
+
E < v ? (v = E, z = _ < z ? _ : z, S = D) : E === v && _ < z && (z = _, S = D);
|
|
3721
3721
|
}
|
|
3722
|
-
|
|
3722
|
+
m = S || m.children[0];
|
|
3723
3723
|
}
|
|
3724
|
-
var
|
|
3725
|
-
return
|
|
3726
|
-
}, r.prototype._insert = function(
|
|
3727
|
-
var b = p ?
|
|
3728
|
-
for (v.children.push(
|
|
3729
|
-
this._adjustParentBBoxes(b, z,
|
|
3730
|
-
}, r.prototype._split = function(
|
|
3731
|
-
var p =
|
|
3724
|
+
var T, A;
|
|
3725
|
+
return m;
|
|
3726
|
+
}, r.prototype._insert = function(g, m, p) {
|
|
3727
|
+
var b = p ? g : this.toBBox(g), z = [], v = this._chooseSubtree(b, this.data, m, z);
|
|
3728
|
+
for (v.children.push(g), u(v, b); m >= 0 && z[m].children.length > this._maxEntries; ) this._split(z, m), m--;
|
|
3729
|
+
this._adjustParentBBoxes(b, z, m);
|
|
3730
|
+
}, r.prototype._split = function(g, m) {
|
|
3731
|
+
var p = g[m], b = p.children.length, z = this._minEntries;
|
|
3732
3732
|
this._chooseSplitAxis(p, z, b);
|
|
3733
3733
|
var v = this._chooseSplitIndex(p, z, b), S = P(p.children.splice(v, p.children.length - v));
|
|
3734
|
-
S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox),
|
|
3735
|
-
}, r.prototype._splitRoot = function(
|
|
3736
|
-
this.data = P([
|
|
3737
|
-
}, r.prototype._chooseSplitIndex = function(
|
|
3738
|
-
for (var b, z, v, S, V, D, _,
|
|
3739
|
-
var O = l(
|
|
3740
|
-
B <
|
|
3734
|
+
S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox), m ? g[m - 1].children.push(S) : this._splitRoot(p, S);
|
|
3735
|
+
}, r.prototype._splitRoot = function(g, m) {
|
|
3736
|
+
this.data = P([g, m]), this.data.height = g.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
|
|
3737
|
+
}, r.prototype._chooseSplitIndex = function(g, m, p) {
|
|
3738
|
+
for (var b, z, v, S, V, D, _, E = 1 / 0, T = 1 / 0, A = m; A <= p - m; A++) {
|
|
3739
|
+
var O = l(g, 0, A, this.toBBox), I = l(g, A, p, this.toBBox), B = (z = O, v = I, S = void 0, V = void 0, D = void 0, _ = void 0, S = Math.max(z.minX, v.minX), V = Math.max(z.minY, v.minY), D = Math.min(z.maxX, v.maxX), _ = Math.min(z.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - V)), L = c(O) + c(I);
|
|
3740
|
+
B < E ? (E = B, b = A, T = L < T ? L : T) : B === E && L < T && (T = L, b = A);
|
|
3741
3741
|
}
|
|
3742
|
-
return b || p -
|
|
3743
|
-
}, r.prototype._chooseSplitAxis = function(
|
|
3744
|
-
var b =
|
|
3745
|
-
this._allDistMargin(
|
|
3746
|
-
}, r.prototype._allDistMargin = function(
|
|
3747
|
-
|
|
3748
|
-
for (var z = this.toBBox, v = l(
|
|
3749
|
-
var _ =
|
|
3750
|
-
u(v,
|
|
3742
|
+
return b || p - m;
|
|
3743
|
+
}, r.prototype._chooseSplitAxis = function(g, m, p) {
|
|
3744
|
+
var b = g.leaf ? this.compareMinX : h, z = g.leaf ? this.compareMinY : d;
|
|
3745
|
+
this._allDistMargin(g, m, p, b) < this._allDistMargin(g, m, p, z) && g.children.sort(b);
|
|
3746
|
+
}, r.prototype._allDistMargin = function(g, m, p, b) {
|
|
3747
|
+
g.children.sort(b);
|
|
3748
|
+
for (var z = this.toBBox, v = l(g, 0, m, z), S = l(g, p - m, p, z), V = f(v) + f(S), D = m; D < p - m; D++) {
|
|
3749
|
+
var _ = g.children[D];
|
|
3750
|
+
u(v, g.leaf ? z(_) : _), V += f(v);
|
|
3751
3751
|
}
|
|
3752
|
-
for (var
|
|
3753
|
-
var
|
|
3754
|
-
u(S,
|
|
3752
|
+
for (var E = p - m - 1; E >= m; E--) {
|
|
3753
|
+
var T = g.children[E];
|
|
3754
|
+
u(S, g.leaf ? z(T) : T), V += f(S);
|
|
3755
3755
|
}
|
|
3756
3756
|
return V;
|
|
3757
|
-
}, r.prototype._adjustParentBBoxes = function(
|
|
3758
|
-
for (var b = p; b >= 0; b--) u(
|
|
3759
|
-
}, r.prototype._condense = function(
|
|
3760
|
-
for (var
|
|
3757
|
+
}, r.prototype._adjustParentBBoxes = function(g, m, p) {
|
|
3758
|
+
for (var b = p; b >= 0; b--) u(m[b], g);
|
|
3759
|
+
}, r.prototype._condense = function(g) {
|
|
3760
|
+
for (var m = g.length - 1, p = void 0; m >= 0; m--) g[m].children.length === 0 ? m > 0 ? (p = g[m - 1].children).splice(p.indexOf(g[m]), 1) : this.clear() : a(g[m], this.toBBox);
|
|
3761
3761
|
}, r;
|
|
3762
3762
|
});
|
|
3763
3763
|
})(On);
|
|
@@ -3805,11 +3805,11 @@ const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3805
3805
|
__proto__: null,
|
|
3806
3806
|
default: ir
|
|
3807
3807
|
}, Symbol.toStringTag, { value: "Module" })), lr = /* @__PURE__ */ or(ar);
|
|
3808
|
-
var
|
|
3808
|
+
var Ce = { exports: {} }, cr = function(t, e, o, i) {
|
|
3809
3809
|
var r = t[0], s = t[1], a = !1;
|
|
3810
3810
|
o === void 0 && (o = 0), i === void 0 && (i = e.length);
|
|
3811
3811
|
for (var l = (i - o) / 2, u = 0, h = l - 1; u < l; h = u++) {
|
|
3812
|
-
var
|
|
3812
|
+
var d = e[o + u * 2 + 0], c = e[o + u * 2 + 1], f = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = c > s != w > s && r < (f - d) * (s - c) / (w - c) + d;
|
|
3813
3813
|
x && (a = !a);
|
|
3814
3814
|
}
|
|
3815
3815
|
return a;
|
|
@@ -3817,92 +3817,92 @@ var ke = { exports: {} }, cr = function(t, e, o, i) {
|
|
|
3817
3817
|
var r = t[0], s = t[1], a = !1;
|
|
3818
3818
|
o === void 0 && (o = 0), i === void 0 && (i = e.length);
|
|
3819
3819
|
for (var l = i - o, u = 0, h = l - 1; u < l; h = u++) {
|
|
3820
|
-
var
|
|
3820
|
+
var d = e[u + o][0], c = e[u + o][1], f = e[h + o][0], w = e[h + o][1], x = c > s != w > s && r < (f - d) * (s - c) / (w - c) + d;
|
|
3821
3821
|
x && (a = !a);
|
|
3822
3822
|
}
|
|
3823
3823
|
return a;
|
|
3824
|
-
},
|
|
3825
|
-
|
|
3826
|
-
return e.length > 0 && Array.isArray(e[0]) ?
|
|
3824
|
+
}, Nn = cr, qn = ur;
|
|
3825
|
+
Ce.exports = function(t, e, o, i) {
|
|
3826
|
+
return e.length > 0 && Array.isArray(e[0]) ? qn(t, e, o, i) : Nn(t, e, o, i);
|
|
3827
3827
|
};
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
var hr =
|
|
3828
|
+
Ce.exports.nested = qn;
|
|
3829
|
+
Ce.exports.flat = Nn;
|
|
3830
|
+
var hr = Ce.exports, Ue = { exports: {} };
|
|
3831
3831
|
(function(n, t) {
|
|
3832
3832
|
(function(e, o) {
|
|
3833
3833
|
o(t);
|
|
3834
3834
|
})(Fn, function(e) {
|
|
3835
3835
|
const i = 33306690738754706e-32;
|
|
3836
|
-
function r(x, P, M,
|
|
3837
|
-
let p, b, z, v, S = P[0], V =
|
|
3838
|
-
V > S == V > -S ? (p = S, S = P[++D]) : (p = V, V =
|
|
3839
|
-
let
|
|
3840
|
-
if (D < x && _ < M) for (V > S == V > -S ? (z = p - ((b = S + p) - S), S = P[++D]) : (z = p - ((b = V + p) - V), V =
|
|
3841
|
-
for (; D < x; ) z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D], p = b, z !== 0 && (
|
|
3842
|
-
for (; _ < M; ) z = p - ((b = p + V) - (v = b - p)) + (V - v), V =
|
|
3843
|
-
return p === 0 &&
|
|
3836
|
+
function r(x, P, M, g, m) {
|
|
3837
|
+
let p, b, z, v, S = P[0], V = g[0], D = 0, _ = 0;
|
|
3838
|
+
V > S == V > -S ? (p = S, S = P[++D]) : (p = V, V = g[++_]);
|
|
3839
|
+
let E = 0;
|
|
3840
|
+
if (D < x && _ < M) for (V > S == V > -S ? (z = p - ((b = S + p) - S), S = P[++D]) : (z = p - ((b = V + p) - V), V = g[++_]), p = b, z !== 0 && (m[E++] = z); D < x && _ < M; ) V > S == V > -S ? (z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D]) : (z = p - ((b = p + V) - (v = b - p)) + (V - v), V = g[++_]), p = b, z !== 0 && (m[E++] = z);
|
|
3841
|
+
for (; D < x; ) z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D], p = b, z !== 0 && (m[E++] = z);
|
|
3842
|
+
for (; _ < M; ) z = p - ((b = p + V) - (v = b - p)) + (V - v), V = g[++_], p = b, z !== 0 && (m[E++] = z);
|
|
3843
|
+
return p === 0 && E !== 0 || (m[E++] = p), E;
|
|
3844
3844
|
}
|
|
3845
3845
|
function s(x) {
|
|
3846
3846
|
return new Float64Array(x);
|
|
3847
3847
|
}
|
|
3848
|
-
const a = 33306690738754716e-32, l = 22204460492503146e-32, u = 11093356479670487e-47, h = s(4),
|
|
3849
|
-
e.orient2d = function(x, P, M,
|
|
3850
|
-
const b = (P - p) * (M -
|
|
3848
|
+
const a = 33306690738754716e-32, l = 22204460492503146e-32, u = 11093356479670487e-47, h = s(4), d = s(8), c = s(12), f = s(16), w = s(4);
|
|
3849
|
+
e.orient2d = function(x, P, M, g, m, p) {
|
|
3850
|
+
const b = (P - p) * (M - m), z = (x - m) * (g - p), v = b - z;
|
|
3851
3851
|
if (b === 0 || z === 0 || b > 0 != z > 0) return v;
|
|
3852
3852
|
const S = Math.abs(b + z);
|
|
3853
|
-
return Math.abs(v) >= a * S ? v : -function(V, D, _,
|
|
3854
|
-
let I, B,
|
|
3855
|
-
const
|
|
3856
|
-
C = (
|
|
3857
|
-
let tt = function(
|
|
3858
|
-
let J =
|
|
3859
|
-
for (let ct = 1; ct <
|
|
3853
|
+
return Math.abs(v) >= a * S ? v : -function(V, D, _, E, T, A, O) {
|
|
3854
|
+
let I, B, L, N, C, R, $, X, ot, K, G, ut, rt, F, H, Mt, Zt, qt;
|
|
3855
|
+
const Rt = V - T, _t = _ - T, Et = D - A, Ft = E - A;
|
|
3856
|
+
C = (H = (X = Rt - ($ = (R = 134217729 * Rt) - (R - Rt))) * (K = Ft - (ot = (R = 134217729 * Ft) - (R - Ft))) - ((F = Rt * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (R = 134217729 * Et) - (R - Et))) * (K = _t - (ot = (R = 134217729 * _t) - (R - _t))) - ((Mt = Et * _t) - $ * ot - X * ot - $ * K))), h[0] = H - (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 = (qt = ut + G) - ut, h[2] = ut - (qt - C) + (G - C), h[3] = qt;
|
|
3857
|
+
let tt = function(Tt, Wt) {
|
|
3858
|
+
let J = Wt[0];
|
|
3859
|
+
for (let ct = 1; ct < Tt; ct++) J += Wt[ct];
|
|
3860
3860
|
return J;
|
|
3861
3861
|
}(4, h), lt = l * O;
|
|
3862
|
-
if (tt >= lt || -tt >= lt || (I = V - (
|
|
3863
|
-
C = (
|
|
3864
|
-
const
|
|
3865
|
-
C = (
|
|
3866
|
-
const j = r(
|
|
3867
|
-
C = (
|
|
3868
|
-
const
|
|
3869
|
-
return
|
|
3870
|
-
}(x, P, M,
|
|
3871
|
-
}, e.orient2dfast = function(x, P, M,
|
|
3872
|
-
return (P - p) * (M -
|
|
3862
|
+
if (tt >= lt || -tt >= lt || (I = V - (Rt + (C = V - Rt)) + (C - T), L = _ - (_t + (C = _ - _t)) + (C - T), B = D - (Et + (C = D - Et)) + (C - A), N = E - (Ft + (C = E - Ft)) + (C - A), I === 0 && B === 0 && L === 0 && N === 0) || (lt = u * O + i * Math.abs(tt), (tt += Rt * N + Ft * I - (Et * L + _t * B)) >= lt || -tt >= lt)) return tt;
|
|
3863
|
+
C = (H = (X = I - ($ = (R = 134217729 * I) - (R - I))) * (K = Ft - (ot = (R = 134217729 * Ft) - (R - Ft))) - ((F = I * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (R = 134217729 * B) - (R - B))) * (K = _t - (ot = (R = 134217729 * _t) - (R - _t))) - ((Mt = B * _t) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
|
|
3864
|
+
const W = r(4, h, 4, w, d);
|
|
3865
|
+
C = (H = (X = Rt - ($ = (R = 134217729 * Rt) - (R - Rt))) * (K = N - (ot = (R = 134217729 * N) - (R - N))) - ((F = Rt * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (R = 134217729 * Et) - (R - Et))) * (K = L - (ot = (R = 134217729 * L) - (R - L))) - ((Mt = Et * L) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
|
|
3866
|
+
const j = r(W, d, 4, w, c);
|
|
3867
|
+
C = (H = (X = I - ($ = (R = 134217729 * I) - (R - I))) * (K = N - (ot = (R = 134217729 * N) - (R - N))) - ((F = I * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (R = 134217729 * B) - (R - B))) * (K = L - (ot = (R = 134217729 * L) - (R - L))) - ((Mt = B * L) - $ * ot - X * ot - $ * K))), w[0] = H - (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 = (qt = ut + G) - ut, w[2] = ut - (qt - C) + (G - C), w[3] = qt;
|
|
3868
|
+
const Nt = r(j, c, 4, w, f);
|
|
3869
|
+
return f[Nt - 1];
|
|
3870
|
+
}(x, P, M, g, m, p, S);
|
|
3871
|
+
}, e.orient2dfast = function(x, P, M, g, m, p) {
|
|
3872
|
+
return (P - p) * (M - m) - (x - m) * (g - p);
|
|
3873
3873
|
}, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3874
3874
|
});
|
|
3875
|
-
})(
|
|
3876
|
-
var fr =
|
|
3875
|
+
})(Ue, Ue.exports);
|
|
3876
|
+
var fr = Ue.exports, pn = rr, Ae = lr, dr = hr, mr = fr.orient2d;
|
|
3877
3877
|
Ae.default && (Ae = Ae.default);
|
|
3878
|
-
Ze.exports =
|
|
3879
|
-
Ze.exports.default =
|
|
3880
|
-
function
|
|
3878
|
+
Ze.exports = Wn;
|
|
3879
|
+
Ze.exports.default = Wn;
|
|
3880
|
+
function Wn(n, t, e) {
|
|
3881
3881
|
t = Math.max(0, t === void 0 ? 2 : t), e = e || 0;
|
|
3882
3882
|
var o = wr(n), i = new pn(16);
|
|
3883
|
-
i.toBBox = function(
|
|
3883
|
+
i.toBBox = function(g) {
|
|
3884
3884
|
return {
|
|
3885
|
-
minX:
|
|
3886
|
-
minY:
|
|
3887
|
-
maxX:
|
|
3888
|
-
maxY:
|
|
3885
|
+
minX: g[0],
|
|
3886
|
+
minY: g[1],
|
|
3887
|
+
maxX: g[0],
|
|
3888
|
+
maxY: g[1]
|
|
3889
3889
|
};
|
|
3890
|
-
}, i.compareMinX = function(
|
|
3891
|
-
return
|
|
3892
|
-
}, i.compareMinY = function(
|
|
3893
|
-
return
|
|
3890
|
+
}, i.compareMinX = function(g, m) {
|
|
3891
|
+
return g[0] - m[0];
|
|
3892
|
+
}, i.compareMinY = function(g, m) {
|
|
3893
|
+
return g[1] - m[1];
|
|
3894
3894
|
}, i.load(n);
|
|
3895
3895
|
for (var r = [], s = 0, a; s < o.length; s++) {
|
|
3896
3896
|
var l = o[s];
|
|
3897
3897
|
i.remove(l), a = wn(l, a), r.push(a);
|
|
3898
3898
|
}
|
|
3899
3899
|
var u = new pn(16);
|
|
3900
|
-
for (s = 0; s < r.length; s++) u.insert(
|
|
3901
|
-
for (var h = t * t,
|
|
3902
|
-
var c = r.shift(),
|
|
3903
|
-
if (!(x <
|
|
3900
|
+
for (s = 0; s < r.length; s++) u.insert(Xe(r[s]));
|
|
3901
|
+
for (var h = t * t, d = e * e; r.length; ) {
|
|
3902
|
+
var c = r.shift(), f = c.p, w = c.next.p, x = $e(f, w);
|
|
3903
|
+
if (!(x < d)) {
|
|
3904
3904
|
var P = x / h;
|
|
3905
|
-
l = gr(i, c.prev.p,
|
|
3905
|
+
l = gr(i, c.prev.p, f, w, c.next.next.p, P, u), l && Math.min($e(l, f), $e(l, w)) <= P && (r.push(c), r.push(wn(l, c)), i.remove(l), u.remove(c), u.insert(Xe(c)), u.insert(Xe(c.next)));
|
|
3906
3906
|
}
|
|
3907
3907
|
}
|
|
3908
3908
|
c = a;
|
|
@@ -3915,15 +3915,15 @@ function qn(n, t, e) {
|
|
|
3915
3915
|
function gr(n, t, e, o, i, r, s) {
|
|
3916
3916
|
for (var a = new Ae([], pr), l = n.data; l; ) {
|
|
3917
3917
|
for (var u = 0; u < l.children.length; u++) {
|
|
3918
|
-
var h = l.children[u],
|
|
3919
|
-
|
|
3918
|
+
var h = l.children[u], d = l.leaf ? He(h, e, o) : yr(e, o, h);
|
|
3919
|
+
d > r || a.push({
|
|
3920
3920
|
node: h,
|
|
3921
|
-
dist:
|
|
3921
|
+
dist: d
|
|
3922
3922
|
});
|
|
3923
3923
|
}
|
|
3924
3924
|
for (; a.length && !a.peek().node.children; ) {
|
|
3925
|
-
var c = a.pop(),
|
|
3926
|
-
if (c.dist < w && c.dist < x && xn(e,
|
|
3925
|
+
var c = a.pop(), f = c.node, w = He(f, t, e), x = He(f, o, i);
|
|
3926
|
+
if (c.dist < w && c.dist < x && xn(e, f, s) && xn(o, f, s)) return f;
|
|
3927
3927
|
}
|
|
3928
3928
|
l = a.pop(), l && (l = l.node);
|
|
3929
3929
|
}
|
|
@@ -3934,13 +3934,13 @@ function pr(n, t) {
|
|
|
3934
3934
|
}
|
|
3935
3935
|
function yr(n, t, e) {
|
|
3936
3936
|
if (yn(n, e) || yn(t, e)) return 0;
|
|
3937
|
-
var o =
|
|
3937
|
+
var o = Ee(n[0], n[1], t[0], t[1], e.minX, e.minY, e.maxX, e.minY);
|
|
3938
3938
|
if (o === 0) return 0;
|
|
3939
|
-
var i =
|
|
3939
|
+
var i = Ee(n[0], n[1], t[0], t[1], e.minX, e.minY, e.minX, e.maxY);
|
|
3940
3940
|
if (i === 0) return 0;
|
|
3941
|
-
var r =
|
|
3941
|
+
var r = Ee(n[0], n[1], t[0], t[1], e.maxX, e.minY, e.maxX, e.maxY);
|
|
3942
3942
|
if (r === 0) return 0;
|
|
3943
|
-
var s =
|
|
3943
|
+
var s = Ee(n[0], n[1], t[0], t[1], e.minX, e.maxY, e.maxX, e.maxY);
|
|
3944
3944
|
return s === 0 ? 0 : Math.min(o, i, r, s);
|
|
3945
3945
|
}
|
|
3946
3946
|
function yn(n, t) {
|
|
@@ -3957,7 +3957,7 @@ function xe(n, t, e) {
|
|
|
3957
3957
|
function xr(n, t, e, o) {
|
|
3958
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;
|
|
3959
3959
|
}
|
|
3960
|
-
function
|
|
3960
|
+
function Xe(n) {
|
|
3961
3961
|
var t = n.p, e = n.next.p;
|
|
3962
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;
|
|
3963
3963
|
}
|
|
@@ -3983,7 +3983,7 @@ function wn(n, t) {
|
|
|
3983
3983
|
};
|
|
3984
3984
|
return t ? (e.next = t.next, e.prev = t, t.next.prev = e, t.next = e) : (e.prev = e, e.next = e), e;
|
|
3985
3985
|
}
|
|
3986
|
-
function
|
|
3986
|
+
function $e(n, t) {
|
|
3987
3987
|
var e = n[0] - t[0], o = n[1] - t[1];
|
|
3988
3988
|
return e * e + o * o;
|
|
3989
3989
|
}
|
|
@@ -3995,10 +3995,10 @@ function He(n, t, e) {
|
|
|
3995
3995
|
}
|
|
3996
3996
|
return r = n[0] - o, s = n[1] - i, r * r + s * s;
|
|
3997
3997
|
}
|
|
3998
|
-
function
|
|
3999
|
-
var l = e - n, u = o - t, h = s - i,
|
|
4000
|
-
|
|
4001
|
-
var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o,
|
|
3998
|
+
function Ee(n, t, e, o, i, r, s, a) {
|
|
3999
|
+
var l = e - n, u = o - t, h = s - i, d = a - r, c = n - i, f = t - r, w = l * l + u * u, x = l * h + u * d, P = h * h + d * d, M = l * c + u * f, g = h * c + d * f, m = w * P - x * x, p, b, z, v, S = m, V = m;
|
|
4000
|
+
m === 0 ? (b = 0, S = 1, v = g, V = P) : (b = x * g - P * M, v = w * g - x * M, b < 0 ? (b = 0, v = g, V = P) : b > S && (b = S, v = g + x, V = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > V && (v = V, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), p = b === 0 ? 0 : b / S, z = v === 0 ? 0 : v / V;
|
|
4001
|
+
var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o, E = (1 - z) * i + z * s, T = (1 - z) * r + z * a, A = E - D, O = T - _;
|
|
4002
4002
|
return A * A + O * O;
|
|
4003
4003
|
}
|
|
4004
4004
|
function br(n, t) {
|
|
@@ -4076,16 +4076,16 @@ function bn(n, t) {
|
|
|
4076
4076
|
const r = Math.log(
|
|
4077
4077
|
Math.tan(o / 2 + Math.PI / 4) / Math.tan(e / 2 + Math.PI / 4)
|
|
4078
4078
|
), s = Math.atan2(i, r);
|
|
4079
|
-
return (
|
|
4079
|
+
return (Ln(s) + 360) % 360;
|
|
4080
4080
|
}
|
|
4081
4081
|
function Dr(n, t, e = {}) {
|
|
4082
4082
|
const o = se(n), i = se(t);
|
|
4083
4083
|
i[0] += i[0] - o[0] > 180 ? -360 : o[0] - i[0] > 180 ? 360 : 0;
|
|
4084
4084
|
const r = _r(o, i);
|
|
4085
|
-
return
|
|
4085
|
+
return Rn(r, "meters", e.units);
|
|
4086
4086
|
}
|
|
4087
4087
|
function _r(n, t, e) {
|
|
4088
|
-
e = e === void 0 ?
|
|
4088
|
+
e = e === void 0 ? Ht : Number(e);
|
|
4089
4089
|
const o = e, i = n[1] * Math.PI / 180, r = t[1] * Math.PI / 180, s = r - i;
|
|
4090
4090
|
let a = Math.abs(t[0] - n[0]) * Math.PI / 180;
|
|
4091
4091
|
a > Math.PI && (a -= 2 * Math.PI);
|
|
@@ -4096,29 +4096,29 @@ function _r(n, t, e) {
|
|
|
4096
4096
|
s * s + u * u * a * a
|
|
4097
4097
|
) * o;
|
|
4098
4098
|
}
|
|
4099
|
-
function
|
|
4099
|
+
function Er(n, t, e, o = {}) {
|
|
4100
4100
|
const i = t < 0;
|
|
4101
|
-
let r =
|
|
4101
|
+
let r = Rn(
|
|
4102
4102
|
Math.abs(t),
|
|
4103
4103
|
o.units,
|
|
4104
4104
|
"meters"
|
|
4105
4105
|
);
|
|
4106
4106
|
i && (r = -Math.abs(r));
|
|
4107
|
-
const s = se(n), a =
|
|
4107
|
+
const s = se(n), a = Tr(
|
|
4108
4108
|
s,
|
|
4109
4109
|
r,
|
|
4110
4110
|
e
|
|
4111
4111
|
);
|
|
4112
4112
|
return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0, kn(a, o.properties);
|
|
4113
4113
|
}
|
|
4114
|
-
function
|
|
4115
|
-
o = o === void 0 ?
|
|
4114
|
+
function Tr(n, t, e, o) {
|
|
4115
|
+
o = o === void 0 ? Ht : Number(o);
|
|
4116
4116
|
const i = t / o, r = n[0] * Math.PI / 180, s = ie(n[1]), a = ie(e), l = i * Math.cos(a);
|
|
4117
4117
|
let u = s + l;
|
|
4118
4118
|
Math.abs(u) > Math.PI / 2 && (u = u > 0 ? Math.PI - u : -Math.PI - u);
|
|
4119
4119
|
const h = Math.log(
|
|
4120
4120
|
Math.tan(u / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4)
|
|
4121
|
-
),
|
|
4121
|
+
), d = Math.abs(h) > 1e-11 ? l / h : Math.cos(s), c = i * Math.sin(a) / d;
|
|
4122
4122
|
return [
|
|
4123
4123
|
((r + c) * 180 / Math.PI + 540) % 360 - 180,
|
|
4124
4124
|
u * 180 / Math.PI
|
|
@@ -4129,7 +4129,7 @@ function Ar(n) {
|
|
|
4129
4129
|
throw new Error("geojson is required");
|
|
4130
4130
|
switch (n.type) {
|
|
4131
4131
|
case "Feature":
|
|
4132
|
-
return
|
|
4132
|
+
return $n(n);
|
|
4133
4133
|
case "FeatureCollection":
|
|
4134
4134
|
return Br(n);
|
|
4135
4135
|
case "Point":
|
|
@@ -4144,7 +4144,7 @@ function Ar(n) {
|
|
|
4144
4144
|
throw new Error("unknown GeoJSON type");
|
|
4145
4145
|
}
|
|
4146
4146
|
}
|
|
4147
|
-
function
|
|
4147
|
+
function $n(n) {
|
|
4148
4148
|
const t = { type: "Feature" };
|
|
4149
4149
|
return Object.keys(n).forEach((e) => {
|
|
4150
4150
|
switch (e) {
|
|
@@ -4155,13 +4155,13 @@ function Hn(n) {
|
|
|
4155
4155
|
default:
|
|
4156
4156
|
t[e] = n[e];
|
|
4157
4157
|
}
|
|
4158
|
-
}), t.properties =
|
|
4158
|
+
}), t.properties = Hn(n.properties), n.geometry == null ? t.geometry = null : t.geometry = Ke(n.geometry), t;
|
|
4159
4159
|
}
|
|
4160
|
-
function
|
|
4160
|
+
function Hn(n) {
|
|
4161
4161
|
const t = {};
|
|
4162
4162
|
return n && Object.keys(n).forEach((e) => {
|
|
4163
4163
|
const o = n[e];
|
|
4164
|
-
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] = Hn(o) : t[e] = o;
|
|
4165
4165
|
}), t;
|
|
4166
4166
|
}
|
|
4167
4167
|
function Br(n) {
|
|
@@ -4174,15 +4174,15 @@ function Br(n) {
|
|
|
4174
4174
|
default:
|
|
4175
4175
|
t[e] = n[e];
|
|
4176
4176
|
}
|
|
4177
|
-
}), t.features = n.features.map((e) =>
|
|
4177
|
+
}), t.features = n.features.map((e) => $n(e)), t;
|
|
4178
4178
|
}
|
|
4179
4179
|
function Ke(n) {
|
|
4180
4180
|
const t = { type: n.type };
|
|
4181
|
-
return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) => Ke(e)), t) : (t.coordinates =
|
|
4181
|
+
return n.bbox && (t.bbox = n.bbox), n.type === "GeometryCollection" ? (t.geometries = n.geometries.map((e) => Ke(e)), t) : (t.coordinates = Yn(n.coordinates), t);
|
|
4182
4182
|
}
|
|
4183
|
-
function
|
|
4183
|
+
function Yn(n) {
|
|
4184
4184
|
const t = n;
|
|
4185
|
-
return typeof t[0] != "object" ? t.slice() : t.map((e) =>
|
|
4185
|
+
return typeof t[0] != "object" ? t.slice() : t.map((e) => Yn(e));
|
|
4186
4186
|
}
|
|
4187
4187
|
function Pn(n, t, e) {
|
|
4188
4188
|
if (e = e || {}, !Qo(e)) throw new Error("options is invalid");
|
|
@@ -4194,7 +4194,7 @@ function Pn(n, t, e) {
|
|
|
4194
4194
|
const r = o ?? Xn(n);
|
|
4195
4195
|
return (i === !1 || i === void 0) && (n = Ar(n)), Pe(n, function(s) {
|
|
4196
4196
|
const l = vr(r, s) + t, u = Dr(r, s), h = Sr(
|
|
4197
|
-
|
|
4197
|
+
Er(r, u, l)
|
|
4198
4198
|
);
|
|
4199
4199
|
s[0] = h[0], s[1] = h[1];
|
|
4200
4200
|
}), n;
|
|
@@ -4203,7 +4203,7 @@ function Gn(n, t, e = {}) {
|
|
|
4203
4203
|
if (e.final === !0)
|
|
4204
4204
|
return Ir(n, t);
|
|
4205
4205
|
const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), u = 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
|
|
4206
|
+
return Ln(Math.atan2(u, h));
|
|
4207
4207
|
}
|
|
4208
4208
|
function Ir(n, t) {
|
|
4209
4209
|
let e = Gn(t, n);
|
|
@@ -4230,10 +4230,10 @@ function Cr(n, t = {}) {
|
|
|
4230
4230
|
{ bbox: n, id: t.id }
|
|
4231
4231
|
);
|
|
4232
4232
|
}
|
|
4233
|
-
function
|
|
4233
|
+
function Lr(n) {
|
|
4234
4234
|
return Cr(kr(n));
|
|
4235
4235
|
}
|
|
4236
|
-
function
|
|
4236
|
+
function Rr(n) {
|
|
4237
4237
|
return er(
|
|
4238
4238
|
n,
|
|
4239
4239
|
(t, e) => t + Fr(e),
|
|
@@ -4266,7 +4266,7 @@ function Mn(n) {
|
|
|
4266
4266
|
}
|
|
4267
4267
|
return t;
|
|
4268
4268
|
}
|
|
4269
|
-
var Or =
|
|
4269
|
+
var Or = Ht * Ht / 2, Ye = Math.PI / 180;
|
|
4270
4270
|
function zn(n) {
|
|
4271
4271
|
const t = n.length - 1;
|
|
4272
4272
|
if (t <= 2) return 0;
|
|
@@ -4277,7 +4277,7 @@ function zn(n) {
|
|
|
4277
4277
|
}
|
|
4278
4278
|
return e * Or;
|
|
4279
4279
|
}
|
|
4280
|
-
function
|
|
4280
|
+
function Nr(n) {
|
|
4281
4281
|
const t = Vr(n);
|
|
4282
4282
|
if (!t)
|
|
4283
4283
|
throw new Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
|
|
@@ -4286,7 +4286,7 @@ function Wr(n) {
|
|
|
4286
4286
|
for (let s = 0; s < o.length - 1; s++) {
|
|
4287
4287
|
let a = Gn(o[s], o[s + 1]), l = Pn(t, -1 * a, {
|
|
4288
4288
|
pivot: e
|
|
4289
|
-
}), u =
|
|
4289
|
+
}), u = Lr(l), h = Rr(u);
|
|
4290
4290
|
h < i && (i = h, r = Pn(u, a, {
|
|
4291
4291
|
pivot: e
|
|
4292
4292
|
}));
|
|
@@ -4297,7 +4297,7 @@ function Vn(n, t) {
|
|
|
4297
4297
|
const e = t[0] - n[0], o = t[1] - n[1];
|
|
4298
4298
|
return Math.sqrt(e * e + o * o);
|
|
4299
4299
|
}
|
|
4300
|
-
function
|
|
4300
|
+
function qr(n) {
|
|
4301
4301
|
let t = 1 / 0, e = -1 / 0, o = 1 / 0, i = -1 / 0;
|
|
4302
4302
|
for (const [r, s] of n)
|
|
4303
4303
|
r < t && (t = r), r > e && (e = r), s < o && (o = s), s > i && (i = s);
|
|
@@ -4305,7 +4305,7 @@ function Nr(n) {
|
|
|
4305
4305
|
}
|
|
4306
4306
|
class Ie extends An {
|
|
4307
4307
|
getBoxMesh() {
|
|
4308
|
-
le.identity(), le.setFromMatrix3(this.rotation), le.decompose(
|
|
4308
|
+
le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Te, fe, new y.Vector3());
|
|
4309
4309
|
const t = this.halfSize.clone().multiplyScalar(2), e = new y.Mesh(new y.BoxGeometry(t.x, t.y, t.z));
|
|
4310
4310
|
return e.position.copy(this.center), e.rotation.setFromQuaternion(fe), e;
|
|
4311
4311
|
}
|
|
@@ -4316,7 +4316,7 @@ class Ie extends An {
|
|
|
4316
4316
|
return new y.LineSegments(o, new y.LineBasicMaterial({ color: t, toneMapped: !1 }));
|
|
4317
4317
|
}
|
|
4318
4318
|
toJson() {
|
|
4319
|
-
return le.identity(), le.setFromMatrix3(this.rotation), le.decompose(
|
|
4319
|
+
return le.identity(), le.setFromMatrix3(this.rotation), le.decompose(Te, fe, new y.Vector3()), {
|
|
4320
4320
|
size: this.halfSize.toArray(),
|
|
4321
4321
|
center: this.center.toArray(),
|
|
4322
4322
|
quaternion: fe.toArray()
|
|
@@ -4333,7 +4333,7 @@ class Ie extends An {
|
|
|
4333
4333
|
if (o instanceof y.Euler) fe.setFromEuler(o);
|
|
4334
4334
|
else if (o instanceof y.Quaternion) fe.copy(o);
|
|
4335
4335
|
else throw new Error("传入的旋转不是欧拉角或者四元数");
|
|
4336
|
-
return le.compose(e, fe,
|
|
4336
|
+
return le.compose(e, fe, Wr), i.center.copy(e), i.halfSize.copy(t.multiplyScalar(0.5)), i.rotation.setFromMatrix4(le), i;
|
|
4337
4337
|
}
|
|
4338
4338
|
/** 通过2d路径创建
|
|
4339
4339
|
* @param path
|
|
@@ -4343,39 +4343,39 @@ class Ie extends An {
|
|
|
4343
4343
|
* @returns
|
|
4344
4344
|
*/
|
|
4345
4345
|
static fromByPath2D(t, e, o, i = new Ie()) {
|
|
4346
|
-
const r =
|
|
4346
|
+
const r = Nr({
|
|
4347
4347
|
type: "Polygon",
|
|
4348
|
-
coordinates: [t.map((
|
|
4348
|
+
coordinates: [t.map((f) => [f.x, f.y])]
|
|
4349
4349
|
});
|
|
4350
4350
|
if (!r) throw new Error("2d obb 获取失败");
|
|
4351
4351
|
const s = r.geometry.coordinates[0], a = Vn(s[0], s[1]), l = Vn(s[1], s[2]), u = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
|
|
4352
|
-
|
|
4353
|
-
const [h,
|
|
4354
|
-
return e.x = h, e.y =
|
|
4352
|
+
Te.set(a, l, o), Sn.set(0, 0, u);
|
|
4353
|
+
const [h, d] = qr(s);
|
|
4354
|
+
return e.x = h, e.y = d, this.from(Te, e, Sn, i);
|
|
4355
4355
|
}
|
|
4356
4356
|
}
|
|
4357
|
-
const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(),
|
|
4358
|
-
function
|
|
4357
|
+
const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(), Wr = new y.Vector3(1, 1, 1), Te = new y.Vector3(), Xr = new y.Box3();
|
|
4358
|
+
function $r(n, t, e = 5e-3, o = 0.2) {
|
|
4359
4359
|
if (!n.length || !t.length) return 0;
|
|
4360
|
-
const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (
|
|
4361
|
-
for (const
|
|
4362
|
-
const c = a(
|
|
4363
|
-
s.has(c) || s.set(c, []), s.get(c).push(
|
|
4360
|
+
const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (d, c, f) => `${Math.floor(d / i)},${Math.floor(c / i)},${Math.floor(f / i)}`;
|
|
4361
|
+
for (const d of t) {
|
|
4362
|
+
const c = a(d.x, d.y, d.z);
|
|
4363
|
+
s.has(c) || s.set(c, []), s.get(c).push(d);
|
|
4364
4364
|
}
|
|
4365
4365
|
let l = 0;
|
|
4366
4366
|
const u = Math.ceil(e / i) + 1, h = [];
|
|
4367
|
-
for (let
|
|
4367
|
+
for (let d = -u; d <= u; d++)
|
|
4368
4368
|
for (let c = -u; c <= u; c++)
|
|
4369
|
-
for (let
|
|
4370
|
-
|
|
4371
|
-
for (const
|
|
4372
|
-
const c = Math.floor(
|
|
4369
|
+
for (let f = -u; f <= u; f++)
|
|
4370
|
+
d * d + c * c + f * f <= u * u && h.push([d, c, f]);
|
|
4371
|
+
for (const d of n) {
|
|
4372
|
+
const c = Math.floor(d.x / i), f = Math.floor(d.y / i), w = Math.floor(d.z / i);
|
|
4373
4373
|
let x = !1;
|
|
4374
|
-
for (const [P, M,
|
|
4375
|
-
const
|
|
4376
|
-
if (s.has(
|
|
4377
|
-
for (const p of s.get(
|
|
4378
|
-
if (
|
|
4374
|
+
for (const [P, M, g] of h) {
|
|
4375
|
+
const m = `${c + P},${f + M},${w + g}`;
|
|
4376
|
+
if (s.has(m)) {
|
|
4377
|
+
for (const p of s.get(m))
|
|
4378
|
+
if (d.distanceToSquared(p) < r) {
|
|
4379
4379
|
x = !0;
|
|
4380
4380
|
break;
|
|
4381
4381
|
}
|
|
@@ -4394,7 +4394,7 @@ function pe(n, t, e = 0.5) {
|
|
|
4394
4394
|
break;
|
|
4395
4395
|
return i;
|
|
4396
4396
|
}
|
|
4397
|
-
function
|
|
4397
|
+
function Ge(n, t, e, o) {
|
|
4398
4398
|
if (n.intersectsOBB(t))
|
|
4399
4399
|
return !0;
|
|
4400
4400
|
{
|
|
@@ -4447,7 +4447,7 @@ function _n(n, t, e, o) {
|
|
|
4447
4447
|
const r = Ie.fromByPath2D(i, t, e);
|
|
4448
4448
|
return r.center.z = o, r;
|
|
4449
4449
|
}
|
|
4450
|
-
const
|
|
4450
|
+
const Mi = (n) => {
|
|
4451
4451
|
if (n.length == 0) return [];
|
|
4452
4452
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
4453
4453
|
for (let r = 0; r < n.length; r++) {
|
|
@@ -4456,9 +4456,9 @@ const gi = (n) => {
|
|
|
4456
4456
|
const l = a.indexOf("_") + 1, u = a.lastIndexOf("_"), h = a.substring(l, u);
|
|
4457
4457
|
if (h === "wall")
|
|
4458
4458
|
continue;
|
|
4459
|
-
let
|
|
4459
|
+
let d = [];
|
|
4460
4460
|
for (let P = 0; P < n[r].points.length; P++)
|
|
4461
|
-
|
|
4461
|
+
d.push(new y.Vector3(
|
|
4462
4462
|
n[r].points[P].x,
|
|
4463
4463
|
n[r].points[P].y,
|
|
4464
4464
|
n[r].points[P].z
|
|
@@ -4466,26 +4466,26 @@ const gi = (n) => {
|
|
|
4466
4466
|
let c = -99999;
|
|
4467
4467
|
if (h === "floor") {
|
|
4468
4468
|
let P = /* @__PURE__ */ new Map();
|
|
4469
|
-
for (let
|
|
4470
|
-
let
|
|
4471
|
-
if (
|
|
4472
|
-
const p = P.get(
|
|
4473
|
-
p.num += 1, p.points.push(n[r].points[
|
|
4469
|
+
for (let g = 0; g < n[r].points.length; g++) {
|
|
4470
|
+
let m = n[r].points[g].z;
|
|
4471
|
+
if (m = Math.floor(m * 10) / 10, P.has(m)) {
|
|
4472
|
+
const p = P.get(m);
|
|
4473
|
+
p.num += 1, p.points.push(n[r].points[g]), P.set(m, p);
|
|
4474
4474
|
} else
|
|
4475
|
-
P.set(
|
|
4475
|
+
P.set(m, { num: 1, points: [n[r].points[g]] });
|
|
4476
4476
|
}
|
|
4477
4477
|
let M = [...P.entries()].reduce(
|
|
4478
|
-
(
|
|
4478
|
+
(g, m) => m[1].num > g[1].num ? m : g
|
|
4479
4479
|
);
|
|
4480
|
-
s = [], s = M[1].points.map((
|
|
4480
|
+
s = [], s = M[1].points.map((g) => [g.x, g.y]), d = [], d = M[1].points.map((g) => new y.Vector3(g.x, g.y, g.z)), c = M[0];
|
|
4481
4481
|
}
|
|
4482
|
-
const
|
|
4483
|
-
points:
|
|
4482
|
+
const f = Dn(d), w = {
|
|
4483
|
+
points: d,
|
|
4484
4484
|
path: cn(s),
|
|
4485
|
-
h:
|
|
4486
|
-
minz:
|
|
4487
|
-
maxz:
|
|
4488
|
-
center: { x:
|
|
4485
|
+
h: f.h,
|
|
4486
|
+
minz: f.minz,
|
|
4487
|
+
maxz: f.maxz,
|
|
4488
|
+
center: { x: f.x, y: f.y, z: f.z },
|
|
4489
4489
|
obj_id: n[r].obj_id,
|
|
4490
4490
|
type: h,
|
|
4491
4491
|
averagePz: n[r].averagePz,
|
|
@@ -4529,24 +4529,24 @@ const gi = (n) => {
|
|
|
4529
4529
|
for (let h = 0; h < s.length; h++) {
|
|
4530
4530
|
if (s[h].obb == null || a.includes(h))
|
|
4531
4531
|
continue;
|
|
4532
|
-
const
|
|
4532
|
+
const d = {
|
|
4533
4533
|
...s[h],
|
|
4534
4534
|
obb: s[h].obb.clone()
|
|
4535
4535
|
};
|
|
4536
4536
|
for (let c = h + 1; c < s.length; c++) {
|
|
4537
4537
|
if (s[c].obb == null || a.includes(c))
|
|
4538
4538
|
continue;
|
|
4539
|
-
if (
|
|
4539
|
+
if (d.obb.intersectsOBB(s[c].obb)) {
|
|
4540
4540
|
a.push(c);
|
|
4541
4541
|
for (let P = 0; P < s[c].points.length; P++)
|
|
4542
|
-
(s[c].points[P].z > o && s[c].points[P].z - o > 0.1 ||
|
|
4543
|
-
const w =
|
|
4544
|
-
|
|
4545
|
-
const x = Dn(
|
|
4546
|
-
|
|
4542
|
+
(s[c].points[P].z > o && s[c].points[P].z - o > 0.1 || d.type == "floor") && d.points.push(s[c].points[P]);
|
|
4543
|
+
const w = d.points.map((P) => [P.x, P.y]);
|
|
4544
|
+
d.path = cn(w);
|
|
4545
|
+
const x = Dn(d.points);
|
|
4546
|
+
d.h = x.h, d.minz = x.minz, d.maxz = x.maxz, d.center = { x: x.x, y: x.y, z: x.z }, d.obb = _n(d.path, d.center, d.h, (d.maxz + d.minz) / 2), d.positionArr.push(...s[c].positionArr), c = h;
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
4549
|
-
|
|
4549
|
+
d.path.length > s[h].path.length && (a.push(h), l.push(d));
|
|
4550
4550
|
}
|
|
4551
4551
|
const u = [];
|
|
4552
4552
|
for (let h = 0; h < s.length; h++)
|
|
@@ -4561,13 +4561,13 @@ const gi = (n) => {
|
|
|
4561
4561
|
for (let l = 0; l < a.length; l++) {
|
|
4562
4562
|
const u = a[l].obb, h = a[l].minz;
|
|
4563
4563
|
a[l].maxz;
|
|
4564
|
-
const
|
|
4564
|
+
const d = a[l].averagePz;
|
|
4565
4565
|
if (s === "window" || s === "door" || s === "tv" || s === "chair" || s === "cabinet" || s === "table") {
|
|
4566
4566
|
const c = new y.Vector3();
|
|
4567
4567
|
u.getSize(c);
|
|
4568
|
-
const
|
|
4568
|
+
const f = [c.x, c.y, c.z];
|
|
4569
4569
|
let w = 0;
|
|
4570
|
-
for (const x of
|
|
4570
|
+
for (const x of f)
|
|
4571
4571
|
if (x < 0.2 && (w++, w === 2)) {
|
|
4572
4572
|
a[l].isDel = !0;
|
|
4573
4573
|
break;
|
|
@@ -4575,8 +4575,8 @@ const gi = (n) => {
|
|
|
4575
4575
|
}
|
|
4576
4576
|
if (!a[l].isDel)
|
|
4577
4577
|
for (let c = r + 1; c < t.length; c++) {
|
|
4578
|
-
const
|
|
4579
|
-
if (
|
|
4578
|
+
const f = t[c].type;
|
|
4579
|
+
if (f === "people" || f === "floor")
|
|
4580
4580
|
continue;
|
|
4581
4581
|
const w = t[c].array;
|
|
4582
4582
|
for (let x = 0; x < w.length; x++) {
|
|
@@ -4584,52 +4584,52 @@ const gi = (n) => {
|
|
|
4584
4584
|
const P = w[x].obb, M = w[x].minz;
|
|
4585
4585
|
if (w[x].maxz, u.intersectsOBB(P)) {
|
|
4586
4586
|
pe(w[x].points, u);
|
|
4587
|
-
const
|
|
4588
|
-
if (
|
|
4587
|
+
const g = pe(a[l].points, P), m = vn(u, P);
|
|
4588
|
+
if (g >= 0.3 && m == -1) {
|
|
4589
4589
|
a[l].isDel = !0;
|
|
4590
4590
|
break;
|
|
4591
4591
|
}
|
|
4592
4592
|
if (s !== "wall" && s !== "floor" && s !== "roof") {
|
|
4593
4593
|
if (s === "window") {
|
|
4594
|
-
if (
|
|
4594
|
+
if (f === "balcony railing" && we(u, w[x].points)) {
|
|
4595
4595
|
w[x].isDel = !0;
|
|
4596
4596
|
continue;
|
|
4597
4597
|
}
|
|
4598
|
-
if (
|
|
4598
|
+
if (f === "balcony railing" && we(P, a[l].points)) {
|
|
4599
4599
|
a[l].isDel = !0;
|
|
4600
4600
|
break;
|
|
4601
4601
|
}
|
|
4602
|
-
if (
|
|
4602
|
+
if (f === "balcony railing" && Ge(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - d) > 0.3)) {
|
|
4603
4603
|
w[x].isDel = !0;
|
|
4604
4604
|
continue;
|
|
4605
4605
|
}
|
|
4606
4606
|
} else if (s === "balcony railing") {
|
|
4607
|
-
if (
|
|
4607
|
+
if (f === "window" && we(u, w[x].points)) {
|
|
4608
4608
|
w[x].isDel = !0;
|
|
4609
4609
|
continue;
|
|
4610
4610
|
}
|
|
4611
|
-
if (
|
|
4611
|
+
if (f === "window" && we(P, a[l].points)) {
|
|
4612
4612
|
a[l].isDel = !0;
|
|
4613
4613
|
break;
|
|
4614
4614
|
}
|
|
4615
|
-
if (
|
|
4615
|
+
if (f === "window" && Ge(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - d) > 0.3)) {
|
|
4616
4616
|
a[l].isDel = !0;
|
|
4617
4617
|
break;
|
|
4618
4618
|
}
|
|
4619
4619
|
}
|
|
4620
4620
|
let p = !1, b = [], z = [];
|
|
4621
4621
|
const v = a[l].points, S = w[x].points;
|
|
4622
|
-
if (v.length > S.length ? (p = !0, b = v, z = S) : (b = S, z = v),
|
|
4622
|
+
if (v.length > S.length ? (p = !0, b = v, z = S) : (b = S, z = v), $r(z, b, 0.03, 0.5) > 0.5)
|
|
4623
4623
|
if (p)
|
|
4624
4624
|
w[x].isDel = !0;
|
|
4625
4625
|
else {
|
|
4626
4626
|
a[l].isDel = !0;
|
|
4627
4627
|
break;
|
|
4628
4628
|
}
|
|
4629
|
-
else if (
|
|
4629
|
+
else if (Ge(u, P)) {
|
|
4630
4630
|
const D = vn(u, P);
|
|
4631
4631
|
if (D === 1 || D === 0) {
|
|
4632
|
-
if (
|
|
4632
|
+
if (f === "switch") continue;
|
|
4633
4633
|
v.length > S.length ? pe(z, u) >= 0.5 && (w[x].isDel = !0) : pe(b, u) >= 0.5 && (w[x].isDel = !0);
|
|
4634
4634
|
} else {
|
|
4635
4635
|
if (s === "switch") continue;
|
|
@@ -4654,19 +4654,19 @@ const gi = (n) => {
|
|
|
4654
4654
|
for (let r = 0; r < t.length; r++) {
|
|
4655
4655
|
const s = t[r].type, a = t[r].array;
|
|
4656
4656
|
for (let l = 0; l < a.length; l++) {
|
|
4657
|
-
let u = a[l].maxz, h = a[l].minz,
|
|
4657
|
+
let u = a[l].maxz, h = a[l].minz, d = s === "switch" ? 0.1 : 0.3;
|
|
4658
4658
|
const c = a[l].averagePz;
|
|
4659
|
-
if (Math.abs(u - c) <
|
|
4659
|
+
if (Math.abs(u - c) < d) {
|
|
4660
4660
|
a[l].isDel = !0;
|
|
4661
4661
|
continue;
|
|
4662
4662
|
}
|
|
4663
4663
|
if (s === "window" || s === "door" || s === "tv") {
|
|
4664
|
-
const
|
|
4665
|
-
(s === "tv" && w < 1.6 || s !== "window" &&
|
|
4664
|
+
const f = Math.abs(u - c), w = Math.abs(h - c);
|
|
4665
|
+
(s === "tv" && w < 1.6 || s !== "window" && f < 1.6) && (a[l].isDel = !0), s === "window" && f < 1 && (a[l].isDel = !0);
|
|
4666
4666
|
}
|
|
4667
4667
|
if (s === "chair") {
|
|
4668
|
-
const
|
|
4669
|
-
a[l].obb.getSize(
|
|
4668
|
+
const f = new y.Vector3();
|
|
4669
|
+
a[l].obb.getSize(f), (f.x < 0.1 || f.y < 0.1 || f.z < 0.2) && (a[l].isDel = !0);
|
|
4670
4670
|
}
|
|
4671
4671
|
s === "balcony railing" && (Math.abs(u - h) < 0.4 && (a[l].isDel = !0), (h < c && Math.abs(h - c) > 1 || h > c && Math.abs(h - c) > 1) && (a[l].isDel = !0), u < c && (a[l].isDel = !0)), s === "people" && (Math.abs(u - h) < 1 && (a[l].isDel = !0), h > c && h - c > 0.3 && (a[l].isDel = !0), u < c && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
|
|
4672
4672
|
}
|
|
@@ -4690,11 +4690,120 @@ const gi = (n) => {
|
|
|
4690
4690
|
}
|
|
4691
4691
|
return i;
|
|
4692
4692
|
};
|
|
4693
|
+
function Hr(n, t, e, o) {
|
|
4694
|
+
return 1 + (n[t][0] === 0 || n[e][0] === 0 || n[o][0] === 0 ? 1 : 0);
|
|
4695
|
+
}
|
|
4696
|
+
function Yr(n) {
|
|
4697
|
+
if (!n.length) return 0;
|
|
4698
|
+
const t = [...n].sort((o, i) => o - i), e = Math.floor(t.length / 2);
|
|
4699
|
+
return t.length % 2 ? t[e] : (t[e - 1] + t[e]) / 2;
|
|
4700
|
+
}
|
|
4701
|
+
function Gr(n, t, e, o, i, r) {
|
|
4702
|
+
const s = Math.hypot(e - i, o - r), a = Math.hypot(n - i, t - r), l = Math.hypot(n - e, t - o), u = Math.abs(
|
|
4703
|
+
(e - n) * (r - t) - (i - n) * (o - t)
|
|
4704
|
+
) / 2, h = Math.max(s, a, l);
|
|
4705
|
+
return u === 0 ? {
|
|
4706
|
+
radius: 1 / 0,
|
|
4707
|
+
maxEdge: h
|
|
4708
|
+
} : {
|
|
4709
|
+
radius: s * a * l / (4 * u),
|
|
4710
|
+
maxEdge: h
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
function jr(n, t) {
|
|
4714
|
+
const e = [], o = /* @__PURE__ */ new Set(), i = (r, s) => r < s ? `${r}_${s}` : `${s}_${r}`;
|
|
4715
|
+
for (let r = 0; r < t.length; r += 3) {
|
|
4716
|
+
const s = t[r], a = t[r + 1], l = t[r + 2], u = [
|
|
4717
|
+
[s, a],
|
|
4718
|
+
[a, l],
|
|
4719
|
+
[l, s]
|
|
4720
|
+
];
|
|
4721
|
+
for (const [h, d] of u) {
|
|
4722
|
+
const c = i(h, d);
|
|
4723
|
+
if (o.has(c)) continue;
|
|
4724
|
+
o.add(c);
|
|
4725
|
+
const [f, w] = n[h], [x, P] = n[d], M = Math.hypot(x - f, P - w);
|
|
4726
|
+
Number.isFinite(M) && M > 0 && e.push(M);
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
return Yr(e);
|
|
4730
|
+
}
|
|
4731
|
+
function Ur(n) {
|
|
4732
|
+
const t = /* @__PURE__ */ new Set(), e = [];
|
|
4733
|
+
for (const o of n) {
|
|
4734
|
+
if (!o || o.length < 2) continue;
|
|
4735
|
+
const i = o[0], r = o[1];
|
|
4736
|
+
if (!Number.isFinite(i) || !Number.isFinite(r)) continue;
|
|
4737
|
+
const s = `${i}_${r}`;
|
|
4738
|
+
t.has(s) || (t.add(s), e.push([i, r]));
|
|
4739
|
+
}
|
|
4740
|
+
return e;
|
|
4741
|
+
}
|
|
4742
|
+
function Zr(n) {
|
|
4743
|
+
const t = /* @__PURE__ */ new Map();
|
|
4744
|
+
for (const [e, o] of n)
|
|
4745
|
+
t.has(e) || t.set(e, []), t.has(o) || t.set(o, []), t.get(e).push(o), t.get(o).push(e);
|
|
4746
|
+
return t;
|
|
4747
|
+
}
|
|
4748
|
+
function Kr(n, t) {
|
|
4749
|
+
if (!t.length) return [];
|
|
4750
|
+
const e = Zr(t), o = t[0][0], i = [], r = /* @__PURE__ */ new Set();
|
|
4751
|
+
let s = o, a = -1;
|
|
4752
|
+
do {
|
|
4753
|
+
i.push(n[s]), r.add(s);
|
|
4754
|
+
const l = e.get(s) || [];
|
|
4755
|
+
let u = l.find((h) => h !== a && !r.has(h));
|
|
4756
|
+
if (u === void 0 && (u = l.find((h) => h !== a)), u === void 0)
|
|
4757
|
+
break;
|
|
4758
|
+
a = s, s = u;
|
|
4759
|
+
} while (s !== o && i.length <= t.length + 1);
|
|
4760
|
+
return i;
|
|
4761
|
+
}
|
|
4762
|
+
function zi(n, t = {}) {
|
|
4763
|
+
const {
|
|
4764
|
+
edgeFactor: e = 20,
|
|
4765
|
+
alphaScale: o = 2
|
|
4766
|
+
} = t;
|
|
4767
|
+
if (!n || n.length < 3) return [];
|
|
4768
|
+
const i = Ur(n);
|
|
4769
|
+
if (i.length < 3) return [];
|
|
4770
|
+
const r = new ke(Float64Array.from(i.flat())), { triangles: s } = r;
|
|
4771
|
+
if (!s.length) return [];
|
|
4772
|
+
const a = jr(i, s);
|
|
4773
|
+
if (!Number.isFinite(a) || a <= 0)
|
|
4774
|
+
return [];
|
|
4775
|
+
const l = a * e, u = /* @__PURE__ */ new Map(), h = (f, w) => f < w ? `${f}_${w}` : `${w}_${f}`;
|
|
4776
|
+
for (let f = 0; f < s.length; f += 3) {
|
|
4777
|
+
const w = s[f], x = s[f + 1], P = s[f + 2], [M, g] = i[w], [m, p] = i[x], [b, z] = i[P], { radius: v, maxEdge: S } = Gr(
|
|
4778
|
+
M,
|
|
4779
|
+
g,
|
|
4780
|
+
m,
|
|
4781
|
+
p,
|
|
4782
|
+
b,
|
|
4783
|
+
z
|
|
4784
|
+
), V = Hr(i, w, x, P) * o;
|
|
4785
|
+
if (v <= 1 / V && S <= l) {
|
|
4786
|
+
const D = [
|
|
4787
|
+
[w, x],
|
|
4788
|
+
[x, P],
|
|
4789
|
+
[P, w]
|
|
4790
|
+
];
|
|
4791
|
+
for (const [_, E] of D) {
|
|
4792
|
+
const T = h(_, E);
|
|
4793
|
+
u.set(T, (u.get(T) || 0) + 1);
|
|
4794
|
+
}
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
const d = [];
|
|
4798
|
+
for (const [f, w] of u)
|
|
4799
|
+
w === 1 && d.push(f.split("_").map(Number));
|
|
4800
|
+
return d.length ? Kr(i, d) : [];
|
|
4801
|
+
}
|
|
4693
4802
|
function be(n, t) {
|
|
4694
4803
|
const e = n.x - t.x, o = n.y - t.y;
|
|
4695
4804
|
return Math.sqrt(e * e + o * o);
|
|
4696
4805
|
}
|
|
4697
|
-
function
|
|
4806
|
+
function Qr(n) {
|
|
4698
4807
|
let t = 0, e = 0, o = 0;
|
|
4699
4808
|
for (let i = 0; i < 4; i++) {
|
|
4700
4809
|
const r = n[i], s = n[(i + 1) % 4], a = s.x - r.x, l = s.y - r.y, u = Math.sqrt(a * a + l * l);
|
|
@@ -4719,17 +4828,17 @@ function Un(n, t, e, o, i, r) {
|
|
|
4719
4828
|
const s = i - e, a = r - o, l = s * s + a * a;
|
|
4720
4829
|
if (l < 1e-12)
|
|
4721
4830
|
return { dist: Math.sqrt((n - e) ** 2 + (t - o) ** 2), t: 0 };
|
|
4722
|
-
const u = n - e, h = t - o,
|
|
4723
|
-
return { dist: Math.sqrt((n - c) ** 2 + (t -
|
|
4831
|
+
const u = n - e, h = t - o, d = (u * s + h * a) / l, c = e + d * s, f = o + d * a;
|
|
4832
|
+
return { dist: Math.sqrt((n - c) ** 2 + (t - f) ** 2), t: d };
|
|
4724
4833
|
}
|
|
4725
|
-
function
|
|
4834
|
+
function Jr(n, t, e = 0.15) {
|
|
4726
4835
|
let o = 0, i = 0;
|
|
4727
4836
|
for (const s of t)
|
|
4728
4837
|
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++);
|
|
4729
4838
|
let r = 0;
|
|
4730
4839
|
return o >= 1 && i >= 1 ? r = 5 : (o >= 1 || i >= 1) && (r = 2), { left: o, right: i, score: r };
|
|
4731
4840
|
}
|
|
4732
|
-
function
|
|
4841
|
+
function ti(n, t) {
|
|
4733
4842
|
const e = [], { start: o, end: i } = n;
|
|
4734
4843
|
for (const a of t) {
|
|
4735
4844
|
const { dist: l } = Un(a.x, a.y, o.x, o.y, i.x, i.y);
|
|
@@ -4738,37 +4847,37 @@ function Gr(n, t) {
|
|
|
4738
4847
|
const r = e.reduce((a, l) => a + l, 0) / e.length, s = e.reduce((a, l) => a + (l - r) ** 2, 0) / e.length;
|
|
4739
4848
|
return s < 0.01 ? 3 : s < 0.05 ? 2 : s < 0.1 ? 1 : 0;
|
|
4740
4849
|
}
|
|
4741
|
-
function
|
|
4850
|
+
function ei(n, t, e = 0.15) {
|
|
4742
4851
|
const o = n.end.x - n.start.x, i = n.end.y - n.start.y, r = Math.sqrt(o * o + i * i);
|
|
4743
4852
|
if (r < 1e-12) return 0;
|
|
4744
4853
|
const s = -i / r, a = o / r, l = [[], []];
|
|
4745
|
-
for (let
|
|
4746
|
-
const c =
|
|
4747
|
-
for (const
|
|
4748
|
-
if (
|
|
4749
|
-
const w = be(c,
|
|
4854
|
+
for (let d = 0; d < 2; d++) {
|
|
4855
|
+
const c = d === 0 ? n.start : n.end;
|
|
4856
|
+
for (const f of t) {
|
|
4857
|
+
if (f === n) continue;
|
|
4858
|
+
const w = be(c, f.start), x = be(c, f.end);
|
|
4750
4859
|
let P = null;
|
|
4751
|
-
if (w <= e ? P =
|
|
4752
|
-
const M =
|
|
4753
|
-
if (
|
|
4860
|
+
if (w <= e ? P = f.end : x <= e && (P = f.start), !P) continue;
|
|
4861
|
+
const M = f.end.x - f.start.x, g = f.end.y - f.start.y, m = Math.sqrt(M * M + g * g);
|
|
4862
|
+
if (m < 1e-12 || Math.abs(o * M + i * g) / (r * m) >= 0.342) continue;
|
|
4754
4863
|
const b = (P.x - c.x) * s + (P.y - c.y) * a;
|
|
4755
|
-
l[
|
|
4864
|
+
l[d].push(b > 0 ? 1 : -1);
|
|
4756
4865
|
}
|
|
4757
4866
|
}
|
|
4758
4867
|
if (l[0].length === 0 || l[1].length === 0) return 0;
|
|
4759
4868
|
const u = [...l[0], ...l[1]];
|
|
4760
|
-
return u.every((
|
|
4869
|
+
return u.every((d) => d === u[0]) ? 2 : 1;
|
|
4761
4870
|
}
|
|
4762
|
-
function
|
|
4763
|
-
const o =
|
|
4871
|
+
function ni(n, t, e) {
|
|
4872
|
+
const o = Jr(n, e), i = ti(n, t), r = ei(n, e);
|
|
4764
4873
|
return { score: o.score * 3 + i * 2 + r * 2, details: { conn: o.score, variance: i, sameSide: r } };
|
|
4765
4874
|
}
|
|
4766
|
-
function
|
|
4875
|
+
function oi(n) {
|
|
4767
4876
|
const t = n.end.x - n.start.x, e = n.end.y - n.start.y;
|
|
4768
4877
|
let o = Math.atan2(e, t) * (180 / Math.PI);
|
|
4769
4878
|
return o < 0 && (o += 180), o;
|
|
4770
4879
|
}
|
|
4771
|
-
function
|
|
4880
|
+
function ri(n, t) {
|
|
4772
4881
|
const e = [];
|
|
4773
4882
|
for (const o of n) {
|
|
4774
4883
|
let i = !1;
|
|
@@ -4783,7 +4892,7 @@ function Kr(n, t) {
|
|
|
4783
4892
|
}
|
|
4784
4893
|
return e;
|
|
4785
4894
|
}
|
|
4786
|
-
function
|
|
4895
|
+
function ii(n, t = 0.05) {
|
|
4787
4896
|
const e = [];
|
|
4788
4897
|
for (const o of n) {
|
|
4789
4898
|
let i = !1;
|
|
@@ -4796,7 +4905,7 @@ function Qr(n, t = 0.05) {
|
|
|
4796
4905
|
}
|
|
4797
4906
|
return e;
|
|
4798
4907
|
}
|
|
4799
|
-
function
|
|
4908
|
+
function si(n, t, e, o, i) {
|
|
4800
4909
|
const r = [];
|
|
4801
4910
|
for (const a of n) {
|
|
4802
4911
|
const l = a.seg, u = (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;
|
|
@@ -4814,11 +4923,11 @@ function Jr(n, t, e, o, i) {
|
|
|
4814
4923
|
}
|
|
4815
4924
|
return s;
|
|
4816
4925
|
}
|
|
4817
|
-
function
|
|
4926
|
+
function ai(n, t, e, o, i, r, s) {
|
|
4818
4927
|
const a = e - t, l = { ...n };
|
|
4819
4928
|
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;
|
|
4820
4929
|
}
|
|
4821
|
-
function
|
|
4930
|
+
function li(n, t) {
|
|
4822
4931
|
let e = !0;
|
|
4823
4932
|
for (; e; ) {
|
|
4824
4933
|
e = !1;
|
|
@@ -4829,10 +4938,10 @@ function ei(n, t) {
|
|
|
4829
4938
|
continue;
|
|
4830
4939
|
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, u = 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;
|
|
4831
4940
|
if (!(a || l || u || h) || r.direction.x * s.direction.x + r.direction.y * s.direction.y < 0.98) continue;
|
|
4832
|
-
let c = r.start,
|
|
4833
|
-
a ?
|
|
4834
|
-
const w = Math.hypot(
|
|
4835
|
-
x.start = c, x.end =
|
|
4941
|
+
let c = r.start, f = r.end;
|
|
4942
|
+
a ? f = s.end : l ? c = s.start : u ? f = s.start : h && (c = s.end);
|
|
4943
|
+
const w = Math.hypot(f.x - c.x, f.y - c.y), x = { ...r };
|
|
4944
|
+
x.start = c, x.end = f, x.length = w, x.direction = { x: (f.x - c.x) / w, y: (f.y - c.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;
|
|
4836
4945
|
}
|
|
4837
4946
|
}
|
|
4838
4947
|
return { segments: n, sourceMap: t };
|
|
@@ -4840,53 +4949,53 @@ function ei(n, t) {
|
|
|
4840
4949
|
function Zn(n, t = 5, e = 0.05) {
|
|
4841
4950
|
if (n.length <= 1)
|
|
4842
4951
|
return { segments: n, sourceMap: n.map((l, u) => [u]) };
|
|
4843
|
-
const o = n.map((l, u) => ({ seg: l, angle:
|
|
4952
|
+
const o = n.map((l, u) => ({ seg: l, angle: oi(l), idx: u }));
|
|
4844
4953
|
o.sort((l, u) => l.angle - u.angle);
|
|
4845
|
-
const i =
|
|
4954
|
+
const i = ri(o, t), r = [], s = [], a = [];
|
|
4846
4955
|
for (const l of i) {
|
|
4847
4956
|
let u = l[0].seg;
|
|
4848
4957
|
for (const M of l)
|
|
4849
4958
|
M.seg.length > u.length && (u = M.seg);
|
|
4850
|
-
const h = u.end.x - u.start.x,
|
|
4959
|
+
const h = u.end.x - u.start.x, d = u.end.y - u.start.y, c = Math.sqrt(h * h + d * d);
|
|
4851
4960
|
if (c < 1e-12) continue;
|
|
4852
|
-
const
|
|
4853
|
-
const
|
|
4854
|
-
return { seg: M.seg, offset: Math.abs(
|
|
4961
|
+
const f = -d / c, w = h / c, x = l.map((M) => {
|
|
4962
|
+
const g = M.seg.start.x - u.start.x, m = M.seg.start.y - u.start.y;
|
|
4963
|
+
return { seg: M.seg, offset: Math.abs(g * f + m * w), idx: M.idx };
|
|
4855
4964
|
});
|
|
4856
|
-
x.sort((M,
|
|
4857
|
-
const P =
|
|
4965
|
+
x.sort((M, g) => M.offset - g.offset);
|
|
4966
|
+
const P = ii(x);
|
|
4858
4967
|
for (const M of P) {
|
|
4859
|
-
let
|
|
4860
|
-
for (const
|
|
4861
|
-
|
|
4862
|
-
const
|
|
4968
|
+
let g = M[0].seg;
|
|
4969
|
+
for (const E of M)
|
|
4970
|
+
E.seg.length > g.length && (g = E.seg);
|
|
4971
|
+
const m = g.end.x - g.start.x, p = g.end.y - g.start.y, b = Math.sqrt(m * m + p * p);
|
|
4863
4972
|
if (b < 1e-12) continue;
|
|
4864
|
-
const z =
|
|
4973
|
+
const z = m / b, v = p / b, S = M.map((E) => E.seg.rooftopPz ?? 0), V = Math.max(...S), D = [...new Set(S.map((E) => E.toFixed(3)))];
|
|
4865
4974
|
if (D.length > 1) {
|
|
4866
|
-
const
|
|
4867
|
-
idx:
|
|
4868
|
-
start: { x:
|
|
4869
|
-
end: { x:
|
|
4870
|
-
length:
|
|
4871
|
-
rooftopPz:
|
|
4975
|
+
const E = M.map((T) => ({
|
|
4976
|
+
idx: T.idx,
|
|
4977
|
+
start: { x: T.seg.start.x, y: T.seg.start.y, z: T.seg.start.z },
|
|
4978
|
+
end: { x: T.seg.end.x, y: T.seg.end.y, z: T.seg.end.z },
|
|
4979
|
+
length: T.seg.length,
|
|
4980
|
+
rooftopPz: T.seg.rooftopPz ?? 0
|
|
4872
4981
|
}));
|
|
4873
|
-
a.push({ values: [...D], segments:
|
|
4982
|
+
a.push({ values: [...D], segments: E });
|
|
4874
4983
|
}
|
|
4875
|
-
[...new Set(M.map((
|
|
4876
|
-
const _ =
|
|
4877
|
-
for (const { l:
|
|
4878
|
-
if (
|
|
4879
|
-
const O =
|
|
4984
|
+
[...new Set(M.map((E) => String(E.seg.buildRosource)))];
|
|
4985
|
+
const _ = si(M, g, z, v, e);
|
|
4986
|
+
for (const { l: E, r: T, srcIdxs: A } of _) {
|
|
4987
|
+
if (T - E < 0.01) continue;
|
|
4988
|
+
const O = ai(g, E, T, z, v, V, g.buildRosource);
|
|
4880
4989
|
r.push(O), s.push(A);
|
|
4881
4990
|
}
|
|
4882
4991
|
}
|
|
4883
4992
|
}
|
|
4884
4993
|
return {
|
|
4885
|
-
...
|
|
4994
|
+
...li(r, s),
|
|
4886
4995
|
debugRPZGroups: a
|
|
4887
4996
|
};
|
|
4888
4997
|
}
|
|
4889
|
-
function
|
|
4998
|
+
function ci(n) {
|
|
4890
4999
|
return {
|
|
4891
5000
|
minLengthRatio: 0.95,
|
|
4892
5001
|
maxDistance: 0.5,
|
|
@@ -4896,7 +5005,7 @@ function ni(n) {
|
|
|
4896
5005
|
...n
|
|
4897
5006
|
};
|
|
4898
5007
|
}
|
|
4899
|
-
function
|
|
5008
|
+
function ui(n, t, e) {
|
|
4900
5009
|
return [
|
|
4901
5010
|
{ x: t, y: e, z: 0 },
|
|
4902
5011
|
{ x: n[0].x, y: n[0].y, z: 0 },
|
|
@@ -4905,7 +5014,7 @@ function oi(n, t, e) {
|
|
|
4905
5014
|
{ x: n[3].x, y: n[3].y, z: 0 }
|
|
4906
5015
|
];
|
|
4907
5016
|
}
|
|
4908
|
-
function
|
|
5017
|
+
function hi(n, t, e, o, i, r, s) {
|
|
4909
5018
|
const a = [
|
|
4910
5019
|
{ margin: r.projectionMargin, maxDist: r.maxDistance, label: "严格" },
|
|
4911
5020
|
{ margin: 0.4, maxDist: 0.65, label: "宽松" }
|
|
@@ -4914,22 +5023,22 @@ function ri(n, t, e, o, i, r, s) {
|
|
|
4914
5023
|
for (const u of a) {
|
|
4915
5024
|
if (l.length > 0) break;
|
|
4916
5025
|
for (const h of n) {
|
|
4917
|
-
const
|
|
4918
|
-
if (h.length <
|
|
5026
|
+
const d = t * r.minLengthRatio;
|
|
5027
|
+
if (h.length < d)
|
|
4919
5028
|
continue;
|
|
4920
|
-
const { start: c, end:
|
|
5029
|
+
const { start: c, end: f } = h;
|
|
4921
5030
|
let w = !1, x = 1 / 0;
|
|
4922
5031
|
for (const S of i) {
|
|
4923
|
-
const { dist: V, t: D } = Un(S.x, S.y, c.x, c.y,
|
|
5032
|
+
const { dist: V, t: D } = Un(S.x, S.y, c.x, c.y, f.x, f.y);
|
|
4924
5033
|
D >= -u.margin && D <= 1 + u.margin && V <= u.maxDist && (w = !0, x = Math.min(x, V));
|
|
4925
5034
|
}
|
|
4926
5035
|
if (!w) {
|
|
4927
5036
|
`${u.maxDist}${(-u.margin).toFixed(1)}${(1 + u.margin).toFixed(1)}`;
|
|
4928
5037
|
continue;
|
|
4929
5038
|
}
|
|
4930
|
-
const P = Math.sqrt((
|
|
5039
|
+
const P = Math.sqrt((f.x - c.x) ** 2 + (f.y - c.y) ** 2);
|
|
4931
5040
|
if (P < 1e-12) continue;
|
|
4932
|
-
const M = (
|
|
5041
|
+
const M = (f.x - c.x) / P, g = (f.y - c.y) / P, m = Math.abs(e * M + o * g), p = Math.abs(-o * M + e * g), b = Math.max(m, p), z = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
|
|
4933
5042
|
if (z > r.angleThreshold) {
|
|
4934
5043
|
`${z.toFixed(1)}${r.angleThreshold}`;
|
|
4935
5044
|
continue;
|
|
@@ -4938,7 +5047,7 @@ function ri(n, t, e, o, i, r, s) {
|
|
|
4938
5047
|
if (P > 0.01) {
|
|
4939
5048
|
const S = [];
|
|
4940
5049
|
for (let _ = 1; _ <= 4; _++) {
|
|
4941
|
-
const
|
|
5050
|
+
const E = i[_], T = E.x - c.x, A = E.y - c.y, O = (T * M + A * g) / P;
|
|
4942
5051
|
S.push(O);
|
|
4943
5052
|
}
|
|
4944
5053
|
const V = Math.min(...S), D = Math.max(...S);
|
|
@@ -4956,66 +5065,66 @@ function ri(n, t, e, o, i, r, s) {
|
|
|
4956
5065
|
}
|
|
4957
5066
|
return l;
|
|
4958
5067
|
}
|
|
4959
|
-
function
|
|
5068
|
+
function fi(n, t, e, o) {
|
|
4960
5069
|
if (n.length <= 1)
|
|
4961
5070
|
return n.length === 1 && (n[0].score = -1), n;
|
|
4962
5071
|
for (const i of n) {
|
|
4963
|
-
const { score: r, details: s } =
|
|
5072
|
+
const { score: r, details: s } = ni(i.seg, t, e);
|
|
4964
5073
|
i.score = r, i.details = s;
|
|
4965
5074
|
}
|
|
4966
5075
|
return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
|
|
4967
5076
|
}
|
|
4968
|
-
function
|
|
5077
|
+
function di(n, t, e, o) {
|
|
4969
5078
|
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, u = t.map((v) => {
|
|
4970
5079
|
const S = v.x - n.start.x, V = v.y - n.start.y;
|
|
4971
5080
|
return (S * a + V * l) / s;
|
|
4972
|
-
}), h = Math.min(...u),
|
|
5081
|
+
}), h = Math.min(...u), d = Math.max(...u), c = (d - h) * s, f = (h + d) / 2, w = n.start.x + f * i, x = n.start.y + f * r, P = e.box.min.z, M = e.box.max.z, g = Math.abs(M - P), m = jn(o, n.start.x, n.start.y), p = Math.max(0, P - m), b = h <= 0 && d >= 1, z = n.start.z + f * (n.end.z - n.start.z);
|
|
4973
5082
|
return {
|
|
4974
5083
|
p: { x: w, y: x, z },
|
|
4975
5084
|
width: c,
|
|
4976
5085
|
full: b,
|
|
4977
|
-
height:
|
|
5086
|
+
height: g,
|
|
4978
5087
|
groundClearance: p
|
|
4979
5088
|
};
|
|
4980
5089
|
}
|
|
4981
5090
|
function Kn(n, t, e) {
|
|
4982
|
-
var h,
|
|
5091
|
+
var h, d, c, f, w;
|
|
4983
5092
|
const o = t.map((x) => e[x]), i = [], r = [], s = [], a = [], l = [];
|
|
4984
5093
|
let u;
|
|
4985
5094
|
for (const x of o) {
|
|
4986
5095
|
if ((h = x.points) != null && h.length) for (const P of x.points) i.push(P);
|
|
4987
|
-
if ((
|
|
5096
|
+
if ((d = x.originalPoints) != null && d.length) for (const P of x.originalPoints) r.push(P);
|
|
4988
5097
|
if ((c = x.doorAndBeamData) != null && c.length) for (const P of x.doorAndBeamData) s.push(P);
|
|
4989
|
-
if ((
|
|
5098
|
+
if ((f = x.insetionArr) != null && f.length) for (const P of x.insetionArr) a.push(P);
|
|
4990
5099
|
if ((w = x.drawWindow) != null && w.length) for (const P of x.drawWindow) l.push(P);
|
|
4991
5100
|
x.boxData && !u && (u = x.boxData);
|
|
4992
5101
|
}
|
|
4993
5102
|
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), u && (n.boxData = u);
|
|
4994
5103
|
}
|
|
4995
|
-
function
|
|
5104
|
+
function mi(n, t, e, o) {
|
|
4996
5105
|
var u;
|
|
4997
|
-
const i =
|
|
5106
|
+
const i = ci(e), r = [], { segments: s, sourceMap: a } = o ?? Zn(t), l = s;
|
|
4998
5107
|
for (const h of n) {
|
|
4999
|
-
const
|
|
5000
|
-
if (!
|
|
5108
|
+
const d = (u = h.coordinatesByArea) == null ? void 0 : u.coordinates;
|
|
5109
|
+
if (!d || d.length < 4)
|
|
5001
5110
|
continue;
|
|
5002
|
-
const c =
|
|
5111
|
+
const c = d.slice(0, 4), f = c.reduce((D, _) => D + _.x, 0) / 4, w = c.reduce((D, _) => D + _.y, 0) / 4, { longSide: x, dirX: P, dirY: M } = Qr(c);
|
|
5003
5112
|
if (x < 0.01)
|
|
5004
5113
|
continue;
|
|
5005
|
-
const
|
|
5006
|
-
if (
|
|
5114
|
+
const g = c.reduce((D, _) => D + _.z, 0) / 4, m = jn(t, f, w);
|
|
5115
|
+
if (g < m - 0.3)
|
|
5007
5116
|
continue;
|
|
5008
|
-
const p =
|
|
5117
|
+
const p = ui(c, f, w);
|
|
5009
5118
|
h.name;
|
|
5010
|
-
let b =
|
|
5011
|
-
b =
|
|
5119
|
+
let b = hi(l, x, P, M, p, i, h.name);
|
|
5120
|
+
b = fi(b, p, t, h.name);
|
|
5012
5121
|
let z = null, v = 1 / 0, S = 0;
|
|
5013
5122
|
if (b.length > 0) {
|
|
5014
5123
|
const D = b[0];
|
|
5015
5124
|
z = D.seg, v = D.minDist, S = D.ratio;
|
|
5016
5125
|
}
|
|
5017
5126
|
let V;
|
|
5018
|
-
if (z && (V =
|
|
5127
|
+
if (z && (V = di(z, c, h, s), !i.printOnly)) {
|
|
5019
5128
|
const D = z;
|
|
5020
5129
|
D.drawWindow || (D.drawWindow = []), D.drawWindow.push(V);
|
|
5021
5130
|
}
|
|
@@ -5030,49 +5139,50 @@ function ai(n, t, e, o) {
|
|
|
5030
5139
|
});
|
|
5031
5140
|
}
|
|
5032
5141
|
for (const h of r) {
|
|
5033
|
-
const
|
|
5142
|
+
const d = h.wallSegment, c = s.indexOf(d);
|
|
5034
5143
|
if (c === -1) continue;
|
|
5035
|
-
const
|
|
5036
|
-
!
|
|
5144
|
+
const f = a[c];
|
|
5145
|
+
!f || f.length <= 1 || Kn(d, f, t);
|
|
5037
5146
|
}
|
|
5038
5147
|
return r;
|
|
5039
5148
|
}
|
|
5040
|
-
function
|
|
5149
|
+
function Vi(n, t, e) {
|
|
5041
5150
|
const o = {
|
|
5042
5151
|
printOnly: !1,
|
|
5043
5152
|
...e
|
|
5044
|
-
}, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], { segments: r, sourceMap: s } = Zn(n), a =
|
|
5153
|
+
}, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], { segments: r, sourceMap: s } = Zn(n), a = mi(i, n, o, { segments: r, sourceMap: s }), l = /* @__PURE__ */ new Set();
|
|
5045
5154
|
for (const c of a) {
|
|
5046
|
-
const
|
|
5047
|
-
|
|
5155
|
+
const f = r.indexOf(c.wallSegment);
|
|
5156
|
+
f >= 0 && l.add(f);
|
|
5048
5157
|
}
|
|
5049
5158
|
const u = [], h = /* @__PURE__ */ new Set();
|
|
5050
5159
|
for (const c of l) {
|
|
5051
|
-
const
|
|
5052
|
-
if (
|
|
5053
|
-
Kn(r[c],
|
|
5054
|
-
for (const w of
|
|
5160
|
+
const f = s[c];
|
|
5161
|
+
if (f) {
|
|
5162
|
+
Kn(r[c], f, n);
|
|
5163
|
+
for (const w of f) h.add(w);
|
|
5055
5164
|
}
|
|
5056
5165
|
u.push(r[c]);
|
|
5057
5166
|
}
|
|
5058
5167
|
for (let c = 0; c < n.length; c++)
|
|
5059
5168
|
h.has(c) || u.push(n[c]);
|
|
5060
|
-
const
|
|
5169
|
+
const d = new Set(a.map((c) => c.windowName));
|
|
5061
5170
|
for (const c of t)
|
|
5062
|
-
c && c.category === "window" && !c.isBayWindowObj && (
|
|
5171
|
+
c && c.category === "window" && !c.isBayWindowObj && (d.has(c.name) ? delete c.AbnormalWindow : c.AbnormalWindow = !0);
|
|
5063
5172
|
for (const c of a)
|
|
5064
5173
|
c.drawWindow && c.wallSegment && (c.wallSegment.drawWindow || (c.wallSegment.drawWindow = []), c.wallSegment.drawWindow.push(c.drawWindow));
|
|
5065
5174
|
return { segments: u, matches: a };
|
|
5066
5175
|
}
|
|
5067
5176
|
export {
|
|
5068
5177
|
cn as computeContour,
|
|
5178
|
+
zi as computeContourNew,
|
|
5069
5179
|
jn as computeLocalFloorZ,
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5180
|
+
mi as findWindowWalls,
|
|
5181
|
+
yi as getAllGeometry,
|
|
5182
|
+
wi as getBeamLine,
|
|
5183
|
+
bi as getColLine,
|
|
5184
|
+
Mi as getMergeMeaning,
|
|
5075
5185
|
Zn as mergeCollinearSegments,
|
|
5076
|
-
|
|
5077
|
-
|
|
5186
|
+
Vi as processData,
|
|
5187
|
+
xi as updateStEdPoint
|
|
5078
5188
|
};
|