rm-graphical-computing 1.0.69 → 1.0.70

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.js CHANGED
@@ -2,7 +2,7 @@ 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
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 En, MathUtils as Ne, Box3 as oo, Matrix4 as Tn, Ray as ro } from "three";
5
+ import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as Vt, 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;
@@ -167,24 +167,24 @@ const oe = (n, t, e = 0.01) => {
167
167
  }, co = (n, t, e, o) => {
168
168
  const i = n;
169
169
  let r = [];
170
- if (o && o.length && (r = o.map((z) => z.clone())), !i || i.length < 4) return {};
170
+ if (o && o.length && (r = o.map((V) => V.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
172
  let u = 1 / 0, h = -1 / 0, d = 1 / 0, c = -1 / 0;
173
- for (const z of i) {
174
- const S = z.dot(s), v = z.dot(a);
175
- S < u && (u = S), S > h && (h = S), v < d && (d = v), v > c && (c = v);
173
+ for (const V of i) {
174
+ const v = V.dot(s), S = V.dot(a);
175
+ v < u && (u = v), v > h && (h = v), S < d && (d = S), S > c && (c = S);
176
176
  }
177
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)), b = 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
178
  let g = [w, x, b, M], m = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
179
  m && m.parallel && (g = [w, M, b, x]);
180
180
  let p = 0;
181
181
  if (o.length > 0) {
182
- const z = new y.Vector3().subVectors(g[1], g[0]).normalize(), S = z.clone().negate(), v = new y.Vector3().subVectors(g[3], g[0]).normalize(), V = v.clone().negate();
182
+ const V = new y.Vector3().subVectors(g[1], g[0]).normalize(), v = V.clone().negate(), S = new y.Vector3().subVectors(g[3], g[0]).normalize(), z = S.clone().negate();
183
183
  let D = g[0].distanceTo(g[1]), _ = g[0].distanceTo(g[3]), E = D / t, T = _ / e, A = 1e-3;
184
184
  for (let O = 0; O < E; O++) {
185
185
  let I = g[0], B = 0;
186
186
  for (let R = 0; R < T; R++) {
187
- let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(v, e), L = I.clone().addScaledVector(v, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
187
+ let N = I.clone().addScaledVector(V, t), C = N.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
188
188
  for (let X = 0; X < r.length; X++)
189
189
  if (r[X].distanceTo($) < A) {
190
190
  B++;
@@ -194,13 +194,13 @@ const oe = (n, t, e = 0.01) => {
194
194
  }
195
195
  if (B >= T / 2)
196
196
  break;
197
- p += B, g[0] = g[0].addScaledVector(z, t), g[3] = g[3].addScaledVector(z, t);
197
+ p += B, g[0] = g[0].addScaledVector(V, t), g[3] = g[3].addScaledVector(V, t);
198
198
  }
199
199
  D = g[0].distanceTo(g[1]), E = D / t;
200
200
  for (let O = 0; O < E; O++) {
201
201
  let I = g[1], B = 0;
202
202
  for (let R = 0; R < T; R++) {
203
- let N = I.clone().addScaledVector(S, t), C = N.clone().addScaledVector(v, e), L = I.clone().addScaledVector(v, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
203
+ let N = I.clone().addScaledVector(v, t), C = N.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
204
204
  for (let X = 0; X < r.length; X++)
205
205
  if (r[X].distanceTo($) < A) {
206
206
  B++;
@@ -210,13 +210,13 @@ const oe = (n, t, e = 0.01) => {
210
210
  }
211
211
  if (B >= T / 2)
212
212
  break;
213
- p += B, g[1] = g[1].addScaledVector(S, t), g[2] = g[2].addScaledVector(S, t);
213
+ p += B, g[1] = g[1].addScaledVector(v, t), g[2] = g[2].addScaledVector(v, t);
214
214
  }
215
215
  D = g[0].distanceTo(g[1]), E = D / t;
216
216
  for (let O = 0; O < T; O++) {
217
217
  let I = g[3], B = 0;
218
218
  for (let R = 0; R < E; R++) {
219
- let N = I.clone().addScaledVector(z, t), C = N.clone().addScaledVector(V, e), L = I.clone().addScaledVector(V, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
219
+ let N = I.clone().addScaledVector(V, t), C = N.clone().addScaledVector(z, e), L = I.clone().addScaledVector(z, e), $ = new y.Vector3().add(I).add(N).add(C).add(L).multiplyScalar(0.25);
220
220
  for (let X = 0; X < r.length; X++)
221
221
  if (r[X].distanceTo($) < A) {
222
222
  B++;
@@ -226,7 +226,7 @@ const oe = (n, t, e = 0.01) => {
226
226
  }
227
227
  if (B >= E / 2)
228
228
  break;
229
- p += B, g[2] = g[2].addScaledVector(V, e), g[3] = g[3].addScaledVector(V, e);
229
+ p += B, g[2] = g[2].addScaledVector(z, e), g[3] = g[3].addScaledVector(z, e);
230
230
  }
231
231
  }
232
232
  const P = g[0].distanceTo(g[1]) * g[0].distanceTo(g[3]);
@@ -298,7 +298,7 @@ const oe = (n, t, e = 0.01) => {
298
298
  closestDistance: null
299
299
  };
300
300
  f < 0 && c.negate();
301
- const b = 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, P = Math.max(g, m), z = n.dot(b), S = t.dot(b), v = e.dot(b), V = o.dot(b), D = Math.min(z, S), _ = Math.max(z, S), E = Math.min(v, V), T = Math.max(v, V), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), R = B < 0 ? -B : 0, N = B > 0 ? B : 0, C = I > 0 ? N / I : 0, L = uo(
301
+ const b = 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, P = Math.max(g, m), V = n.dot(b), v = t.dot(b), S = e.dot(b), z = o.dot(b), D = Math.min(V, v), _ = Math.max(V, v), E = Math.min(S, z), T = Math.max(S, z), A = _ - D, O = T - E, I = Math.min(A, O), B = Math.min(_, T) - Math.max(D, E), R = B < 0 ? -B : 0, N = B > 0 ? B : 0, C = I > 0 ? N / I : 0, L = uo(
302
302
  n,
303
303
  t,
304
304
  e,
@@ -353,7 +353,7 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
353
353
  break;
354
354
  }
355
355
  return { minZ: c, maxZ: f };
356
- }, ze = (n, t, e) => {
356
+ }, Ve = (n, t, e) => {
357
357
  let o = new y.Plane();
358
358
  const i = new y.Vector3(n.x, n.y, n.z), r = new y.Vector3(t.x, t.y, t.z), s = new y.Vector3(t.x, t.y, t.z + 5);
359
359
  o.setFromCoplanarPoints(i, r, s);
@@ -379,10 +379,10 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
379
379
  for (let P = 0; P < h.checkResults[m].allCenterPoints.length; P++) {
380
380
  if (c.has(m) && c.get(m).removePtsIndex.includes(P))
381
381
  continue;
382
- let z = h.checkResults[m].allCenterPoints[P];
383
- z = new y.Vector3(z.x, z.y, z.z);
384
- let S = d.closestPointToPoint(z, !0, f), v = z.distanceTo(S);
385
- Math.abs(v - s) < 0.01 && (g++, M.has(m) ? M.get(m).removePtsIndex.push(P) : M.set(m, {
382
+ let V = h.checkResults[m].allCenterPoints[P];
383
+ V = new y.Vector3(V.x, V.y, V.z);
384
+ let v = d.closestPointToPoint(V, !0, f), S = V.distanceTo(v);
385
+ Math.abs(S - s) < 0.01 && (g++, M.has(m) ? M.get(m).removePtsIndex.push(P) : M.set(m, {
386
386
  index: m,
387
387
  removePtsIndex: [P]
388
388
  }));
@@ -417,10 +417,10 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
417
417
  if (!o.checkResults || o.checkResults.length <= 0)
418
418
  continue;
419
419
  if (o.checkResults[0].originalVertices && o.checkResults[0].originalVertices.length > 0) {
420
- const v = o.checkResults[0].originalVertices[0];
421
- let [V, D, _, E] = v;
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));
420
+ const S = o.checkResults[0].originalVertices[0];
421
+ let [z, D, _, E] = S;
422
+ z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), E = new y.Vector3(E.x, E.y, E.z), i = z.distanceTo(D), r = z.distanceTo(E);
423
+ let T = new y.Vector3().subVectors(z, 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)
@@ -429,15 +429,15 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
429
429
  const l = s.distanceTo(a), u = o.rooftopPz - o.start.z, h = Math.ceil(l / i), d = Math.ceil(u / r);
430
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)), b = new y.Vector3().subVectors(f, c).normalize(), M = b.clone().negate();
431
431
  new y.Vector3().subVectors(w, c).normalize().clone().negate();
432
- let m = i / 2, p = l * u, P = i * r, z = p / P;
433
- t(c, x, b, 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: S } = ze(c, f, o.originalPoints);
435
- o.originalPoints = S;
432
+ let m = i / 2, p = l * u, P = i * r, V = p / P;
433
+ t(c, x, b, i, m, d, h, V, o), t(f, w, M, i, m, d, h, V, o), o.start = c, o.end = f;
434
+ const { newOriginalPoints: v } = Ve(c, f, o.originalPoints);
435
+ o.originalPoints = v;
436
436
  }
437
437
  }, Rt = (n, t) => new y.Vector3(n.x, n.y, 0).distanceTo(new y.Vector3(t.x, t.y, 0)), mo = (n, t, e = 1e-6) => {
438
438
  const o = new y.Vector3();
439
439
  return n.closestPointToPoint(t, !0, o), o.distanceTo(t) < e;
440
- }, ve = (n) => {
440
+ }, Se = (n) => {
441
441
  let t = 0, e = [];
442
442
  for (let o = 0; o < n.length; o++)
443
443
  for (let i = o + 1; i < n.length; i++) {
@@ -560,18 +560,18 @@ class yo {
560
560
  for (let g = 0; g < e; g++)
561
561
  for (let m = 0; m < o; m++)
562
562
  try {
563
- const p = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar(g * x)), P = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar(g * x)), z = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar((g + 1) * x)), S = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar((g + 1) * x)), v = {
564
- points: [p, P, z, S],
563
+ const p = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar(g * x)), P = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar(g * x)), V = new y.Vector3().copy(a).add(b.clone().multiplyScalar((m + 1) * w)).add(M.clone().multiplyScalar((g + 1) * x)), v = new y.Vector3().copy(a).add(b.clone().multiplyScalar(m * w)).add(M.clone().multiplyScalar((g + 1) * x)), S = {
564
+ points: [p, P, V, v],
565
565
  userData: {}
566
566
  };
567
- v.userData = {
567
+ S.userData = {
568
568
  type: "wallSegment",
569
569
  row: g,
570
570
  col: m,
571
571
  originalMaterial: i,
572
572
  width: w,
573
573
  height: x
574
- }, s.push(v);
574
+ }, s.push(S);
575
575
  } catch (p) {
576
576
  console.error(`创建墙体小平面(${g}, ${m})时出错:`, p);
577
577
  }
@@ -1046,10 +1046,10 @@ class yo {
1046
1046
  const [M, g] = b.shift(), m = `row${M}_col${g}`;
1047
1047
  r.has(m) && x.push(r.get(m));
1048
1048
  for (const [p, P] of l) {
1049
- const z = M + p, S = g + P;
1050
- if (s.has(z) && s.get(z).has(S)) {
1051
- const v = s.get(z).get(S);
1052
- !v.visited && v.isEmpty && (v.visited = !0, b.push([z, S]));
1049
+ const V = M + p, v = g + P;
1050
+ if (s.has(V) && s.get(V).has(v)) {
1051
+ const S = s.get(V).get(v);
1052
+ !S.visited && S.isEmpty && (S.visited = !0, b.push([V, v]));
1053
1053
  }
1054
1054
  }
1055
1055
  }
@@ -1225,12 +1225,12 @@ const xo = (n) => {
1225
1225
  o.push(...r.vertices), i.push(r.center), e.push(r.vertices);
1226
1226
  }), t.originalVertices = e, t.allCenterPoints = i, t;
1227
1227
  }, wo = (n) => {
1228
- const t = new zt().copy(n.start).add(n.end).multiplyScalar(0.5), e = new zt().subVectors(
1229
- new zt(t.x, t.y, t.z + 1),
1228
+ const t = new Vt().copy(n.start).add(n.end).multiplyScalar(0.5), e = new Vt().subVectors(
1229
+ new Vt(t.x, t.y, t.z + 1),
1230
1230
  t
1231
- ).normalize(), o = new zt(n.direction.x, n.direction.y, 0);
1231
+ ).normalize(), o = new Vt(n.direction.x, n.direction.y, 0);
1232
1232
  o.applyAxisAngle(e, Math.PI / 2);
1233
- const i = new zt().copy(t).add(o.clone().multiplyScalar(n.length)), r = new zt().copy(t).sub(o.clone().multiplyScalar(n.length));
1233
+ const i = new Vt().copy(t).add(o.clone().multiplyScalar(n.length)), r = new Vt().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 = [];
@@ -1243,12 +1243,12 @@ const xo = (n) => {
1243
1243
  s.applyEuler(new y.Euler(-Math.PI / 2, 0, 0));
1244
1244
  let a = new y.Vector3(r.end.x, r.end.y, r.end.z);
1245
1245
  if (a.applyEuler(new y.Euler(-Math.PI / 2, 0, 0)), t.add(ao(String(i), new y.Vector3((s.x + a.x) / 2, (s.y + a.y) / 2, (s.z + a.z) / 2))), (r.isBayWindow || r.isWindow) && e) continue;
1246
- const l = new no().setFromCoplanarPoints(new zt(r.start.x, r.start.y, r.start.z), new zt(r.end.x, r.end.y, r.end.z), new zt(r.start.x, r.start.y, r.rooftopPz)), u = [];
1247
- r.originalPoints.forEach((S, v) => {
1248
- const V = new zt();
1249
- l.projectPoint(S, V), u.push(V);
1246
+ const l = new no().setFromCoplanarPoints(new Vt(r.start.x, r.start.y, r.start.z), new Vt(r.end.x, r.end.y, r.end.z), new Vt(r.start.x, r.start.y, r.rooftopPz)), u = [];
1247
+ r.originalPoints.forEach((v, S) => {
1248
+ const z = new Vt();
1249
+ l.projectPoint(v, z), u.push(z);
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)), d = Math.abs(r.rooftopPz - r.start.z), c = new y.MeshBasicMaterial({
1251
+ const h = new Vt(r.start.x, r.start.y, r.start.z).distanceTo(new Vt(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,
@@ -1262,12 +1262,12 @@ const xo = (n) => {
1262
1262
  opacity: 0.8,
1263
1263
  side: y.DoubleSide
1264
1264
  }), m = w.highlightEmptySegments(M, g, f), p = [];
1265
- for (const S of m.clusters) {
1266
- const v = xo(S);
1267
- v && p.push(v);
1265
+ for (const v of m.clusters) {
1266
+ const S = xo(v);
1267
+ S && p.push(S);
1268
1268
  }
1269
- const z = wo(r).direction;
1270
- r.checkResults = p, r.verticalDirection = z, r.originaIndex = i, o.push(r);
1269
+ const V = wo(r).direction;
1270
+ r.checkResults = p, r.verticalDirection = V, r.originaIndex = i, o.push(r);
1271
1271
  }
1272
1272
  return o;
1273
1273
  }, xi = (n, t) => {
@@ -1276,8 +1276,8 @@ const xo = (n) => {
1276
1276
  const o = n[e], i = [];
1277
1277
  o.originalPoints.forEach((m) => {
1278
1278
  let p = new y.Vector3(m.x, m.y, 0), P = !1;
1279
- for (let z = 0; z < i.length; z++)
1280
- if (kt(p, i[z], 0.01)) {
1279
+ for (let V = 0; V < i.length; V++)
1280
+ if (kt(p, i[V], 0.01)) {
1281
1281
  P = !0;
1282
1282
  break;
1283
1283
  }
@@ -1292,8 +1292,8 @@ const xo = (n) => {
1292
1292
  const p = [];
1293
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 P = [];
1295
- for (let z = 0; z < i.length; z++)
1296
- c.includes(z) || Po(i[z], p) && (c.push(z), P.push(i[z]));
1295
+ for (let V = 0; V < i.length; V++)
1296
+ c.includes(V) || Po(i[V], p) && (c.push(V), P.push(i[V]));
1297
1297
  P.length > 0 && f.push(Mo(P)), a = a.addScaledVector(u, w);
1298
1298
  }
1299
1299
  const x = new Float32Array(i.length * 3);
@@ -1302,7 +1302,7 @@ const xo = (n) => {
1302
1302
  });
1303
1303
  const b = new y.BufferGeometry();
1304
1304
  b.setAttribute("position", new y.BufferAttribute(x, 3)), b.rotateX(-Math.PI / 2), t.add(new y.Points(b, new y.PointsMaterial({ color: go(), size: 0.02 })));
1305
- const [M, g] = So(f, {
1305
+ const [M, g] = vo(f, {
1306
1306
  plane: "xy",
1307
1307
  trimRatio: 0
1308
1308
  });
@@ -1342,11 +1342,11 @@ function Mo(n) {
1342
1342
  Array.isArray(e) ? (t.x += e[0], t.y += e[1], t.z += e[2]) : (t.x += e.x, t.y += e.y, t.z += e.z);
1343
1343
  return t.divideScalar(n.length), t;
1344
1344
  }
1345
- function zo(n) {
1345
+ function Vo(n) {
1346
1346
  return n instanceof y.Vector3 ? n.clone() : Array.isArray(n) ? new y.Vector3(n[0], n[1], n[2]) : new y.Vector3(n.x, n.y, n.z);
1347
1347
  }
1348
- function Vo(n, t = "xy") {
1349
- const e = zo(n);
1348
+ function zo(n, t = "xy") {
1349
+ const e = Vo(n);
1350
1350
  if (t === "xy")
1351
1351
  return {
1352
1352
  x: e.x,
@@ -1376,7 +1376,7 @@ function nn(n, t, e, o = "xy") {
1376
1376
  return new y.Vector3(e, n, t);
1377
1377
  throw new Error(`Unsupported plane: ${o}`);
1378
1378
  }
1379
- function vo(n, t, e) {
1379
+ function So(n, t, e) {
1380
1380
  if (Math.abs(t) < 1e-12)
1381
1381
  return n >= e ? { x: 1, y: 0 } : { x: 0, y: 1 };
1382
1382
  const i = n + e, r = n * e - t * t, s = Math.sqrt(Math.max(0, i * i * 0.25 - r)), a = i * 0.5 + s;
@@ -1387,7 +1387,7 @@ function vo(n, t, e) {
1387
1387
  y: u / h
1388
1388
  };
1389
1389
  }
1390
- function So(n, t = {}) {
1390
+ function vo(n, t = {}) {
1391
1391
  const {
1392
1392
  plane: e = "xy",
1393
1393
  // 0 表示完全取最远两端
@@ -1396,7 +1396,7 @@ function So(n, t = {}) {
1396
1396
  } = t;
1397
1397
  if (!n || n.length < 2)
1398
1398
  return null;
1399
- const i = n.map((B) => Vo(B, e));
1399
+ const i = n.map((B) => zo(B, e));
1400
1400
  let r = 0, s = 0, a = 0;
1401
1401
  for (const B of i)
1402
1402
  r += B.x, s += B.y, a += B.up;
@@ -1407,7 +1407,7 @@ function So(n, t = {}) {
1407
1407
  l += R * R, u += R * N, h += N * N;
1408
1408
  }
1409
1409
  l /= i.length, u /= i.length, h /= i.length;
1410
- const d = vo(l, u, h), c = {
1410
+ const d = So(l, u, h), c = {
1411
1411
  x: -d.y,
1412
1412
  y: d.x
1413
1413
  }, f = [];
@@ -1429,7 +1429,7 @@ function So(n, t = {}) {
1429
1429
  })(), p = (() => {
1430
1430
  const B = f.map((N) => N.up).sort((N, C) => N - C), R = Math.floor(B.length / 2);
1431
1431
  return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1432
- })(), P = M.s, z = g.s, S = m, v = m, V = p, D = p, _ = r + d.x * P + c.x * S, E = s + d.y * P + c.y * S, T = r + d.x * z + c.x * v, A = s + d.y * z + c.y * v, O = nn(_, E, V, e), I = nn(T, A, D, e);
1432
+ })(), P = M.s, V = g.s, v = m, S = m, z = p, D = p, _ = r + d.x * P + c.x * v, E = s + d.y * P + c.y * v, T = r + d.x * V + c.x * S, A = s + d.y * V + c.y * S, O = nn(_, E, z, e), I = nn(T, A, D, e);
1433
1433
  return [O, I];
1434
1434
  }
1435
1435
  const wi = async (n, t, e, o, i) => {
@@ -1446,32 +1446,32 @@ const wi = async (n, t, e, o, i) => {
1446
1446
  if (!(!m.checkResults || m.checkResults.length <= 0)) {
1447
1447
  for (let P = 0; P < m.checkResults.length; P++) {
1448
1448
  let D = function(A) {
1449
- for (; V[A] !== A; )
1450
- V[A] = V[V[A]], A = V[A];
1449
+ for (; z[A] !== A; )
1450
+ z[A] = z[z[A]], A = z[A];
1451
1451
  return A;
1452
1452
  };
1453
- const z = m.checkResults[P];
1454
- if (z.isDoor = !1, !z.originalVertices || z.originalVertices.length == 0)
1453
+ const V = m.checkResults[P];
1454
+ if (V.isDoor = !1, !V.originalVertices || V.originalVertices.length == 0)
1455
1455
  continue;
1456
- const S = [];
1457
- z.originalVertices.forEach((A) => {
1456
+ const v = [];
1457
+ V.originalVertices.forEach((A) => {
1458
1458
  let O = [];
1459
1459
  A.forEach((I) => {
1460
1460
  O.push(new y.Vector3(I.x, I.y, I.z));
1461
- }), S.push(O);
1461
+ }), v.push(O);
1462
1462
  });
1463
- const v = S.length, V = Array.from({ length: v }, (A, O) => O);
1464
- for (let A = 0; A < v; A++)
1465
- for (let O = A + 1; O < v; O++) {
1466
- const I = S[A], B = S[O];
1463
+ const S = v.length, z = Array.from({ length: S }, (A, O) => O);
1464
+ for (let A = 0; A < S; A++)
1465
+ for (let O = A + 1; O < S; O++) {
1466
+ const I = v[A], B = v[O];
1467
1467
  if (I.some((N) => B.some((C) => N.equals(C)))) {
1468
1468
  const N = D(A), C = D(O);
1469
- N !== C && (V[N] = C);
1469
+ N !== C && (z[N] = C);
1470
1470
  }
1471
1471
  }
1472
1472
  const _ = /* @__PURE__ */ new Map();
1473
1473
  let E = -1, T = -1;
1474
- for (let A = 0; A < v; A++) {
1474
+ for (let A = 0; A < S; A++) {
1475
1475
  const O = D(A);
1476
1476
  _.has(O) || _.set(O, {
1477
1477
  points: [],
@@ -1483,9 +1483,9 @@ const wi = async (n, t, e, o, i) => {
1483
1483
  centerPts: []
1484
1484
  });
1485
1485
  const I = _.get(O);
1486
- let [B, R, N, C] = S[A];
1486
+ let [B, R, N, C] = v[A];
1487
1487
  const L = new y.Vector3().add(B).add(R).add(N).add(C).multiplyScalar(0.25);
1488
- if (I.points.push(...S[A]), I.area += B.distanceTo(R) * B.distanceTo(C), I.originalVertices.push(S[A]), I.index = P, I.centerPts.push(L), E == -1 || T == -1) {
1488
+ if (I.points.push(...v[A]), I.area += B.distanceTo(R) * B.distanceTo(C), I.originalVertices.push(v[A]), I.index = P, I.centerPts.push(L), E == -1 || T == -1) {
1489
1489
  let $ = new y.Vector3().subVectors(B, R).normalize();
1490
1490
  T = B.distanceTo(C), E = B.distanceTo(R);
1491
1491
  let X = oe($, new y.Vector3(0, 0, 1));
@@ -1522,12 +1522,12 @@ const wi = async (n, t, e, o, i) => {
1522
1522
  p.coordinatesByArea.coordinates.forEach((D) => {
1523
1523
  P.push(new y.Vector3(D.x, D.y, D.z));
1524
1524
  }), P[0].equals(P[P.length - 1]) && P.pop();
1525
- let z = P[0].distanceTo(P[1]), S = P[0].distanceTo(P[3]);
1526
- S > z && ([z, S] = [S, z], P = [P[0], P[3], P[2], P[1]]);
1527
- let v = ee(P[0], P[3], !0), V = ee(P[1], P[2], !0);
1525
+ let V = P[0].distanceTo(P[1]), v = P[0].distanceTo(P[3]);
1526
+ v > V && ([V, v] = [v, V], P = [P[0], P[3], P[2], P[1]]);
1527
+ let S = ee(P[0], P[3], !0), z = ee(P[1], P[2], !0);
1528
1528
  a.push({
1529
- doorStartPt: v,
1530
- doorEndPt: V,
1529
+ doorStartPt: S,
1530
+ doorEndPt: z,
1531
1531
  boxPoints: P,
1532
1532
  minZ: p.coordinatesByArea.heightData.minZ,
1533
1533
  maxZ: p.coordinatesByArea.heightData.maxZ,
@@ -1542,20 +1542,20 @@ const wi = async (n, t, e, o, i) => {
1542
1542
  const p = a[m];
1543
1543
  for (let P = 0; P < n.length; P++) {
1544
1544
  if (n[P].length < 0.5) continue;
1545
- let z = [];
1546
- const S = ee(n[P].start, n[P].end, !0);
1547
- z.push(S), z.push(ee(S, n[P].start, !0)), z.push(ee(S, n[P].end, !0));
1548
- let v = !1;
1549
- const V = p.boxPoints.length;
1550
- for (let D = 0; D < z.length; D++) {
1551
- const _ = z[D].x, E = z[D].y;
1552
- for (let T = 0, A = V - 1; T < V; A = T++) {
1545
+ let V = [];
1546
+ const v = ee(n[P].start, n[P].end, !0);
1547
+ V.push(v), V.push(ee(v, n[P].start, !0)), V.push(ee(v, n[P].end, !0));
1548
+ let S = !1;
1549
+ const z = p.boxPoints.length;
1550
+ for (let D = 0; D < V.length; D++) {
1551
+ const _ = V[D].x, E = V[D].y;
1552
+ for (let T = 0, A = z - 1; T < z; A = T++) {
1553
1553
  const O = p.boxPoints[T].x, I = p.boxPoints[T].y, B = p.boxPoints[A].x, R = p.boxPoints[A].y;
1554
- I > E != R > E && _ < (B - O) * (E - I) / (R - I) + O && (v = !v);
1554
+ I > E != R > E && _ < (B - O) * (E - I) / (R - I) + O && (S = !S);
1555
1555
  }
1556
- if (v) break;
1556
+ if (S) break;
1557
1557
  }
1558
- if (v) {
1558
+ if (S) {
1559
1559
  let D = new y.Vector3(n[P].start.x, n[P].start.y, 0), _ = new y.Vector3(n[P].end.x, n[P].end.y, 0), E = p.doorStartPt.distanceTo(p.doorEndPt), T = D.distanceTo(_), A = Jt(p.doorStartPt, p.doorEndPt, D, _);
1560
1560
  if (Math.abs(T - E) < 0.5 && A && A.angleDeg < 15) {
1561
1561
  p.doorStartPt = new y.Vector3(n[P].start.x, n[P].start.y, 0), p.doorEndPt = new y.Vector3(n[P].end.x, n[P].end.y, 0);
@@ -1587,10 +1587,10 @@ const wi = async (n, t, e, o, i) => {
1587
1587
  p.completePointAreaPercentage = -1;
1588
1588
  let P = new y.Box3();
1589
1589
  P.setFromPoints(p.originalPoints);
1590
- let z = P.max.z;
1590
+ let V = P.max.z;
1591
1591
  P.min.z;
1592
- const S = new y.Vector3(p.start.x, p.start.y, p.start.z), v = new y.Vector3(p.end.x, p.end.y, p.end.z);
1593
- let V = p.rooftopPz - p.start.z, D = 0;
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
+ let z = p.rooftopPz - p.start.z, D = 0;
1594
1594
  for (const E of p.mergeCheckRegion) {
1595
1595
  const { facePoints: T, boxArea: A, totalInPlaneNum: O } = co(
1596
1596
  E.points,
@@ -1633,7 +1633,7 @@ const wi = async (n, t, e, o, i) => {
1633
1633
  lineEd: new y.Vector3(),
1634
1634
  facePoints: []
1635
1635
  };
1636
- let H = ve(X[rt]);
1636
+ let H = Se(X[rt]);
1637
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
1639
  D += E.area;
@@ -1642,15 +1642,15 @@ const wi = async (n, t, e, o, i) => {
1642
1642
  for (let rt = 0; rt < K.length; rt++) {
1643
1643
  const F = K[rt];
1644
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)
1645
+ if (Mt < 1.5 || V < F.facePoints[2].z || qt > z / 3 * 2)
1646
1646
  continue;
1647
1647
  let Lt = !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
1649
  if (H > 0.17 && p.length > 0.5) {
1650
- let Wt = Rt(S, W), J = Rt(S, j), ct = Rt(v, W), q = Rt(v, j);
1651
- const bt = 0.1, Vt = 10;
1650
+ let Wt = Rt(v, W), J = Rt(v, j), ct = Rt(S, W), q = Rt(S, j);
1651
+ const bt = 0.1, zt = 10;
1652
1652
  if (Wt < bt || J < bt) {
1653
- const { newOriginalPoints: Ut } = ze(W, j, p.originalPoints), at = [];
1653
+ const { newOriginalPoints: Ut } = Ve(W, j, p.originalPoints), at = [];
1654
1654
  if (Ut.forEach((Q) => {
1655
1655
  Q.z >= tt.z ? at.push(Q) : Q.z <= W.z;
1656
1656
  }), at.length > 10) {
@@ -1659,9 +1659,9 @@ const wi = async (n, t, e, o, i) => {
1659
1659
  for (let U = 0; U < n.length; U++) {
1660
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
- let vt = re(Q, gt, it, dt);
1662
+ let St = re(Q, gt, it, dt);
1663
1663
  if (Ct != null) {
1664
- if (vt && vt.angle > 85) {
1664
+ if (St && St.angle > 85) {
1665
1665
  let At = Ct.point.distanceTo(Q);
1666
1666
  if (Ct.point.distanceTo(gt), At < 0.3) {
1667
1667
  ft = !0, ht = 1 / 0, Z = -1;
@@ -1670,19 +1670,19 @@ const wi = async (n, t, e, o, i) => {
1670
1670
  }
1671
1671
  continue;
1672
1672
  }
1673
- if (vt && vt.angle > 85) {
1673
+ if (St && St.angle > 85) {
1674
1674
  const Y = new y.Line3(it, dt).closestPointToPoint(Q, !0, Gt);
1675
1675
  let pt = Jt(Q, gt, Y, Q);
1676
1676
  if (!pt || pt.direction != "same") continue;
1677
- const et = Q.clone().addScaledVector(Pt, Vt), st = gt.clone().addScaledVector(Pt.clone().negate(), Vt);
1678
- let xt = new y.Vector3().subVectors(dt, it).normalize(), St = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1679
- const wt = te(et, st, St, Bt);
1677
+ const et = Q.clone().addScaledVector(Pt, zt), st = gt.clone().addScaledVector(Pt.clone().negate(), zt);
1678
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1679
+ const wt = te(et, st, vt, Bt);
1680
1680
  if (wt == null) continue;
1681
1681
  let Xt = Q.distanceTo(wt.point);
1682
1682
  Xt < ht && (ht = Xt, Z = U);
1683
- } else if (vt && vt.angle < 5) {
1683
+ } else if (St && St.angle < 5) {
1684
1684
  const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
1685
- let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(Y, dt), St = Jt(Q, gt, it, At), Bt = !1;
1685
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(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,7 +1691,7 @@ const wi = async (n, t, e, o, i) => {
1691
1691
  n[U].checkResults[wt].allCenterPoints[Kt].y,
1692
1692
  0
1693
1693
  ));
1694
- let $t = ve(Xt);
1694
+ let $t = Se(Xt);
1695
1695
  if ($t.length == 2) {
1696
1696
  let Kt = Rt(At, $t[0]), Re = Rt(At, $t[1]), Le = Rt(Y, $t[0]), Fe = Rt(Y, $t[1]);
1697
1697
  if (Kt < 0.2 || Re < 0.2 || Le < 0.2 || Fe < 0.2) {
@@ -1700,7 +1700,7 @@ const wi = async (n, t, e, o, i) => {
1700
1700
  }
1701
1701
  }
1702
1702
  }
1703
- if (St && St.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1703
+ if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1704
1704
  k = !0, ht = 1 / 0, Z = -1;
1705
1705
  break;
1706
1706
  }
@@ -1718,7 +1718,7 @@ const wi = async (n, t, e, o, i) => {
1718
1718
  continue;
1719
1719
  }
1720
1720
  if (ct < bt || q < bt) {
1721
- const { newOriginalPoints: Ut } = ze(W, j, p.originalPoints), at = [];
1721
+ const { newOriginalPoints: Ut } = Ve(W, j, p.originalPoints), at = [];
1722
1722
  if (Ut.forEach((Q) => {
1723
1723
  Q.z >= tt.z ? at.push(Q) : Q.z <= W.z;
1724
1724
  }), at.length > 10) {
@@ -1727,27 +1727,27 @@ const wi = async (n, t, e, o, i) => {
1727
1727
  for (let U = 0; U < n.length; U++) {
1728
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
- let vt = re(Q, gt, it, dt);
1730
+ let St = re(Q, gt, it, dt);
1731
1731
  if (Ct != null) {
1732
- if (vt && vt.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
1732
+ if (St && St.angle > 85 && (Ct.point.distanceTo(Q), Ct.point.distanceTo(gt) < 0.3)) {
1733
1733
  ft = !0, ht = 1 / 0, Z = -1;
1734
1734
  break;
1735
1735
  }
1736
1736
  continue;
1737
1737
  }
1738
- if (vt && vt.angle > 85) {
1738
+ if (St && St.angle > 85) {
1739
1739
  const Y = new y.Line3(it, dt).closestPointToPoint(gt, !0, Gt);
1740
1740
  let pt = Jt(gt, Q, Y, gt);
1741
1741
  if (!pt || pt.direction != "same") continue;
1742
- const et = Q.clone().addScaledVector(Pt.clone().negate(), Vt), st = gt.clone().addScaledVector(Pt, Vt);
1743
- let xt = new y.Vector3().subVectors(dt, it).normalize(), St = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1744
- const wt = te(et, st, St, Bt);
1742
+ const et = Q.clone().addScaledVector(Pt.clone().negate(), zt), st = gt.clone().addScaledVector(Pt, zt);
1743
+ let xt = new y.Vector3().subVectors(dt, it).normalize(), vt = it.clone().addScaledVector(xt.clone().negate(), 0.03), Bt = dt.clone().addScaledVector(xt, 0.03);
1744
+ const wt = te(et, st, vt, Bt);
1745
1745
  if (wt == null) continue;
1746
1746
  let Xt = gt.distanceTo(wt.point);
1747
1747
  Xt < ht && (ht = Xt, Z = U);
1748
- } else if (vt && vt.angle < 5) {
1748
+ } else if (St && St.angle < 5) {
1749
1749
  const At = new y.Vector3(W.x, W.y, 0), Y = new y.Vector3(j.x, j.y, 0);
1750
- let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(Y, dt), St = Jt(gt, Q, it, At), Bt = !1;
1750
+ let pt = Rt(At, it), et = Rt(At, dt), st = Rt(Y, it), xt = Rt(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,7 +1756,7 @@ const wi = async (n, t, e, o, i) => {
1756
1756
  n[U].checkResults[wt].allCenterPoints[Kt].y,
1757
1757
  0
1758
1758
  ));
1759
- let $t = ve(Xt);
1759
+ let $t = Se(Xt);
1760
1760
  if ($t.length == 2) {
1761
1761
  let Kt = Rt(At, $t[0]), Re = Rt(At, $t[1]), Le = Rt(Y, $t[0]), Fe = Rt(Y, $t[1]);
1762
1762
  if (Kt < 0.2 || Re < 0.2 || Le < 0.2 || Fe < 0.2) {
@@ -1765,7 +1765,7 @@ const wi = async (n, t, e, o, i) => {
1765
1765
  }
1766
1766
  }
1767
1767
  }
1768
- if (St && St.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1768
+ if (vt && vt.direction == "same" && !Bt && (pt < 0.1 || et < 0.1 || st < 0.1 || xt < 0.1)) {
1769
1769
  k = !0, ht = 1 / 0, Z = -1;
1770
1770
  break;
1771
1771
  }
@@ -1784,7 +1784,7 @@ const wi = async (n, t, e, o, i) => {
1784
1784
  }
1785
1785
  H = lt.distanceTo(tt);
1786
1786
  }
1787
- if (Zt < 85 && H > 0.3 || H > 0.7 && Mt > V - V / 3) {
1787
+ if (Zt < 85 && H > 0.3 || H > 0.7 && Mt > z - z / 3) {
1788
1788
  let Wt = !1;
1789
1789
  for (let J = 0; J < t.length; J++) {
1790
1790
  let ct = J + 1;
@@ -1803,29 +1803,29 @@ const wi = async (n, t, e, o, i) => {
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), 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;
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), zt = 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(), q.clone(), bt.clone(), Vt.clone(), {
1808
+ let at = ne(ct.clone(), q.clone(), bt.clone(), zt.clone(), {
1809
1809
  distanceThreshold: 2
1810
1810
  });
1811
1811
  if (at && at.type == "collinear_gap") {
1812
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
- let Z = bt.distanceTo(ct), k = Vt.distanceTo(ct);
1814
+ let Z = bt.distanceTo(ct), k = zt.distanceTo(ct);
1815
1815
  if (Z > 0.25 && k > 0.25) {
1816
- let it = bt.distanceTo(q), dt = Vt.distanceTo(q);
1816
+ let it = bt.distanceTo(q), dt = zt.distanceTo(q);
1817
1817
  if (it > 0.2 && dt > 0.2)
1818
1818
  continue;
1819
1819
  }
1820
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;
1821
+ let ft = new y.Vector3().subVectors(bt, zt).normalize(), U = ct.distanceTo(q) - at.overlap;
1822
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 = q.distanceTo(ct);
1825
+ let Q = bt.distanceTo(zt), 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(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;
1828
+ let Pt = bt.distanceTo(ct), Gt = bt.distanceTo(q), ht = zt.distanceTo(ct), Z = zt.distanceTo(q), k = Pt < Gt ? Pt : Gt, ft = ht < Z ? ht : Z, U = new y.Vector3().subVectors(bt, zt).normalize(), it = gt - at.overlap;
1829
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
1831
  _t = !0, Et = !0, Ft.push(a[J].index), a[J].isFind = !0, e[a[J].index].isFindBeam = !0, Tt = J;
@@ -1836,10 +1836,10 @@ const wi = async (n, t, e, o, i) => {
1836
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), 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);
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), zt = 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, zt).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 = zt.clone().addScaledVector(at.clone().negate(), Q), Z = te(gt, Pt, Gt, ht), k = !0, ft = ct.distanceTo(bt), U = ct.distanceTo(zt), it = q.distanceTo(bt), dt = q.distanceTo(zt);
1840
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 || Wt || Math.abs(Mt - V) > 0.1 && Mt > V / 2 && H > 0.3) && (Lt = !0);
1842
+ (_t || Wt || Math.abs(Mt - z) > 0.1 && Mt > z / 2 && H > 0.3) && (Lt = !0);
1843
1843
  }
1844
1844
  }
1845
1845
  if (Lt) {
@@ -1862,19 +1862,19 @@ const wi = async (n, t, e, o, i) => {
1862
1862
  {
1863
1863
  new y.PointsMaterial({ color: 65535, size: 0.01 });
1864
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
- const Ct = [], vt = [];
1865
+ const Ct = [], St = [];
1866
1866
  let At = new y.Line3(tt, lt), Y = new y.Vector3(), pt = 999999;
1867
1867
  if (p.originalPoints.forEach((et) => {
1868
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), St = new y.Vector3().subVectors(st, lt), Bt = oe(Z, St), wt = oe(k, xt);
1870
- Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && vt.push(et);
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
+ 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(W, j, Ct);
1873
+ const { newProjectPoints: et } = Ve(W, j, Ct);
1874
1874
  for (const st of et)
1875
1875
  st.z = W.z;
1876
1876
  et.forEach((st) => {
1877
- let xt = new y.Vector3(st.x, st.y, W.z), St = new y.Vector3().subVectors(xt, j), Bt = new y.Vector3().subVectors(xt, W), wt = oe(Z, Bt), Xt = oe(k, St);
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
1879
  let $t = xt.distanceTo(W);
1880
1880
  $t < ft && (ft = $t, it = xt);
@@ -1884,11 +1884,11 @@ const wi = async (n, t, e, o, i) => {
1884
1884
  }
1885
1885
  });
1886
1886
  }
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)), vt.length > 10) {
1888
- const { newOnLinePoints: et } = ze(lt, tt, vt);
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
+ const { newOnLinePoints: et } = Ve(lt, tt, St);
1889
1889
  for (let st = 0; st < et.length; st++) {
1890
- let St = At.closestPointToPoint(et[st], !0, Y).distanceTo(et[st]);
1891
- St > 0.02 && pt > St && (pt = St);
1890
+ let vt = At.closestPointToPoint(et[st], !0, Y).distanceTo(et[st]);
1891
+ vt > 0.02 && pt > vt && (pt = vt);
1892
1892
  }
1893
1893
  tt.z += pt, lt.z += pt, Mt += pt;
1894
1894
  }
@@ -1913,7 +1913,7 @@ const wi = async (n, t, e, o, i) => {
1913
1913
  isPullOutDoor: Et,
1914
1914
  pcbDoorIndexs: Ft,
1915
1915
  beamNearWallVec: new y.Vector3(0, 0, 0)
1916
- }, bt = !1, Vt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
1916
+ }, bt = !1, zt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
1917
1917
  for (let Z = 0; Z < u.length; Z++) {
1918
1918
  const k = n[u[Z].linesIndex].doorAndBeamData[u[Z].doorIndex];
1919
1919
  if (k.nearId != -1)
@@ -1929,13 +1929,13 @@ const wi = 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 vt = new y.Vector3(), At = dt.closestPointToPoint(Ct, !0, vt), 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), St = !_t && !k.isDoor && (U > it * 2 || it > U * 2);
1933
- if (Y < 0.4 && xt != null && !St) {
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
1934
  k.nearId = l, q.nearId = k.id;
1935
1935
  let Bt = 0.8;
1936
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, 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;
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, zt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = u[Z].linesIndex, gt = u[Z].doorIndex;
1939
1939
  break;
1940
1940
  }
1941
1941
  }
@@ -1949,28 +1949,28 @@ const wi = async (n, t, e, o, i) => {
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(W.x, W.y, ft.z), St = st.closestPointToPoint(xt, !0, new y.Vector3()), Bt = re(St, xt, W, j);
1953
- Bt && Bt.angle > 85 && (q.beamNearWallVec = new y.Vector3().subVectors(St, xt).normalize());
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
- const vt = [];
1955
+ const St = [];
1956
1956
  n[k].originalPoints.forEach((st) => {
1957
- st.z > W.z + 0.2 && st.z < W.z + Mt / 2 && vt.push(new y.Vector3(st.x, st.y, W.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
1960
  let Y = [], pt = [];
1961
- for (let st = 0; st < vt.length; st++) {
1962
- let xt = Z.closestPointToPoint(vt[st], !0, At);
1963
- xt.distanceTo(vt[st]) < 0.15 && (Y.push(vt[st]), pt.push(xt.clone()));
1961
+ for (let st = 0; st < St.length; st++) {
1962
+ let xt = Z.closestPointToPoint(St[st], !0, At);
1963
+ xt.distanceTo(St[st]) < 0.15 && (Y.push(St[st]), pt.push(xt.clone()));
1964
1964
  }
1965
1965
  for (let st = 0; st < pt.length; st++)
1966
1966
  mo(Z, pt[st]) && Y.push(pt[st]);
1967
1967
  if (Y = pt, Y = po(Y), Y.length < 150) continue;
1968
- let et = ve(Y);
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), St = new y.Vector3(W.x, W.y, ft.z), Bt = xt.closestPointToPoint(St, !0, new y.Vector3());
1973
- if (q.beamNearWallVec = new y.Vector3().subVectors(Bt, St).normalize(), q.beamStart.z > Ct.maxZ - 0.03 && H > 1)
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
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];
@@ -1991,7 +1991,7 @@ const wi = async (n, t, e, o, i) => {
1991
1991
  }
1992
1992
  let Gt = !1;
1993
1993
  if (at != -1)
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++)
1994
+ for (let Z = 0; Z < c.length && !(c[Z].length == 1 && (c[Z][0].id == l ? (c[Z].push({ id: at, beamStart: zt, 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
1997
  const ht = q.doorStart.distanceTo(q.doorEnd);
@@ -2021,27 +2021,27 @@ const wi = async (n, t, e, o, i) => {
2021
2021
  for (let m = 0; m < h.length; m++) {
2022
2022
  let p = [];
2023
2023
  for (let P = 0; P < n[h[m]].doorAndBeamData.length; P++) {
2024
- let z = !1;
2025
- if (n[h[m]].doorAndBeamData[P].type === "beam" && n[h[m]].doorAndBeamData[P].beamNearWallVec.x == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.y == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.z == 0 && n[h[m]].doorAndBeamData[P].nearId == -1 && (z = !0), !z) {
2026
- let S = n[h[m]].doorAndBeamData[P].doorStart.clone(), v = n[h[m]].doorAndBeamData[P].doorEnd.clone();
2027
- S.z = v.z = 0;
2028
- let V = S.distanceTo(v);
2024
+ let V = !1;
2025
+ if (n[h[m]].doorAndBeamData[P].type === "beam" && n[h[m]].doorAndBeamData[P].beamNearWallVec.x == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.y == 0 && n[h[m]].doorAndBeamData[P].beamNearWallVec.z == 0 && n[h[m]].doorAndBeamData[P].nearId == -1 && (V = !0), !V) {
2026
+ let v = n[h[m]].doorAndBeamData[P].doorStart.clone(), S = n[h[m]].doorAndBeamData[P].doorEnd.clone();
2027
+ v.z = S.z = 0;
2028
+ let z = v.distanceTo(S);
2029
2029
  for (let D = 0; D < h.length; D++)
2030
2030
  if (m != D)
2031
2031
  for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
2032
2032
  let E = n[h[D]].doorAndBeamData[_].doorStart.clone(), T = n[h[D]].doorAndBeamData[_].doorEnd.clone();
2033
2033
  E.z = T.z = 0, E.distanceTo(T);
2034
- let A = ne(S, v, E, 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(E, T), I = ee(S, v), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
2037
- if (Math.abs(V - A.overlap) < 0.1 && R < 0.04) {
2038
- n[h[D]].doorAndBeamData[_].nearId == n[h[m]].doorAndBeamData[P].id && (n[h[D]].doorAndBeamData[_].nearId = -1), z = !0;
2036
+ let O = new y.Line3(E, T), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
2037
+ if (Math.abs(z - A.overlap) < 0.1 && R < 0.04) {
2038
+ n[h[D]].doorAndBeamData[_].nearId == n[h[m]].doorAndBeamData[P].id && (n[h[D]].doorAndBeamData[_].nearId = -1), V = !0;
2039
2039
  break;
2040
2040
  }
2041
2041
  }
2042
2042
  }
2043
2043
  }
2044
- z || p.push(n[h[m]].doorAndBeamData[P]);
2044
+ V || p.push(n[h[m]].doorAndBeamData[P]);
2045
2045
  }
2046
2046
  p.length != n[h[m]].doorAndBeamData.length && (n[h[m]].doorAndBeamData = p);
2047
2047
  }
@@ -2049,26 +2049,26 @@ const wi = async (n, t, e, o, i) => {
2049
2049
  for (let m = 0; m < a.length; m++) {
2050
2050
  if (a[m].isFind || a[m].inWall)
2051
2051
  continue;
2052
- let p = new y.Vector3(a[m].doorStartPt.x, a[m].doorStartPt.y, 0), P = new y.Vector3(a[m].doorEndPt.x, a[m].doorEndPt.y, 0), z = new y.Vector3().subVectors(p, P).normalize();
2053
- for (let S = 0; S < n.length; S++) {
2054
- if (n[S].length < 0.7 || n[S].completePointAreaPercentage > 60)
2052
+ let p = new y.Vector3(a[m].doorStartPt.x, a[m].doorStartPt.y, 0), P = new y.Vector3(a[m].doorEndPt.x, a[m].doorEndPt.y, 0), V = new y.Vector3().subVectors(p, P).normalize();
2053
+ for (let v = 0; v < n.length; v++) {
2054
+ if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
2055
2055
  continue;
2056
- let v = new y.Vector3(n[S].start.x, n[S].start.y, 0), V = new y.Vector3(n[S].end.x, n[S].end.y, 0), D = new y.Vector3().subVectors(v, V).normalize(), _ = 0.3, E = p.clone().addScaledVector(z, _), T = P.clone().addScaledVector(z.clone().negate(), _), A = v.clone().addScaledVector(D, _), O = V.clone().addScaledVector(D.clone().negate(), _);
2056
+ let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3, E = p.clone().addScaledVector(V, _), T = P.clone().addScaledVector(V.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = z.clone().addScaledVector(D.clone().negate(), _);
2057
2057
  te(E, T, A, O);
2058
2058
  let I = Jt(
2059
2059
  E,
2060
2060
  T,
2061
2061
  A,
2062
2062
  O
2063
- ), B = p.distanceTo(v) > P.distanceTo(v) ? P : p, R = B.distanceTo(v), N = B.distanceTo(V);
2063
+ ), B = p.distanceTo(S) > P.distanceTo(S) ? P : p, R = B.distanceTo(S), N = B.distanceTo(z);
2064
2064
  if ((R < f || N < f) && I && !I.isParallel) {
2065
- let L = p.distanceTo(v), $ = p.distanceTo(V), X = L < $ ? v : V, ot = !1;
2065
+ let L = p.distanceTo(S), $ = p.distanceTo(z), X = L < $ ? S : z, ot = !1;
2066
2066
  for (let K = 0; K < n.length; K++) {
2067
- if (K == S || b.includes(K) || n[K].length < 0.7)
2067
+ if (K == v || b.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(), H = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(v, V, G, ut), qt = ne(v, V, G, ut), Lt = te(v, V, H, Mt), _t = !0;
2070
- if (Lt != null && (_t = Lt.point.distanceTo(v) < f || Lt.point.distanceTo(V) < f), (Zt && Zt.angle > 85 || qt && qt.type == "collinear_gap") && _t) {
2071
- let Et = new y.Line3(v, 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;
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, z, G, ut), qt = ne(S, z, G, ut), Lt = te(S, z, H, Mt), _t = !0;
2070
+ if (Lt != null && (_t = Lt.point.distanceTo(S) < f || Lt.point.distanceTo(z) < f), (Zt && Zt.angle > 85 || qt && qt.type == "collinear_gap") && _t) {
2071
+ let Et = new y.Line3(S, z), 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
2072
  if (W > j && j > w)
2073
2073
  Nt = ut, Tt = lt;
2074
2074
  else if (W < j && W > w)
@@ -2108,7 +2108,7 @@ const wi = async (n, t, e, o, i) => {
2108
2108
  start: Nt,
2109
2109
  end: Tt
2110
2110
  }), b.push(K);
2111
- let bt = n[K].rooftopPz - n[K].start.z, Vt = n[S].rooftopPz - n[S].start.z, Ut = bt < Vt ? bt : Vt;
2111
+ let bt = n[K].rooftopPz - n[K].start.z, zt = n[v].rooftopPz - n[v].start.z, Ut = bt < zt ? bt : zt;
2112
2112
  n[K].doorAndBeamData || (n[K].doorAndBeamData = []), n[K].doorAndBeamData.push({
2113
2113
  id: l,
2114
2114
  beamStart: Nt,
@@ -2154,12 +2154,12 @@ const wi = async (n, t, e, o, i) => {
2154
2154
  let m = n[g].length;
2155
2155
  if (g == l || m < i || m > r)
2156
2156
  continue;
2157
- let p = new y.Vector3(n[g].start.x, n[g].start.y, n[g].start.z), P = new y.Vector3(n[g].end.x, n[g].end.y, n[g].end.z), z = re(d, c, p, P);
2158
- if (!z || z.angle < 85)
2157
+ let p = new y.Vector3(n[g].start.x, n[g].start.y, n[g].start.z), P = new y.Vector3(n[g].end.x, n[g].end.y, n[g].end.z), V = re(d, c, p, P);
2158
+ if (!V || V.angle < 85)
2159
2159
  continue;
2160
- let S = kt(p, d), v = kt(p, c), V = kt(P, d), D = kt(P, c);
2161
- if (!(!S && !v && !V && !D)) {
2162
- S || v ? (x = p.clone(), b = P.clone()) : (x = P.clone(), b = p.clone()), M = new y.Vector3().subVectors(b, x).normalize(), M.clone().negate();
2160
+ let v = kt(p, d), S = kt(p, c), z = kt(P, d), D = kt(P, c);
2161
+ if (!(!v && !S && !z && !D)) {
2162
+ v || S ? (x = p.clone(), b = P.clone()) : (x = P.clone(), b = p.clone()), M = new y.Vector3().subVectors(b, x).normalize(), M.clone().negate();
2163
2163
  for (let _ = 0; _ < n.length; _++) {
2164
2164
  let E = n[_].length;
2165
2165
  if (_ == l || _ == g || E < i || E > r)
@@ -2218,8 +2218,8 @@ const wi = async (n, t, e, o, i) => {
2218
2218
  for (let M = 0; M < n.length; M++) {
2219
2219
  if (M == l || n[M].length < i)
2220
2220
  continue;
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), P = kt(m, d), z = kt(g, c), S = kt(m, c);
2222
- if (p || P ? f = !1 : (z || S) && (w = !1), !f && !w) break;
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), P = kt(m, d), V = kt(g, c), v = kt(m, c);
2222
+ if (p || P ? f = !1 : (V || v) && (w = !1), !f && !w) break;
2223
2223
  }
2224
2224
  if (!f && !w) continue;
2225
2225
  let x = new y.Vector3();
@@ -2232,19 +2232,19 @@ const wi = async (n, t, e, o, i) => {
2232
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), P = re(d, c, m, p);
2233
2233
  if (!P || P.angle < 85)
2234
2234
  continue;
2235
- let z = kt(m, c), S = kt(p, c);
2236
- if (!z && !S) continue;
2235
+ let V = kt(m, c), v = kt(p, c);
2236
+ if (!V && !v) continue;
2237
2237
  new y.Vector3();
2238
- let v = new y.Vector3();
2239
- z ? (m.clone(), v = p.clone()) : (p.clone(), v = m.clone());
2240
- for (let V = 0; V < n.length; V++) {
2241
- let D = n[V].length;
2242
- if (V == l || V == M || o.has(V) || D < i || D > r)
2238
+ let S = new y.Vector3();
2239
+ V ? (m.clone(), S = p.clone()) : (p.clone(), S = m.clone());
2240
+ for (let z = 0; z < n.length; z++) {
2241
+ let D = n[z].length;
2242
+ if (z == l || z == M || o.has(z) || D < i || D > r)
2243
2243
  continue;
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);
2244
+ let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z), E = new y.Vector3(n[z].end.x, n[z].end.y, n[z].end.z), T = re(m, p, _, E);
2245
2245
  if (!T || T.angle < 85)
2246
2246
  continue;
2247
- let A = kt(_, v), O = kt(E, v);
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
2250
  A ? (I = _.clone(), B = E.clone()) : (I = E.clone(), B = _.clone());
@@ -2252,14 +2252,14 @@ const wi = async (n, t, e, o, i) => {
2252
2252
  if (!N || !N.parallel || !N.sameDirection) continue;
2253
2253
  let C = !0, L = !0;
2254
2254
  for (let X = 0; X < n.length; X++) {
2255
- if (X == V || n[X].length < i) continue;
2255
+ if (X == z || n[X].length < i) continue;
2256
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
2257
  if (G || ut ? C = !1 : (rt || F) && (L = !1), !C && !L) break;
2258
2258
  }
2259
2259
  if (!C && !L) continue;
2260
2260
  let $ = u * g;
2261
2261
  if (!($ < s || $ > a)) {
2262
- h.uuids = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end = d;
2262
+ h.uuids = [n[l].uuid, n[M].uuid, n[z].uuid], h.missingEdge.start = B, h.missingEdge.end = d;
2263
2263
  break;
2264
2264
  }
2265
2265
  }
@@ -2287,25 +2287,25 @@ function _o(n, t) {
2287
2287
  for (let o = 1; o < n; o++) e += t[o];
2288
2288
  return e;
2289
2289
  }
2290
- function Ve(n) {
2290
+ function ze(n) {
2291
2291
  return new Float64Array(n);
2292
2292
  }
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);
2293
+ const Eo = (3 + 16 * ae) * ae, To = (2 + 12 * ae) * ae, Ao = (9 + 64 * ae) * ae * ae, me = ze(4), on = ze(8), rn = ze(12), sn = ze(16), jt = ze(4);
2294
2294
  function Bo(n, t, e, o, i, r, s) {
2295
- let a, l, u, h, d, c, f, w, x, b, M, g, m, p, P, z, S, v;
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), b = E - x, P = w * b - (p - f * x - w * x - f * b), z = _ * D, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * D, x = c - (c - D), b = D - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, me[0] = P - (M + d) + (d - S), 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), v = g + M, d = v - g, me[2] = g - (v - d) + (M - d), me[3] = v;
2295
+ let a, l, u, h, d, c, f, w, x, b, M, g, m, p, P, V, v, S;
2296
+ const z = n - i, D = e - i, _ = t - r, E = o - r;
2297
+ p = z * E, c = Yt * z, f = c - (c - z), w = z - f, c = Yt * E, x = c - (c - E), b = E - x, P = w * b - (p - f * x - w * x - f * b), V = _ * D, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * D, x = c - (c - D), b = D - x, v = w * b - (V - f * x - w * x - f * b), M = P - v, d = P - M, me[0] = P - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - V, d = m - M, me[1] = m - (M + d) + (d - V), S = g + M, d = S - g, me[2] = g - (S - d) + (M - d), me[3] = S;
2298
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), b = E - x, P = w * b - (p - f * x - w * x - f * b), z = l * D, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * D, x = c - (c - D), b = D - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), 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), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2299
+ if (T >= A || -T >= A || (d = n - z, a = n - (z + 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 += z * 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), b = E - x, P = w * b - (p - f * x - w * x - f * b), V = l * D, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * D, x = c - (c - D), b = D - x, v = w * b - (V - f * x - w * x - f * b), M = P - v, d = P - M, jt[0] = P - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - V, d = m - M, jt[1] = m - (M + d) + (d - V), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2301
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), b = h - x, P = w * b - (p - f * x - w * x - f * b), z = _ * u, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * u, x = c - (c - u), b = u - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), 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), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2302
+ p = z * h, c = Yt * z, f = c - (c - z), w = z - f, c = Yt * h, x = c - (c - h), b = h - x, P = w * b - (p - f * x - w * x - f * b), V = _ * u, c = Yt * _, f = c - (c - _), w = _ - f, c = Yt * u, x = c - (c - u), b = u - x, v = w * b - (V - f * x - w * x - f * b), M = P - v, d = P - M, jt[0] = P - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - V, d = m - M, jt[1] = m - (M + d) + (d - V), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2303
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), b = h - x, P = w * b - (p - f * x - w * x - f * b), z = l * u, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * u, x = c - (c - u), b = u - x, S = w * b - (z - f * x - w * x - f * b), M = P - S, d = P - M, jt[0] = P - (M + d) + (d - S), 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), v = g + M, d = v - g, jt[2] = g - (v - d) + (M - d), jt[3] = v;
2304
+ p = a * h, c = Yt * a, f = c - (c - a), w = a - f, c = Yt * h, x = c - (c - h), b = h - x, P = w * b - (p - f * x - w * x - f * b), V = l * u, c = Yt * l, f = c - (c - l), w = l - f, c = Yt * u, x = c - (c - u), b = u - x, v = w * b - (V - f * x - w * x - f * b), M = P - v, d = P - M, jt[0] = P - (M + d) + (d - v), g = p + M, d = g - p, m = p - (g - d) + (M - d), M = m - V, d = m - M, jt[1] = m - (M + d) + (d - V), S = g + M, d = S - g, jt[2] = g - (S - d) + (M - d), jt[3] = S;
2305
2305
  const B = qe(I, rn, 4, jt, sn);
2306
2306
  return sn[B - 1];
2307
2307
  }
2308
- function Se(n, t, e, o, i, r) {
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
2310
  return Math.abs(l) >= Eo * u ? l : -Bo(n, t, e, o, i, r, u);
2311
2311
  }
@@ -2349,80 +2349,80 @@ class Be {
2349
2349
  update() {
2350
2350
  const { coords: t, _hullPrev: e, _hullNext: o, _hullTri: i, _hullHash: r } = this, s = t.length >> 1;
2351
2351
  let a = 1 / 0, l = 1 / 0, u = -1 / 0, h = -1 / 0;
2352
- for (let V = 0; V < s; V++) {
2353
- const D = t[2 * V], _ = t[2 * V + 1];
2354
- D < a && (a = D), _ < l && (l = _), D > u && (u = D), _ > h && (h = _), this._ids[V] = V;
2352
+ for (let z = 0; z < s; z++) {
2353
+ const D = t[2 * z], _ = t[2 * z + 1];
2354
+ D < a && (a = D), _ < l && (l = _), D > u && (u = D), _ > h && (h = _), this._ids[z] = z;
2355
2355
  }
2356
2356
  const d = (a + u) / 2, c = (l + h) / 2;
2357
2357
  let f = 0, w = 0, x = 0;
2358
- for (let V = 0, D = 1 / 0; V < s; V++) {
2359
- const _ = We(d, c, t[2 * V], t[2 * V + 1]);
2360
- _ < D && (f = V, D = _);
2358
+ for (let z = 0, D = 1 / 0; z < s; z++) {
2359
+ const _ = We(d, c, t[2 * z], t[2 * z + 1]);
2360
+ _ < D && (f = z, D = _);
2361
2361
  }
2362
2362
  const b = t[2 * f], M = t[2 * f + 1];
2363
- for (let V = 0, D = 1 / 0; V < s; V++) {
2364
- if (V === f) continue;
2365
- const _ = We(b, M, t[2 * V], t[2 * V + 1]);
2366
- _ < D && _ > 0 && (w = V, D = _);
2363
+ for (let z = 0, D = 1 / 0; z < s; z++) {
2364
+ if (z === f) continue;
2365
+ const _ = We(b, M, t[2 * z], t[2 * z + 1]);
2366
+ _ < D && _ > 0 && (w = z, D = _);
2367
2367
  }
2368
2368
  let g = t[2 * w], m = t[2 * w + 1], p = 1 / 0;
2369
- for (let V = 0; V < s; V++) {
2370
- if (V === f || V === w) continue;
2371
- const D = Co(b, M, g, m, t[2 * V], t[2 * V + 1]);
2372
- D < p && (x = V, p = D);
2369
+ for (let z = 0; z < s; z++) {
2370
+ if (z === f || z === w) continue;
2371
+ const D = Co(b, M, g, m, t[2 * z], t[2 * z + 1]);
2372
+ D < p && (x = z, p = D);
2373
2373
  }
2374
- let P = t[2 * x], z = t[2 * x + 1];
2374
+ let P = t[2 * x], V = t[2 * x + 1];
2375
2375
  if (p === 1 / 0) {
2376
2376
  for (let _ = 0; _ < s; _++)
2377
2377
  this._dists[_] = t[2 * _] - t[0] || t[2 * _ + 1] - t[1];
2378
2378
  ye(this._ids, this._dists, 0, s - 1);
2379
- const V = new Uint32Array(s);
2379
+ const z = new Uint32Array(s);
2380
2380
  let D = 0;
2381
2381
  for (let _ = 0, E = -1 / 0; _ < s; _++) {
2382
2382
  const T = this._ids[_], A = this._dists[T];
2383
- A > E && (V[D++] = T, E = A);
2383
+ A > E && (z[D++] = T, E = A);
2384
2384
  }
2385
- this.hull = V.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2385
+ this.hull = z.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2386
2386
  return;
2387
2387
  }
2388
- if (Se(b, M, g, m, P, z) < 0) {
2389
- const V = w, D = g, _ = m;
2390
- w = x, g = P, m = z, x = V, P = D, z = _;
2388
+ if (ve(b, M, g, m, P, V) < 0) {
2389
+ const z = w, D = g, _ = m;
2390
+ w = x, g = P, m = V, x = z, P = D, V = _;
2391
2391
  }
2392
- const S = Ro(b, M, g, m, P, z);
2393
- this._cx = S.x, this._cy = S.y;
2394
- for (let V = 0; V < s; V++)
2395
- this._dists[V] = We(t[2 * V], t[2 * V + 1], S.x, S.y);
2392
+ const v = Ro(b, M, g, m, P, V);
2393
+ this._cx = v.x, this._cy = v.y;
2394
+ for (let z = 0; z < s; z++)
2395
+ this._dists[z] = We(t[2 * z], t[2 * z + 1], v.x, v.y);
2396
2396
  ye(this._ids, this._dists, 0, s - 1), this._hullStart = f;
2397
- let v = 3;
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(b, M)] = f, r[this._hashKey(g, m)] = w, r[this._hashKey(P, z)] = x, this.trianglesLen = 0, this._addTriangle(f, w, x, -1, -1, -1);
2399
- for (let V = 0, D = 0, _ = 0; V < this._ids.length; V++) {
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;
2397
+ let S = 3;
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(b, M)] = f, r[this._hashKey(g, m)] = w, r[this._hashKey(P, V)] = x, this.trianglesLen = 0, this._addTriangle(f, w, x, -1, -1, -1);
2399
+ for (let z = 0, D = 0, _ = 0; z < this._ids.length; z++) {
2400
+ const E = this._ids[z], T = t[2 * E], A = t[2 * E + 1];
2401
+ if (z > 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
2403
  for (let C = 0, L = this._hashKey(T, A); C < this._hashSize && (O = r[(L + 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], Se(T, A, t[2 * I], t[2 * I + 1], t[2 * B], t[2 * B + 1]) >= 0; )
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
2413
  let R = this._addTriangle(I, E, o[I], -1, -1, i[I]);
2414
- i[E] = this._legalize(R + 2), i[I] = R, v++;
2414
+ i[E] = this._legalize(R + 2), i[I] = R, S++;
2415
2415
  let N = o[I];
2416
- for (; B = o[N], Se(T, A, t[2 * N], t[2 * N + 1], t[2 * B], t[2 * B + 1]) < 0; )
2417
- R = this._addTriangle(N, E, B, i[E], -1, i[N]), i[E] = this._legalize(R + 2), o[N] = N, v--, N = B;
2416
+ for (; B = o[N], ve(T, A, t[2 * N], t[2 * N + 1], t[2 * B], t[2 * B + 1]) < 0; )
2417
+ R = this._addTriangle(N, E, B, i[E], -1, i[N]), i[E] = this._legalize(R + 2), o[N] = N, S--, N = B;
2418
2418
  if (I === O)
2419
- for (; B = e[I], Se(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2420
- R = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(R + 2), i[B] = R, o[I] = I, v--, I = B;
2419
+ for (; B = e[I], ve(T, A, t[2 * B], t[2 * B + 1], t[2 * I], t[2 * I + 1]) < 0; )
2420
+ R = this._addTriangle(B, E, I, -1, i[I], i[B]), this._legalize(R + 2), i[B] = R, o[I] = I, S--, I = B;
2421
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
- this.hull = new Uint32Array(v);
2424
- for (let V = 0, D = this._hullStart; V < v; V++)
2425
- this.hull[V] = D, D = o[D];
2423
+ this.hull = new Uint32Array(S);
2424
+ for (let z = 0, D = this._hullStart; z < S; z++)
2425
+ this.hull[z] = D, D = o[D];
2426
2426
  this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
2427
2427
  }
2428
2428
  /**
@@ -2623,18 +2623,18 @@ class Oo {
2623
2623
  let r, s;
2624
2624
  const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
2625
2625
  for (let x = 0, b = 0, M = o.length, g, m; x < M; x += 3, b += 2) {
2626
- const p = o[x] * 2, P = o[x + 1] * 2, z = o[x + 2] * 2, S = t[p], v = t[p + 1], V = t[P], D = t[P + 1], _ = t[z], E = t[z + 1], T = V - S, A = D - v, O = _ - S, I = E - v, B = (T * I - A * O) * 2;
2626
+ const p = o[x] * 2, P = o[x + 1] * 2, V = o[x + 2] * 2, v = t[p], S = t[p + 1], z = t[P], D = t[P + 1], _ = t[V], E = t[V + 1], T = z - 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
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 R = 1e9 * Math.sign((r - S) * I - (s - v) * O);
2634
- g = (S + _) / 2 - R * I, m = (v + E) / 2 + R * O;
2633
+ const R = 1e9 * Math.sign((r - v) * I - (s - S) * O);
2634
+ g = (v + _) / 2 - R * I, m = (S + E) / 2 + R * O;
2635
2635
  } else {
2636
2636
  const R = 1 / B, N = T * T + A * A, C = O * O + I * I;
2637
- g = S + (I * N - A * C) * R, m = v + (T * C - O * N) * R;
2637
+ g = v + (I * N - A * C) * R, m = S + (T * C - O * N) * R;
2638
2638
  }
2639
2639
  a[b] = g, a[b + 1] = m;
2640
2640
  }
@@ -3009,8 +3009,8 @@ function cn(n) {
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], b = i[w + 1], M = i[w + 2], [g, m] = e[x], [p, P] = e[b], [z, S] = e[M], v = jo(g, m, p, P, z, S), V = Go(e, x, b, M);
3013
- if (v <= 1 / V)
3012
+ const x = i[w], b = i[w + 1], M = i[w + 2], [g, m] = e[x], [p, P] = e[b], [V, v] = e[M], S = jo(g, m, p, P, V, v), z = Go(e, x, b, M);
3013
+ if (S <= 1 / z)
3014
3014
  for (const [D, _] of [[x, b], [b, M], [M, x]]) {
3015
3015
  const E = s(D, _);
3016
3016
  r.set(E, (r.get(E) || 0) + 1);
@@ -3036,18 +3036,18 @@ function cn(n) {
3036
3036
  const mt = {
3037
3037
  c: null,
3038
3038
  // center
3039
- u: [new zt(), new zt(), new zt()],
3039
+ u: [new Vt(), new Vt(), new Vt()],
3040
3040
  // basis vectors
3041
3041
  e: []
3042
3042
  // half width
3043
3043
  }, yt = {
3044
3044
  c: null,
3045
3045
  // center
3046
- u: [new zt(), new zt(), new zt()],
3046
+ u: [new Vt(), new Vt(), new Vt()],
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 En(), fn = new oo(), _e = new Tn(), dn = new Tn(), mn = new ro();
3050
+ }, It = [[], [], []], nt = [[], [], []], Dt = [], ce = new Vt(), ue = new Vt(), he = new Vt(), Ot = new Vt(), un = new Vt(), hn = new Vt(), 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 En()) {
3059
+ constructor(t = new Vt(), e = new Vt(), o = new En()) {
3060
3060
  this.center = t, this.halfSize = e, this.rotation = o;
3061
3061
  }
3062
3062
  /**
@@ -3555,21 +3555,21 @@ var Ze = { exports: {} }, On = { exports: {} };
3555
3555
  (function(e, o) {
3556
3556
  n.exports = o();
3557
3557
  })(Fn, function() {
3558
- function e(g, m, p, P, z) {
3559
- (function S(v, V, D, _, E) {
3558
+ function e(g, m, p, P, V) {
3559
+ (function v(S, z, D, _, E) {
3560
3560
  for (; _ > D; ) {
3561
3561
  if (_ - D > 600) {
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), R = Math.max(D, Math.floor(V - A * I / T + B)), N = Math.min(_, Math.floor(V + (T - A) * I / T + B));
3563
- S(v, V, R, N, E);
3562
+ var T = _ - D + 1, A = z - 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), R = Math.max(D, Math.floor(z - A * I / T + B)), N = Math.min(_, Math.floor(z + (T - A) * I / T + B));
3563
+ v(S, z, R, N, E);
3564
3564
  }
3565
- var C = v[V], L = D, $ = _;
3566
- for (o(v, D, V), E(v[_], C) > 0 && o(v, D, _); L < $; ) {
3567
- for (o(v, L, $), L++, $--; E(v[L], C) < 0; ) L++;
3568
- for (; E(v[$], C) > 0; ) $--;
3565
+ var C = S[z], L = D, $ = _;
3566
+ for (o(S, D, z), E(S[_], C) > 0 && o(S, D, _); L < $; ) {
3567
+ for (o(S, L, $), L++, $--; E(S[L], C) < 0; ) L++;
3568
+ for (; E(S[$], C) > 0; ) $--;
3569
3569
  }
3570
- E(v[D], C) === 0 ? o(v, D, $) : o(v, ++$, _), $ <= V && (D = $ + 1), V <= $ && (_ = $ - 1);
3570
+ E(S[D], C) === 0 ? o(S, D, $) : o(S, ++$, _), $ <= z && (D = $ + 1), z <= $ && (_ = $ - 1);
3571
3571
  }
3572
- })(g, m, p || 0, P || g.length - 1, z || i);
3572
+ })(g, m, p || 0, P || g.length - 1, V || i);
3573
3573
  }
3574
3574
  function o(g, m, p) {
3575
3575
  var P = g[m];
@@ -3589,13 +3589,13 @@ var Ze = { exports: {} }, On = { exports: {} };
3589
3589
  function a(g, m) {
3590
3590
  l(g, 0, g.children.length, m, g);
3591
3591
  }
3592
- function l(g, m, p, P, z) {
3593
- z || (z = b(null)), z.minX = 1 / 0, z.minY = 1 / 0, z.maxX = -1 / 0, z.maxY = -1 / 0;
3594
- for (var S = m; S < p; S++) {
3595
- var v = g.children[S];
3596
- u(z, g.leaf ? P(v) : v);
3592
+ function l(g, m, p, P, V) {
3593
+ V || (V = b(null)), V.minX = 1 / 0, V.minY = 1 / 0, V.maxX = -1 / 0, V.maxY = -1 / 0;
3594
+ for (var v = m; v < p; v++) {
3595
+ var S = g.children[v];
3596
+ u(V, g.leaf ? P(S) : S);
3597
3597
  }
3598
- return z;
3598
+ return V;
3599
3599
  }
3600
3600
  function u(g, m) {
3601
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;
@@ -3621,10 +3621,10 @@ var Ze = { exports: {} }, On = { exports: {} };
3621
3621
  function b(g) {
3622
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(g, m, p, P, z) {
3625
- for (var S = [m, p]; S.length; ) if (!((p = S.pop()) - (m = S.pop()) <= P)) {
3626
- var v = m + Math.ceil((p - m) / P / 2) * P;
3627
- e(g, v, m, p, z), S.push(m, v, v, p);
3624
+ function M(g, m, p, P, V) {
3625
+ for (var v = [m, p]; v.length; ) if (!((p = v.pop()) - (m = v.pop()) <= P)) {
3626
+ var S = m + Math.ceil((p - m) / P / 2) * P;
3627
+ e(g, S, m, p, V), v.push(m, S, S, p);
3628
3628
  }
3629
3629
  }
3630
3630
  return r.prototype.all = function() {
@@ -3632,12 +3632,12 @@ var Ze = { exports: {} }, On = { exports: {} };
3632
3632
  }, r.prototype.search = function(g) {
3633
3633
  var m = this.data, p = [];
3634
3634
  if (!x(g, m)) return p;
3635
- for (var P = this.toBBox, z = []; m; ) {
3636
- for (var S = 0; S < m.children.length; S++) {
3637
- var v = m.children[S], V = m.leaf ? P(v) : v;
3638
- x(g, V) && (m.leaf ? p.push(v) : w(g, V) ? this._all(v, p) : z.push(v));
3635
+ for (var P = this.toBBox, V = []; m; ) {
3636
+ for (var v = 0; v < m.children.length; v++) {
3637
+ var S = m.children[v], z = m.leaf ? P(S) : S;
3638
+ x(g, z) && (m.leaf ? p.push(S) : w(g, z) ? this._all(S, p) : V.push(S));
3639
3639
  }
3640
- m = z.pop();
3640
+ m = V.pop();
3641
3641
  }
3642
3642
  return p;
3643
3643
  }, r.prototype.collides = function(g) {
@@ -3645,10 +3645,10 @@ var Ze = { exports: {} }, On = { exports: {} };
3645
3645
  if (!x(g, m)) return !1;
3646
3646
  for (var p = []; m; ) {
3647
3647
  for (var P = 0; P < m.children.length; P++) {
3648
- var z = m.children[P], S = m.leaf ? this.toBBox(z) : z;
3649
- if (x(g, S)) {
3650
- if (m.leaf || w(g, S)) return !0;
3651
- p.push(z);
3648
+ var V = m.children[P], v = m.leaf ? this.toBBox(V) : V;
3649
+ if (x(g, v)) {
3650
+ if (m.leaf || w(g, v)) return !0;
3651
+ p.push(V);
3652
3652
  }
3653
3653
  }
3654
3654
  m = p.pop();
@@ -3677,12 +3677,12 @@ var Ze = { exports: {} }, On = { exports: {} };
3677
3677
  return this.data = b([]), this;
3678
3678
  }, r.prototype.remove = function(g, m) {
3679
3679
  if (!g) return this;
3680
- for (var p, P, z, S = this.data, v = this.toBBox(g), V = [], D = []; S || V.length; ) {
3681
- if (S || (S = V.pop(), P = V[V.length - 1], p = D.pop(), z = !0), S.leaf) {
3682
- var _ = s(g, S.children, m);
3683
- if (_ !== -1) return S.children.splice(_, 1), V.push(S), this._condense(V), this;
3680
+ for (var p, P, V, v = this.data, S = this.toBBox(g), z = [], D = []; v || z.length; ) {
3681
+ if (v || (v = z.pop(), P = z[z.length - 1], p = D.pop(), V = !0), v.leaf) {
3682
+ var _ = s(g, v.children, m);
3683
+ if (_ !== -1) return v.children.splice(_, 1), z.push(v), this._condense(z), this;
3684
3684
  }
3685
- z || S.leaf || !w(S, v) ? P ? (p++, S = P.children[p], z = !1) : S = null : (V.push(S), D.push(p), p = 0, P = S, S = S.children[0]);
3685
+ V || v.leaf || !w(v, S) ? P ? (p++, v = P.children[p], V = !1) : v = null : (z.push(v), D.push(p), p = 0, P = v, v = v.children[0]);
3686
3686
  }
3687
3687
  return this;
3688
3688
  }, r.prototype.toBBox = function(g) {
@@ -3699,61 +3699,61 @@ var Ze = { exports: {} }, On = { exports: {} };
3699
3699
  for (var p = []; g; ) g.leaf ? m.push.apply(m, g.children) : p.push.apply(p, g.children), g = p.pop();
3700
3700
  return m;
3701
3701
  }, r.prototype._build = function(g, m, p, P) {
3702
- var z, S = p - m + 1, v = this._maxEntries;
3703
- if (S <= v) return a(z = b(g.slice(m, p + 1)), this.toBBox), z;
3704
- P || (P = Math.ceil(Math.log(S) / Math.log(v)), v = Math.ceil(S / Math.pow(v, P - 1))), (z = b([])).leaf = !1, z.height = P;
3705
- var V = Math.ceil(S / v), D = V * Math.ceil(Math.sqrt(v));
3702
+ var V, v = p - m + 1, S = this._maxEntries;
3703
+ if (v <= S) return a(V = b(g.slice(m, p + 1)), this.toBBox), V;
3704
+ P || (P = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, P - 1))), (V = b([])).leaf = !1, V.height = P;
3705
+ var z = Math.ceil(v / S), D = z * Math.ceil(Math.sqrt(S));
3706
3706
  M(g, m, p, D, this.compareMinX);
3707
3707
  for (var _ = m; _ <= p; _ += D) {
3708
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, P - 1));
3709
+ M(g, _, E, z, this.compareMinY);
3710
+ for (var T = _; T <= E; T += z) {
3711
+ var A = Math.min(T + z - 1, E);
3712
+ V.children.push(this._build(g, T, A, P - 1));
3713
3713
  }
3714
3714
  }
3715
- return a(z, this.toBBox), z;
3715
+ return a(V, this.toBBox), V;
3716
3716
  }, r.prototype._chooseSubtree = function(g, m, p, P) {
3717
3717
  for (; P.push(m), !m.leaf && P.length - 1 !== p; ) {
3718
- for (var z = 1 / 0, S = 1 / 0, v = 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 < S ? (S = E, z = _ < z ? _ : z, v = D) : E === S && _ < z && (z = _, v = D);
3718
+ for (var V = 1 / 0, v = 1 / 0, S = void 0, z = 0; z < m.children.length; z++) {
3719
+ var D = m.children[z], _ = 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, V = _ < V ? _ : V, S = D) : E === v && _ < V && (V = _, S = D);
3721
3721
  }
3722
- m = v || m.children[0];
3722
+ m = S || m.children[0];
3723
3723
  }
3724
3724
  var T, A;
3725
3725
  return m;
3726
3726
  }, r.prototype._insert = function(g, m, p) {
3727
- var P = p ? g : this.toBBox(g), z = [], S = this._chooseSubtree(P, this.data, m, z);
3728
- for (S.children.push(g), u(S, P); m >= 0 && z[m].children.length > this._maxEntries; ) this._split(z, m), m--;
3729
- this._adjustParentBBoxes(P, z, m);
3727
+ var P = p ? g : this.toBBox(g), V = [], v = this._chooseSubtree(P, this.data, m, V);
3728
+ for (v.children.push(g), u(v, P); m >= 0 && V[m].children.length > this._maxEntries; ) this._split(V, m), m--;
3729
+ this._adjustParentBBoxes(P, V, m);
3730
3730
  }, r.prototype._split = function(g, m) {
3731
- var p = g[m], P = p.children.length, z = this._minEntries;
3732
- this._chooseSplitAxis(p, z, P);
3733
- var S = this._chooseSplitIndex(p, z, P), v = b(p.children.splice(S, p.children.length - S));
3734
- v.height = p.height, v.leaf = p.leaf, a(p, this.toBBox), a(v, this.toBBox), m ? g[m - 1].children.push(v) : this._splitRoot(p, v);
3731
+ var p = g[m], P = p.children.length, V = this._minEntries;
3732
+ this._chooseSplitAxis(p, V, P);
3733
+ var v = this._chooseSplitIndex(p, V, P), S = b(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), m ? g[m - 1].children.push(S) : this._splitRoot(p, S);
3735
3735
  }, r.prototype._splitRoot = function(g, m) {
3736
3736
  this.data = b([g, m]), this.data.height = g.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3737
3737
  }, r.prototype._chooseSplitIndex = function(g, m, p) {
3738
- for (var P, z, S, v, 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, S = I, v = void 0, V = void 0, D = void 0, _ = void 0, v = Math.max(z.minX, S.minX), V = Math.max(z.minY, S.minY), D = Math.min(z.maxX, S.maxX), _ = Math.min(z.maxY, S.maxY), Math.max(0, D - v) * Math.max(0, _ - V)), R = c(O) + c(I);
3738
+ for (var P, V, v, S, z, 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 = (V = O, v = I, S = void 0, z = void 0, D = void 0, _ = void 0, S = Math.max(V.minX, v.minX), z = Math.max(V.minY, v.minY), D = Math.min(V.maxX, v.maxX), _ = Math.min(V.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - z)), R = c(O) + c(I);
3740
3740
  B < E ? (E = B, P = A, T = R < T ? R : T) : B === E && R < T && (T = R, P = A);
3741
3741
  }
3742
3742
  return P || p - m;
3743
3743
  }, r.prototype._chooseSplitAxis = function(g, m, p) {
3744
- var P = g.leaf ? this.compareMinX : h, z = g.leaf ? this.compareMinY : d;
3745
- this._allDistMargin(g, m, p, P) < this._allDistMargin(g, m, p, z) && g.children.sort(P);
3744
+ var P = g.leaf ? this.compareMinX : h, V = g.leaf ? this.compareMinY : d;
3745
+ this._allDistMargin(g, m, p, P) < this._allDistMargin(g, m, p, V) && g.children.sort(P);
3746
3746
  }, r.prototype._allDistMargin = function(g, m, p, P) {
3747
3747
  g.children.sort(P);
3748
- for (var z = this.toBBox, S = l(g, 0, m, z), v = l(g, p - m, p, z), V = f(S) + f(v), D = m; D < p - m; D++) {
3748
+ for (var V = this.toBBox, v = l(g, 0, m, V), S = l(g, p - m, p, V), z = f(v) + f(S), D = m; D < p - m; D++) {
3749
3749
  var _ = g.children[D];
3750
- u(S, g.leaf ? z(_) : _), V += f(S);
3750
+ u(v, g.leaf ? V(_) : _), z += f(v);
3751
3751
  }
3752
3752
  for (var E = p - m - 1; E >= m; E--) {
3753
3753
  var T = g.children[E];
3754
- u(v, g.leaf ? z(T) : T), V += f(v);
3754
+ u(S, g.leaf ? V(T) : T), z += f(S);
3755
3755
  }
3756
- return V;
3756
+ return z;
3757
3757
  }, r.prototype._adjustParentBBoxes = function(g, m, p) {
3758
3758
  for (var P = p; P >= 0; P--) u(m[P], g);
3759
3759
  }, r.prototype._condense = function(g) {
@@ -3834,12 +3834,12 @@ var hr = Ce.exports, Ue = { exports: {} };
3834
3834
  })(Fn, function(e) {
3835
3835
  const i = 33306690738754706e-32;
3836
3836
  function r(x, b, M, g, m) {
3837
- let p, P, z, S, v = b[0], V = g[0], D = 0, _ = 0;
3838
- V > v == V > -v ? (p = v, v = b[++D]) : (p = V, V = g[++_]);
3837
+ let p, P, V, v, S = b[0], z = g[0], D = 0, _ = 0;
3838
+ z > S == z > -S ? (p = S, S = b[++D]) : (p = z, z = g[++_]);
3839
3839
  let E = 0;
3840
- if (D < x && _ < M) for (V > v == V > -v ? (z = p - ((P = v + p) - v), v = b[++D]) : (z = p - ((P = V + p) - V), V = g[++_]), p = P, z !== 0 && (m[E++] = z); D < x && _ < M; ) V > v == V > -v ? (z = p - ((P = p + v) - (S = P - p)) + (v - S), v = b[++D]) : (z = p - ((P = p + V) - (S = P - p)) + (V - S), V = g[++_]), p = P, z !== 0 && (m[E++] = z);
3841
- for (; D < x; ) z = p - ((P = p + v) - (S = P - p)) + (v - S), v = b[++D], p = P, z !== 0 && (m[E++] = z);
3842
- for (; _ < M; ) z = p - ((P = p + V) - (S = P - p)) + (V - S), V = g[++_], p = P, z !== 0 && (m[E++] = z);
3840
+ if (D < x && _ < M) for (z > S == z > -S ? (V = p - ((P = S + p) - S), S = b[++D]) : (V = p - ((P = z + p) - z), z = g[++_]), p = P, V !== 0 && (m[E++] = V); D < x && _ < M; ) z > S == z > -S ? (V = p - ((P = p + S) - (v = P - p)) + (S - v), S = b[++D]) : (V = p - ((P = p + z) - (v = P - p)) + (z - v), z = g[++_]), p = P, V !== 0 && (m[E++] = V);
3841
+ for (; D < x; ) V = p - ((P = p + S) - (v = P - p)) + (S - v), S = b[++D], p = P, V !== 0 && (m[E++] = V);
3842
+ for (; _ < M; ) V = p - ((P = p + z) - (v = P - p)) + (z - v), z = g[++_], p = P, V !== 0 && (m[E++] = V);
3843
3843
  return p === 0 && E !== 0 || (m[E++] = p), E;
3844
3844
  }
3845
3845
  function s(x) {
@@ -3847,19 +3847,19 @@ var hr = Ce.exports, Ue = { exports: {} };
3847
3847
  }
3848
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
3849
  e.orient2d = function(x, b, M, g, m, p) {
3850
- const P = (b - p) * (M - m), z = (x - m) * (g - p), S = P - z;
3851
- if (P === 0 || z === 0 || P > 0 != z > 0) return S;
3852
- const v = Math.abs(P + z);
3853
- return Math.abs(S) >= a * v ? S : -function(V, D, _, E, T, A, O) {
3850
+ const P = (b - p) * (M - m), V = (x - m) * (g - p), v = P - V;
3851
+ if (P === 0 || V === 0 || P > 0 != V > 0) return v;
3852
+ const S = Math.abs(P + V);
3853
+ return Math.abs(v) >= a * S ? v : -function(z, D, _, E, T, A, O) {
3854
3854
  let I, B, R, N, C, L, $, X, ot, K, G, ut, rt, F, H, Mt, Zt, qt;
3855
- const Lt = V - T, _t = _ - T, Et = D - A, Ft = E - A;
3855
+ const Lt = z - T, _t = _ - T, Et = D - A, Ft = E - A;
3856
3856
  C = (H = (X = Lt - ($ = (L = 134217729 * Lt) - (L - Lt))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = Lt * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (L = 134217729 * Et) - (L - Et))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _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
3857
  let tt = function(Tt, Wt) {
3858
3858
  let J = Wt[0];
3859
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 - (Lt + (C = V - Lt)) + (C - T), R = _ - (_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 && R === 0 && N === 0) || (lt = u * O + i * Math.abs(tt), (tt += Lt * N + Ft * I - (Et * R + _t * B)) >= lt || -tt >= lt)) return tt;
3862
+ if (tt >= lt || -tt >= lt || (I = z - (Lt + (C = z - Lt)) + (C - T), R = _ - (_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 && R === 0 && N === 0) || (lt = u * O + i * Math.abs(tt), (tt += Lt * N + Ft * I - (Et * R + _t * B)) >= lt || -tt >= lt)) return tt;
3863
3863
  C = (H = (X = I - ($ = (L = 134217729 * I) - (L - I))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = I * Ft) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (L = 134217729 * B) - (L - B))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _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
3864
  const W = r(4, h, 4, w, d);
3865
3865
  C = (H = (X = Lt - ($ = (L = 134217729 * Lt) - (L - Lt))) * (K = N - (ot = (L = 134217729 * N) - (L - N))) - ((F = Lt * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = Et - ($ = (L = 134217729 * Et) - (L - Et))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = Et * R) - $ * 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;
@@ -3867,7 +3867,7 @@ var hr = Ce.exports, Ue = { exports: {} };
3867
3867
  C = (H = (X = I - ($ = (L = 134217729 * I) - (L - I))) * (K = N - (ot = (L = 134217729 * N) - (L - N))) - ((F = I * N) - $ * ot - X * ot - $ * K)) - (G = H - (Zt = (X = B - ($ = (L = 134217729 * B) - (L - B))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = B * R) - $ * 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
3868
  const Nt = r(j, c, 4, w, f);
3869
3869
  return f[Nt - 1];
3870
- }(x, b, M, g, m, p, v);
3870
+ }(x, b, M, g, m, p, S);
3871
3871
  }, e.orient2dfast = function(x, b, M, g, m, p) {
3872
3872
  return (b - p) * (M - m) - (x - m) * (g - p);
3873
3873
  }, Object.defineProperty(e, "__esModule", { value: !0 });
@@ -3996,9 +3996,9 @@ function He(n, t, e) {
3996
3996
  return r = n[0] - o, s = n[1] - i, r * r + s * s;
3997
3997
  }
3998
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, b = h * h + d * d, M = l * c + u * f, g = h * c + d * f, m = w * b - x * x, p, P, z, S, v = m, V = m;
4000
- m === 0 ? (P = 0, v = 1, S = g, V = b) : (P = x * g - b * M, S = w * g - x * M, P < 0 ? (P = 0, S = g, V = b) : P > v && (P = v, S = g + x, V = b)), S < 0 ? (S = 0, -M < 0 ? P = 0 : -M > w ? P = v : (P = -M, v = w)) : S > V && (S = V, -M + x < 0 ? P = 0 : -M + x > w ? P = v : (P = -M + x, v = w)), p = P === 0 ? 0 : P / v, z = S === 0 ? 0 : S / 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 - _;
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, b = h * h + d * d, M = l * c + u * f, g = h * c + d * f, m = w * b - x * x, p, P, V, v, S = m, z = m;
4000
+ m === 0 ? (P = 0, S = 1, v = g, z = b) : (P = x * g - b * M, v = w * g - x * M, P < 0 ? (P = 0, v = g, z = b) : P > S && (P = S, v = g + x, z = b)), v < 0 ? (v = 0, -M < 0 ? P = 0 : -M > w ? P = S : (P = -M, S = w)) : v > z && (v = z, -M + x < 0 ? P = 0 : -M + x > w ? P = S : (P = -M + x, S = w)), p = P === 0 ? 0 : P / S, V = v === 0 ? 0 : v / z;
4001
+ var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o, E = (1 - V) * i + V * s, T = (1 - V) * r + V * a, A = E - D, O = T - _;
4002
4002
  return A * A + O * O;
4003
4003
  }
4004
4004
  function br(n, t) {
@@ -4019,15 +4019,15 @@ function Pr(n) {
4019
4019
  return o.pop(), t.pop(), t.concat(o);
4020
4020
  }
4021
4021
  var Mr = Ze.exports;
4022
- const zr = /* @__PURE__ */ nr(Mr);
4023
- function Vr(n, t = {}) {
4022
+ const Vr = /* @__PURE__ */ nr(Mr);
4023
+ function zr(n, t = {}) {
4024
4024
  t.concavity = t.concavity || 1 / 0;
4025
4025
  const e = [];
4026
4026
  if (Pe(n, (i) => {
4027
4027
  e.push([i[0], i[1]]);
4028
4028
  }), !e.length)
4029
4029
  return null;
4030
- const o = zr(e, t.concavity);
4030
+ const o = Vr(e, t.concavity);
4031
4031
  return o.length > 3 ? Cn([o]) : null;
4032
4032
  }
4033
4033
  function Xn(n, t = {}) {
@@ -4053,7 +4053,7 @@ function se(n) {
4053
4053
  return [...n];
4054
4054
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
4055
4055
  }
4056
- function vr(n) {
4056
+ function Sr(n) {
4057
4057
  if (Array.isArray(n))
4058
4058
  return n;
4059
4059
  if (n.type === "Feature") {
@@ -4065,7 +4065,7 @@ function vr(n) {
4065
4065
  "coords must be GeoJSON Feature, Geometry Object or an Array"
4066
4066
  );
4067
4067
  }
4068
- function Sr(n, t, e = {}) {
4068
+ function vr(n, t, e = {}) {
4069
4069
  let o;
4070
4070
  return e.final ? o = bn(se(t), se(n)) : o = bn(se(n), se(t)), o > 180 ? -(360 - o) : o;
4071
4071
  }
@@ -4193,7 +4193,7 @@ function Pn(n, t, e) {
4193
4193
  if (t === 0) return n;
4194
4194
  const r = o ?? Xn(n);
4195
4195
  return (i === !1 || i === void 0) && (n = Ar(n)), Pe(n, function(s) {
4196
- const l = Sr(r, s) + t, u = Dr(r, s), h = vr(
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];
@@ -4260,14 +4260,14 @@ function Fr(n) {
4260
4260
  function Mn(n) {
4261
4261
  let t = 0;
4262
4262
  if (n && n.length > 0) {
4263
- t += Math.abs(zn(n[0]));
4263
+ t += Math.abs(Vn(n[0]));
4264
4264
  for (let e = 1; e < n.length; e++)
4265
- t -= Math.abs(zn(n[e]));
4265
+ t -= Math.abs(Vn(n[e]));
4266
4266
  }
4267
4267
  return t;
4268
4268
  }
4269
4269
  var Or = Ht * Ht / 2, Ye = Math.PI / 180;
4270
- function zn(n) {
4270
+ function Vn(n) {
4271
4271
  const t = n.length - 1;
4272
4272
  if (t <= 2) return 0;
4273
4273
  let e = 0, o = 0;
@@ -4278,7 +4278,7 @@ function zn(n) {
4278
4278
  return e * Or;
4279
4279
  }
4280
4280
  function Nr(n) {
4281
- const t = Vr(n);
4281
+ const t = zr(n);
4282
4282
  if (!t)
4283
4283
  throw new Error("Can't calculate smallestSurroundingRectangleByArea for given geometry");
4284
4284
  const e = Xn(t), o = Jo(t);
@@ -4293,7 +4293,7 @@ function Nr(n) {
4293
4293
  }
4294
4294
  return r;
4295
4295
  }
4296
- function Vn(n, t) {
4296
+ function zn(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
  }
@@ -4348,13 +4348,13 @@ class Ie extends An {
4348
4348
  coordinates: [t.map((f) => [f.x, f.y])]
4349
4349
  });
4350
4350
  if (!r) throw new Error("2d obb 获取失败");
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
- Te.set(a, l, o), vn.set(0, 0, u);
4351
+ const s = r.geometry.coordinates[0], a = zn(s[0], s[1]), l = zn(s[1], s[2]), u = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
4352
+ Te.set(a, l, o), Sn.set(0, 0, u);
4353
4353
  const [h, d] = qr(s);
4354
- return e.x = h, e.y = d, this.from(Te, e, vn, i);
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(), vn = new y.Euler(), Wr = new y.Vector3(1, 1, 1), Te = new y.Vector3(), Xr = new y.Box3();
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
4358
  function $r(n, t, e = 5e-3, o = 0.2) {
4359
4359
  if (!n.length || !t.length) return 0;
4360
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)}`;
@@ -4404,7 +4404,7 @@ function Ge(n, t, e, o) {
4404
4404
  }
4405
4405
  return !1;
4406
4406
  }
4407
- function Sn(n, t) {
4407
+ function vn(n, t) {
4408
4408
  const e = new y.Vector3(), o = new y.Vector3();
4409
4409
  n.getSize(e), t.getSize(o);
4410
4410
  const i = e.x * e.y * e.z, r = o.x * o.y * o.z;
@@ -4447,9 +4447,10 @@ 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 Mi = (n) => {
4450
+ const Mi = (n, t) => {
4451
4451
  if (n.length == 0) return [];
4452
- const t = [], e = /* @__PURE__ */ new Map();
4452
+ t || (t = n[0].averagePz);
4453
+ const e = [], o = /* @__PURE__ */ new Map();
4453
4454
  for (let r = 0; r < n.length; r++) {
4454
4455
  let s = n[r].points.map((b) => [b.x, b.y]), a = n[r].obj_id;
4455
4456
  a = a.replace(/calcony railing/g, "balcony railing").replace(/glass balcony railing/g, "balcony railing").replace(/metal balcony railing/g, "balcony railing").replace(/temporary construction guardrail/g, "balcony railing").replace(/the floor of the house/g, "floor").replace(/the outdoor floor/g, "floor"), a.split("_").slice(1, 3).join("_").split(".")[0].split("_")[0];
@@ -4488,7 +4489,7 @@ const Mi = (n) => {
4488
4489
  center: { x: f.x, y: f.y, z: f.z },
4489
4490
  obj_id: n[r].obj_id,
4490
4491
  type: h,
4491
- averagePz: n[r].averagePz,
4492
+ averagePz: t,
4492
4493
  obb: null,
4493
4494
  isDel: !1,
4494
4495
  obj_id: a,
@@ -4496,36 +4497,35 @@ const Mi = (n) => {
4496
4497
  };
4497
4498
  if (w.obb = _n(w.path, w.center, w.h, (w.maxz + w.minz) / 2), w.obb == null) continue;
4498
4499
  let x = -1;
4499
- for (let b = 0; b < t.length; b++)
4500
- if (t[b].type == h) {
4500
+ for (let b = 0; b < e.length; b++)
4501
+ if (e[b].type == h) {
4501
4502
  x = b;
4502
4503
  break;
4503
4504
  }
4504
- if (x != -1 ? t[x].array.push(w) : t.push({
4505
+ if (x != -1 ? e[x].array.push(w) : e.push({
4505
4506
  type: h,
4506
4507
  array: [w]
4507
4508
  }), h == "floor" && c != -99999)
4508
- if (e.has(c)) {
4509
- const b = e.get(c);
4510
- b.num += w.points.length, b.datas.push(w), e.set(c, b);
4509
+ if (o.has(c)) {
4510
+ const b = o.get(c);
4511
+ b.num += w.points.length, b.datas.push(w), o.set(c, b);
4511
4512
  } else
4512
- e.set(c, { num: w.points.length, datas: [w] });
4513
+ o.set(c, { num: w.points.length, datas: [w] });
4513
4514
  }
4514
- let o = -1 / 0;
4515
- if (e.size > 0) {
4515
+ if (o.size > 0) {
4516
4516
  let r = [];
4517
- for (const [s, a] of e.entries()) {
4517
+ for (const [s, a] of o.entries()) {
4518
4518
  const { num: l, datas: u } = a;
4519
- l > 3e3 && (s > o && (o = s), r.push(...u));
4519
+ l > 3e3 && r.push(...u);
4520
4520
  }
4521
- for (let s = 0; s < t.length; s++)
4522
- if (t[s].type == "floor") {
4523
- t[s].array = r;
4521
+ for (let s = 0; s < e.length; s++)
4522
+ if (e[s].type == "floor") {
4523
+ e[s].array = r;
4524
4524
  break;
4525
4525
  }
4526
4526
  }
4527
- for (let r = 0; r < t.length; r++) {
4528
- const s = t[r].array, a = [], l = [];
4527
+ for (let r = 0; r < e.length; r++) {
4528
+ const s = e[r].array, a = [], l = [];
4529
4529
  for (let h = 0; h < s.length; h++) {
4530
4530
  if (s[h].obb == null || a.includes(h))
4531
4531
  continue;
@@ -4539,7 +4539,7 @@ const Mi = (n) => {
4539
4539
  if (d.obb.intersectsOBB(s[c].obb)) {
4540
4540
  a.push(c);
4541
4541
  for (let b = 0; b < s[c].points.length; b++)
4542
- (s[c].points[b].z > o && s[c].points[b].z - o > 0.1 || d.type == "floor") && d.points.push(s[c].points[b]);
4542
+ (s[c].points[b].z > t && s[c].points[b].z - t > 0.1 || d.type == "floor") && d.points.push(s[c].points[b]);
4543
4543
  const w = d.points.map((b) => [b.x, b.y]);
4544
4544
  d.path = cn(w);
4545
4545
  const x = Dn(d.points);
@@ -4551,13 +4551,13 @@ const Mi = (n) => {
4551
4551
  const u = [];
4552
4552
  for (let h = 0; h < s.length; h++)
4553
4553
  a.includes(h) || u.push(s[h]);
4554
- u.push(...l), t[r].array = u;
4554
+ u.push(...l), e[r].array = u;
4555
4555
  }
4556
- for (let r = 0; r < t.length; r++) {
4557
- const s = t[r].type;
4556
+ for (let r = 0; r < e.length; r++) {
4557
+ const s = e[r].type;
4558
4558
  if (s === "people" || s === "floor")
4559
4559
  continue;
4560
- const a = t[r].array;
4560
+ const a = e[r].array;
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;
@@ -4574,17 +4574,17 @@ const Mi = (n) => {
4574
4574
  }
4575
4575
  }
4576
4576
  if (!a[l].isDel)
4577
- for (let c = r + 1; c < t.length; c++) {
4578
- const f = t[c].type;
4577
+ for (let c = r + 1; c < e.length; c++) {
4578
+ const f = e[c].type;
4579
4579
  if (f === "people" || f === "floor")
4580
4580
  continue;
4581
- const w = t[c].array;
4581
+ const w = e[c].array;
4582
4582
  for (let x = 0; x < w.length; x++) {
4583
4583
  if (w[x].isDel) continue;
4584
4584
  const b = w[x].obb, M = w[x].minz;
4585
4585
  if (w[x].maxz, u.intersectsOBB(b)) {
4586
4586
  pe(w[x].points, u);
4587
- const g = pe(a[l].points, b), m = Sn(u, b);
4587
+ const g = pe(a[l].points, b), m = vn(u, b);
4588
4588
  if (g >= 0.3 && m == -1) {
4589
4589
  a[l].isDel = !0;
4590
4590
  break;
@@ -4617,9 +4617,9 @@ const Mi = (n) => {
4617
4617
  break;
4618
4618
  }
4619
4619
  }
4620
- let p = !1, P = [], z = [];
4621
- const S = a[l].points, v = w[x].points;
4622
- if (S.length > v.length ? (p = !0, P = S, z = v) : (P = v, z = S), $r(z, P, 0.03, 0.5) > 0.5)
4620
+ let p = !1, P = [], V = [];
4621
+ const v = a[l].points, S = w[x].points;
4622
+ if (v.length > S.length ? (p = !0, P = v, V = S) : (P = S, V = v), $r(V, P, 0.03, 0.5) > 0.5)
4623
4623
  if (p)
4624
4624
  w[x].isDel = !0;
4625
4625
  else {
@@ -4627,18 +4627,18 @@ const Mi = (n) => {
4627
4627
  break;
4628
4628
  }
4629
4629
  else if (Ge(u, b)) {
4630
- const D = Sn(u, b);
4630
+ const D = vn(u, b);
4631
4631
  if (D === 1 || D === 0) {
4632
4632
  if (f === "switch") continue;
4633
- S.length > v.length ? pe(z, u) >= 0.5 && (w[x].isDel = !0) : pe(P, u) >= 0.5 && (w[x].isDel = !0);
4633
+ v.length > S.length ? pe(V, u) >= 0.5 && (w[x].isDel = !0) : pe(P, u) >= 0.5 && (w[x].isDel = !0);
4634
4634
  } else {
4635
4635
  if (s === "switch") continue;
4636
- if (S.length > v.length) {
4636
+ if (v.length > S.length) {
4637
4637
  if (pe(P, b) >= 0.5) {
4638
4638
  a[l].isDel = !0;
4639
4639
  break;
4640
4640
  }
4641
- } else if (pe(z, b) >= 0.5) {
4641
+ } else if (pe(V, b) >= 0.5) {
4642
4642
  a[l].isDel = !0;
4643
4643
  break;
4644
4644
  }
@@ -4651,31 +4651,30 @@ const Mi = (n) => {
4651
4651
  }
4652
4652
  }
4653
4653
  }
4654
- for (let r = 0; r < t.length; r++) {
4655
- const s = t[r].type, a = t[r].array;
4654
+ for (let r = 0; r < e.length; r++) {
4655
+ const s = e[r].type, a = e[r].array;
4656
4656
  for (let l = 0; l < a.length; l++) {
4657
4657
  let u = a[l].maxz, h = a[l].minz, d = s === "switch" ? 0.1 : 0.3;
4658
- const c = a[l].averagePz;
4659
- if (Math.abs(u - c) < d) {
4658
+ if (Math.abs(u - t) < d) {
4660
4659
  a[l].isDel = !0;
4661
4660
  continue;
4662
4661
  }
4663
4662
  if (s === "window" || s === "door" || s === "tv") {
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);
4663
+ const c = Math.abs(u - t), f = Math.abs(h - t);
4664
+ (s === "tv" && f < 1.6 || s !== "window" && c < 1.6) && (a[l].isDel = !0), s === "window" && c < 1 && (a[l].isDel = !0);
4666
4665
  }
4667
4666
  if (s === "chair") {
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);
4667
+ const c = new y.Vector3();
4668
+ a[l].obb.getSize(c), (c.x < 0.1 || c.y < 0.1 || c.z < 0.2) && (a[l].isDel = !0);
4670
4669
  }
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);
4670
+ s === "balcony railing" && (Math.abs(u - h) < 0.4 && (a[l].isDel = !0), (h < t && Math.abs(h - t) > 1 || h > t && Math.abs(h - t) > 1) && (a[l].isDel = !0), u < t && (a[l].isDel = !0)), s === "people" && (Math.abs(u - h) < 1 && (a[l].isDel = !0), h > t && h - t > 0.3 && (a[l].isDel = !0), u < t && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
4672
4671
  }
4673
4672
  }
4674
- for (let r = 0; r < t.length; r++)
4675
- t[r].array = t[r].array.filter((s) => !s.isDel);
4673
+ for (let r = 0; r < e.length; r++)
4674
+ e[r].array = e[r].array.filter((s) => !s.isDel);
4676
4675
  const i = [];
4677
- for (let r = 0; r < t.length; r++) {
4678
- const s = t[r].array;
4676
+ for (let r = 0; r < e.length; r++) {
4677
+ const s = e[r].array;
4679
4678
  for (let a = 0; a < s.length; a++)
4680
4679
  i.push({
4681
4680
  obbBox: s[a].obb,
@@ -4759,7 +4758,7 @@ function Kr(n, t) {
4759
4758
  } while (s !== o && i.length <= t.length + 1);
4760
4759
  return i;
4761
4760
  }
4762
- function zi(n, t = {}) {
4761
+ function Vi(n, t = {}) {
4763
4762
  const {
4764
4763
  edgeFactor: e = 20,
4765
4764
  alphaScale: o = 2
@@ -4774,15 +4773,15 @@ function zi(n, t = {}) {
4774
4773
  return [];
4775
4774
  const l = a * e, u = /* @__PURE__ */ new Map(), h = (f, w) => f < w ? `${f}_${w}` : `${w}_${f}`;
4776
4775
  for (let f = 0; f < s.length; f += 3) {
4777
- const w = s[f], x = s[f + 1], b = s[f + 2], [M, g] = i[w], [m, p] = i[x], [P, z] = i[b], { radius: S, maxEdge: v } = Gr(
4776
+ const w = s[f], x = s[f + 1], b = s[f + 2], [M, g] = i[w], [m, p] = i[x], [P, V] = i[b], { radius: v, maxEdge: S } = Gr(
4778
4777
  M,
4779
4778
  g,
4780
4779
  m,
4781
4780
  p,
4782
4781
  P,
4783
- z
4784
- ), V = Hr(i, w, x, b) * o;
4785
- if (S <= 1 / V && v <= l) {
4782
+ V
4783
+ ), z = Hr(i, w, x, b) * o;
4784
+ if (v <= 1 / z && S <= l) {
4786
4785
  const D = [
4787
4786
  [w, x],
4788
4787
  [x, b],
@@ -4970,7 +4969,7 @@ function Zn(n, t = 5, e = 0.05) {
4970
4969
  E.seg.length > g.length && (g = E.seg);
4971
4970
  const m = g.end.x - g.start.x, p = g.end.y - g.start.y, P = Math.sqrt(m * m + p * p);
4972
4971
  if (P < 1e-12) continue;
4973
- const z = m / P, S = p / P, v = M.map((E) => E.seg.rooftopPz ?? 0), V = Math.max(...v), D = [...new Set(v.map((E) => E.toFixed(3)))];
4972
+ const V = m / P, v = p / P, S = M.map((E) => E.seg.rooftopPz ?? 0), z = Math.max(...S), D = [...new Set(S.map((E) => E.toFixed(3)))];
4974
4973
  if (D.length > 1) {
4975
4974
  const E = M.map((T) => ({
4976
4975
  idx: T.idx,
@@ -4982,10 +4981,10 @@ function Zn(n, t = 5, e = 0.05) {
4982
4981
  a.push({ values: [...D], segments: E });
4983
4982
  }
4984
4983
  [...new Set(M.map((E) => String(E.seg.buildRosource)))];
4985
- const _ = si(M, g, z, S, e);
4984
+ const _ = si(M, g, V, v, e);
4986
4985
  for (const { l: E, r: T, srcIdxs: A } of _) {
4987
4986
  if (T - E < 0.01) continue;
4988
- const O = ai(g, E, T, z, S, V, g.buildRosource);
4987
+ const O = ai(g, E, T, V, v, z, g.buildRosource);
4989
4988
  r.push(O), s.push(A);
4990
4989
  }
4991
4990
  }
@@ -5028,9 +5027,9 @@ function hi(n, t, e, o, i, r, s) {
5028
5027
  continue;
5029
5028
  const { start: c, end: f } = h;
5030
5029
  let w = !1, x = 1 / 0;
5031
- for (const v of i) {
5032
- const { dist: V, t: D } = Un(v.x, v.y, c.x, c.y, f.x, f.y);
5033
- D >= -u.margin && D <= 1 + u.margin && V <= u.maxDist && (w = !0, x = Math.min(x, V));
5030
+ for (const S of i) {
5031
+ const { dist: z, t: D } = Un(S.x, S.y, c.x, c.y, f.x, f.y);
5032
+ D >= -u.margin && D <= 1 + u.margin && z <= u.maxDist && (w = !0, x = Math.min(x, z));
5034
5033
  }
5035
5034
  if (!w) {
5036
5035
  `${u.maxDist}${(-u.margin).toFixed(1)}${(1 + u.margin).toFixed(1)}`;
@@ -5038,25 +5037,25 @@ function hi(n, t, e, o, i, r, s) {
5038
5037
  }
5039
5038
  const b = Math.sqrt((f.x - c.x) ** 2 + (f.y - c.y) ** 2);
5040
5039
  if (b < 1e-12) continue;
5041
- const M = (f.x - c.x) / b, g = (f.y - c.y) / b, m = Math.abs(e * M + o * g), p = Math.abs(-o * M + e * g), P = Math.max(m, p), z = Math.acos(Math.min(P, 1)) * (180 / Math.PI);
5042
- if (z > r.angleThreshold) {
5043
- `${z.toFixed(1)}${r.angleThreshold}`;
5040
+ const M = (f.x - c.x) / b, g = (f.y - c.y) / b, m = Math.abs(e * M + o * g), p = Math.abs(-o * M + e * g), P = Math.max(m, p), V = Math.acos(Math.min(P, 1)) * (180 / Math.PI);
5041
+ if (V > r.angleThreshold) {
5042
+ `${V.toFixed(1)}${r.angleThreshold}`;
5044
5043
  continue;
5045
5044
  }
5046
- let S = 0;
5045
+ let v = 0;
5047
5046
  if (b > 0.01) {
5048
- const v = [];
5047
+ const S = [];
5049
5048
  for (let _ = 1; _ <= 4; _++) {
5050
5049
  const E = i[_], T = E.x - c.x, A = E.y - c.y, O = (T * M + A * g) / b;
5051
- v.push(O);
5050
+ S.push(O);
5052
5051
  }
5053
- const V = Math.min(...v), D = Math.max(...v);
5054
- D > V && (S = Math.max(0, Math.min(1, D) - Math.max(0, V)) / (D - V));
5052
+ const z = Math.min(...S), D = Math.max(...S);
5053
+ D > z && (v = Math.max(0, Math.min(1, D) - Math.max(0, z)) / (D - z));
5055
5054
  }
5056
5055
  l.push({
5057
5056
  seg: h,
5058
5057
  minDist: x,
5059
- embedRatio: S,
5058
+ embedRatio: v,
5060
5059
  ratio: h.length / t,
5061
5060
  score: 0,
5062
5061
  details: { conn: 0, variance: 0, sameSide: 0 }
@@ -5075,12 +5074,12 @@ function fi(n, t, e, o) {
5075
5074
  return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
5076
5075
  }
5077
5076
  function di(n, t, e, o) {
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((S) => {
5079
- const v = S.x - n.start.x, V = S.y - n.start.y;
5080
- return (v * a + V * l) / s;
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, b = e.box.min.z, M = e.box.max.z, g = Math.abs(M - b), m = jn(o, n.start.x, n.start.y), p = Math.max(0, b - m), P = h <= 0 && d >= 1, z = n.start.z + f * (n.end.z - n.start.z);
5077
+ 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) => {
5078
+ const S = v.x - n.start.x, z = v.y - n.start.y;
5079
+ return (S * a + z * l) / s;
5080
+ }), 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, b = e.box.min.z, M = e.box.max.z, g = Math.abs(M - b), m = jn(o, n.start.x, n.start.y), p = Math.max(0, b - m), P = h <= 0 && d >= 1, V = n.start.z + f * (n.end.z - n.start.z);
5082
5081
  return {
5083
- p: { x: w, y: x, z },
5082
+ p: { x: w, y: x, z: V },
5084
5083
  width: c,
5085
5084
  full: P,
5086
5085
  height: g,
@@ -5118,24 +5117,24 @@ function mi(n, t, e, o) {
5118
5117
  h.name;
5119
5118
  let P = hi(l, x, b, M, p, i, h.name);
5120
5119
  P = fi(P, p, t, h.name);
5121
- let z = null, S = 1 / 0, v = 0;
5120
+ let V = null, v = 1 / 0, S = 0;
5122
5121
  if (P.length > 0) {
5123
5122
  const D = P[0];
5124
- z = D.seg, S = D.minDist, v = D.ratio;
5123
+ V = D.seg, v = D.minDist, S = D.ratio;
5125
5124
  }
5126
- let V;
5127
- if (z && (V = di(z, c, h, s), !i.printOnly)) {
5128
- const D = z;
5129
- D.drawWindow || (D.drawWindow = []), D.drawWindow.push(V);
5125
+ let z;
5126
+ if (V && (z = di(V, c, h, s), !i.printOnly)) {
5127
+ const D = V;
5128
+ D.drawWindow || (D.drawWindow = []), D.drawWindow.push(z);
5130
5129
  }
5131
- z && r.push({
5130
+ V && r.push({
5132
5131
  windowName: h.name,
5133
5132
  windowCategory: h.category,
5134
5133
  windowCenter: h.center,
5135
- wallSegment: z,
5136
- distance: S,
5137
- wallLengthRatio: v,
5138
- drawWindow: V
5134
+ wallSegment: V,
5135
+ distance: v,
5136
+ wallLengthRatio: S,
5137
+ drawWindow: z
5139
5138
  });
5140
5139
  }
5141
5140
  for (const h of r) {
@@ -5146,7 +5145,7 @@ function mi(n, t, e, o) {
5146
5145
  }
5147
5146
  return r;
5148
5147
  }
5149
- function Vi(n, t, e) {
5148
+ function zi(n, t, e) {
5150
5149
  const o = {
5151
5150
  printOnly: !1,
5152
5151
  ...e
@@ -5175,7 +5174,7 @@ function Vi(n, t, e) {
5175
5174
  }
5176
5175
  export {
5177
5176
  cn as computeContour,
5178
- zi as computeContourNew,
5177
+ Vi as computeContourNew,
5179
5178
  jn as computeLocalFloorZ,
5180
5179
  mi as findWindowWalls,
5181
5180
  yi as getAllGeometry,
@@ -5183,6 +5182,6 @@ export {
5183
5182
  bi as getColLine,
5184
5183
  Mi as getMergeMeaning,
5185
5184
  Zn as mergeCollinearSegments,
5186
- Vi as processData,
5185
+ zi as processData,
5187
5186
  xi as updateStEdPoint
5188
5187
  };