rm-graphical-computing 1.0.63 → 1.0.64

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.
Files changed (3) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1090 -1084
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,63 +5,63 @@ import * as y from "three";
5
5
  import { BufferGeometry as to, BufferAttribute as eo, Plane as no, Vector3 as zt, Matrix3 as Tn, MathUtils as Oe, Box3 as oo, Matrix4 as En, Ray as ro } from "three";
6
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
- let c = 0;
8
+ let u = 0;
9
9
  for (let h = 0; h < n.length; ++h) {
10
- const f = n[h];
11
- let u = 0;
12
- if (e !== (f.index !== null))
10
+ const g = n[h];
11
+ let c = 0;
12
+ if (e !== (g.index !== null))
13
13
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
14
- for (const p in f.attributes) {
15
- if (!o.has(p))
16
- return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + p + '" attribute exists among all geometries, or in none of them.'), null;
17
- r[p] === void 0 && (r[p] = []), r[p].push(f.attributes[p]), u++;
14
+ for (const m in g.attributes) {
15
+ if (!o.has(m))
16
+ return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + m + '" attribute exists among all geometries, or in none of them.'), null;
17
+ r[m] === void 0 && (r[m] = []), r[m].push(g.attributes[m]), c++;
18
18
  }
19
- if (u !== o.size)
19
+ if (c !== o.size)
20
20
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". Make sure all geometries have the same number of attributes."), null;
21
- if (a !== f.morphTargetsRelative)
21
+ if (a !== g.morphTargetsRelative)
22
22
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
23
- for (const p in f.morphAttributes) {
24
- if (!i.has(p))
23
+ for (const m in g.morphAttributes) {
24
+ if (!i.has(m))
25
25
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphAttributes must be consistent throughout all geometries."), null;
26
- s[p] === void 0 && (s[p] = []), s[p].push(f.morphAttributes[p]);
26
+ s[m] === void 0 && (s[m] = []), s[m].push(g.morphAttributes[m]);
27
27
  }
28
28
  if (t) {
29
- let p;
29
+ let m;
30
30
  if (e)
31
- p = f.index.count;
32
- else if (f.attributes.position !== void 0)
33
- p = f.attributes.position.count;
31
+ m = g.index.count;
32
+ else if (g.attributes.position !== void 0)
33
+ m = g.attributes.position.count;
34
34
  else
35
35
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". The geometry must have either an index or a position attribute"), null;
36
- l.addGroup(c, p, h), c += p;
36
+ l.addGroup(u, m, h), u += m;
37
37
  }
38
38
  }
39
39
  if (e) {
40
40
  let h = 0;
41
- const f = [];
42
- for (let u = 0; u < n.length; ++u) {
43
- const p = n[u].index;
44
- for (let w = 0; w < p.count; ++w)
45
- f.push(p.getX(w) + h);
46
- h += n[u].attributes.position.count;
41
+ const g = [];
42
+ for (let c = 0; c < n.length; ++c) {
43
+ const m = n[c].index;
44
+ for (let w = 0; w < m.count; ++w)
45
+ g.push(m.getX(w) + h);
46
+ h += n[c].attributes.position.count;
47
47
  }
48
- l.setIndex(f);
48
+ l.setIndex(g);
49
49
  }
50
50
  for (const h in r) {
51
- const f = Qe(r[h]);
52
- if (!f)
51
+ const g = Qe(r[h]);
52
+ if (!g)
53
53
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " attribute."), null;
54
- l.setAttribute(h, f);
54
+ l.setAttribute(h, g);
55
55
  }
56
56
  for (const h in s) {
57
- const f = s[h][0].length;
58
- if (f === 0) break;
57
+ const g = s[h][0].length;
58
+ if (g === 0) break;
59
59
  l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[h] = [];
60
- for (let u = 0; u < f; ++u) {
61
- const p = [];
60
+ for (let c = 0; c < g; ++c) {
61
+ const m = [];
62
62
  for (let x = 0; x < s[h].length; ++x)
63
- p.push(s[h][x][u]);
64
- const w = Qe(p);
63
+ m.push(s[h][x][c]);
64
+ const w = Qe(m);
65
65
  if (!w)
66
66
  return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + h + " morphAttribute."), null;
67
67
  l.morphAttributes[h].push(w);
@@ -71,8 +71,8 @@ function io(n, t = !1) {
71
71
  }
72
72
  function Qe(n) {
73
73
  let t, e, o, i = -1, r = 0;
74
- for (let c = 0; c < n.length; ++c) {
75
- const h = n[c];
74
+ for (let u = 0; u < n.length; ++u) {
75
+ const h = n[u];
76
76
  if (t === void 0 && (t = h.array.constructor), t !== h.array.constructor)
77
77
  return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
78
78
  if (e === void 0 && (e = h.itemSize), e !== h.itemSize)
@@ -85,14 +85,14 @@ function Qe(n) {
85
85
  }
86
86
  const s = new t(r), a = new eo(s, e, o);
87
87
  let l = 0;
88
- for (let c = 0; c < n.length; ++c) {
89
- const h = n[c];
88
+ for (let u = 0; u < n.length; ++u) {
89
+ const h = n[u];
90
90
  if (h.isInterleavedBufferAttribute) {
91
- const f = l / e;
92
- for (let u = 0, p = h.count; u < p; u++)
91
+ const g = l / e;
92
+ for (let c = 0, m = h.count; c < m; c++)
93
93
  for (let w = 0; w < e; w++) {
94
- const x = h.getComponent(u, w);
95
- a.setComponent(u + f, w, x);
94
+ const x = h.getComponent(c, w);
95
+ a.setComponent(c + g, w, x);
96
96
  }
97
97
  } else
98
98
  s.set(h.array, l);
@@ -106,10 +106,10 @@ const so = (n, t, e) => {
106
106
  let r = new y.BufferGeometry();
107
107
  r.setFromPoints(i), r.rotateX(-Math.PI / 2), e.add(new y.Line(r, o));
108
108
  }, te = (n, t, e, o, i = 1e-8) => {
109
- const r = t.x - n.x, s = t.y - n.y, a = o.x - e.x, l = o.y - e.y, c = r * l - s * a;
110
- if (Math.abs(c) < i) return null;
111
- const h = ((e.x - n.x) * l - (e.y - n.y) * a) / c, f = ((e.x - n.x) * s - (e.y - n.y) * r) / c;
112
- return h < -i || h > 1 + i || f < -i || f > 1 + i ? null : {
109
+ const r = t.x - n.x, s = t.y - n.y, a = o.x - e.x, l = o.y - e.y, u = r * l - s * a;
110
+ if (Math.abs(u) < i) return null;
111
+ const h = ((e.x - n.x) * l - (e.y - n.y) * a) / u, g = ((e.x - n.x) * s - (e.y - n.y) * r) / u;
112
+ return h < -i || h > 1 + i || g < -i || g > 1 + i ? null : {
113
113
  point: new y.Vector3(
114
114
  n.x + h * r,
115
115
  n.y + h * s,
@@ -127,29 +127,29 @@ const so = (n, t, e) => {
127
127
  // 最大宽度限制
128
128
  } = e, h = document.createElement("canvas").getContext("2d");
129
129
  h.font = `bold ${o}px ${i}`;
130
- const u = h.measureText(n).width;
131
- let p = Math.min(u + a * 2, l), w = o + a * 2;
130
+ const c = h.measureText(n).width;
131
+ let m = Math.min(c + a * 2, l), w = o + a * 2;
132
132
  const x = document.createElement("canvas");
133
- x.width = p, x.height = w;
133
+ x.width = m, x.height = w;
134
134
  const P = x.getContext("2d");
135
- P.fillStyle = r, P.fillRect(0, 0, p, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", u > l - a * 2 ? lo(P, n, p / 2, w / 2, l, o) : P.fillText(n, p / 2, w / 2);
136
- const M = new y.CanvasTexture(x), m = new y.SpriteMaterial({
135
+ P.fillStyle = r, P.fillRect(0, 0, m, w), P.fillStyle = s, P.font = `bold ${o}px ${i}`, P.textAlign = "center", P.textBaseline = "middle", c > l - a * 2 ? lo(P, n, m / 2, w / 2, l, o) : P.fillText(n, m / 2, w / 2);
136
+ const M = new y.CanvasTexture(x), d = new y.SpriteMaterial({
137
137
  map: M,
138
138
  depthTest: !1,
139
139
  transparent: !0
140
- }), d = new y.Sprite(m);
141
- d.position.set(t.x, t.y, t.z);
142
- const g = 5e-3;
143
- return d.scale.set(p * g, w * g, 1), d;
140
+ }), f = new y.Sprite(d);
141
+ f.position.set(t.x, t.y, t.z);
142
+ const p = 5e-3;
143
+ return f.scale.set(m * p, w * p, 1), f;
144
144
  };
145
145
  function lo(n, t, e, o, i, r) {
146
146
  const s = t.split("");
147
- let a = "", l = r * 1.2, c = o;
147
+ let a = "", l = r * 1.2, u = o;
148
148
  for (let h = 0; h < s.length; h++) {
149
- const f = a + s[h];
150
- n.measureText(f).width > i && h > 0 ? (n.fillText(a, e, c), a = s[h], c += l) : a = f;
149
+ const g = a + s[h];
150
+ n.measureText(g).width > i && h > 0 ? (n.fillText(a, e, u), a = s[h], u += l) : a = g;
151
151
  }
152
- n.fillText(a, e, c);
152
+ n.fillText(a, e, u);
153
153
  }
154
154
  const oe = (n, t, e = 0.01) => {
155
155
  const o = Math.sqrt(n.x * n.x + n.y * n.y + n.z * n.z), i = Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z);
@@ -158,33 +158,33 @@ const oe = (n, t, e = 0.01) => {
158
158
  const r = { x: n.x / o, y: n.y / o, z: n.z / o }, s = { x: t.x / i, y: t.y / i, z: t.z / i };
159
159
  let a = r.x * s.x + r.y * s.y + r.z * s.z;
160
160
  a = Math.max(-1, Math.min(1, a));
161
- const l = Math.acos(Math.abs(a)), c = l <= e;
161
+ const l = Math.acos(Math.abs(a)), u = l <= e;
162
162
  return {
163
- parallel: c,
164
- sameDirection: c ? a > 0 : null,
163
+ parallel: u,
164
+ sameDirection: u ? a > 0 : null,
165
165
  angle: l
166
166
  };
167
167
  }, co = (n, t, e, o) => {
168
168
  const i = n;
169
169
  let r = [];
170
- if (o && o.length && (r = o.map((V) => V.clone())), !i || i.length < 4) return {};
170
+ if (o && o.length && (r = o.map((z) => z.clone())), !i || i.length < 4) return {};
171
171
  const s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = s.clone().cross(a).normalize();
172
- let c = 1 / 0, h = -1 / 0, f = 1 / 0, u = -1 / 0;
173
- for (const V of i) {
174
- const v = V.dot(s), S = V.dot(a);
175
- v < c && (c = v), v > h && (h = v), S < f && (f = S), S > u && (u = S);
176
- }
177
- const p = i[0].dot(l), w = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(f)).add(l.clone().multiplyScalar(p)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p)), M = s.clone().multiplyScalar(c).add(a.clone().multiplyScalar(u)).add(l.clone().multiplyScalar(p));
178
- let m = [w, x, P, M], d = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
- d && d.parallel && (m = [w, M, P, x]);
180
- let g = 0;
172
+ let u = 1 / 0, h = -1 / 0, g = 1 / 0, c = -1 / 0;
173
+ for (const z of i) {
174
+ const v = z.dot(s), S = z.dot(a);
175
+ v < u && (u = v), v > h && (h = v), S < g && (g = S), S > c && (c = S);
176
+ }
177
+ const m = i[0].dot(l), w = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(g)).add(l.clone().multiplyScalar(m)), x = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(g)).add(l.clone().multiplyScalar(m)), P = s.clone().multiplyScalar(h).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(m)), M = s.clone().multiplyScalar(u).add(a.clone().multiplyScalar(c)).add(l.clone().multiplyScalar(m));
178
+ let d = [w, x, P, M], f = oe(new y.Vector3().subVectors(w, x), new y.Vector3(0, 0, 1));
179
+ f && f.parallel && (d = [w, M, P, x]);
180
+ let p = 0;
181
181
  if (o.length > 0) {
182
- const V = new y.Vector3().subVectors(m[1], m[0]).normalize(), v = V.clone().negate(), S = new y.Vector3().subVectors(m[3], m[0]).normalize(), z = S.clone().negate();
183
- let D = m[0].distanceTo(m[1]), _ = m[0].distanceTo(m[3]), T = D / t, E = _ / e, A = 1e-3;
182
+ const z = new y.Vector3().subVectors(d[1], d[0]).normalize(), v = z.clone().negate(), S = new y.Vector3().subVectors(d[3], d[0]).normalize(), V = S.clone().negate();
183
+ let D = d[0].distanceTo(d[1]), _ = d[0].distanceTo(d[3]), T = D / t, E = _ / e, A = 1e-3;
184
184
  for (let O = 0; O < T; O++) {
185
- let I = m[0], B = 0;
185
+ let I = d[0], B = 0;
186
186
  for (let R = 0; R < E; R++) {
187
- let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
187
+ let W = I.clone().addScaledVector(z, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
188
188
  for (let X = 0; X < r.length; X++)
189
189
  if (r[X].distanceTo(H) < A) {
190
190
  B++;
@@ -194,11 +194,11 @@ const oe = (n, t, e = 0.01) => {
194
194
  }
195
195
  if (B >= E / 2)
196
196
  break;
197
- g += B, m[0] = m[0].addScaledVector(V, t), m[3] = m[3].addScaledVector(V, t);
197
+ p += B, d[0] = d[0].addScaledVector(z, t), d[3] = d[3].addScaledVector(z, t);
198
198
  }
199
- D = m[0].distanceTo(m[1]), T = D / t;
199
+ D = d[0].distanceTo(d[1]), T = D / t;
200
200
  for (let O = 0; O < T; O++) {
201
- let I = m[1], B = 0;
201
+ let I = d[1], B = 0;
202
202
  for (let R = 0; R < E; R++) {
203
203
  let W = I.clone().addScaledVector(v, t), C = W.clone().addScaledVector(S, e), L = I.clone().addScaledVector(S, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
204
204
  for (let X = 0; X < r.length; X++)
@@ -210,13 +210,13 @@ const oe = (n, t, e = 0.01) => {
210
210
  }
211
211
  if (B >= E / 2)
212
212
  break;
213
- g += B, m[1] = m[1].addScaledVector(v, t), m[2] = m[2].addScaledVector(v, t);
213
+ p += B, d[1] = d[1].addScaledVector(v, t), d[2] = d[2].addScaledVector(v, t);
214
214
  }
215
- D = m[0].distanceTo(m[1]), T = D / t;
215
+ D = d[0].distanceTo(d[1]), T = D / t;
216
216
  for (let O = 0; O < E; O++) {
217
- let I = m[3], B = 0;
217
+ let I = d[3], B = 0;
218
218
  for (let R = 0; R < T; R++) {
219
- let W = I.clone().addScaledVector(V, t), C = W.clone().addScaledVector(z, e), L = I.clone().addScaledVector(z, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
219
+ let W = I.clone().addScaledVector(z, t), C = W.clone().addScaledVector(V, e), L = I.clone().addScaledVector(V, e), H = new y.Vector3().add(I).add(W).add(C).add(L).multiplyScalar(0.25);
220
220
  for (let X = 0; X < r.length; X++)
221
221
  if (r[X].distanceTo(H) < A) {
222
222
  B++;
@@ -226,14 +226,14 @@ const oe = (n, t, e = 0.01) => {
226
226
  }
227
227
  if (B >= T / 2)
228
228
  break;
229
- g += B, m[2] = m[2].addScaledVector(z, e), m[3] = m[3].addScaledVector(z, e);
229
+ p += B, d[2] = d[2].addScaledVector(V, e), d[3] = d[3].addScaledVector(V, e);
230
230
  }
231
231
  }
232
- const b = m[0].distanceTo(m[1]) * m[0].distanceTo(m[3]);
232
+ const b = d[0].distanceTo(d[1]) * d[0].distanceTo(d[3]);
233
233
  return {
234
- facePoints: m,
234
+ facePoints: d,
235
235
  boxArea: b,
236
- totalInPlaneNum: g
236
+ totalInPlaneNum: p
237
237
  };
238
238
  }, Jt = (n, t, e, o, i = y.MathUtils.degToRad(8)) => {
239
239
  const r = new y.Vector3(), s = new y.Vector3();
@@ -244,9 +244,9 @@ const oe = (n, t, e = 0.01) => {
244
244
  new y.Vector3(o.x, o.y, 0),
245
245
  new y.Vector3(e.x, e.y, 0)
246
246
  ).normalize();
247
- const a = r.dot(s), l = Math.acos(Math.min(Math.abs(a), 1)), c = 1 - Math.min(l / i, 1), h = a > 0 ? "same" : "opposite";
247
+ const a = r.dot(s), l = Math.acos(Math.min(Math.abs(a), 1)), u = 1 - Math.min(l / i, 1), h = a > 0 ? "same" : "opposite";
248
248
  return {
249
- parallelism: c,
249
+ parallelism: u,
250
250
  // 平行率 0-1
251
251
  angle: l,
252
252
  // 实际夹角(弧度)
@@ -264,17 +264,17 @@ const oe = (n, t, e = 0.01) => {
264
264
  if (s === 0 || a === 0)
265
265
  return { rate: NaN, angle: NaN, isPerpendicular: !1, isParallel: !1 };
266
266
  i.normalize(), r.normalize();
267
- const l = Math.abs(i.dot(r)), c = Math.min(1, Math.max(0, l)), h = Math.acos(c), f = y.MathUtils.radToDeg(h), u = 1 - c;
267
+ const l = Math.abs(i.dot(r)), u = Math.min(1, Math.max(0, l)), h = Math.acos(u), g = y.MathUtils.radToDeg(h), c = 1 - u;
268
268
  return {
269
- rate: u,
269
+ rate: c,
270
270
  // 垂直率 0~1
271
- percent: `${(u * 100).toFixed(2)}%`,
271
+ percent: `${(c * 100).toFixed(2)}%`,
272
272
  // 垂直率百分比
273
- angle: f,
273
+ angle: g,
274
274
  // 夹角(度,0~90)
275
- isPerpendicular: Math.abs(f - 90) < 0.01,
275
+ isPerpendicular: Math.abs(g - 90) < 0.01,
276
276
  // 是否垂直
277
- isParallel: f < 0.01
277
+ isParallel: g < 0.01
278
278
  // 是否平行
279
279
  };
280
280
  }, ee = (n, t, e = !1) => new y.Vector3((n.x + t.x) / 2, (n.y + t.y) / 2, e ? 0 : (n.z + t.z) / 2), ne = (n, t, e, o, i = {}) => {
@@ -284,9 +284,9 @@ const oe = (n, t, e = 0.01) => {
284
284
  distanceThreshold: a = 2,
285
285
  overlapThreshold: l = 0.01
286
286
  // 投影重叠量大于此值才算 overlap
287
- } = i, c = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e), f = c.clone().normalize(), u = h.clone().normalize();
288
- let p = y.MathUtils.clamp(f.dot(u), -1, 1);
289
- const w = Math.acos(Math.abs(p)), x = y.MathUtils.radToDeg(w);
287
+ } = i, u = new y.Vector3().subVectors(t, n), h = new y.Vector3().subVectors(o, e), g = u.clone().normalize(), c = h.clone().normalize();
288
+ let m = y.MathUtils.clamp(g.dot(c), -1, 1);
289
+ const w = Math.acos(Math.abs(m)), x = y.MathUtils.radToDeg(w);
290
290
  if (w > r)
291
291
  return {
292
292
  type: "not_parallel",
@@ -297,18 +297,18 @@ const oe = (n, t, e = 0.01) => {
297
297
  overlap: null,
298
298
  closestDistance: null
299
299
  };
300
- p < 0 && u.negate();
301
- const P = new y.Vector3().addVectors(f, u).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), m = Je(e, M, f), d = Je(o, M, f), g = (m + d) / 2, b = Math.max(m, d), V = n.dot(P), v = t.dot(P), S = e.dot(P), z = o.dot(P), D = Math.min(V, v), _ = Math.max(V, v), T = Math.min(S, z), E = Math.max(S, z), A = _ - D, O = E - T, I = Math.min(A, O), B = Math.min(_, E) - Math.max(D, T), R = B < 0 ? -B : 0, W = B > 0 ? B : 0, C = I > 0 ? W / I : 0, L = uo(
300
+ m < 0 && c.negate();
301
+ const P = new y.Vector3().addVectors(g, c).normalize(), M = new y.Vector3().addVectors(n, t).multiplyScalar(0.5), d = Je(e, M, g), f = Je(o, M, g), p = (d + f) / 2, b = Math.max(d, f), z = n.dot(P), v = t.dot(P), S = e.dot(P), V = o.dot(P), D = Math.min(z, v), _ = Math.max(z, v), T = Math.min(S, V), E = Math.max(S, V), A = _ - D, O = E - T, I = Math.min(A, O), B = Math.min(_, E) - Math.max(D, T), R = B < 0 ? -B : 0, W = B > 0 ? B : 0, C = I > 0 ? W / I : 0, L = uo(
302
302
  n,
303
303
  t,
304
304
  e,
305
305
  o
306
- ), H = w <= s && g < a;
306
+ ), H = w <= s && p < a;
307
307
  let X;
308
308
  return H ? X = C > 0.5 ? "collinear_overlap" : "collinear_gap" : w <= r && (X = "parallel_offset"), {
309
309
  type: X,
310
310
  angleDeg: x,
311
- avgPerpendicularDistance: g,
311
+ avgPerpendicularDistance: p,
312
312
  maxPerpendicularDistance: b,
313
313
  gap: R,
314
314
  overlap: W,
@@ -320,39 +320,39 @@ function Je(n, t, e) {
320
320
  return new y.Vector3().subVectors(o, r).length();
321
321
  }
322
322
  function uo(n, t, e, o) {
323
- const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = new y.Vector3().subVectors(e, n), a = i.dot(i), l = i.dot(r), c = r.dot(r), h = i.dot(s), f = r.dot(s), u = a * c - l * l;
324
- let p, w;
325
- u < 1e-10 ? (p = 0, w = c !== 0 ? f / c : 0) : (p = (l * f - c * h) / u, w = (a * f - l * h) / u), p = y.MathUtils.clamp(p, 0, 1), w = c !== 0 ? y.MathUtils.clamp((l * p + f) / c, 0, 1) : 0, p = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
326
- const x = n.clone().add(i.clone().multiplyScalar(p)), P = e.clone().add(r.clone().multiplyScalar(w));
323
+ const i = new y.Vector3().subVectors(t, n), r = new y.Vector3().subVectors(o, e), s = new y.Vector3().subVectors(e, n), a = i.dot(i), l = i.dot(r), u = r.dot(r), h = i.dot(s), g = r.dot(s), c = a * u - l * l;
324
+ let m, w;
325
+ c < 1e-10 ? (m = 0, w = u !== 0 ? g / u : 0) : (m = (l * g - u * h) / c, w = (a * g - l * h) / c), m = y.MathUtils.clamp(m, 0, 1), w = u !== 0 ? y.MathUtils.clamp((l * m + g) / u, 0, 1) : 0, m = a !== 0 ? y.MathUtils.clamp((l * w - h) / a, 0, 1) : 0;
326
+ const x = n.clone().add(i.clone().multiplyScalar(m)), P = e.clone().add(r.clone().multiplyScalar(w));
327
327
  return x.distanceTo(P);
328
328
  }
329
329
  const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), ho = (n) => {
330
330
  let t = new y.Vector3(n.start.x, n.start.y, n.start.z), e = new y.Vector3(n.end.x, n.end.y, n.end.z), o = t.distanceTo(e), i = n.rooftopPz - n.start.z, r = tn(o, 100), s = tn(i, 70), a = i / s, l = /* @__PURE__ */ new Map();
331
331
  for (let x = 0; x < s; x++)
332
332
  l.set((x + 1) * a, { count: 0, minZ: 1 / 0, maxZ: -1 / 0 });
333
- let c = new y.Line3(t, e);
334
- const h = n.originalPoints, f = new y.Vector3();
333
+ let u = new y.Line3(t, e);
334
+ const h = n.originalPoints, g = new y.Vector3();
335
335
  for (let x = 0; x < h.length; x++) {
336
336
  const P = h[x];
337
- let m = c.closestPointToPoint(P, !0, f).distanceTo(P);
338
- const d = Math.floor(m / a);
339
- if (d < s) {
340
- const g = l.get((d + 1) * a);
341
- g.count++, P.z < g.minZ && (g.minZ = P.z), P.z > g.maxZ && (g.maxZ = P.z);
337
+ let d = u.closestPointToPoint(P, !0, g).distanceTo(P);
338
+ const f = Math.floor(d / a);
339
+ if (f < s) {
340
+ const p = l.get((f + 1) * a);
341
+ p.count++, P.z < p.minZ && (p.minZ = P.z), P.z > p.maxZ && (p.maxZ = P.z);
342
342
  }
343
343
  }
344
- let u, p, w = r / 2;
344
+ let c, m, w = r / 2;
345
345
  for (const [x, P] of l)
346
346
  if (P.count >= w) {
347
- u = P.minZ;
347
+ c = P.minZ;
348
348
  break;
349
349
  }
350
350
  for (const [x, P] of [...l.entries()].reverse())
351
351
  if (P.count >= w) {
352
- p = P.maxZ;
352
+ m = P.maxZ;
353
353
  break;
354
354
  }
355
- return { minZ: u, maxZ: p };
355
+ return { minZ: c, maxZ: m };
356
356
  }, ze = (n, t, e) => {
357
357
  let o = new y.Plane();
358
358
  const i = new y.Vector3(n.x, n.y, n.z), r = new y.Vector3(t.x, t.y, t.z), s = new y.Vector3(t.x, t.y, t.z + 5);
@@ -362,28 +362,28 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
362
362
  const M = new y.Vector3();
363
363
  o.projectPoint(P, M), l.push(M.clone()), M.z = i.z, a.push(M);
364
364
  });
365
- let c = new y.Vector3(), h = new y.Vector3();
366
- o.projectPoint(i, c), o.projectPoint(r, h);
367
- const f = new y.Line3(c, h), u = [], p = [], w = [];
365
+ let u = new y.Vector3(), h = new y.Vector3();
366
+ o.projectPoint(i, u), o.projectPoint(r, h);
367
+ const g = new y.Line3(u, h), c = [], m = [], w = [];
368
368
  let x = new y.Vector3();
369
369
  return a.forEach((P, M) => {
370
- f.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (u.push(e[M]), p.push(l[M])) : w.push(P);
371
- }), { newOriginalPoints: u, newProjectPoints: w, newOnLinePoints: p };
370
+ g.closestPointToPoint(P, !0, x).distanceTo(P) < 1e-3 ? (c.push(e[M]), m.push(l[M])) : w.push(P);
371
+ }), { newOriginalPoints: c, newProjectPoints: w, newOnLinePoints: m };
372
372
  }, fo = (n) => {
373
- function t(e, o, i, r, s, a, l, c, h) {
374
- let f = new y.Line3(e, o), u = /* @__PURE__ */ new Map(), p = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
373
+ function t(e, o, i, r, s, a, l, u, h) {
374
+ let g = new y.Line3(e, o), c = /* @__PURE__ */ new Map(), m = new y.Vector3(), w = e.clone(), x = o.clone(), P = 0;
375
375
  for (; ; ) {
376
- let M = /* @__PURE__ */ new Map(), m = 0;
377
- for (let d = 0; d < h.checkResults.length; d++)
378
- if (!(h.checkResults[d].allCenterPoints.length / c * 100 < 1))
379
- for (let b = 0; b < h.checkResults[d].allCenterPoints.length; b++) {
380
- if (u.has(d) && u.get(d).removePtsIndex.includes(b))
376
+ let M = /* @__PURE__ */ new Map(), d = 0;
377
+ for (let f = 0; f < h.checkResults.length; f++)
378
+ if (!(h.checkResults[f].allCenterPoints.length / u * 100 < 1))
379
+ for (let b = 0; b < h.checkResults[f].allCenterPoints.length; b++) {
380
+ if (c.has(f) && c.get(f).removePtsIndex.includes(b))
381
381
  continue;
382
- let V = h.checkResults[d].allCenterPoints[b];
383
- V = new y.Vector3(V.x, V.y, V.z);
384
- let v = f.closestPointToPoint(V, !0, p), S = V.distanceTo(v);
385
- Math.abs(S - s) < 0.01 && (m++, M.has(d) ? M.get(d).removePtsIndex.push(b) : M.set(d, {
386
- index: d,
382
+ let z = h.checkResults[f].allCenterPoints[b];
383
+ z = new y.Vector3(z.x, z.y, z.z);
384
+ let v = g.closestPointToPoint(z, !0, m), S = z.distanceTo(v);
385
+ Math.abs(S - s) < 0.01 && (d++, M.has(f) ? M.get(f).removePtsIndex.push(b) : M.set(f, {
386
+ index: f,
387
387
  removePtsIndex: [b]
388
388
  }));
389
389
  }
@@ -391,22 +391,22 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
391
391
  e = w, o = x;
392
392
  break;
393
393
  }
394
- if (m < a / 20 * 18 || m == 0) {
395
- M.clear(), l - P < 5 && (e = w, o = x, u.clear());
394
+ if (d < a / 20 * 18 || d == 0) {
395
+ M.clear(), l - P < 5 && (e = w, o = x, c.clear());
396
396
  break;
397
397
  } else {
398
398
  P++;
399
- for (const [d, g] of M)
400
- u.has(d) ? u.get(d).removePtsIndex.push(...g.removePtsIndex) : u.set(d, g);
401
- M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), f.set(e, o);
399
+ for (const [f, p] of M)
400
+ c.has(f) ? c.get(f).removePtsIndex.push(...p.removePtsIndex) : c.set(f, p);
401
+ M.clear(), e = e.addScaledVector(i, r), o = o.addScaledVector(i, r), g.set(e, o);
402
402
  }
403
403
  }
404
- if (u.size > 0 && P != l)
405
- for (const [M, m] of u) {
406
- let d = [], g = [];
404
+ if (c.size > 0 && P != l)
405
+ for (const [M, d] of c) {
406
+ let f = [], p = [];
407
407
  for (let b = 0; b < h.checkResults[M].allCenterPoints.length; b++)
408
- m.removePtsIndex.includes(b) || (d.push(h.checkResults[M].allCenterPoints[b]), g.push(h.checkResults[M].originalVertices[b]));
409
- h.checkResults[M].allCenterPoints = d, h.checkResults[M].originalVertices = g;
408
+ d.removePtsIndex.includes(b) || (f.push(h.checkResults[M].allCenterPoints[b]), p.push(h.checkResults[M].originalVertices[b]));
409
+ h.checkResults[M].allCenterPoints = f, h.checkResults[M].originalVertices = p;
410
410
  }
411
411
  }
412
412
  for (let e = 0; e < n.length; e++) {
@@ -418,20 +418,20 @@ const tn = (n, t) => Math.round(Math.max(5, Math.min(350, t * Math.sqrt(n)))), h
418
418
  continue;
419
419
  if (o.checkResults[0].originalVertices && o.checkResults[0].originalVertices.length > 0) {
420
420
  const S = o.checkResults[0].originalVertices[0];
421
- let [z, D, _, T] = S;
422
- z = new y.Vector3(z.x, z.y, z.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), T = new y.Vector3(T.x, T.y, T.z), i = z.distanceTo(D), r = z.distanceTo(T);
423
- let E = new y.Vector3().subVectors(z, D).normalize(), A = oe(E, new y.Vector3(0, 0, 1));
421
+ let [V, D, _, T] = S;
422
+ V = new y.Vector3(V.x, V.y, V.z), D = new y.Vector3(D.x, D.y, D.z), _ = new y.Vector3(_.x, _.y, _.z), T = new y.Vector3(T.x, T.y, T.z), i = V.distanceTo(D), r = V.distanceTo(T);
423
+ let E = new y.Vector3().subVectors(V, D).normalize(), A = oe(E, new y.Vector3(0, 0, 1));
424
424
  A && A.parallel && ([r, i] = [i, r]);
425
425
  }
426
426
  if (i < 0 || r < 0)
427
427
  continue;
428
428
  let s = new y.Vector3(o.start.x, o.start.y, o.start.z), a = new y.Vector3(o.end.x, o.end.y, o.end.z);
429
- const l = s.distanceTo(a), c = o.rooftopPz - o.start.z, h = Math.ceil(l / i), f = Math.ceil(c / r);
430
- let u = s.clone(), p = a.clone(), w = p.clone().add(new y.Vector3(0, 0, c)), x = u.clone().add(new y.Vector3(0, 0, c)), P = new y.Vector3().subVectors(p, u).normalize(), M = P.clone().negate();
431
- new y.Vector3().subVectors(w, u).normalize().clone().negate();
432
- let d = i / 2, g = l * c, b = i * r, V = g / b;
433
- t(u, x, P, i, d, f, h, V, o), t(p, w, M, i, d, f, h, V, o), o.start = u, o.end = p;
434
- const { newOriginalPoints: v } = ze(u, p, o.originalPoints);
429
+ const l = s.distanceTo(a), u = o.rooftopPz - o.start.z, h = Math.ceil(l / i), g = Math.ceil(u / r);
430
+ let c = s.clone(), m = a.clone(), w = m.clone().add(new y.Vector3(0, 0, u)), x = c.clone().add(new y.Vector3(0, 0, u)), P = new y.Vector3().subVectors(m, c).normalize(), M = P.clone().negate();
431
+ new y.Vector3().subVectors(w, c).normalize().clone().negate();
432
+ let f = i / 2, p = l * u, b = i * r, z = p / b;
433
+ t(c, x, P, i, f, g, h, z, o), t(m, w, M, i, f, g, h, z, o), o.start = c, o.end = m;
434
+ const { newOriginalPoints: v } = ze(c, m, o.originalPoints);
435
435
  o.originalPoints = v;
436
436
  }
437
437
  }, Rt = (n, t) => new y.Vector3(n.x, n.y, 0).distanceTo(new y.Vector3(t.x, t.y, 0)), mo = (n, t, e = 1e-6) => {
@@ -503,7 +503,7 @@ class yo {
503
503
  const l = [t, e, o, i];
504
504
  for (let P = 0; P < l.length; P++)
505
505
  this.isValidVector3(l[P]) || (console.error(`点${P + 1}包含无效数据:`, l[P]), l[P] = new y.Vector3(P, 0, P));
506
- const c = new y.BufferGeometry(), h = new Float32Array([
506
+ const u = new y.BufferGeometry(), h = new Float32Array([
507
507
  l[0].x,
508
508
  l[0].y,
509
509
  l[0].z,
@@ -520,7 +520,7 @@ class yo {
520
520
  l[3].y,
521
521
  l[3].z
522
522
  // 左上
523
- ]), f = [0, 1, 2, 0, 2, 3], u = new Float32Array([
523
+ ]), g = [0, 1, 2, 0, 2, 3], c = new Float32Array([
524
524
  0,
525
525
  0,
526
526
  // 左下
@@ -534,9 +534,9 @@ class yo {
534
534
  1
535
535
  // 左上
536
536
  ]);
537
- c.setAttribute("position", new y.BufferAttribute(h, 3)), c.setAttribute("uv", new y.BufferAttribute(u, 2)), c.setIndex(f), c.computeVertexNormals();
538
- const p = new y.Mesh(c, r), w = new y.EdgesGeometry(c), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
539
- return s.add(x), p;
537
+ u.setAttribute("position", new y.BufferAttribute(h, 3)), u.setAttribute("uv", new y.BufferAttribute(c, 2)), u.setIndex(g), u.computeVertexNormals();
538
+ const m = new y.Mesh(u, r), w = new y.EdgesGeometry(u), x = new y.LineSegments(w, new y.LineBasicMaterial({ color: a }));
539
+ return s.add(x), m;
540
540
  }
541
541
  /**
542
542
  * 将一面墙体按 rows×cols 细分成小格 Mesh,每格存入 wallGroup。
@@ -549,31 +549,31 @@ class yo {
549
549
  const s = [];
550
550
  if (!t || !t.start || !t.end || isNaN(t.rooftopPz))
551
551
  return s;
552
- const a = new y.Vector3(t.start.x, t.start.y, t.start.z), l = new y.Vector3(t.end.x, t.end.y, t.end.z), c = new y.Vector3(t.end.x, t.end.y, t.rooftopPz), h = new y.Vector3(t.start.x, t.start.y, t.rooftopPz), f = [a, l, c, h];
553
- for (let m = 0; m < f.length; m++)
554
- if (!this.isValidVector3(f[m]))
555
- return console.error(`墙体基础点${m}无效:`, f[m]), s;
556
- const u = a.distanceTo(l), p = Math.abs(t.rooftopPz - t.start.z);
557
- if (u === 0 || p === 0)
552
+ const a = new y.Vector3(t.start.x, t.start.y, t.start.z), l = new y.Vector3(t.end.x, t.end.y, t.end.z), u = new y.Vector3(t.end.x, t.end.y, t.rooftopPz), h = new y.Vector3(t.start.x, t.start.y, t.rooftopPz), g = [a, l, u, h];
553
+ for (let d = 0; d < g.length; d++)
554
+ if (!this.isValidVector3(g[d]))
555
+ return console.error(`墙体基础点${d}无效:`, g[d]), s;
556
+ const c = a.distanceTo(l), m = Math.abs(t.rooftopPz - t.start.z);
557
+ if (c === 0 || m === 0)
558
558
  return console.error("墙体宽度或高度为0"), console.log("line.rooftopPz", t.rooftopPz), console.log("bottomLeft", a), console.log("bottomRight", l), console.log(t.length), s;
559
- const w = u / o, x = p / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
560
- for (let m = 0; m < e; m++)
561
- for (let d = 0; d < o; d++)
559
+ const w = c / o, x = m / e, P = new y.Vector3().subVectors(l, a).normalize(), M = new y.Vector3(0, 0, 1);
560
+ for (let d = 0; d < e; d++)
561
+ for (let f = 0; f < o; f++)
562
562
  try {
563
- const g = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar(m * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar(m * x)), V = new y.Vector3().copy(a).add(P.clone().multiplyScalar((d + 1) * w)).add(M.clone().multiplyScalar((m + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(d * w)).add(M.clone().multiplyScalar((m + 1) * x)), S = {
564
- points: [g, b, V, v],
563
+ const p = new y.Vector3().copy(a).add(P.clone().multiplyScalar(f * w)).add(M.clone().multiplyScalar(d * x)), b = new y.Vector3().copy(a).add(P.clone().multiplyScalar((f + 1) * w)).add(M.clone().multiplyScalar(d * x)), z = new y.Vector3().copy(a).add(P.clone().multiplyScalar((f + 1) * w)).add(M.clone().multiplyScalar((d + 1) * x)), v = new y.Vector3().copy(a).add(P.clone().multiplyScalar(f * w)).add(M.clone().multiplyScalar((d + 1) * x)), S = {
564
+ points: [p, b, z, v],
565
565
  userData: {}
566
566
  };
567
567
  S.userData = {
568
568
  type: "wallSegment",
569
- row: m,
570
- col: d,
569
+ row: d,
570
+ col: f,
571
571
  originalMaterial: i,
572
572
  width: w,
573
573
  height: x
574
574
  }, s.push(S);
575
- } catch (g) {
576
- console.error(`创建墙体小平面(${m}, ${d})时出错:`, g);
575
+ } catch (p) {
576
+ console.error(`创建墙体小平面(${d}, ${f})时出错:`, p);
577
577
  }
578
578
  return s;
579
579
  }
@@ -813,9 +813,9 @@ class yo {
813
813
  }
814
814
  evaluateSegmentByArea(t, e, o, i) {
815
815
  if (e === 0) return !1;
816
- const r = t.area, s = t.minRequiredPoints, a = t.expectedDensity, l = e / Math.max(r, 1e-3), c = e >= s, h = l >= a * 0.3;
817
- let f = !0;
818
- return r < 0.5 && e > 0 && (f = this.checkSmallAreaDistribution(t, o, i)), c && h && f;
816
+ const r = t.area, s = t.minRequiredPoints, a = t.expectedDensity, l = e / Math.max(r, 1e-3), u = e >= s, h = l >= a * 0.3;
817
+ let g = !0;
818
+ return r < 0.5 && e > 0 && (g = this.checkSmallAreaDistribution(t, o, i)), u && h && g;
819
819
  }
820
820
  checkSmallAreaDistribution(t, e, o) {
821
821
  if (e.length < 2) return !0;
@@ -873,23 +873,23 @@ class yo {
873
873
  }), this.results.totalSegments = r.length;
874
874
  for (const s of r) {
875
875
  if (s.vertices.length < 4) continue;
876
- const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [c, h, f, u] = s.vertices, p = new y.Vector3().subVectors(h, c).normalize(), w = new y.Vector3().subVectors(u, c).normalize(), x = c.distanceTo(h), P = c.distanceTo(u), M = new y.Plane();
877
- M.setFromCoplanarPoints(c, h, u);
878
- const m = x / 2, d = P / 2;
879
- for (let g = 0; g < e.length; g++)
876
+ const a = s.userData.center, l = `row${s.userData.row}_col${s.userData.col}`, [u, h, g, c] = s.vertices, m = new y.Vector3().subVectors(h, u).normalize(), w = new y.Vector3().subVectors(c, u).normalize(), x = u.distanceTo(h), P = u.distanceTo(c), M = new y.Plane();
877
+ M.setFromCoplanarPoints(u, h, c);
878
+ const d = x / 2, f = P / 2;
879
+ for (let p = 0; p < e.length; p++)
880
880
  this.isPointInWallSegmentOptimized(
881
- e[g],
881
+ e[p],
882
882
  a,
883
883
  M,
884
- c,
885
- p,
884
+ u,
885
+ m,
886
886
  w,
887
887
  x,
888
888
  P,
889
- m,
890
889
  d,
890
+ f,
891
891
  o
892
- ) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(g));
892
+ ) && (this.results.pointsInSegments.has(l) || this.results.pointsInSegments.set(l, []), this.results.pointsInSegments.get(l).push(p));
893
893
  }
894
894
  return r.forEach((s) => {
895
895
  const a = `row${s.userData.row}_col${s.userData.col}`, l = this.results.pointsInSegments.has(a) ? this.results.pointsInSegments.get(a).length : 0;
@@ -911,14 +911,14 @@ class yo {
911
911
  }), this.results.analysisTime = performance.now() - i, this.printAnalysisResults(), this.results;
912
912
  }
913
913
  // 优化后的判断函数(移出重复计算)
914
- isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, c, h, f) {
915
- if (Math.abs(o.distanceToPoint(t)) > f)
914
+ isPointInWallSegmentOptimized(t, e, o, i, r, s, a, l, u, h, g) {
915
+ if (Math.abs(o.distanceToPoint(t)) > g)
916
916
  return !1;
917
- const p = new y.Vector3().subVectors(t, e), w = Math.abs(p.dot(r)), x = Math.abs(p.dot(s));
918
- if (w > c && x > h)
917
+ const m = new y.Vector3().subVectors(t, e), w = Math.abs(m.dot(r)), x = Math.abs(m.dot(s));
918
+ if (w > u && x > h)
919
919
  return !1;
920
- const P = new y.Vector3().subVectors(t, i), M = P.dot(r), m = P.dot(s), d = M >= -f && M <= a + f, g = m >= -f && m <= l + f;
921
- return d && g;
920
+ const P = new y.Vector3().subVectors(t, i), M = P.dot(r), d = P.dot(s), f = M >= -g && M <= a + g, p = d >= -g && d <= l + g;
921
+ return f && p;
922
922
  }
923
923
  // 判断点是否在细分墙体平面内
924
924
  isPointInWallSegment(t, e, o, i = 0.1) {
@@ -932,13 +932,13 @@ class yo {
932
932
  }
933
933
  // 判断点是否在任意旋转的墙体平面内
934
934
  isPointInRotatedWall(t, e, o, i = 0.1) {
935
- const [r, s, a, l] = t, c = new y.Plane();
936
- if (c.setFromCoplanarPoints(r, s, l), Math.abs(c.distanceToPoint(e)) > i)
935
+ const [r, s, a, l] = t, u = new y.Plane();
936
+ if (u.setFromCoplanarPoints(r, s, l), Math.abs(u.distanceToPoint(e)) > i)
937
937
  return !1;
938
- const f = new y.Vector3().subVectors(s, r).normalize(), u = new y.Vector3().subVectors(l, r).normalize();
939
- new y.Vector3().crossVectors(f, u).normalize();
940
- const p = new y.Vector3().subVectors(e, r), w = p.dot(f), x = p.dot(u), P = r.distanceTo(s), M = r.distanceTo(l), m = w >= -i && w <= P + i, d = x >= -i && x <= M + i;
941
- return m && d && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
938
+ const g = new y.Vector3().subVectors(s, r).normalize(), c = new y.Vector3().subVectors(l, r).normalize();
939
+ new y.Vector3().crossVectors(g, c).normalize();
940
+ const m = new y.Vector3().subVectors(e, r), w = m.dot(g), x = m.dot(c), P = r.distanceTo(s), M = r.distanceTo(l), d = w >= -i && w <= P + i, f = x >= -i && x <= M + i;
941
+ return d && f && o.distanceTo(e) < P / 2 && o.distanceTo(e) < M / 2;
942
942
  }
943
943
  // 优化顶点获取(添加缓存)
944
944
  getWorldVertices(t) {
@@ -1006,23 +1006,23 @@ class yo {
1006
1006
  // }
1007
1007
  // 高亮没有点的平面并进行聚类
1008
1008
  highlightEmptySegments(t, e, o, i = 1) {
1009
- var f;
1009
+ var g;
1010
1010
  if (!this.results) {
1011
1011
  console.warn("请先运行分析函数");
1012
1012
  return;
1013
1013
  }
1014
1014
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1015
- this.results.missingSegments.forEach((u) => {
1016
- r.set(u.segmentKey, u), s.has(u.row) || s.set(u.row, /* @__PURE__ */ new Map()), s.get(u.row).set(u.col, {
1017
- segmentKey: u.segmentKey,
1015
+ this.results.missingSegments.forEach((c) => {
1016
+ r.set(c.segmentKey, c), s.has(c.row) || s.set(c.row, /* @__PURE__ */ new Map()), s.get(c.row).set(c.col, {
1017
+ segmentKey: c.segmentKey,
1018
1018
  isEmpty: !0,
1019
1019
  visited: !1
1020
1020
  });
1021
- }), t.forEach((u) => {
1022
- if (u.userData && u.userData.type === "wallSegment") {
1023
- const p = `row${u.userData.row}_col${u.userData.col}`, w = r.has(p);
1024
- s.has(u.userData.row) || s.set(u.userData.row, /* @__PURE__ */ new Map()), s.get(u.userData.row).has(u.userData.col) || s.get(u.userData.row).set(u.userData.col, {
1025
- segmentKey: p,
1021
+ }), t.forEach((c) => {
1022
+ if (c.userData && c.userData.type === "wallSegment") {
1023
+ const m = `row${c.userData.row}_col${c.userData.col}`, w = r.has(m);
1024
+ s.has(c.userData.row) || s.set(c.userData.row, /* @__PURE__ */ new Map()), s.get(c.userData.row).has(c.userData.col) || s.get(c.userData.row).set(c.userData.col, {
1025
+ segmentKey: m,
1026
1026
  isEmpty: w,
1027
1027
  visited: !1
1028
1028
  });
@@ -1038,29 +1038,29 @@ class yo {
1038
1038
  [-1, 0]
1039
1039
  // 上
1040
1040
  ];
1041
- for (const [u, p] of r) {
1042
- const w = (f = s.get(p.row)) == null ? void 0 : f.get(p.col);
1041
+ for (const [c, m] of r) {
1042
+ const w = (g = s.get(m.row)) == null ? void 0 : g.get(m.col);
1043
1043
  if (w && !w.visited) {
1044
- const x = [], P = [[p.row, p.col]];
1044
+ const x = [], P = [[m.row, m.col]];
1045
1045
  for (w.visited = !0; P.length > 0; ) {
1046
- const [M, m] = P.shift(), d = `row${M}_col${m}`;
1047
- r.has(d) && x.push(r.get(d));
1048
- for (const [g, b] of l) {
1049
- const V = M + g, v = m + b;
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, P.push([V, v]));
1046
+ const [M, d] = P.shift(), f = `row${M}_col${d}`;
1047
+ r.has(f) && x.push(r.get(f));
1048
+ for (const [p, b] of l) {
1049
+ const z = M + p, v = d + b;
1050
+ if (s.has(z) && s.get(z).has(v)) {
1051
+ const S = s.get(z).get(v);
1052
+ !S.visited && S.isEmpty && (S.visited = !0, P.push([z, v]));
1053
1053
  }
1054
1054
  }
1055
1055
  }
1056
1056
  x.length >= i && a.push(x);
1057
1057
  }
1058
1058
  }
1059
- const c = this.createClusterMaterials(a.length), h = [];
1059
+ const u = this.createClusterMaterials(a.length), h = [];
1060
1060
  return this.clusterResults = {
1061
- clusters: a.sort((u, p) => p.length - u.length),
1061
+ clusters: a.sort((c, m) => m.length - c.length),
1062
1062
  highlightedMeshes: h,
1063
- clusterMaterials: c,
1063
+ clusterMaterials: u,
1064
1064
  totalClusters: a.length,
1065
1065
  totalHighlighted: h.length
1066
1066
  }, this.clusterResults;
@@ -1073,20 +1073,20 @@ class yo {
1073
1073
  for (let x = i; x <= r; x++)
1074
1074
  t.has(a) && t.get(a).has(x) || (l = !1);
1075
1075
  l && s++;
1076
- const c = o;
1076
+ const u = o;
1077
1077
  let h = !0;
1078
1078
  for (let x = i; x <= r; x++)
1079
- t.has(c) && t.get(c).has(x) || (h = !1);
1079
+ t.has(u) && t.get(u).has(x) || (h = !1);
1080
1080
  h && s++;
1081
- const f = i;
1082
- let u = !0;
1081
+ const g = i;
1082
+ let c = !0;
1083
1083
  for (let x = e; x <= o; x++)
1084
- t.has(x) && t.get(x).has(f) || (u = !1);
1085
- u && s++;
1086
- const p = r;
1084
+ t.has(x) && t.get(x).has(g) || (c = !1);
1085
+ c && s++;
1086
+ const m = r;
1087
1087
  let w = !0;
1088
1088
  for (let x = e; x <= o; x++)
1089
- t.has(x) && t.get(x).has(p) || (w = !1);
1089
+ t.has(x) && t.get(x).has(m) || (w = !1);
1090
1090
  return w && s++, s / 4;
1091
1091
  }
1092
1092
  // 计算聚类质量分数
@@ -1096,20 +1096,20 @@ class yo {
1096
1096
  }
1097
1097
  // 计算严格的聚类边界尺寸(基于实际几何)
1098
1098
  calculateStrictClusterBounds(t) {
1099
- var f, u;
1099
+ var g, c;
1100
1100
  if (t.length === 0) return { width: 0, height: 0 };
1101
1101
  const e = [];
1102
- if (t.forEach((p) => {
1103
- p.vertices && p.vertices.length > 0 && e.push(...p.vertices);
1102
+ if (t.forEach((m) => {
1103
+ m.vertices && m.vertices.length > 0 && e.push(...m.vertices);
1104
1104
  }), e.length === 0) {
1105
- const p = [...new Set(t.map((x) => x.row))];
1105
+ const m = [...new Set(t.map((x) => x.row))];
1106
1106
  return {
1107
- width: [...new Set(t.map((x) => x.col))].length * (((f = t[0].bounds) == null ? void 0 : f.width) || 1),
1108
- height: p.length * (((u = t[0].bounds) == null ? void 0 : u.height) || 1)
1107
+ width: [...new Set(t.map((x) => x.col))].length * (((g = t[0].bounds) == null ? void 0 : g.width) || 1),
1108
+ height: m.length * (((c = t[0].bounds) == null ? void 0 : c.height) || 1)
1109
1109
  };
1110
1110
  }
1111
- const o = Math.min(...e.map((p) => p.x)), i = Math.max(...e.map((p) => p.x)), r = Math.min(...e.map((p) => p.y)), s = Math.max(...e.map((p) => p.y)), a = Math.min(...e.map((p) => p.z)), l = Math.max(...e.map((p) => p.z)), c = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
1112
- return { width: c, height: h };
1111
+ const o = Math.min(...e.map((m) => m.x)), i = Math.max(...e.map((m) => m.x)), r = Math.min(...e.map((m) => m.y)), s = Math.max(...e.map((m) => m.y)), a = Math.min(...e.map((m) => m.z)), l = Math.max(...e.map((m) => m.z)), u = Math.abs(i - o), h = Math.max(Math.abs(s - r), Math.abs(l - a));
1112
+ return { width: u, height: h };
1113
1113
  }
1114
1114
  // 创建不同颜色的聚类材质
1115
1115
  createClusterMaterials(t) {
@@ -1182,8 +1182,8 @@ class yo {
1182
1182
  if (o.userData && o.userData.type === "wallSegment") {
1183
1183
  const i = this.getWorldVertices(o);
1184
1184
  if (i.length < 4) return;
1185
- const r = new y.Vector3().add(i[0]).add(i[1]).add(i[2]).add(i[3]).multiplyScalar(0.25), s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = new y.Vector3().crossVectors(s, a).normalize(), c = new y.ArrowHelper(l, r, 0.3, 16711680), h = new y.ArrowHelper(s, r, 0.2, 65280), f = new y.ArrowHelper(a, r, 0.2, 255);
1186
- e.add(c), e.add(h), e.add(f);
1185
+ const r = new y.Vector3().add(i[0]).add(i[1]).add(i[2]).add(i[3]).multiplyScalar(0.25), s = new y.Vector3().subVectors(i[1], i[0]).normalize(), a = new y.Vector3().subVectors(i[3], i[0]).normalize(), l = new y.Vector3().crossVectors(s, a).normalize(), u = new y.ArrowHelper(l, r, 0.3, 16711680), h = new y.ArrowHelper(s, r, 0.2, 65280), g = new y.ArrowHelper(a, r, 0.2, 255);
1186
+ e.add(u), e.add(h), e.add(g);
1187
1187
  }
1188
1188
  }), e;
1189
1189
  }
@@ -1243,70 +1243,70 @@ 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)), c = [];
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
1247
  r.originalPoints.forEach((v, S) => {
1248
- const z = new zt();
1249
- l.projectPoint(v, z), c.push(z);
1248
+ const V = new zt();
1249
+ l.projectPoint(v, V), u.push(V);
1250
1250
  });
1251
- const h = new zt(r.start.x, r.start.y, r.start.z).distanceTo(new zt(r.end.x, r.end.y, r.end.z)), f = Math.abs(r.rooftopPz - r.start.z), u = new y.MeshBasicMaterial({
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)), g = Math.abs(r.rooftopPz - r.start.z), c = new y.MeshBasicMaterial({
1252
1252
  color: "red",
1253
1253
  side: y.DoubleSide,
1254
1254
  wireframe: !1,
1255
1255
  transparent: !0,
1256
1256
  opacity: 0.5
1257
- }), p = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, f), M = w.createSubdividedWallPlane(r, P, x, u, p);
1258
- w.analyzePointDistribution(M, c, 0.01);
1259
- const m = new y.MeshBasicMaterial({
1257
+ }), m = new y.Group(), w = new yo(), { horizontalSubdivisions: x, verticalSubdivisions: P } = w.initLimits4(h, g), M = w.createSubdividedWallPlane(r, P, x, c, m);
1258
+ w.analyzePointDistribution(M, u, 0.01);
1259
+ const d = new y.MeshBasicMaterial({
1260
1260
  color: "black",
1261
1261
  transparent: !0,
1262
1262
  opacity: 0.8,
1263
1263
  side: y.DoubleSide
1264
- }), d = w.highlightEmptySegments(M, m, p), g = [];
1265
- for (const v of d.clusters) {
1264
+ }), f = w.highlightEmptySegments(M, d, m), p = [];
1265
+ for (const v of f.clusters) {
1266
1266
  const S = xo(v);
1267
- S && g.push(S);
1267
+ S && p.push(S);
1268
1268
  }
1269
- const V = wo(r).direction;
1270
- r.checkResults = g, r.verticalDirection = V, r.originaIndex = i, o.push(r);
1269
+ const z = wo(r).direction;
1270
+ r.checkResults = p, r.verticalDirection = z, r.originaIndex = i, o.push(r);
1271
1271
  }
1272
1272
  return o;
1273
1273
  }, hi = (n, t) => {
1274
1274
  console.log("lines", n);
1275
1275
  for (let e = 0; e < n.length; e++) {
1276
1276
  const o = n[e], i = [];
1277
- o.originalPoints.forEach((d) => {
1278
- let g = new y.Vector3(d.x, d.y, 0), b = !1;
1279
- for (let V = 0; V < i.length; V++)
1280
- if (kt(g, i[V], 0.01)) {
1277
+ o.originalPoints.forEach((f) => {
1278
+ let p = new y.Vector3(f.x, f.y, 0), b = !1;
1279
+ for (let z = 0; z < i.length; z++)
1280
+ if (kt(p, i[z], 0.01)) {
1281
1281
  b = !0;
1282
1282
  break;
1283
1283
  }
1284
- b || i.push(g);
1284
+ b || i.push(p);
1285
1285
  });
1286
1286
  const r = Math.round(Math.max(5, Math.min(350, 20 * Math.sqrt(o.length)))), s = 1;
1287
- let a = new y.Vector3(o.start.x, o.start.y, o.start.z), l = new y.Vector3(o.end.x, o.end.y, o.end.z), c = new y.Vector3().subVectors(l, a).normalize(), h = c.clone().cross(new y.Vector3(0, 0, 1)).normalize(), f = h.clone().negate(), u = [];
1288
- const p = [];
1287
+ let a = new y.Vector3(o.start.x, o.start.y, o.start.z), l = new y.Vector3(o.end.x, o.end.y, o.end.z), u = new y.Vector3().subVectors(l, a).normalize(), h = u.clone().cross(new y.Vector3(0, 0, 1)).normalize(), g = h.clone().negate(), c = [];
1288
+ const m = [];
1289
1289
  let w = o.length / r;
1290
1290
  console.log(w);
1291
- for (let d = 0; d < r; d++) {
1292
- const g = [];
1293
- g.push(a.clone().addScaledVector(h, s)), g.push(g[0].clone().addScaledVector(c, w)), g.push(g[1].clone().addScaledVector(f, s * 2)), g.push(a.clone().addScaledVector(f, w));
1291
+ for (let f = 0; f < r; f++) {
1292
+ const p = [];
1293
+ p.push(a.clone().addScaledVector(h, s)), p.push(p[0].clone().addScaledVector(u, w)), p.push(p[1].clone().addScaledVector(g, s * 2)), p.push(a.clone().addScaledVector(g, w));
1294
1294
  let b = [];
1295
- for (let V = 0; V < i.length; V++)
1296
- u.includes(V) || Po(i[V], g) && (u.push(V), b.push(i[V]));
1297
- b.length > 0 && p.push(Mo(b)), a = a.addScaledVector(c, w);
1295
+ for (let z = 0; z < i.length; z++)
1296
+ c.includes(z) || Po(i[z], p) && (c.push(z), b.push(i[z]));
1297
+ b.length > 0 && m.push(Mo(b)), a = a.addScaledVector(u, w);
1298
1298
  }
1299
1299
  const x = new Float32Array(i.length * 3);
1300
- i.forEach((d, g) => {
1301
- x[g * 3] = d.x, x[g * 3 + 1] = d.y, x[g * 3 + 2] = d.z;
1300
+ i.forEach((f, p) => {
1301
+ x[p * 3] = f.x, x[p * 3 + 1] = f.y, x[p * 3 + 2] = f.z;
1302
1302
  });
1303
1303
  const P = new y.BufferGeometry();
1304
1304
  P.setAttribute("position", new y.BufferAttribute(x, 3)), P.rotateX(-Math.PI / 2), t.add(new y.Points(P, new y.PointsMaterial({ color: go(), size: 0.02 })));
1305
- const [M, m] = vo(p, {
1305
+ const [M, d] = vo(m, {
1306
1306
  plane: "xy",
1307
1307
  trimRatio: 0
1308
1308
  });
1309
- so(M, m, t);
1309
+ so(M, d, t);
1310
1310
  }
1311
1311
  };
1312
1312
  function en(n, t = "xy") {
@@ -1328,7 +1328,7 @@ function Po(n, t, e = "xy") {
1328
1328
  const o = en(n, e), i = t.map((a) => en(a, e));
1329
1329
  let r = !1, s = !1;
1330
1330
  for (let a = 0; a < 4; a++) {
1331
- const l = i[a], c = i[(a + 1) % 4], h = bo(l, c, o);
1331
+ const l = i[a], u = i[(a + 1) % 4], h = bo(l, u, o);
1332
1332
  if (h > 1e-9 && (r = !0), h < -1e-9 && (s = !0), r && s)
1333
1333
  return !1;
1334
1334
  }
@@ -1380,11 +1380,11 @@ 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;
1383
- let l = t, c = a - n;
1384
- const h = Math.hypot(l, c);
1383
+ let l = t, u = a - n;
1384
+ const h = Math.hypot(l, u);
1385
1385
  return h < 1e-12 ? { x: 1, y: 0 } : {
1386
1386
  x: l / h,
1387
- y: c / h
1387
+ y: u / h
1388
1388
  };
1389
1389
  }
1390
1390
  function vo(n, t = {}) {
@@ -1401,72 +1401,72 @@ function vo(n, t = {}) {
1401
1401
  for (const B of i)
1402
1402
  r += B.x, s += B.y, a += B.up;
1403
1403
  r /= i.length, s /= i.length, a /= i.length;
1404
- let l = 0, c = 0, h = 0;
1404
+ let l = 0, u = 0, h = 0;
1405
1405
  for (const B of i) {
1406
1406
  const R = B.x - r, W = B.y - s;
1407
- l += R * R, c += R * W, h += W * W;
1407
+ l += R * R, u += R * W, h += W * W;
1408
1408
  }
1409
- l /= i.length, c /= i.length, h /= i.length;
1410
- const f = So(l, c, h), u = {
1411
- x: -f.y,
1412
- y: f.x
1413
- }, p = [];
1409
+ l /= i.length, u /= i.length, h /= i.length;
1410
+ const g = So(l, u, h), c = {
1411
+ x: -g.y,
1412
+ y: g.x
1413
+ }, m = [];
1414
1414
  for (const B of i) {
1415
- const R = B.x - r, W = B.y - s, C = R * f.x + W * f.y, L = R * u.x + W * u.y;
1416
- p.push({
1415
+ const R = B.x - r, W = B.y - s, C = R * g.x + W * g.y, L = R * c.x + W * c.y;
1416
+ m.push({
1417
1417
  s: C,
1418
1418
  t: L,
1419
1419
  up: B.up
1420
1420
  });
1421
1421
  }
1422
- p.sort((B, R) => B.s - R.s);
1423
- const w = p.length;
1422
+ m.sort((B, R) => B.s - R.s);
1423
+ const w = m.length;
1424
1424
  let x = Math.floor(w * o), P = Math.ceil(w * (1 - o)) - 1;
1425
1425
  x = Math.max(0, Math.min(w - 1, x)), P = Math.max(0, Math.min(w - 1, P));
1426
- const M = p[x], m = p[P], d = (() => {
1427
- const B = p.map((W) => W.t).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1426
+ const M = m[x], d = m[P], f = (() => {
1427
+ const B = m.map((W) => W.t).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1428
1428
  return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1429
- })(), g = (() => {
1430
- const B = p.map((W) => W.up).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1429
+ })(), p = (() => {
1430
+ const B = m.map((W) => W.up).sort((W, C) => W - C), R = Math.floor(B.length / 2);
1431
1431
  return B.length % 2 === 0 ? (B[R - 1] + B[R]) * 0.5 : B[R];
1432
- })(), b = M.s, V = m.s, v = d, S = d, z = g, D = g, _ = r + f.x * b + u.x * v, T = s + f.y * b + u.y * v, E = r + f.x * V + u.x * S, A = s + f.y * V + u.y * S, O = nn(_, T, z, e), I = nn(E, A, D, e);
1432
+ })(), b = M.s, z = d.s, v = f, S = f, V = p, D = p, _ = r + g.x * b + c.x * v, T = s + g.y * b + c.y * v, E = r + g.x * z + c.x * S, A = s + g.y * z + c.y * S, O = nn(_, T, V, e), I = nn(E, A, D, e);
1433
1433
  return [O, I];
1434
1434
  }
1435
1435
  const fi = async (n, t, e, o, i) => {
1436
1436
  if (o && o.length > 0)
1437
- for (let d = 0; d < o.length; d++) {
1438
- const g = o[d];
1439
- g.isLine2 = !0, n.push(g);
1437
+ for (let f = 0; f < o.length; f++) {
1438
+ const p = o[f];
1439
+ p.isLine2 = !0, n.push(p);
1440
1440
  }
1441
1441
  if (fo(n), n.length <= 0 || t.length <= 0)
1442
1442
  return n;
1443
1443
  e || (e = []);
1444
- for (const d of n) {
1445
- let g = [];
1446
- if (!(!d.checkResults || d.checkResults.length <= 0)) {
1447
- for (let b = 0; b < d.checkResults.length; b++) {
1444
+ for (const f of n) {
1445
+ let p = [];
1446
+ if (!(!f.checkResults || f.checkResults.length <= 0)) {
1447
+ for (let b = 0; b < f.checkResults.length; b++) {
1448
1448
  let D = function(A) {
1449
- for (; z[A] !== A; )
1450
- z[A] = z[z[A]], A = z[A];
1449
+ for (; V[A] !== A; )
1450
+ V[A] = V[V[A]], A = V[A];
1451
1451
  return A;
1452
1452
  };
1453
- const V = d.checkResults[b];
1454
- if (V.isDoor = !1, !V.originalVertices || V.originalVertices.length == 0)
1453
+ const z = f.checkResults[b];
1454
+ if (z.isDoor = !1, !z.originalVertices || z.originalVertices.length == 0)
1455
1455
  continue;
1456
1456
  const v = [];
1457
- V.originalVertices.forEach((A) => {
1457
+ z.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
1461
  }), v.push(O);
1462
1462
  });
1463
- const S = v.length, z = Array.from({ length: S }, (A, O) => O);
1463
+ const S = v.length, V = Array.from({ length: S }, (A, O) => O);
1464
1464
  for (let A = 0; A < S; A++)
1465
1465
  for (let O = A + 1; O < S; O++) {
1466
1466
  const I = v[A], B = v[O];
1467
1467
  if (I.some((W) => B.some((C) => W.equals(C)))) {
1468
1468
  const W = D(A), C = D(O);
1469
- W !== C && (z[W] = C);
1469
+ W !== C && (V[W] = C);
1470
1470
  }
1471
1471
  }
1472
1472
  const _ = /* @__PURE__ */ new Map();
@@ -1493,82 +1493,82 @@ const fi = async (n, t, e, o, i) => {
1493
1493
  }
1494
1494
  I.gridWidth = T, I.gridHeight = E;
1495
1495
  }
1496
- g.push(..._.values());
1496
+ p.push(..._.values());
1497
1497
  }
1498
- d.mergeCheckRegion = g;
1498
+ f.mergeCheckRegion = p;
1499
1499
  }
1500
1500
  }
1501
1501
  let r = /* @__PURE__ */ new Map();
1502
- for (const d of n) {
1503
- if (d.length < 0.3) continue;
1504
- let g = d.rooftopPz - d.start.z, b = Math.floor(d.rooftopPz - d.start.z);
1502
+ for (const f of n) {
1503
+ if (f.length < 0.3) continue;
1504
+ let p = f.rooftopPz - f.start.z, b = Math.floor(f.rooftopPz - f.start.z);
1505
1505
  r.has(b) ? r.set(b, {
1506
1506
  num: r.get(b).num + 1,
1507
- totalHeight: r.get(b).totalHeight + g
1507
+ totalHeight: r.get(b).totalHeight + p
1508
1508
  }) : r.set(b, {
1509
1509
  num: 1,
1510
- totalHeight: g
1510
+ totalHeight: p
1511
1511
  });
1512
1512
  }
1513
1513
  let s = [...r.entries()].reduce(
1514
- (d, g) => g[1].num > d[1].num ? g : d
1514
+ (f, p) => p[1].num > f[1].num ? p : f
1515
1515
  );
1516
1516
  s[0], s[1].totalHeight / s[1].num;
1517
1517
  const a = [];
1518
- for (let d = 0; d < e.length; d++) {
1519
- const g = e[d];
1520
- if (g.isFindBeam = !1, g.category == "door") {
1518
+ for (let f = 0; f < e.length; f++) {
1519
+ const p = e[f];
1520
+ if (p.isFindBeam = !1, p.category == "door") {
1521
1521
  let b = [];
1522
- g.coordinatesByArea.coordinates.forEach((D) => {
1522
+ p.coordinatesByArea.coordinates.forEach((D) => {
1523
1523
  b.push(new y.Vector3(D.x, D.y, D.z));
1524
1524
  }), b[0].equals(b[b.length - 1]) && b.pop();
1525
- let V = b[0].distanceTo(b[1]), v = b[0].distanceTo(b[3]);
1526
- v > V && ([V, v] = [v, V], b = [b[0], b[3], b[2], b[1]]);
1527
- let S = ee(b[0], b[3], !0), z = ee(b[1], b[2], !0);
1525
+ let z = b[0].distanceTo(b[1]), v = b[0].distanceTo(b[3]);
1526
+ v > z && ([z, v] = [v, z], b = [b[0], b[3], b[2], b[1]]);
1527
+ let S = ee(b[0], b[3], !0), V = ee(b[1], b[2], !0);
1528
1528
  a.push({
1529
1529
  doorStartPt: S,
1530
- doorEndPt: z,
1530
+ doorEndPt: V,
1531
1531
  boxPoints: b,
1532
- minZ: g.coordinatesByArea.heightData.minZ,
1533
- maxZ: g.coordinatesByArea.heightData.maxZ,
1534
- index: d,
1532
+ minZ: p.coordinatesByArea.heightData.minZ,
1533
+ maxZ: p.coordinatesByArea.heightData.maxZ,
1534
+ index: f,
1535
1535
  isFind: !1,
1536
1536
  inWall: !1
1537
1537
  //是否在墙内
1538
1538
  });
1539
1539
  }
1540
1540
  }
1541
- for (let d = 0; d < a.length; d++) {
1542
- const g = a[d];
1541
+ for (let f = 0; f < a.length; f++) {
1542
+ const p = a[f];
1543
1543
  for (let b = 0; b < n.length; b++) {
1544
1544
  if (n[b].length < 0.5) continue;
1545
- let V = [];
1545
+ let z = [];
1546
1546
  const v = ee(n[b].start, n[b].end, !0);
1547
- V.push(v), V.push(ee(v, n[b].start, !0)), V.push(ee(v, n[b].end, !0));
1547
+ z.push(v), z.push(ee(v, n[b].start, !0)), z.push(ee(v, n[b].end, !0));
1548
1548
  let S = !1;
1549
- const z = g.boxPoints.length;
1550
- for (let D = 0; D < V.length; D++) {
1551
- const _ = V[D].x, T = V[D].y;
1552
- for (let E = 0, A = z - 1; E < z; A = E++) {
1553
- const O = g.boxPoints[E].x, I = g.boxPoints[E].y, B = g.boxPoints[A].x, R = g.boxPoints[A].y;
1549
+ const V = p.boxPoints.length;
1550
+ for (let D = 0; D < z.length; D++) {
1551
+ const _ = z[D].x, T = z[D].y;
1552
+ for (let E = 0, A = V - 1; E < V; A = E++) {
1553
+ const O = p.boxPoints[E].x, I = p.boxPoints[E].y, B = p.boxPoints[A].x, R = p.boxPoints[A].y;
1554
1554
  I > T != R > T && _ < (B - O) * (T - I) / (R - I) + O && (S = !S);
1555
1555
  }
1556
1556
  if (S) break;
1557
1557
  }
1558
1558
  if (S) {
1559
- let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0), T = g.doorStartPt.distanceTo(g.doorEndPt), E = D.distanceTo(_), A = Jt(g.doorStartPt, g.doorEndPt, D, _);
1559
+ let D = new y.Vector3(n[b].start.x, n[b].start.y, 0), _ = new y.Vector3(n[b].end.x, n[b].end.y, 0), T = p.doorStartPt.distanceTo(p.doorEndPt), E = D.distanceTo(_), A = Jt(p.doorStartPt, p.doorEndPt, D, _);
1560
1560
  if (Math.abs(E - T) < 0.5 && A && A.angleDeg < 15) {
1561
- g.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), g.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
1561
+ p.doorStartPt = new y.Vector3(n[b].start.x, n[b].start.y, 0), p.doorEndPt = new y.Vector3(n[b].end.x, n[b].end.y, 0);
1562
1562
  break;
1563
1563
  } else if (Math.abs(E - T) > 1.3 && A && A.angleDeg < 15) {
1564
- let O = ne(g.doorStartPt, g.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = g.doorStartPt.distanceTo(D), B = g.doorStartPt.distanceTo(_), R = g.doorEndPt.distanceTo(D), W = g.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || R < 0.2 || W < 0.2;
1564
+ let O = ne(p.doorStartPt, p.doorEndPt, D, _, { parallelAngleMax: y.MathUtils.degToRad(15) }), I = p.doorStartPt.distanceTo(D), B = p.doorStartPt.distanceTo(_), R = p.doorEndPt.distanceTo(D), W = p.doorEndPt.distanceTo(_), C = I < 0.2 || B < 0.2 || R < 0.2 || W < 0.2;
1565
1565
  if (O && O.type == "collinear_overlap" && O.maxPerpendicularDistance < 0.1 && !C) {
1566
- g.inWall = !0;
1566
+ p.inWall = !0;
1567
1567
  break;
1568
1568
  } else {
1569
- let L = new y.Line3(D, _), H = L.closestPointToPoint(g.doorStartPt, !0, new y.Vector3()), X = L.closestPointToPoint(g.doorEndPt, !0, new y.Vector3()), ot = H.distanceTo(g.doorStartPt), K = X.distanceTo(g.doorEndPt);
1569
+ let L = new y.Line3(D, _), H = L.closestPointToPoint(p.doorStartPt, !0, new y.Vector3()), X = L.closestPointToPoint(p.doorEndPt, !0, new y.Vector3()), ot = H.distanceTo(p.doorStartPt), K = X.distanceTo(p.doorEndPt);
1570
1570
  if (ot < 0.1 || K < 0.1) {
1571
- g.inWall = !0;
1571
+ p.inWall = !0;
1572
1572
  break;
1573
1573
  }
1574
1574
  }
@@ -1577,21 +1577,21 @@ const fi = async (n, t, e, o, i) => {
1577
1577
  continue;
1578
1578
  }
1579
1579
  }
1580
- let l = 0, c = [], h = [], f = [];
1581
- const u = [];
1582
- let p = 0.15;
1583
- for (let d = 0; d < n.length; d++) {
1584
- const g = n[d];
1585
- if (g.noDetection || (g.doorAndBeamData = [], !g.mergeCheckRegion || g.mergeCheckRegion.length == 0))
1580
+ let l = 0, u = [], h = [], g = [];
1581
+ const c = [];
1582
+ let m = 0.15;
1583
+ for (let f = 0; f < n.length; f++) {
1584
+ const p = n[f];
1585
+ if (p.noDetection || (p.doorAndBeamData = [], !p.mergeCheckRegion || p.mergeCheckRegion.length == 0))
1586
1586
  continue;
1587
- g.completePointAreaPercentage = -1;
1587
+ p.completePointAreaPercentage = -1;
1588
1588
  let b = new y.Box3();
1589
- b.setFromPoints(g.originalPoints);
1590
- let V = b.max.z;
1589
+ b.setFromPoints(p.originalPoints);
1590
+ let z = b.max.z;
1591
1591
  b.min.z;
1592
- const v = new y.Vector3(g.start.x, g.start.y, g.start.z), S = new y.Vector3(g.end.x, g.end.y, g.end.z);
1593
- let z = g.rooftopPz - g.start.z, D = 0;
1594
- for (const T of g.mergeCheckRegion) {
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 V = p.rooftopPz - p.start.z, D = 0;
1594
+ for (const T of p.mergeCheckRegion) {
1595
1595
  const { facePoints: E, boxArea: A, totalInPlaneNum: O } = co(
1596
1596
  T.points,
1597
1597
  T.gridWidth,
@@ -1641,23 +1641,23 @@ const fi = async (n, t, e, o, i) => {
1641
1641
  if (O != 0 && (G = T.gridHeight * T.gridWidth * O), (T.area - G) / A * 100 > 70 && K.length == 1 || K.length > 1)
1642
1642
  for (let rt = 0; rt < K.length; rt++) {
1643
1643
  const F = K[rt];
1644
- let Y = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = Y / g.length * 100, Nt = g.rooftopPz - F.facePoints[2].z;
1645
- if (Mt < 1.5 || V < F.facePoints[2].z || Nt > z / 3 * 2)
1644
+ let Y = F.facePoints[0].distanceTo(F.facePoints[1]), Mt = F.facePoints[0].distanceTo(F.facePoints[3]), Zt = Y / p.length * 100, Nt = p.rooftopPz - F.facePoints[2].z;
1645
+ if (Mt < 1.5 || z < F.facePoints[2].z || Nt > V / 3 * 2)
1646
1646
  continue;
1647
1647
  let Lt = !1, _t = !1, Tt = !1, Ft = [], tt = F.facePoints[2].clone(), lt = F.facePoints[3].clone(), q = F.facePoints[0].clone(), j = F.facePoints[1].clone(), Wt = !1, Et = -1;
1648
- if (Math.abs(F.facePoints[0].z - g.start.z) < 0.25) {
1649
- if (Y > 0.17 && g.length > 0.5) {
1648
+ if (Math.abs(F.facePoints[0].z - p.start.z) < 0.25) {
1649
+ if (Y > 0.17 && p.length > 0.5) {
1650
1650
  let qt = Rt(v, q), J = Rt(v, j), ct = Rt(S, q), N = Rt(S, j);
1651
1651
  const bt = 0.1, Vt = 10;
1652
1652
  if (qt < bt || J < bt) {
1653
- const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
1653
+ const { newOriginalPoints: Ut } = ze(q, j, p.originalPoints), at = [];
1654
1654
  if (Ut.forEach((Q) => {
1655
1655
  Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
1656
1656
  }), at.length > 10) {
1657
- const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(Q, gt).normalize();
1657
+ const Q = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), Pt = new y.Vector3().subVectors(Q, gt).normalize();
1658
1658
  let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
1659
1659
  for (let U = 0; U < n.length; U++) {
1660
- if (U == d) continue;
1660
+ if (U == f) continue;
1661
1661
  const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
1662
1662
  let St = re(Q, gt, it, dt);
1663
1663
  if (Ct != null) {
@@ -1706,26 +1706,26 @@ const fi = async (n, t, e, o, i) => {
1706
1706
  }
1707
1707
  }
1708
1708
  }
1709
- if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
1709
+ if (ht != 1 / 0 && ht < 2 && (p.length - Y > 0.2 || p.length - Y < 0.02) && ht < Y * 3)
1710
1710
  n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, qt < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
1711
1711
  else {
1712
- if (!k && !ft && g.length - Y > 0.1)
1712
+ if (!k && !ft && p.length - Y > 0.1)
1713
1713
  continue;
1714
- if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
1714
+ if (!k && !ft && p.length - Y < 0.1 && p.length < 1.8)
1715
1715
  continue;
1716
1716
  }
1717
1717
  } else
1718
1718
  continue;
1719
1719
  }
1720
1720
  if (ct < bt || N < bt) {
1721
- const { newOriginalPoints: Ut } = ze(q, j, g.originalPoints), at = [];
1721
+ const { newOriginalPoints: Ut } = ze(q, j, p.originalPoints), at = [];
1722
1722
  if (Ut.forEach((Q) => {
1723
1723
  Q.z >= tt.z ? at.push(Q) : Q.z <= q.z;
1724
1724
  }), at.length > 10) {
1725
- const Q = new y.Vector3(g.start.x, g.start.y, 0), gt = new y.Vector3(g.end.x, g.end.y, 0), Pt = new y.Vector3().subVectors(gt, Q).normalize();
1725
+ const Q = new y.Vector3(p.start.x, p.start.y, 0), gt = new y.Vector3(p.end.x, p.end.y, 0), Pt = new y.Vector3().subVectors(gt, Q).normalize();
1726
1726
  let Gt = new y.Vector3(), ht = 1 / 0, Z = -1, k = !1, ft = !1;
1727
1727
  for (let U = 0; U < n.length; U++) {
1728
- if (U == d) continue;
1728
+ if (U == f) continue;
1729
1729
  const it = new y.Vector3(n[U].start.x, n[U].start.y, 0), dt = new y.Vector3(n[U].end.x, n[U].end.y, 0), Ct = te(Q, gt, it, dt);
1730
1730
  let St = re(Q, gt, it, dt);
1731
1731
  if (Ct != null) {
@@ -1771,12 +1771,12 @@ const fi = async (n, t, e, o, i) => {
1771
1771
  }
1772
1772
  }
1773
1773
  }
1774
- if (ht != 1 / 0 && ht < 2 && (g.length - Y > 0.2 || g.length - Y < 0.02) && ht < Y * 3)
1774
+ if (ht != 1 / 0 && ht < 2 && (p.length - Y > 0.2 || p.length - Y < 0.02) && ht < Y * 3)
1775
1775
  n[Z].length > 0.25 && Y + ht > 0.5 && (Wt = !0, ct < bt ? (lt = lt.addScaledVector(Pt, ht), q = q.addScaledVector(Pt, ht)) : (tt = tt.addScaledVector(Pt, ht), j = j.addScaledVector(Pt, ht)));
1776
1776
  else {
1777
- if (!k && !ft && g.length - Y > 0.1)
1777
+ if (!k && !ft && p.length - Y > 0.1)
1778
1778
  continue;
1779
- if (!k && !ft && g.length - Y < 0.1 && g.length < 1.8)
1779
+ if (!k && !ft && p.length - Y < 0.1 && p.length < 1.8)
1780
1780
  continue;
1781
1781
  }
1782
1782
  } else
@@ -1784,7 +1784,7 @@ const fi = async (n, t, e, o, i) => {
1784
1784
  }
1785
1785
  Y = lt.distanceTo(tt);
1786
1786
  }
1787
- if (Zt < 85 && Y > 0.3 || Y > 0.7 && Mt > z - z / 3) {
1787
+ if (Zt < 85 && Y > 0.3 || Y > 0.7 && Mt > V - V / 3) {
1788
1788
  let qt = !1;
1789
1789
  for (let J = 0; J < t.length; J++) {
1790
1790
  let ct = J + 1;
@@ -1809,7 +1809,7 @@ const fi = async (n, t, e, o, i) => {
1809
1809
  distanceThreshold: 2
1810
1810
  });
1811
1811
  if (at && at.type == "collinear_gap") {
1812
- let Q = ee(ct, N), gt = new y.Line3(new y.Vector3(g.start.x, g.start.y, 0), new y.Vector3(g.end.x, g.end.y, 0)), Pt = new y.Vector3(), Gt = gt.closestPointToPoint(Q, !0, Pt);
1812
+ let Q = ee(ct, N), gt = new y.Line3(new y.Vector3(p.start.x, p.start.y, 0), new y.Vector3(p.end.x, p.end.y, 0)), Pt = new y.Vector3(), Gt = gt.closestPointToPoint(Q, !0, Pt);
1813
1813
  if (Q.distanceTo(Gt) < 0.15) {
1814
1814
  let Z = bt.distanceTo(ct), k = Vt.distanceTo(ct);
1815
1815
  if (Z > 0.25 && k > 0.25) {
@@ -1837,15 +1837,15 @@ const fi = async (n, t, e, o, i) => {
1837
1837
  for (let J = 0; J < a.length; J++) {
1838
1838
  if (a[J].inWall) continue;
1839
1839
  let ct = new y.Vector3(a[J].doorStartPt.x, a[J].doorStartPt.y, 0), N = new y.Vector3(a[J].doorEndPt.x, a[J].doorEndPt.y, 0), bt = new y.Vector3(F.facePoints[0].x, F.facePoints[0].y, 0), Vt = new y.Vector3(F.facePoints[1].x, F.facePoints[1].y, 0), Ut = new y.Vector3().subVectors(ct, N).normalize(), at = new y.Vector3().subVectors(bt, Vt).normalize(), Q = 0.25, gt = ct.clone().addScaledVector(Ut, Q), Pt = N.clone().addScaledVector(Ut.clone().negate(), Q), Gt = bt.clone().addScaledVector(at, Q), ht = Vt.clone().addScaledVector(at.clone().negate(), Q), Z = te(gt, Pt, Gt, ht), k = !0, ft = ct.distanceTo(bt), U = ct.distanceTo(Vt), it = N.distanceTo(bt), dt = N.distanceTo(Vt);
1840
- (ft < p || U < p || it < p || dt < p || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Et = J);
1840
+ (ft < m || U < m || it < m || dt < m || Z) && k && (e[a[J].index].isFindBeam = !0, _t = !0, a[J].isFind = !0, Et = J);
1841
1841
  }
1842
- (_t || qt || Math.abs(Mt - z) > 0.1 && Mt > z / 2 && Y > 0.3) && (Lt = !0);
1842
+ (_t || qt || Math.abs(Mt - V) > 0.1 && Mt > V / 2 && Y > 0.3) && (Lt = !0);
1843
1843
  }
1844
1844
  }
1845
1845
  if (Lt) {
1846
1846
  let qt = !1;
1847
- for (let Z = 0; Z < f.length; Z++) {
1848
- let k = ne(f[Z].start, f[Z].end, q, j);
1847
+ for (let Z = 0; Z < g.length; Z++) {
1848
+ let k = ne(g[Z].start, g[Z].end, q, j);
1849
1849
  if (k && k.type == "collinear_overlap" && k.maxPerpendicularDistance < 0.01) {
1850
1850
  qt = !0;
1851
1851
  break;
@@ -1855,7 +1855,7 @@ const fi = async (n, t, e, o, i) => {
1855
1855
  Et != -1 && (e[a[Et].index].isFindBeam = !1, a[Et].isFind = !1);
1856
1856
  continue;
1857
1857
  }
1858
- f.push({
1858
+ g.push({
1859
1859
  start: q,
1860
1860
  end: j
1861
1861
  });
@@ -1864,7 +1864,7 @@ const fi = async (n, t, e, o, i) => {
1864
1864
  let Z = new y.Vector3().subVectors(q, j), k = new y.Vector3().subVectors(j, q), ft = 1 / 0, U = 1 / 0, it = q.clone(), dt = j.clone();
1865
1865
  const Ct = [], St = [];
1866
1866
  let At = new y.Line3(tt, lt), $ = new y.Vector3(), pt = 999999;
1867
- if (g.originalPoints.forEach((et) => {
1867
+ if (p.originalPoints.forEach((et) => {
1868
1868
  if (et.z - q.z < Mt / 2 + 0.1 && et.z - q.z > Mt / 2 - 0.1 && Ct.push(et), et.z > tt.z) {
1869
1869
  let st = At.closestPointToPoint(et, !0, $), xt = new y.Vector3().subVectors(st, tt), vt = new y.Vector3().subVectors(st, lt), Bt = oe(Z, vt), wt = oe(k, xt);
1870
1870
  Bt && Bt.parallel && !Bt.sameDirection && wt && wt.parallel && !wt.sameDirection && St.push(et);
@@ -1896,12 +1896,12 @@ const fi = async (n, t, e, o, i) => {
1896
1896
  let J = j.distanceTo(q);
1897
1897
  if (J < 0.4 && !_t || J < 0.3 && _t)
1898
1898
  continue;
1899
- h.includes(d) || h.push(d), g.checkResults[T.index].isDoor = !0;
1899
+ h.includes(f) || h.push(f), p.checkResults[T.index].isDoor = !0;
1900
1900
  let ct = "", N = {
1901
1901
  id: l,
1902
1902
  beamStart: tt,
1903
1903
  beamEnd: lt,
1904
- beamHeight: g.rooftopPz - tt.z,
1904
+ beamHeight: p.rooftopPz - tt.z,
1905
1905
  doorStart: q,
1906
1906
  doorEnd: j,
1907
1907
  doorHeight: Mt,
@@ -1914,8 +1914,8 @@ const fi = async (n, t, e, o, i) => {
1914
1914
  pcbDoorIndexs: Ft,
1915
1915
  beamNearWallVec: new y.Vector3(0, 0, 0)
1916
1916
  }, bt = !1, Vt = new y.Vector3(), Ut = new y.Vector3(), at = -1, Q = -1, gt = -1;
1917
- for (let Z = 0; Z < c.length; Z++) {
1918
- const k = n[c[Z].linesIndex].doorAndBeamData[c[Z].doorIndex];
1917
+ for (let Z = 0; Z < u.length; Z++) {
1918
+ const k = n[u[Z].linesIndex].doorAndBeamData[u[Z].doorIndex];
1919
1919
  if (k.nearId != -1)
1920
1920
  continue;
1921
1921
  let ft = Jt(
@@ -1935,7 +1935,7 @@ const fi = async (n, t, e, o, i) => {
1935
1935
  let Bt = 0.8;
1936
1936
  (k.isDoor || N.isDoor) && (k.isDoor = !0, N.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, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Tt || Tt && k.isPullOutDoor && wt ? (N.beamStart = k.beamStart.clone().addScaledVector(pt, $), N.beamEnd = k.beamEnd.clone().addScaledVector(pt, $), N.doorStart = k.doorStart.clone().addScaledVector(pt, $), N.doorEnd = k.doorEnd.clone().addScaledVector(pt, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : U > it && (it > Bt && !Tt ? (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : !k.isPullOutDoor || Tt && k.isPullOutDoor && wt ? (k.beamStart = tt.clone().addScaledVector(pt, $), k.beamEnd = lt.clone().addScaledVector(pt, $), k.doorStart = q.clone().addScaledVector(pt, $), k.doorEnd = j.clone().addScaledVector(pt, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight)), at = N.nearId, Vt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = c[Z].linesIndex, gt = c[Z].doorIndex;
1938
+ U < it ? U > Bt && !k.isPullOutDoor ? (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : !Tt || Tt && k.isPullOutDoor && wt ? (N.beamStart = k.beamStart.clone().addScaledVector(pt, $), N.beamEnd = k.beamEnd.clone().addScaledVector(pt, $), N.doorStart = k.doorStart.clone().addScaledVector(pt, $), N.doorEnd = k.doorEnd.clone().addScaledVector(pt, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : (k.beamStart = tt.clone().addScaledVector(et, $), k.beamEnd = lt.clone().addScaledVector(et, $), k.doorStart = q.clone().addScaledVector(et, $), k.doorEnd = j.clone().addScaledVector(et, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : U > it && (it > Bt && !Tt ? (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight) : !k.isPullOutDoor || Tt && k.isPullOutDoor && wt ? (k.beamStart = tt.clone().addScaledVector(pt, $), k.beamEnd = lt.clone().addScaledVector(pt, $), k.doorStart = q.clone().addScaledVector(pt, $), k.doorEnd = j.clone().addScaledVector(pt, $), k.doorHeight = N.doorHeight, k.beamStart.z = k.beamEnd.z = k.doorStart.z + k.doorHeight) : (N.beamStart = k.beamStart.clone().addScaledVector(et, $), N.beamEnd = k.beamEnd.clone().addScaledVector(et, $), N.doorStart = k.doorStart.clone().addScaledVector(et, $), N.doorEnd = k.doorEnd.clone().addScaledVector(et, $), N.doorHeight = k.doorHeight, N.beamStart.z = N.beamEnd.z = N.doorStart.z + N.doorHeight)), at = N.nearId, Vt = k.beamStart.clone(), Ut = k.beamEnd.clone(), bt = !0, Q = u[Z].linesIndex, gt = u[Z].doorIndex;
1939
1939
  break;
1940
1940
  }
1941
1941
  }
@@ -1944,7 +1944,7 @@ const fi = async (n, t, e, o, i) => {
1944
1944
  if (!bt) {
1945
1945
  let Z = new y.Line3(q.clone(), j.clone());
1946
1946
  for (let k = 0; k < n.length; k++) {
1947
- if (n[k].length < 0.5 || k == d) continue;
1947
+ if (n[k].length < 0.5 || k == f) continue;
1948
1948
  let ft = new y.Vector3(n[k].start.x, n[k].start.y, n[k].start.z), U = new y.Vector3(n[k].end.x, n[k].end.y, n[k].end.z), it = ne(ft, U, q, j), dt = Jt(ft, U, q, j);
1949
1949
  const Ct = ho(n[k]);
1950
1950
  if (it && it.maxPerpendicularDistance < 0.5) {
@@ -1991,9 +1991,9 @@ const fi = async (n, t, e, o, i) => {
1991
1991
  }
1992
1992
  let Gt = !1;
1993
1993
  if (at != -1)
1994
- for (let Z = 0; Z < u.length && !(u[Z].length == 1 && (u[Z][0].id == l ? (u[Z].push({ id: at, beamStart: Vt, beamEnd: Ut }), Gt = !0) : u[Z][0].id == at && (u[Z].push({ id: l, beamStart: tt, beamEnd: lt }), Gt = !0), Gt)); Z++)
1994
+ for (let Z = 0; Z < c.length && !(c[Z].length == 1 && (c[Z][0].id == l ? (c[Z].push({ id: at, beamStart: Vt, beamEnd: Ut }), Gt = !0) : c[Z][0].id == at && (c[Z].push({ id: l, beamStart: tt, beamEnd: lt }), Gt = !0), Gt)); Z++)
1995
1995
  ;
1996
- Gt || u.push([{ id: l, beamStart: tt, beamEnd: lt }]);
1996
+ Gt || c.push([{ id: l, beamStart: tt, beamEnd: lt }]);
1997
1997
  const ht = N.doorStart.distanceTo(N.doorEnd);
1998
1998
  if (_t ? ct = "door" : ht > 1.8 ? ct = "beam" : ct = Pt && ht > 1 ? "beam" : "hole", N.type = ct, N.nearId != -1 && ct == "hole") {
1999
1999
  let Z = !1;
@@ -2007,68 +2007,68 @@ const fi = async (n, t, e, o, i) => {
2007
2007
  if (Z) break;
2008
2008
  }
2009
2009
  }
2010
- if (g.doorAndBeamData.push(N), c.push({
2011
- linesIndex: d,
2012
- doorIndex: g.doorAndBeamData.length - 1
2010
+ if (p.doorAndBeamData.push(N), u.push({
2011
+ linesIndex: f,
2012
+ doorIndex: p.doorAndBeamData.length - 1
2013
2013
  }), l++, Tt && Y < 2) break;
2014
2014
  }
2015
2015
  }
2016
2016
  }
2017
- let _ = g.length * (g.rooftopPz - g.start.z);
2018
- g.completePointAreaPercentage = D / _ * 100;
2017
+ let _ = p.length * (p.rooftopPz - p.start.z);
2018
+ p.completePointAreaPercentage = D / _ * 100;
2019
2019
  }
2020
2020
  if (h.length > 1)
2021
- for (let d = 0; d < h.length; d++) {
2022
- let g = [];
2023
- for (let b = 0; b < n[h[d]].doorAndBeamData.length; b++) {
2024
- let V = !1;
2025
- if (n[h[d]].doorAndBeamData[b].type === "beam" && n[h[d]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[d]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[d]].doorAndBeamData[b].nearId == -1 && (V = !0), !V) {
2026
- let v = n[h[d]].doorAndBeamData[b].doorStart.clone(), S = n[h[d]].doorAndBeamData[b].doorEnd.clone();
2021
+ for (let f = 0; f < h.length; f++) {
2022
+ let p = [];
2023
+ for (let b = 0; b < n[h[f]].doorAndBeamData.length; b++) {
2024
+ let z = !1;
2025
+ if (n[h[f]].doorAndBeamData[b].type === "beam" && n[h[f]].doorAndBeamData[b].beamNearWallVec.x == 0 && n[h[f]].doorAndBeamData[b].beamNearWallVec.y == 0 && n[h[f]].doorAndBeamData[b].beamNearWallVec.z == 0 && n[h[f]].doorAndBeamData[b].nearId == -1 && (z = !0), !z) {
2026
+ let v = n[h[f]].doorAndBeamData[b].doorStart.clone(), S = n[h[f]].doorAndBeamData[b].doorEnd.clone();
2027
2027
  v.z = S.z = 0;
2028
- let z = v.distanceTo(S);
2028
+ let V = v.distanceTo(S);
2029
2029
  for (let D = 0; D < h.length; D++)
2030
- if (d != D)
2030
+ if (f != D)
2031
2031
  for (let _ = 0; _ < n[h[D]].doorAndBeamData.length; _++) {
2032
2032
  let T = n[h[D]].doorAndBeamData[_].doorStart.clone(), E = n[h[D]].doorAndBeamData[_].doorEnd.clone();
2033
2033
  T.z = E.z = 0, T.distanceTo(E);
2034
2034
  let A = ne(v, S, T, E);
2035
2035
  if (A.type == "collinear_overlap" && A.maxPerpendicularDistance < 0.2) {
2036
2036
  let O = new y.Line3(T, E), I = ee(v, S), B = O.closestPointToPoint(I, !0, new y.Vector3()), R = I.distanceTo(B);
2037
- if (Math.abs(z - A.overlap) < 0.1 && R < 0.04) {
2038
- n[h[D]].doorAndBeamData[_].nearId == n[h[d]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), V = !0;
2037
+ if (Math.abs(V - A.overlap) < 0.1 && R < 0.04) {
2038
+ n[h[D]].doorAndBeamData[_].nearId == n[h[f]].doorAndBeamData[b].id && (n[h[D]].doorAndBeamData[_].nearId = -1), z = !0;
2039
2039
  break;
2040
2040
  }
2041
2041
  }
2042
2042
  }
2043
2043
  }
2044
- V || g.push(n[h[d]].doorAndBeamData[b]);
2044
+ z || p.push(n[h[f]].doorAndBeamData[b]);
2045
2045
  }
2046
- g.length != n[h[d]].doorAndBeamData.length && (n[h[d]].doorAndBeamData = g);
2046
+ p.length != n[h[f]].doorAndBeamData.length && (n[h[f]].doorAndBeamData = p);
2047
2047
  }
2048
2048
  let w = 0.65, x = 2, P = [], M = [];
2049
- for (let d = 0; d < a.length; d++) {
2050
- if (a[d].isFind || a[d].inWall)
2049
+ for (let f = 0; f < a.length; f++) {
2050
+ if (a[f].isFind || a[f].inWall)
2051
2051
  continue;
2052
- let g = new y.Vector3(a[d].doorStartPt.x, a[d].doorStartPt.y, 0), b = new y.Vector3(a[d].doorEndPt.x, a[d].doorEndPt.y, 0), V = new y.Vector3().subVectors(g, b).normalize();
2052
+ let p = new y.Vector3(a[f].doorStartPt.x, a[f].doorStartPt.y, 0), b = new y.Vector3(a[f].doorEndPt.x, a[f].doorEndPt.y, 0), z = new y.Vector3().subVectors(p, b).normalize();
2053
2053
  for (let v = 0; v < n.length; v++) {
2054
2054
  if (n[v].length < 0.7 || n[v].completePointAreaPercentage > 60)
2055
2055
  continue;
2056
- let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), z = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, z).normalize(), _ = 0.3, T = g.clone().addScaledVector(V, _), E = b.clone().addScaledVector(V.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = z.clone().addScaledVector(D.clone().negate(), _);
2056
+ let S = new y.Vector3(n[v].start.x, n[v].start.y, 0), V = new y.Vector3(n[v].end.x, n[v].end.y, 0), D = new y.Vector3().subVectors(S, V).normalize(), _ = 0.3, T = p.clone().addScaledVector(z, _), E = b.clone().addScaledVector(z.clone().negate(), _), A = S.clone().addScaledVector(D, _), O = V.clone().addScaledVector(D.clone().negate(), _);
2057
2057
  te(T, E, A, O);
2058
2058
  let I = Jt(
2059
2059
  T,
2060
2060
  E,
2061
2061
  A,
2062
2062
  O
2063
- ), B = g.distanceTo(S) > b.distanceTo(S) ? b : g, R = B.distanceTo(S), W = B.distanceTo(z);
2064
- if ((R < p || W < p) && I && !I.isParallel) {
2065
- let L = g.distanceTo(S), H = g.distanceTo(z), X = L < H ? S : z, ot = !1;
2063
+ ), B = p.distanceTo(S) > b.distanceTo(S) ? b : p, R = B.distanceTo(S), W = B.distanceTo(V);
2064
+ if ((R < m || W < m) && I && !I.isParallel) {
2065
+ let L = p.distanceTo(S), H = p.distanceTo(V), X = L < H ? S : V, ot = !1;
2066
2066
  for (let K = 0; K < n.length; K++) {
2067
2067
  if (K == v || P.includes(K) || n[K].length < 0.7)
2068
2068
  continue;
2069
- let G = new y.Vector3(n[K].start.x, n[K].start.y, 0), ut = new y.Vector3(n[K].end.x, n[K].end.y, 0), rt = new y.Vector3().subVectors(G, ut).normalize(), F = rt.clone().negate(), Y = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, z, G, ut), Nt = ne(S, z, G, ut), Lt = te(S, z, Y, Mt), _t = !0;
2070
- if (Lt != null && (_t = Lt.point.distanceTo(S) < p || Lt.point.distanceTo(z) < p), (Zt && Zt.angle > 85 || Nt && Nt.type == "collinear_gap") && _t) {
2071
- let Tt = new y.Line3(S, z), Ft = new y.Vector3(), tt = Tt.closestPointToPoint(G, !0, Ft), lt = Tt.closestPointToPoint(ut, !0, Ft), q = tt.distanceTo(G), j = lt.distanceTo(ut), Wt, Et;
2069
+ let G = new y.Vector3(n[K].start.x, n[K].start.y, 0), ut = new y.Vector3(n[K].end.x, n[K].end.y, 0), rt = new y.Vector3().subVectors(G, ut).normalize(), F = rt.clone().negate(), Y = G.clone().addScaledVector(rt, 5), Mt = ut.clone().addScaledVector(F, 5), Zt = re(S, V, G, ut), Nt = ne(S, V, G, ut), Lt = te(S, V, Y, Mt), _t = !0;
2070
+ if (Lt != null && (_t = Lt.point.distanceTo(S) < m || Lt.point.distanceTo(V) < m), (Zt && Zt.angle > 85 || Nt && Nt.type == "collinear_gap") && _t) {
2071
+ let Tt = new y.Line3(S, V), Ft = new y.Vector3(), tt = Tt.closestPointToPoint(G, !0, Ft), lt = Tt.closestPointToPoint(ut, !0, Ft), q = tt.distanceTo(G), j = lt.distanceTo(ut), Wt, Et;
2072
2072
  if (q > j && j > w)
2073
2073
  Wt = ut, Et = lt;
2074
2074
  else if (q < j && q > w)
@@ -2080,7 +2080,7 @@ const fi = async (n, t, e, o, i) => {
2080
2080
  let qt = Jt(Wt, Et, G, ut), J = Jt(Wt, Et, T, E);
2081
2081
  if (J && J.isParallel || !qt || !qt.isParallel)
2082
2082
  continue;
2083
- let ct = ne(g, b, Wt, Et);
2083
+ let ct = ne(p, b, Wt, Et);
2084
2084
  if (ct && ct.type == "collinear_overlap" && ct.maxPerpendicularDistance < 0.2)
2085
2085
  continue;
2086
2086
  Wt.z = Et.z = n[K].start.z;
@@ -2121,7 +2121,7 @@ const fi = async (n, t, e, o, i) => {
2121
2121
  type: "onlyDoor",
2122
2122
  isDoor: !0,
2123
2123
  beamNearWallVec: new y.Vector3(0, 0, 0)
2124
- }), e[a[d].index].isFindBeam = !0, e[a[d].index].isFindOnlyDoor = !0, u.push([{ id: l, beamStart: Wt, beamEnd: Et }]), l++, ot = !0;
2124
+ }), e[a[f].index].isFindBeam = !0, e[a[f].index].isFindOnlyDoor = !0, c.push([{ id: l, beamStart: Wt, beamEnd: Et }]), l++, ot = !0;
2125
2125
  break;
2126
2126
  }
2127
2127
  }
@@ -2129,10 +2129,10 @@ const fi = async (n, t, e, o, i) => {
2129
2129
  }
2130
2130
  }
2131
2131
  }
2132
- let m = [];
2133
- for (let d = 0; d < n.length; d++)
2134
- n[d].isLine2 || m.push(n[d]), n[d].isLine2 && n[d].doorAndBeamData.length != 0 && m.push(n[d]);
2135
- return n.length = 0, n.push(...m), { lines: n, beamGroup: u };
2132
+ let d = [];
2133
+ for (let f = 0; f < n.length; f++)
2134
+ n[f].isLine2 || d.push(n[f]), n[f].isLine2 && n[f].doorAndBeamData.length != 0 && d.push(n[f]);
2135
+ return n.length = 0, n.push(...d), { lines: n, beamGroup: c };
2136
2136
  }, di = (n, t) => {
2137
2137
  if (!n || n.length <= 0) return;
2138
2138
  let e = {
@@ -2141,30 +2141,30 @@ const fi = async (n, t, e, o, i) => {
2141
2141
  }, o = /* @__PURE__ */ new Set(), i = 0.2, r = 1.5, s = 0.15, a = 2;
2142
2142
  if (!n[0].uuid) {
2143
2143
  let l = 1e4;
2144
- for (let c = 0; c < n.length; c++)
2145
- n[c].uuid = l++;
2144
+ for (let u = 0; u < n.length; u++)
2145
+ n[u].uuid = l++;
2146
2146
  }
2147
2147
  for (let l = 0; l < n.length; l++) {
2148
- let c = n[l].length;
2149
- if (o.has(n[l].uuid) || c < i || c > r)
2148
+ let u = n[l].length;
2149
+ if (o.has(n[l].uuid) || u < i || u > r)
2150
2150
  continue;
2151
- let h = [], f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), w = new y.Vector3().subVectors(u, f).normalize().clone().negate(), x = new y.Vector3(), P = new y.Vector3(), M = new y.Vector3();
2151
+ let h = [], g = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), w = new y.Vector3().subVectors(c, g).normalize().clone().negate(), x = new y.Vector3(), P = new y.Vector3(), M = new y.Vector3();
2152
2152
  new y.Vector3();
2153
- for (let m = 0; m < n.length; m++) {
2154
- let d = n[m].length;
2155
- if (m == l || d < i || d > r)
2153
+ for (let d = 0; d < n.length; d++) {
2154
+ let f = n[d].length;
2155
+ if (d == l || f < i || f > r)
2156
2156
  continue;
2157
- let g = new y.Vector3(n[m].start.x, n[m].start.y, n[m].start.z), b = new y.Vector3(n[m].end.x, n[m].end.y, n[m].end.z), V = re(f, u, g, b);
2158
- if (!V || V.angle < 85)
2157
+ let p = new y.Vector3(n[d].start.x, n[d].start.y, n[d].start.z), b = new y.Vector3(n[d].end.x, n[d].end.y, n[d].end.z), z = re(g, c, p, b);
2158
+ if (!z || z.angle < 85)
2159
2159
  continue;
2160
- let v = kt(g, f), S = kt(g, u), z = kt(b, f), D = kt(b, u);
2161
- if (!(!v && !S && !z && !D)) {
2162
- v || S ? (x = g.clone(), P = b.clone()) : (x = b.clone(), P = g.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
2160
+ let v = kt(p, g), S = kt(p, c), V = kt(b, g), D = kt(b, c);
2161
+ if (!(!v && !S && !V && !D)) {
2162
+ v || S ? (x = p.clone(), P = b.clone()) : (x = b.clone(), P = p.clone()), M = new y.Vector3().subVectors(P, x).normalize(), M.clone().negate();
2163
2163
  for (let _ = 0; _ < n.length; _++) {
2164
2164
  let T = n[_].length;
2165
- if (_ == l || _ == m || T < i || T > r)
2165
+ if (_ == l || _ == d || T < i || T > r)
2166
2166
  continue;
2167
- let E = new y.Vector3(n[_].start.x, n[_].start.y, n[_].start.z), A = new y.Vector3(n[_].end.x, n[_].end.y, n[_].end.z), O = re(g, b, E, A);
2167
+ let E = new y.Vector3(n[_].start.x, n[_].start.y, n[_].start.z), A = new y.Vector3(n[_].end.x, n[_].end.y, n[_].end.z), O = re(p, b, E, A);
2168
2168
  if (!O || O.angle < 85)
2169
2169
  continue;
2170
2170
  let I = kt(E, P), B = kt(A, P);
@@ -2176,7 +2176,7 @@ const fi = async (n, t, e, o, i) => {
2176
2176
  if (!(!C || !C.parallel || !C.sameDirection)) {
2177
2177
  for (let L = 0; L < n.length; L++) {
2178
2178
  let H = n[L].length;
2179
- if (L == l || L == m || L == _ || H < i || H > r)
2179
+ if (L == l || L == d || L == _ || H < i || H > r)
2180
2180
  continue;
2181
2181
  let X = new y.Vector3(n[L].start.x, n[L].start.y, n[L].start.z), ot = new y.Vector3(n[L].end.x, n[L].end.y, n[L].end.z), K = re(X, ot, E, A);
2182
2182
  if (!K || K.angle < 85)
@@ -2186,11 +2186,11 @@ const fi = async (n, t, e, o, i) => {
2186
2186
  new y.Vector3();
2187
2187
  let rt = new y.Vector3();
2188
2188
  G ? (X.clone(), rt = ot.clone()) : (ot.clone(), rt = X.clone());
2189
- let F = kt(rt, f), Y = kt(rt, u);
2189
+ let F = kt(rt, g), Y = kt(rt, c);
2190
2190
  if (!F && !Y) continue;
2191
- let Mt = c * d;
2191
+ let Mt = u * f;
2192
2192
  if (!(Mt < s || Mt > a)) {
2193
- h = [n[l].uuid, n[m].uuid, n[_].uuid, n[L].uuid];
2193
+ h = [n[l].uuid, n[d].uuid, n[_].uuid, n[L].uuid];
2194
2194
  break;
2195
2195
  }
2196
2196
  }
@@ -2202,11 +2202,11 @@ const fi = async (n, t, e, o, i) => {
2202
2202
  break;
2203
2203
  }
2204
2204
  }
2205
- h.length == 4 && (h.forEach((m) => o.add(m)), e.rectangles.push(h));
2205
+ h.length == 4 && (h.forEach((d) => o.add(d)), e.rectangles.push(h));
2206
2206
  }
2207
2207
  for (let l = 0; l < n.length; l++) {
2208
- let c = n[l].length;
2209
- if (o.has(n[l].uuid) || c < i || c > r)
2208
+ let u = n[l].length;
2209
+ if (o.has(n[l].uuid) || u < i || u > r)
2210
2210
  continue;
2211
2211
  let h = {
2212
2212
  indexs: [],
@@ -2214,34 +2214,34 @@ const fi = async (n, t, e, o, i) => {
2214
2214
  start: new y.Vector3(),
2215
2215
  end: new y.Vector3()
2216
2216
  }
2217
- }, f = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), u = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), p = !0, w = !0;
2217
+ }, g = new y.Vector3(n[l].start.x, n[l].start.y, n[l].start.z), c = new y.Vector3(n[l].end.x, n[l].end.y, n[l].end.z), m = !0, w = !0;
2218
2218
  for (let M = 0; M < n.length; M++) {
2219
2219
  if (M == l || n[M].length < i)
2220
2220
  continue;
2221
- let m = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), d = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), g = kt(m, f), b = kt(d, f), V = kt(m, u), v = kt(d, u);
2222
- if (g || b ? p = !1 : (V || v) && (w = !1), !p && !w) break;
2221
+ let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), f = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), p = kt(d, g), b = kt(f, g), z = kt(d, c), v = kt(f, c);
2222
+ if (p || b ? m = !1 : (z || v) && (w = !1), !m && !w) break;
2223
2223
  }
2224
- if (!p && !w) continue;
2224
+ if (!m && !w) continue;
2225
2225
  let x = new y.Vector3();
2226
- p || ([f, u] = [u, f]), x = new y.Vector3().subVectors(u, f).normalize();
2226
+ m || ([g, c] = [c, g]), x = new y.Vector3().subVectors(c, g).normalize();
2227
2227
  let P = x.clone().negate();
2228
2228
  for (let M = 0; M < n.length; M++) {
2229
- let m = n[M].length;
2230
- if (M == l || o.has(M) || m < i || m > r)
2229
+ let d = n[M].length;
2230
+ if (M == l || o.has(M) || d < i || d > r)
2231
2231
  continue;
2232
- let d = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), g = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = re(f, u, d, g);
2232
+ let f = new y.Vector3(n[M].start.x, n[M].start.y, n[M].start.z), p = new y.Vector3(n[M].end.x, n[M].end.y, n[M].end.z), b = re(g, c, f, p);
2233
2233
  if (!b || b.angle < 85)
2234
2234
  continue;
2235
- let V = kt(d, u), v = kt(g, u);
2236
- if (!V && !v) continue;
2235
+ let z = kt(f, c), v = kt(p, c);
2236
+ if (!z && !v) continue;
2237
2237
  new y.Vector3();
2238
2238
  let S = new y.Vector3();
2239
- V ? (d.clone(), S = g.clone()) : (g.clone(), S = d.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)
2239
+ z ? (f.clone(), S = p.clone()) : (p.clone(), S = f.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)
2243
2243
  continue;
2244
- let _ = new y.Vector3(n[z].start.x, n[z].start.y, n[z].start.z), T = new y.Vector3(n[z].end.x, n[z].end.y, n[z].end.z), E = re(d, g, _, T);
2244
+ let _ = new y.Vector3(n[V].start.x, n[V].start.y, n[V].start.z), T = new y.Vector3(n[V].end.x, n[V].end.y, n[V].end.z), E = re(f, p, _, T);
2245
2245
  if (!E || E.angle < 85)
2246
2246
  continue;
2247
2247
  let A = kt(_, S), O = kt(T, S);
@@ -2252,14 +2252,14 @@ const fi = async (n, t, e, o, i) => {
2252
2252
  if (!W || !W.parallel || !W.sameDirection) continue;
2253
2253
  let C = !0, L = !0;
2254
2254
  for (let X = 0; X < n.length; X++) {
2255
- if (X == z || n[X].length < i) continue;
2255
+ if (X == V || 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, T), F = kt(K, T);
2257
2257
  if (G || ut ? C = !1 : (rt || F) && (L = !1), !C && !L) break;
2258
2258
  }
2259
2259
  if (!C && !L) continue;
2260
- let H = c * m;
2260
+ let H = u * d;
2261
2261
  if (!(H < s || H > a)) {
2262
- h.indexs = [n[l].uuid, n[M].uuid, n[z].uuid], h.missingEdge.start = B, h.missingEdge.end = f;
2262
+ h.indexs = [n[l].uuid, n[M].uuid, n[V].uuid], h.missingEdge.start = B, h.missingEdge.end = g;
2263
2263
  break;
2264
2264
  }
2265
2265
  }
@@ -2270,17 +2270,17 @@ const fi = async (n, t, e, o, i) => {
2270
2270
  return e;
2271
2271
  }, ae = 11102230246251565e-32, $t = 134217729, Do = (3 + 8 * ae) * ae;
2272
2272
  function We(n, t, e, o, i) {
2273
- let r, s, a, l, c = t[0], h = o[0], f = 0, u = 0;
2274
- h > c == h > -c ? (r = c, c = t[++f]) : (r = h, h = o[++u]);
2275
- let p = 0;
2276
- if (f < n && u < e)
2277
- for (h > c == h > -c ? (s = c + r, a = r - (s - c), c = t[++f]) : (s = h + r, a = r - (s - h), h = o[++u]), r = s, a !== 0 && (i[p++] = a); f < n && u < e; )
2278
- h > c == h > -c ? (s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u]), r = s, a !== 0 && (i[p++] = a);
2279
- for (; f < n; )
2280
- s = r + c, l = s - r, a = r - (s - l) + (c - l), c = t[++f], r = s, a !== 0 && (i[p++] = a);
2281
- for (; u < e; )
2282
- s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++u], r = s, a !== 0 && (i[p++] = a);
2283
- return (r !== 0 || p === 0) && (i[p++] = r), p;
2273
+ let r, s, a, l, u = t[0], h = o[0], g = 0, c = 0;
2274
+ h > u == h > -u ? (r = u, u = t[++g]) : (r = h, h = o[++c]);
2275
+ let m = 0;
2276
+ if (g < n && c < e)
2277
+ for (h > u == h > -u ? (s = u + r, a = r - (s - u), u = t[++g]) : (s = h + r, a = r - (s - h), h = o[++c]), r = s, a !== 0 && (i[m++] = a); g < n && c < e; )
2278
+ h > u == h > -u ? (s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++g]) : (s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++c]), r = s, a !== 0 && (i[m++] = a);
2279
+ for (; g < n; )
2280
+ s = r + u, l = s - r, a = r - (s - l) + (u - l), u = t[++g], r = s, a !== 0 && (i[m++] = a);
2281
+ for (; c < e; )
2282
+ s = r + h, l = s - r, a = r - (s - l) + (h - l), h = o[++c], r = s, a !== 0 && (i[m++] = a);
2283
+ return (r !== 0 || m === 0) && (i[m++] = r), m;
2284
2284
  }
2285
2285
  function _o(n, t) {
2286
2286
  let e = t[0];
@@ -2292,22 +2292,22 @@ function Ve(n) {
2292
2292
  }
2293
2293
  const To = (3 + 16 * ae) * ae, Eo = (2 + 12 * ae) * ae, Ao = (9 + 64 * ae) * ae * ae, me = Ve(4), on = Ve(8), rn = Ve(12), sn = Ve(16), jt = Ve(4);
2294
2294
  function Bo(n, t, e, o, i, r, s) {
2295
- let a, l, c, h, f, u, p, w, x, P, M, m, d, g, b, V, v, S;
2296
- const z = n - i, D = e - i, _ = t - r, T = o - r;
2297
- g = z * T, u = $t * z, p = u - (u - z), w = z - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = _ * D, u = $t * _, p = u - (u - _), w = _ - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, me[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, me[1] = d - (M + f) + (f - V), S = m + M, f = S - m, me[2] = m - (S - f) + (M - f), me[3] = S;
2295
+ let a, l, u, h, g, c, m, w, x, P, M, d, f, p, b, z, v, S;
2296
+ const V = n - i, D = e - i, _ = t - r, T = o - r;
2297
+ p = V * T, c = $t * V, m = c - (c - V), w = V - m, c = $t * T, x = c - (c - T), P = T - x, b = w * P - (p - m * x - w * x - m * P), z = _ * D, c = $t * _, m = c - (c - _), w = _ - m, c = $t * D, x = c - (c - D), P = D - x, v = w * P - (z - m * x - w * x - m * P), M = b - v, g = b - M, me[0] = b - (M + g) + (g - v), d = p + M, g = d - p, f = p - (d - g) + (M - g), M = f - z, g = f - M, me[1] = f - (M + g) + (g - z), S = d + M, g = S - d, me[2] = d - (S - g) + (M - g), me[3] = S;
2298
2298
  let E = _o(4, me), A = Eo * s;
2299
- if (E >= A || -E >= A || (f = n - z, a = n - (z + f) + (f - i), f = e - D, c = e - (D + f) + (f - i), f = t - _, l = t - (_ + f) + (f - r), f = o - T, h = o - (T + f) + (f - r), a === 0 && l === 0 && c === 0 && h === 0) || (A = Ao * s + Do * Math.abs(E), E += z * h + T * a - (_ * c + D * l), E >= A || -E >= A)) return E;
2300
- g = a * T, u = $t * a, p = u - (u - a), w = a - p, u = $t * T, x = u - (u - T), P = T - x, b = w * P - (g - p * x - w * x - p * P), V = l * D, u = $t * l, p = u - (u - l), w = l - p, u = $t * D, x = u - (u - D), P = D - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2299
+ if (E >= A || -E >= A || (g = n - V, a = n - (V + g) + (g - i), g = e - D, u = e - (D + g) + (g - i), g = t - _, l = t - (_ + g) + (g - r), g = o - T, h = o - (T + g) + (g - r), a === 0 && l === 0 && u === 0 && h === 0) || (A = Ao * s + Do * Math.abs(E), E += V * h + T * a - (_ * u + D * l), E >= A || -E >= A)) return E;
2300
+ p = a * T, c = $t * a, m = c - (c - a), w = a - m, c = $t * T, x = c - (c - T), P = T - x, b = w * P - (p - m * x - w * x - m * P), z = l * D, c = $t * l, m = c - (c - l), w = l - m, c = $t * D, x = c - (c - D), P = D - x, v = w * P - (z - m * x - w * x - m * P), M = b - v, g = b - M, jt[0] = b - (M + g) + (g - v), d = p + M, g = d - p, f = p - (d - g) + (M - g), M = f - z, g = f - M, jt[1] = f - (M + g) + (g - z), S = d + M, g = S - d, jt[2] = d - (S - g) + (M - g), jt[3] = S;
2301
2301
  const O = We(4, me, 4, jt, on);
2302
- g = z * h, u = $t * z, p = u - (u - z), w = z - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = _ * c, u = $t * _, p = u - (u - _), w = _ - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2302
+ p = V * h, c = $t * V, m = c - (c - V), w = V - m, c = $t * h, x = c - (c - h), P = h - x, b = w * P - (p - m * x - w * x - m * P), z = _ * u, c = $t * _, m = c - (c - _), w = _ - m, c = $t * u, x = c - (c - u), P = u - x, v = w * P - (z - m * x - w * x - m * P), M = b - v, g = b - M, jt[0] = b - (M + g) + (g - v), d = p + M, g = d - p, f = p - (d - g) + (M - g), M = f - z, g = f - M, jt[1] = f - (M + g) + (g - z), S = d + M, g = S - d, jt[2] = d - (S - g) + (M - g), jt[3] = S;
2303
2303
  const I = We(O, on, 4, jt, rn);
2304
- g = a * h, u = $t * a, p = u - (u - a), w = a - p, u = $t * h, x = u - (u - h), P = h - x, b = w * P - (g - p * x - w * x - p * P), V = l * c, u = $t * l, p = u - (u - l), w = l - p, u = $t * c, x = u - (u - c), P = c - x, v = w * P - (V - p * x - w * x - p * P), M = b - v, f = b - M, jt[0] = b - (M + f) + (f - v), m = g + M, f = m - g, d = g - (m - f) + (M - f), M = d - V, f = d - M, jt[1] = d - (M + f) + (f - V), S = m + M, f = S - m, jt[2] = m - (S - f) + (M - f), jt[3] = S;
2304
+ p = a * h, c = $t * a, m = c - (c - a), w = a - m, c = $t * h, x = c - (c - h), P = h - x, b = w * P - (p - m * x - w * x - m * P), z = l * u, c = $t * l, m = c - (c - l), w = l - m, c = $t * u, x = c - (c - u), P = u - x, v = w * P - (z - m * x - w * x - m * P), M = b - v, g = b - M, jt[0] = b - (M + g) + (g - v), d = p + M, g = d - p, f = p - (d - g) + (M - g), M = f - z, g = f - M, jt[1] = f - (M + g) + (g - z), S = d + M, g = S - d, jt[2] = d - (S - g) + (M - g), jt[3] = S;
2305
2305
  const B = We(I, rn, 4, jt, sn);
2306
2306
  return sn[B - 1];
2307
2307
  }
2308
2308
  function ve(n, t, e, o, i, r) {
2309
- const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, c = Math.abs(s + a);
2310
- return Math.abs(l) >= To * c ? l : -Bo(n, t, e, o, i, r, c);
2309
+ const s = (t - r) * (e - i), a = (n - i) * (o - r), l = s - a, u = Math.abs(s + a);
2310
+ return Math.abs(l) >= To * u ? l : -Bo(n, t, e, o, i, r, u);
2311
2311
  }
2312
2312
  const an = Math.pow(2, -52), De = new Uint32Array(512);
2313
2313
  class Be {
@@ -2348,57 +2348,57 @@ class Be {
2348
2348
  */
2349
2349
  update() {
2350
2350
  const { coords: t, _hullPrev: e, _hullNext: o, _hullTri: i, _hullHash: r } = this, s = t.length >> 1;
2351
- let a = 1 / 0, l = 1 / 0, c = -1 / 0, h = -1 / 0;
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 > c && (c = D), _ > h && (h = _), this._ids[z] = z;
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;
2355
2355
  }
2356
- const f = (a + c) / 2, u = (l + h) / 2;
2357
- let p = 0, w = 0, x = 0;
2358
- for (let z = 0, D = 1 / 0; z < s; z++) {
2359
- const _ = Ne(f, u, t[2 * z], t[2 * z + 1]);
2360
- _ < D && (p = z, D = _);
2356
+ const g = (a + u) / 2, c = (l + h) / 2;
2357
+ let m = 0, w = 0, x = 0;
2358
+ for (let V = 0, D = 1 / 0; V < s; V++) {
2359
+ const _ = Ne(g, c, t[2 * V], t[2 * V + 1]);
2360
+ _ < D && (m = V, D = _);
2361
2361
  }
2362
- const P = t[2 * p], M = t[2 * p + 1];
2363
- for (let z = 0, D = 1 / 0; z < s; z++) {
2364
- if (z === p) continue;
2365
- const _ = Ne(P, M, t[2 * z], t[2 * z + 1]);
2366
- _ < D && _ > 0 && (w = z, D = _);
2362
+ const P = t[2 * m], M = t[2 * m + 1];
2363
+ for (let V = 0, D = 1 / 0; V < s; V++) {
2364
+ if (V === m) continue;
2365
+ const _ = Ne(P, M, t[2 * V], t[2 * V + 1]);
2366
+ _ < D && _ > 0 && (w = V, D = _);
2367
2367
  }
2368
- let m = t[2 * w], d = t[2 * w + 1], g = 1 / 0;
2369
- for (let z = 0; z < s; z++) {
2370
- if (z === p || z === w) continue;
2371
- const D = Co(P, M, m, d, t[2 * z], t[2 * z + 1]);
2372
- D < g && (x = z, g = D);
2368
+ let d = t[2 * w], f = t[2 * w + 1], p = 1 / 0;
2369
+ for (let V = 0; V < s; V++) {
2370
+ if (V === m || V === w) continue;
2371
+ const D = Co(P, M, d, f, t[2 * V], t[2 * V + 1]);
2372
+ D < p && (x = V, p = D);
2373
2373
  }
2374
- let b = t[2 * x], V = t[2 * x + 1];
2375
- if (g === 1 / 0) {
2374
+ let b = t[2 * x], z = t[2 * x + 1];
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 z = new Uint32Array(s);
2379
+ const V = new Uint32Array(s);
2380
2380
  let D = 0;
2381
2381
  for (let _ = 0, T = -1 / 0; _ < s; _++) {
2382
2382
  const E = this._ids[_], A = this._dists[E];
2383
- A > T && (z[D++] = E, T = A);
2383
+ A > T && (V[D++] = E, T = A);
2384
2384
  }
2385
- this.hull = z.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2385
+ this.hull = V.subarray(0, D), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
2386
2386
  return;
2387
2387
  }
2388
- if (ve(P, M, m, d, b, V) < 0) {
2389
- const z = w, D = m, _ = d;
2390
- w = x, m = b, d = V, x = z, b = D, V = _;
2388
+ if (ve(P, M, d, f, b, z) < 0) {
2389
+ const V = w, D = d, _ = f;
2390
+ w = x, d = b, f = z, x = V, b = D, z = _;
2391
2391
  }
2392
- const v = Ro(P, M, m, d, b, V);
2392
+ const v = Ro(P, M, d, f, b, z);
2393
2393
  this._cx = v.x, this._cy = v.y;
2394
- for (let z = 0; z < s; z++)
2395
- this._dists[z] = Ne(t[2 * z], t[2 * z + 1], v.x, v.y);
2396
- ye(this._ids, this._dists, 0, s - 1), this._hullStart = p;
2394
+ for (let V = 0; V < s; V++)
2395
+ this._dists[V] = Ne(t[2 * V], t[2 * V + 1], v.x, v.y);
2396
+ ye(this._ids, this._dists, 0, s - 1), this._hullStart = m;
2397
2397
  let S = 3;
2398
- o[p] = e[x] = w, o[w] = e[p] = x, o[x] = e[w] = p, i[p] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = p, r[this._hashKey(m, d)] = w, r[this._hashKey(b, V)] = x, this.trianglesLen = 0, this._addTriangle(p, w, x, -1, -1, -1);
2399
- for (let z = 0, D = 0, _ = 0; z < this._ids.length; z++) {
2400
- const T = this._ids[z], E = t[2 * T], A = t[2 * T + 1];
2401
- if (z > 0 && Math.abs(E - D) <= an && Math.abs(A - _) <= an || (D = E, _ = A, T === p || T === w || T === x)) continue;
2398
+ o[m] = e[x] = w, o[w] = e[m] = x, o[x] = e[w] = m, i[m] = 0, i[w] = 1, i[x] = 2, r.fill(-1), r[this._hashKey(P, M)] = m, r[this._hashKey(d, f)] = w, r[this._hashKey(b, z)] = x, this.trianglesLen = 0, this._addTriangle(m, w, x, -1, -1, -1);
2399
+ for (let V = 0, D = 0, _ = 0; V < this._ids.length; V++) {
2400
+ const T = this._ids[V], E = t[2 * T], A = t[2 * T + 1];
2401
+ if (V > 0 && Math.abs(E - D) <= an && Math.abs(A - _) <= an || (D = E, _ = A, T === m || T === w || T === x)) continue;
2402
2402
  let O = 0;
2403
2403
  for (let C = 0, L = this._hashKey(E, A); C < this._hashSize && (O = r[(L + C) % this._hashSize], !(O !== -1 && O !== o[O])); C++)
2404
2404
  ;
@@ -2421,8 +2421,8 @@ class Be {
2421
2421
  this._hullStart = e[T] = I, o[I] = e[W] = T, o[T] = W, r[this._hashKey(E, A)] = T, r[this._hashKey(t[2 * I], t[2 * I + 1])] = I;
2422
2422
  }
2423
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];
2424
+ for (let V = 0, D = this._hullStart; V < S; V++)
2425
+ this.hull[V] = 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
  /**
@@ -2451,32 +2451,32 @@ class Be {
2451
2451
  t = De[--r];
2452
2452
  continue;
2453
2453
  }
2454
- const c = a - a % 3, h = l + (t + 1) % 3, f = c + (a + 2) % 3, u = e[s], p = e[t], w = e[h], x = e[f];
2454
+ const u = a - a % 3, h = l + (t + 1) % 3, g = u + (a + 2) % 3, c = e[s], m = e[t], w = e[h], x = e[g];
2455
2455
  if (ko(
2456
- i[2 * u],
2457
- i[2 * u + 1],
2458
- i[2 * p],
2459
- i[2 * p + 1],
2456
+ i[2 * c],
2457
+ i[2 * c + 1],
2458
+ i[2 * m],
2459
+ i[2 * m + 1],
2460
2460
  i[2 * w],
2461
2461
  i[2 * w + 1],
2462
2462
  i[2 * x],
2463
2463
  i[2 * x + 1]
2464
2464
  )) {
2465
- e[t] = x, e[a] = u;
2466
- const M = o[f];
2465
+ e[t] = x, e[a] = c;
2466
+ const M = o[g];
2467
2467
  if (M === -1) {
2468
- let d = this._hullStart;
2468
+ let f = this._hullStart;
2469
2469
  do {
2470
- if (this._hullTri[d] === f) {
2471
- this._hullTri[d] = t;
2470
+ if (this._hullTri[f] === g) {
2471
+ this._hullTri[f] = t;
2472
2472
  break;
2473
2473
  }
2474
- d = this._hullPrev[d];
2475
- } while (d !== this._hullStart);
2474
+ f = this._hullPrev[f];
2475
+ } while (f !== this._hullStart);
2476
2476
  }
2477
- this._link(t, M), this._link(a, o[s]), this._link(s, f);
2478
- const m = c + (a + 1) % 3;
2479
- r < De.length && (De[r++] = m);
2477
+ this._link(t, M), this._link(a, o[s]), this._link(s, g);
2478
+ const d = u + (a + 1) % 3;
2479
+ r < De.length && (De[r++] = d);
2480
2480
  } else {
2481
2481
  if (r === 0) break;
2482
2482
  t = De[--r];
@@ -2518,16 +2518,16 @@ function Ne(n, t, e, o) {
2518
2518
  return i * i + r * r;
2519
2519
  }
2520
2520
  function ko(n, t, e, o, i, r, s, a) {
2521
- const l = n - s, c = t - a, h = e - s, f = o - a, u = i - s, p = r - a, w = l * l + c * c, x = h * h + f * f, P = u * u + p * p;
2522
- return l * (f * P - x * p) - c * (h * P - x * u) + w * (h * p - f * u) < 0;
2521
+ const l = n - s, u = t - a, h = e - s, g = o - a, c = i - s, m = r - a, w = l * l + u * u, x = h * h + g * g, P = c * c + m * m;
2522
+ return l * (g * P - x * m) - u * (h * P - x * c) + w * (h * m - g * c) < 0;
2523
2523
  }
2524
2524
  function Co(n, t, e, o, i, r) {
2525
- const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = (c * h - a * f) * u, w = (s * f - l * h) * u;
2526
- return p * p + w * w;
2525
+ const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, g = l * l + u * u, c = 0.5 / (s * u - a * l), m = (u * h - a * g) * c, w = (s * g - l * h) * c;
2526
+ return m * m + w * w;
2527
2527
  }
2528
2528
  function Ro(n, t, e, o, i, r) {
2529
- const s = e - n, a = o - t, l = i - n, c = r - t, h = s * s + a * a, f = l * l + c * c, u = 0.5 / (s * c - a * l), p = n + (c * h - a * f) * u, w = t + (s * f - l * h) * u;
2530
- return { x: p, y: w };
2529
+ const s = e - n, a = o - t, l = i - n, u = r - t, h = s * s + a * a, g = l * l + u * u, c = 0.5 / (s * u - a * l), m = n + (u * h - a * g) * c, w = t + (s * g - l * h) * c;
2530
+ return { x: m, y: w };
2531
2531
  }
2532
2532
  function ye(n, t, e, o) {
2533
2533
  if (o - e <= 20)
@@ -2622,8 +2622,8 @@ class Oo {
2622
2622
  const { delaunay: { points: t, hull: e, triangles: o }, vectors: i } = this;
2623
2623
  let r, s;
2624
2624
  const a = this.circumcenters = this._circumcenters.subarray(0, o.length / 3 * 2);
2625
- for (let x = 0, P = 0, M = o.length, m, d; x < M; x += 3, P += 2) {
2626
- const g = o[x] * 2, b = o[x + 1] * 2, V = o[x + 2] * 2, v = t[g], S = t[g + 1], z = t[b], D = t[b + 1], _ = t[V], T = t[V + 1], E = z - v, A = D - S, O = _ - v, I = T - S, B = (E * I - A * O) * 2;
2625
+ for (let x = 0, P = 0, M = o.length, d, f; x < M; x += 3, P += 2) {
2626
+ const p = o[x] * 2, b = o[x + 1] * 2, z = o[x + 2] * 2, v = t[p], S = t[p + 1], V = t[b], D = t[b + 1], _ = t[z], T = t[z + 1], E = V - v, A = D - S, O = _ - v, I = T - S, B = (E * I - A * O) * 2;
2627
2627
  if (Math.abs(B) < 1e-9) {
2628
2628
  if (r === void 0) {
2629
2629
  r = s = 0;
@@ -2631,32 +2631,32 @@ class Oo {
2631
2631
  r /= e.length, s /= e.length;
2632
2632
  }
2633
2633
  const R = 1e9 * Math.sign((r - v) * I - (s - S) * O);
2634
- m = (v + _) / 2 - R * I, d = (S + T) / 2 + R * O;
2634
+ d = (v + _) / 2 - R * I, f = (S + T) / 2 + R * O;
2635
2635
  } else {
2636
2636
  const R = 1 / B, W = E * E + A * A, C = O * O + I * I;
2637
- m = v + (I * W - A * C) * R, d = S + (E * C - O * W) * R;
2637
+ d = v + (I * W - A * C) * R, f = S + (E * C - O * W) * R;
2638
2638
  }
2639
- a[P] = m, a[P + 1] = d;
2639
+ a[P] = d, a[P + 1] = f;
2640
2640
  }
2641
- let l = e[e.length - 1], c, h = l * 4, f, u = t[2 * l], p, w = t[2 * l + 1];
2641
+ let l = e[e.length - 1], u, h = l * 4, g, c = t[2 * l], m, w = t[2 * l + 1];
2642
2642
  i.fill(0);
2643
2643
  for (let x = 0; x < e.length; ++x)
2644
- l = e[x], c = h, f = u, p = w, h = l * 4, u = t[2 * l], w = t[2 * l + 1], i[c + 2] = i[h] = p - w, i[c + 3] = i[h + 1] = u - f;
2644
+ l = e[x], u = h, g = c, m = w, h = l * 4, c = t[2 * l], w = t[2 * l + 1], i[u + 2] = i[h] = m - w, i[u + 3] = i[h + 1] = c - g;
2645
2645
  }
2646
2646
  render(t) {
2647
2647
  const e = t == null ? t = new de() : void 0, { delaunay: { halfedges: o, inedges: i, hull: r }, circumcenters: s, vectors: a } = this;
2648
2648
  if (r.length <= 1) return null;
2649
- for (let h = 0, f = o.length; h < f; ++h) {
2650
- const u = o[h];
2651
- if (u < h) continue;
2652
- const p = Math.floor(h / 3) * 2, w = Math.floor(u / 3) * 2, x = s[p], P = s[p + 1], M = s[w], m = s[w + 1];
2653
- this._renderSegment(x, P, M, m, t);
2649
+ for (let h = 0, g = o.length; h < g; ++h) {
2650
+ const c = o[h];
2651
+ if (c < h) continue;
2652
+ const m = Math.floor(h / 3) * 2, w = Math.floor(c / 3) * 2, x = s[m], P = s[m + 1], M = s[w], d = s[w + 1];
2653
+ this._renderSegment(x, P, M, d, t);
2654
2654
  }
2655
- let l, c = r[r.length - 1];
2655
+ let l, u = r[r.length - 1];
2656
2656
  for (let h = 0; h < r.length; ++h) {
2657
- l = c, c = r[h];
2658
- const f = Math.floor(i[c] / 3) * 2, u = s[f], p = s[f + 1], w = l * 4, x = this._project(u, p, a[w + 2], a[w + 3]);
2659
- x && this._renderSegment(u, p, x[0], x[1], t);
2657
+ l = u, u = r[h];
2658
+ const g = Math.floor(i[u] / 3) * 2, c = s[g], m = s[g + 1], w = l * 4, x = this._project(c, m, a[w + 2], a[w + 3]);
2659
+ x && this._renderSegment(c, m, x[0], x[1], t);
2660
2660
  }
2661
2661
  return e && e.value();
2662
2662
  }
@@ -2713,8 +2713,8 @@ class Oo {
2713
2713
  const a = [];
2714
2714
  let l = s;
2715
2715
  do {
2716
- const c = Math.floor(l / 3);
2717
- if (a.push(e[c * 2], e[c * 2 + 1]), l = l % 3 === 2 ? l - 2 : l + 1, r[l] !== t) break;
2716
+ const u = Math.floor(l / 3);
2717
+ if (a.push(e[u * 2], e[u * 2 + 1]), l = l % 3 === 2 ? l - 2 : l + 1, r[l] !== t) break;
2718
2718
  l = i[l];
2719
2719
  } while (l !== s && l !== -1);
2720
2720
  return a;
@@ -2729,23 +2729,23 @@ class Oo {
2729
2729
  }
2730
2730
  _clipFinite(t, e) {
2731
2731
  const o = e.length;
2732
- let i = null, r, s, a = e[o - 2], l = e[o - 1], c, h = this._regioncode(a, l), f, u = 0;
2733
- for (let p = 0; p < o; p += 2)
2734
- if (r = a, s = l, a = e[p], l = e[p + 1], c = h, h = this._regioncode(a, l), c === 0 && h === 0)
2735
- f = u, u = 0, i ? i.push(a, l) : i = [a, l];
2732
+ let i = null, r, s, a = e[o - 2], l = e[o - 1], u, h = this._regioncode(a, l), g, c = 0;
2733
+ for (let m = 0; m < o; m += 2)
2734
+ if (r = a, s = l, a = e[m], l = e[m + 1], u = h, h = this._regioncode(a, l), u === 0 && h === 0)
2735
+ g = c, c = 0, i ? i.push(a, l) : i = [a, l];
2736
2736
  else {
2737
- let w, x, P, M, m;
2738
- if (c === 0) {
2739
- if ((w = this._clipSegment(r, s, a, l, c, h)) === null) continue;
2740
- [x, P, M, m] = w;
2737
+ let w, x, P, M, d;
2738
+ if (u === 0) {
2739
+ if ((w = this._clipSegment(r, s, a, l, u, h)) === null) continue;
2740
+ [x, P, M, d] = w;
2741
2741
  } else {
2742
- if ((w = this._clipSegment(a, l, r, s, h, c)) === null) continue;
2743
- [M, m, x, P] = w, f = u, u = this._edgecode(x, P), f && u && this._edge(t, f, u, i, i.length), i ? i.push(x, P) : i = [x, P];
2742
+ if ((w = this._clipSegment(a, l, r, s, h, u)) === null) continue;
2743
+ [M, d, x, P] = w, g = c, c = this._edgecode(x, P), g && c && this._edge(t, g, c, i, i.length), i ? i.push(x, P) : i = [x, P];
2744
2744
  }
2745
- f = u, u = this._edgecode(M, m), f && u && this._edge(t, f, u, i, i.length), i ? i.push(M, m) : i = [M, m];
2745
+ g = c, c = this._edgecode(M, d), g && c && this._edge(t, g, c, i, i.length), i ? i.push(M, d) : i = [M, d];
2746
2746
  }
2747
2747
  if (i)
2748
- f = u, u = this._edgecode(i[0], i[1]), f && u && this._edge(t, f, u, i, i.length);
2748
+ g = c, c = this._edgecode(i[0], i[1]), g && c && this._edge(t, g, c, i, i.length);
2749
2749
  else if (this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2))
2750
2750
  return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
2751
2751
  return i;
@@ -2755,15 +2755,15 @@ class Oo {
2755
2755
  for (a && ([t, e, o, i, r, s] = [o, i, t, e, s, r]); ; ) {
2756
2756
  if (r === 0 && s === 0) return a ? [o, i, t, e] : [t, e, o, i];
2757
2757
  if (r & s) return null;
2758
- let l, c, h = r || s;
2759
- h & 8 ? (l = t + (o - t) * (this.ymax - e) / (i - e), c = this.ymax) : h & 4 ? (l = t + (o - t) * (this.ymin - e) / (i - e), c = this.ymin) : h & 2 ? (c = e + (i - e) * (this.xmax - t) / (o - t), l = this.xmax) : (c = e + (i - e) * (this.xmin - t) / (o - t), l = this.xmin), r ? (t = l, e = c, r = this._regioncode(t, e)) : (o = l, i = c, s = this._regioncode(o, i));
2758
+ let l, u, h = r || s;
2759
+ h & 8 ? (l = t + (o - t) * (this.ymax - e) / (i - e), u = this.ymax) : h & 4 ? (l = t + (o - t) * (this.ymin - e) / (i - e), u = this.ymin) : h & 2 ? (u = e + (i - e) * (this.xmax - t) / (o - t), l = this.xmax) : (u = e + (i - e) * (this.xmin - t) / (o - t), l = this.xmin), r ? (t = l, e = u, r = this._regioncode(t, e)) : (o = l, i = u, s = this._regioncode(o, i));
2760
2760
  }
2761
2761
  }
2762
2762
  _clipInfinite(t, e, o, i, r, s) {
2763
2763
  let a = Array.from(e), l;
2764
2764
  if ((l = this._project(a[0], a[1], o, i)) && a.unshift(l[0], l[1]), (l = this._project(a[a.length - 2], a[a.length - 1], r, s)) && a.push(l[0], l[1]), a = this._clipFinite(t, a))
2765
- for (let c = 0, h = a.length, f, u = this._edgecode(a[h - 2], a[h - 1]); c < h; c += 2)
2766
- f = u, u = this._edgecode(a[c], a[c + 1]), f && u && (c = this._edge(t, f, u, a, c), h = a.length);
2765
+ for (let u = 0, h = a.length, g, c = this._edgecode(a[h - 2], a[h - 1]); u < h; u += 2)
2766
+ g = c, c = this._edgecode(a[u], a[u + 1]), g && c && (u = this._edge(t, g, c, a, u), h = a.length);
2767
2767
  else this.contains(t, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2) && (a = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]);
2768
2768
  return a;
2769
2769
  }
@@ -2866,21 +2866,21 @@ class Ue {
2866
2866
  _init() {
2867
2867
  const t = this._delaunator, e = this.points;
2868
2868
  if (t.hull && t.hull.length > 2 && Xo(t)) {
2869
- this.collinear = Int32Array.from({ length: e.length / 2 }, (u, p) => p).sort((u, p) => e[2 * u] - e[2 * p] || e[2 * u + 1] - e[2 * p + 1]);
2870
- const l = this.collinear[0], c = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * c], e[2 * c + 1]], f = 1e-8 * Math.hypot(h[3] - h[1], h[2] - h[0]);
2871
- for (let u = 0, p = e.length / 2; u < p; ++u) {
2872
- const w = Ho(e[2 * u], e[2 * u + 1], f);
2873
- e[2 * u] = w[0], e[2 * u + 1] = w[1];
2869
+ this.collinear = Int32Array.from({ length: e.length / 2 }, (c, m) => m).sort((c, m) => e[2 * c] - e[2 * m] || e[2 * c + 1] - e[2 * m + 1]);
2870
+ const l = this.collinear[0], u = this.collinear[this.collinear.length - 1], h = [e[2 * l], e[2 * l + 1], e[2 * u], e[2 * u + 1]], g = 1e-8 * Math.hypot(h[3] - h[1], h[2] - h[0]);
2871
+ for (let c = 0, m = e.length / 2; c < m; ++c) {
2872
+ const w = Ho(e[2 * c], e[2 * c + 1], g);
2873
+ e[2 * c] = w[0], e[2 * c + 1] = w[1];
2874
2874
  }
2875
2875
  this._delaunator = new Be(e);
2876
2876
  } else
2877
2877
  delete this.collinear;
2878
2878
  const o = this.halfedges = this._delaunator.halfedges, i = this.hull = this._delaunator.hull, r = this.triangles = this._delaunator.triangles, s = this.inedges.fill(-1), a = this._hullIndex.fill(-1);
2879
- for (let l = 0, c = o.length; l < c; ++l) {
2879
+ for (let l = 0, u = o.length; l < u; ++l) {
2880
2880
  const h = r[l % 3 === 2 ? l - 2 : l + 1];
2881
2881
  (o[l] === -1 || s[h] === -1) && (s[h] = l);
2882
2882
  }
2883
- for (let l = 0, c = i.length; l < c; ++l)
2883
+ for (let l = 0, u = i.length; l < u; ++l)
2884
2884
  a[i[l]] = l;
2885
2885
  i.length <= 2 && i.length > 0 && (this.triangles = new Int32Array(3).fill(-1), this.halfedges = new Int32Array(3).fill(-1), this.triangles[0] = i[0], s[i[0]] = 1, i.length === 2 && (s[i[1]] = 0, this.triangles[1] = i[1], this.triangles[2] = i[1]));
2886
2886
  }
@@ -2890,21 +2890,21 @@ class Ue {
2890
2890
  *neighbors(t) {
2891
2891
  const { inedges: e, hull: o, _hullIndex: i, halfedges: r, triangles: s, collinear: a } = this;
2892
2892
  if (a) {
2893
- const f = a.indexOf(t);
2894
- f > 0 && (yield a[f - 1]), f < a.length - 1 && (yield a[f + 1]);
2893
+ const g = a.indexOf(t);
2894
+ g > 0 && (yield a[g - 1]), g < a.length - 1 && (yield a[g + 1]);
2895
2895
  return;
2896
2896
  }
2897
2897
  const l = e[t];
2898
2898
  if (l === -1) return;
2899
- let c = l, h = -1;
2899
+ let u = l, h = -1;
2900
2900
  do {
2901
- if (yield h = s[c], c = c % 3 === 2 ? c - 2 : c + 1, s[c] !== t) return;
2902
- if (c = r[c], c === -1) {
2903
- const f = o[(i[t] + 1) % o.length];
2904
- f !== h && (yield f);
2901
+ if (yield h = s[u], u = u % 3 === 2 ? u - 2 : u + 1, s[u] !== t) return;
2902
+ if (u = r[u], u === -1) {
2903
+ const g = o[(i[t] + 1) % o.length];
2904
+ g !== h && (yield g);
2905
2905
  return;
2906
2906
  }
2907
- } while (c !== l);
2907
+ } while (u !== l);
2908
2908
  }
2909
2909
  find(t, e, o = 0) {
2910
2910
  if (t = +t, t !== t || (e = +e, e !== e)) return -1;
@@ -2914,21 +2914,21 @@ class Ue {
2914
2914
  return r;
2915
2915
  }
2916
2916
  _step(t, e, o) {
2917
- const { inedges: i, hull: r, _hullIndex: s, halfedges: a, triangles: l, points: c } = this;
2918
- if (i[t] === -1 || !c.length) return (t + 1) % (c.length >> 1);
2919
- let h = t, f = ge(e - c[t * 2], 2) + ge(o - c[t * 2 + 1], 2);
2920
- const u = i[t];
2921
- let p = u;
2917
+ const { inedges: i, hull: r, _hullIndex: s, halfedges: a, triangles: l, points: u } = this;
2918
+ if (i[t] === -1 || !u.length) return (t + 1) % (u.length >> 1);
2919
+ let h = t, g = ge(e - u[t * 2], 2) + ge(o - u[t * 2 + 1], 2);
2920
+ const c = i[t];
2921
+ let m = c;
2922
2922
  do {
2923
- let w = l[p];
2924
- const x = ge(e - c[w * 2], 2) + ge(o - c[w * 2 + 1], 2);
2925
- if (x < f && (f = x, h = w), p = p % 3 === 2 ? p - 2 : p + 1, l[p] !== t) break;
2926
- if (p = a[p], p === -1) {
2927
- if (p = r[(s[t] + 1) % r.length], p !== w && ge(e - c[p * 2], 2) + ge(o - c[p * 2 + 1], 2) < f)
2928
- return p;
2923
+ let w = l[m];
2924
+ const x = ge(e - u[w * 2], 2) + ge(o - u[w * 2 + 1], 2);
2925
+ if (x < g && (g = x, h = w), m = m % 3 === 2 ? m - 2 : m + 1, l[m] !== t) break;
2926
+ if (m = a[m], m === -1) {
2927
+ if (m = r[(s[t] + 1) % r.length], m !== w && ge(e - u[m * 2], 2) + ge(o - u[m * 2 + 1], 2) < g)
2928
+ return m;
2929
2929
  break;
2930
2930
  }
2931
- } while (p !== u);
2931
+ } while (m !== c);
2932
2932
  return h;
2933
2933
  }
2934
2934
  render(t) {
@@ -2936,8 +2936,8 @@ class Ue {
2936
2936
  for (let s = 0, a = i.length; s < a; ++s) {
2937
2937
  const l = i[s];
2938
2938
  if (l < s) continue;
2939
- const c = r[s] * 2, h = r[l] * 2;
2940
- t.moveTo(o[c], o[c + 1]), t.lineTo(o[h], o[h + 1]);
2939
+ const u = r[s] * 2, h = r[l] * 2;
2940
+ t.moveTo(o[u], o[u + 1]), t.lineTo(o[h], o[h + 1]);
2941
2941
  }
2942
2942
  return this.renderHull(t), e && e.value();
2943
2943
  }
@@ -2994,8 +2994,8 @@ function Go(n, t, e, o) {
2994
2994
  return 1 + (n[t][0] === 0 || n[e][0] === 0 || n[o][0] === 0 ? 1 : 0);
2995
2995
  }
2996
2996
  function jo(n, t, e, o, i, r) {
2997
- const s = Math.hypot(e - i, o - r), a = Math.hypot(n - i, t - r), l = Math.hypot(n - e, t - o), c = Math.abs((e - n) * (r - t) - (i - n) * (o - t)) / 2;
2998
- return c === 0 ? 1 / 0 : s * a * l / (4 * c);
2997
+ const s = Math.hypot(e - i, o - r), a = Math.hypot(n - i, t - r), l = Math.hypot(n - e, t - o), u = Math.abs((e - n) * (r - t) - (i - n) * (o - t)) / 2;
2998
+ return u === 0 ? 1 / 0 : s * a * l / (4 * u);
2999
2999
  }
3000
3000
  function cn(n) {
3001
3001
  if (!n || n.length < 3) return [];
@@ -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], P = i[w + 1], M = i[w + 2], [m, d] = e[x], [g, b] = e[P], [V, v] = e[M], S = jo(m, d, g, b, V, v), z = Go(e, x, P, M);
3013
- if (S <= 1 / z)
3012
+ const x = i[w], P = i[w + 1], M = i[w + 2], [d, f] = e[x], [p, b] = e[P], [z, v] = e[M], S = jo(d, f, p, b, z, v), V = Go(e, x, P, M);
3013
+ if (S <= 1 / V)
3014
3014
  for (const [D, _] of [[x, P], [P, M], [M, x]]) {
3015
3015
  const T = s(D, _);
3016
3016
  r.set(T, (r.get(T) || 0) + 1);
@@ -3022,15 +3022,15 @@ function cn(n) {
3022
3022
  const l = /* @__PURE__ */ new Map();
3023
3023
  for (const [w, x] of a)
3024
3024
  (l.get(w) || l.set(w, []).get(w)).push(x), (l.get(x) || l.set(x, []).get(x)).push(w);
3025
- const c = a[0][0], h = [], f = /* @__PURE__ */ new Set();
3026
- let u = c, p = -1;
3025
+ const u = a[0][0], h = [], g = /* @__PURE__ */ new Set();
3026
+ let c = u, m = -1;
3027
3027
  do {
3028
- h.push(e[u]), f.add(u);
3029
- const w = l.get(u) || [];
3030
- let x = w.find((P) => P !== p && !f.has(P));
3031
- if (x === void 0 && (x = w.find((P) => P !== p)), x === void 0) break;
3032
- p = u, u = x;
3033
- } while (u !== c && h.length <= a.length + 1);
3028
+ h.push(e[c]), g.add(c);
3029
+ const w = l.get(c) || [];
3030
+ let x = w.find((P) => P !== m && !g.has(P));
3031
+ if (x === void 0 && (x = w.find((P) => P !== m)), x === void 0) break;
3032
+ m = c, c = x;
3033
+ } while (c !== u && h.length <= a.length + 1);
3034
3034
  return h;
3035
3035
  }
3036
3036
  const mt = {
@@ -3225,8 +3225,8 @@ let An = class {
3225
3225
  let o = Ot.set(e[0], e[1], e[2]).length();
3226
3226
  const i = Ot.set(e[4], e[5], e[6]).length(), r = Ot.set(e[8], e[9], e[10]).length();
3227
3227
  t.determinant() < 0 && (o = -o), Qt.setFromMatrix4(t);
3228
- const a = 1 / o, l = 1 / i, c = 1 / r;
3229
- return Qt.elements[0] *= a, Qt.elements[1] *= a, Qt.elements[2] *= a, Qt.elements[3] *= l, Qt.elements[4] *= l, Qt.elements[5] *= l, Qt.elements[6] *= c, Qt.elements[7] *= c, Qt.elements[8] *= c, this.rotation.multiply(Qt), this.halfSize.x *= o, this.halfSize.y *= i, this.halfSize.z *= r, Ot.setFromMatrixPosition(t), this.center.add(Ot), this;
3228
+ const a = 1 / o, l = 1 / i, u = 1 / r;
3229
+ return Qt.elements[0] *= a, Qt.elements[1] *= a, Qt.elements[2] *= a, Qt.elements[3] *= l, Qt.elements[4] *= l, Qt.elements[5] *= l, Qt.elements[6] *= u, Qt.elements[7] *= u, Qt.elements[8] *= u, this.rotation.multiply(Qt), this.halfSize.x *= o, this.halfSize.y *= i, this.halfSize.z *= r, Ot.setFromMatrixPosition(t), this.center.add(Ot), this;
3230
3230
  }
3231
3231
  };
3232
3232
  const Uo = new An();
@@ -3313,17 +3313,17 @@ function Qo(n) {
3313
3313
  }
3314
3314
  function Pe(n, t, e) {
3315
3315
  if (n !== null)
3316
- for (var o, i, r, s, a, l, c, h = 0, f = 0, u, p = n.type, w = p === "FeatureCollection", x = p === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
3317
- c = w ? (
3316
+ for (var o, i, r, s, a, l, u, h = 0, g = 0, c, m = n.type, w = m === "FeatureCollection", x = m === "Feature", P = w ? n.features.length : 1, M = 0; M < P; M++) {
3317
+ u = w ? (
3318
3318
  // @ts-expect-error: Known type conflict
3319
3319
  n.features[M].geometry
3320
3320
  ) : x ? (
3321
3321
  // @ts-expect-error: Known type conflict
3322
3322
  n.geometry
3323
- ) : n, u = c ? c.type === "GeometryCollection" : !1, a = u ? c.geometries.length : 1;
3324
- for (var m = 0; m < a; m++) {
3325
- var d = 0, g = 0;
3326
- if (s = u ? c.geometries[m] : c, s !== null) {
3323
+ ) : n, c = u ? u.type === "GeometryCollection" : !1, a = c ? u.geometries.length : 1;
3324
+ for (var d = 0; d < a; d++) {
3325
+ var f = 0, p = 0;
3326
+ if (s = c ? u.geometries[d] : u, s !== null) {
3327
3327
  l = s.coordinates;
3328
3328
  var b = s.type;
3329
3329
  switch (h = e && (b === "Polygon" || b === "MultiPolygon") ? 1 : 0, b) {
@@ -3334,14 +3334,14 @@ function Pe(n, t, e) {
3334
3334
  // @ts-expect-error: Known type conflict
3335
3335
  t(
3336
3336
  l,
3337
- f,
3337
+ g,
3338
3338
  M,
3339
- d,
3340
- g
3339
+ f,
3340
+ p
3341
3341
  ) === !1
3342
3342
  )
3343
3343
  return !1;
3344
- f++, d++;
3344
+ g++, f++;
3345
3345
  break;
3346
3346
  case "LineString":
3347
3347
  case "MultiPoint":
@@ -3350,16 +3350,16 @@ function Pe(n, t, e) {
3350
3350
  // @ts-expect-error: Known type conflict
3351
3351
  t(
3352
3352
  l[o],
3353
- f,
3353
+ g,
3354
3354
  M,
3355
- d,
3356
- g
3355
+ f,
3356
+ p
3357
3357
  ) === !1
3358
3358
  )
3359
3359
  return !1;
3360
- f++, b === "MultiPoint" && d++;
3360
+ g++, b === "MultiPoint" && f++;
3361
3361
  }
3362
- b === "LineString" && d++;
3362
+ b === "LineString" && f++;
3363
3363
  break;
3364
3364
  case "Polygon":
3365
3365
  case "MultiLineString":
@@ -3369,39 +3369,39 @@ function Pe(n, t, e) {
3369
3369
  // @ts-expect-error: Known type conflict
3370
3370
  t(
3371
3371
  l[o][i],
3372
- f,
3372
+ g,
3373
3373
  M,
3374
- d,
3375
- g
3374
+ f,
3375
+ p
3376
3376
  ) === !1
3377
3377
  )
3378
3378
  return !1;
3379
- f++;
3379
+ g++;
3380
3380
  }
3381
- b === "MultiLineString" && d++, b === "Polygon" && g++;
3381
+ b === "MultiLineString" && f++, b === "Polygon" && p++;
3382
3382
  }
3383
- b === "Polygon" && d++;
3383
+ b === "Polygon" && f++;
3384
3384
  break;
3385
3385
  case "MultiPolygon":
3386
3386
  for (o = 0; o < l.length; o++) {
3387
- for (g = 0, i = 0; i < l[o].length; i++) {
3387
+ for (p = 0, i = 0; i < l[o].length; i++) {
3388
3388
  for (r = 0; r < l[o][i].length - h; r++) {
3389
3389
  if (
3390
3390
  // @ts-expect-error: Known type conflict
3391
3391
  t(
3392
3392
  l[o][i][r],
3393
- f,
3393
+ g,
3394
3394
  M,
3395
- d,
3396
- g
3395
+ f,
3396
+ p
3397
3397
  ) === !1
3398
3398
  )
3399
3399
  return !1;
3400
- f++;
3400
+ g++;
3401
3401
  }
3402
- g++;
3402
+ p++;
3403
3403
  }
3404
- d++;
3404
+ f++;
3405
3405
  }
3406
3406
  break;
3407
3407
  case "GeometryCollection":
@@ -3426,27 +3426,27 @@ function Jo(n) {
3426
3426
  }), t;
3427
3427
  }
3428
3428
  function tr(n, t) {
3429
- var e, o, i, r, s, a, l, c, h, f, u = 0, p = n.type === "FeatureCollection", w = n.type === "Feature", x = p ? n.features.length : 1;
3429
+ var e, o, i, r, s, a, l, u, h, g, c = 0, m = n.type === "FeatureCollection", w = n.type === "Feature", x = m ? n.features.length : 1;
3430
3430
  for (e = 0; e < x; e++) {
3431
- for (a = p ? (
3431
+ for (a = m ? (
3432
3432
  // @ts-expect-error: Known type conflict
3433
3433
  n.features[e].geometry
3434
3434
  ) : w ? (
3435
3435
  // @ts-expect-error: Known type conflict
3436
3436
  n.geometry
3437
- ) : n, c = p ? (
3437
+ ) : n, u = m ? (
3438
3438
  // @ts-expect-error: Known type conflict
3439
3439
  n.features[e].properties
3440
3440
  ) : w ? (
3441
3441
  // @ts-expect-error: Known type conflict
3442
3442
  n.properties
3443
- ) : {}, h = p ? (
3443
+ ) : {}, h = m ? (
3444
3444
  // @ts-expect-error: Known type conflict
3445
3445
  n.features[e].bbox
3446
3446
  ) : w ? (
3447
3447
  // @ts-expect-error: Known type conflict
3448
3448
  n.bbox
3449
- ) : void 0, f = p ? (
3449
+ ) : void 0, g = m ? (
3450
3450
  // @ts-expect-error: Known type conflict
3451
3451
  n.features[e].id
3452
3452
  ) : w ? (
@@ -3459,10 +3459,10 @@ function tr(n, t) {
3459
3459
  t(
3460
3460
  // @ts-expect-error: Known type conflict
3461
3461
  null,
3462
- u,
3463
3462
  c,
3463
+ u,
3464
3464
  h,
3465
- f
3465
+ g
3466
3466
  ) === !1
3467
3467
  )
3468
3468
  return !1;
@@ -3479,10 +3479,10 @@ function tr(n, t) {
3479
3479
  // @ts-expect-error: Known type conflict
3480
3480
  t(
3481
3481
  r,
3482
- u,
3483
3482
  c,
3483
+ u,
3484
3484
  h,
3485
- f
3485
+ g
3486
3486
  ) === !1
3487
3487
  )
3488
3488
  return !1;
@@ -3494,10 +3494,10 @@ function tr(n, t) {
3494
3494
  // @ts-expect-error: Known type conflict
3495
3495
  t(
3496
3496
  r.geometries[o],
3497
- u,
3498
3497
  c,
3498
+ u,
3499
3499
  h,
3500
- f
3500
+ g
3501
3501
  ) === !1
3502
3502
  )
3503
3503
  return !1;
@@ -3507,7 +3507,7 @@ function tr(n, t) {
3507
3507
  throw new Error("Unknown Geometry Type");
3508
3508
  }
3509
3509
  }
3510
- u++;
3510
+ c++;
3511
3511
  }
3512
3512
  }
3513
3513
  function er(n, t, e) {
@@ -3555,209 +3555,209 @@ var Ze = { exports: {} }, On = { exports: {} };
3555
3555
  (function(e, o) {
3556
3556
  n.exports = o();
3557
3557
  })(Fn, function() {
3558
- function e(m, d, g, b, V) {
3559
- (function v(S, z, D, _, T) {
3558
+ function e(d, f, p, b, z) {
3559
+ (function v(S, V, D, _, T) {
3560
3560
  for (; _ > D; ) {
3561
3561
  if (_ - D > 600) {
3562
- var E = _ - D + 1, A = z - D + 1, O = Math.log(E), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (E - I) / E) * (A - E / 2 < 0 ? -1 : 1), R = Math.max(D, Math.floor(z - A * I / E + B)), W = Math.min(_, Math.floor(z + (E - A) * I / E + B));
3563
- v(S, z, R, W, T);
3562
+ var E = _ - D + 1, A = V - D + 1, O = Math.log(E), I = 0.5 * Math.exp(2 * O / 3), B = 0.5 * Math.sqrt(O * I * (E - I) / E) * (A - E / 2 < 0 ? -1 : 1), R = Math.max(D, Math.floor(V - A * I / E + B)), W = Math.min(_, Math.floor(V + (E - A) * I / E + B));
3563
+ v(S, V, R, W, T);
3564
3564
  }
3565
- var C = S[z], L = D, H = _;
3566
- for (o(S, D, z), T(S[_], C) > 0 && o(S, D, _); L < H; ) {
3565
+ var C = S[V], L = D, H = _;
3566
+ for (o(S, D, V), T(S[_], C) > 0 && o(S, D, _); L < H; ) {
3567
3567
  for (o(S, L, H), L++, H--; T(S[L], C) < 0; ) L++;
3568
3568
  for (; T(S[H], C) > 0; ) H--;
3569
3569
  }
3570
- T(S[D], C) === 0 ? o(S, D, H) : o(S, ++H, _), H <= z && (D = H + 1), z <= H && (_ = H - 1);
3570
+ T(S[D], C) === 0 ? o(S, D, H) : o(S, ++H, _), H <= V && (D = H + 1), V <= H && (_ = H - 1);
3571
3571
  }
3572
- })(m, d, g || 0, b || m.length - 1, V || i);
3572
+ })(d, f, p || 0, b || d.length - 1, z || i);
3573
3573
  }
3574
- function o(m, d, g) {
3575
- var b = m[d];
3576
- m[d] = m[g], m[g] = b;
3574
+ function o(d, f, p) {
3575
+ var b = d[f];
3576
+ d[f] = d[p], d[p] = b;
3577
3577
  }
3578
- function i(m, d) {
3579
- return m < d ? -1 : m > d ? 1 : 0;
3578
+ function i(d, f) {
3579
+ return d < f ? -1 : d > f ? 1 : 0;
3580
3580
  }
3581
- var r = function(m) {
3582
- m === void 0 && (m = 9), this._maxEntries = Math.max(4, m), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
3581
+ var r = function(d) {
3582
+ d === void 0 && (d = 9), this._maxEntries = Math.max(4, d), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
3583
3583
  };
3584
- function s(m, d, g) {
3585
- if (!g) return d.indexOf(m);
3586
- for (var b = 0; b < d.length; b++) if (g(m, d[b])) return b;
3584
+ function s(d, f, p) {
3585
+ if (!p) return f.indexOf(d);
3586
+ for (var b = 0; b < f.length; b++) if (p(d, f[b])) return b;
3587
3587
  return -1;
3588
3588
  }
3589
- function a(m, d) {
3590
- l(m, 0, m.children.length, d, m);
3589
+ function a(d, f) {
3590
+ l(d, 0, d.children.length, f, d);
3591
3591
  }
3592
- function l(m, d, g, b, V) {
3593
- V || (V = P(null)), V.minX = 1 / 0, V.minY = 1 / 0, V.maxX = -1 / 0, V.maxY = -1 / 0;
3594
- for (var v = d; v < g; v++) {
3595
- var S = m.children[v];
3596
- c(V, m.leaf ? b(S) : S);
3592
+ function l(d, f, p, b, z) {
3593
+ z || (z = P(null)), z.minX = 1 / 0, z.minY = 1 / 0, z.maxX = -1 / 0, z.maxY = -1 / 0;
3594
+ for (var v = f; v < p; v++) {
3595
+ var S = d.children[v];
3596
+ u(z, d.leaf ? b(S) : S);
3597
3597
  }
3598
- return V;
3598
+ return z;
3599
3599
  }
3600
- function c(m, d) {
3601
- return m.minX = Math.min(m.minX, d.minX), m.minY = Math.min(m.minY, d.minY), m.maxX = Math.max(m.maxX, d.maxX), m.maxY = Math.max(m.maxY, d.maxY), m;
3600
+ function u(d, f) {
3601
+ return d.minX = Math.min(d.minX, f.minX), d.minY = Math.min(d.minY, f.minY), d.maxX = Math.max(d.maxX, f.maxX), d.maxY = Math.max(d.maxY, f.maxY), d;
3602
3602
  }
3603
- function h(m, d) {
3604
- return m.minX - d.minX;
3603
+ function h(d, f) {
3604
+ return d.minX - f.minX;
3605
3605
  }
3606
- function f(m, d) {
3607
- return m.minY - d.minY;
3606
+ function g(d, f) {
3607
+ return d.minY - f.minY;
3608
3608
  }
3609
- function u(m) {
3610
- return (m.maxX - m.minX) * (m.maxY - m.minY);
3609
+ function c(d) {
3610
+ return (d.maxX - d.minX) * (d.maxY - d.minY);
3611
3611
  }
3612
- function p(m) {
3613
- return m.maxX - m.minX + (m.maxY - m.minY);
3612
+ function m(d) {
3613
+ return d.maxX - d.minX + (d.maxY - d.minY);
3614
3614
  }
3615
- function w(m, d) {
3616
- return m.minX <= d.minX && m.minY <= d.minY && d.maxX <= m.maxX && d.maxY <= m.maxY;
3615
+ function w(d, f) {
3616
+ return d.minX <= f.minX && d.minY <= f.minY && f.maxX <= d.maxX && f.maxY <= d.maxY;
3617
3617
  }
3618
- function x(m, d) {
3619
- return d.minX <= m.maxX && d.minY <= m.maxY && d.maxX >= m.minX && d.maxY >= m.minY;
3618
+ function x(d, f) {
3619
+ return f.minX <= d.maxX && f.minY <= d.maxY && f.maxX >= d.minX && f.maxY >= d.minY;
3620
3620
  }
3621
- function P(m) {
3622
- return { children: m, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
3621
+ function P(d) {
3622
+ return { children: d, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
3623
3623
  }
3624
- function M(m, d, g, b, V) {
3625
- for (var v = [d, g]; v.length; ) if (!((g = v.pop()) - (d = v.pop()) <= b)) {
3626
- var S = d + Math.ceil((g - d) / b / 2) * b;
3627
- e(m, S, d, g, V), v.push(d, S, S, g);
3624
+ function M(d, f, p, b, z) {
3625
+ for (var v = [f, p]; v.length; ) if (!((p = v.pop()) - (f = v.pop()) <= b)) {
3626
+ var S = f + Math.ceil((p - f) / b / 2) * b;
3627
+ e(d, S, f, p, z), v.push(f, S, S, p);
3628
3628
  }
3629
3629
  }
3630
3630
  return r.prototype.all = function() {
3631
3631
  return this._all(this.data, []);
3632
- }, r.prototype.search = function(m) {
3633
- var d = this.data, g = [];
3634
- if (!x(m, d)) return g;
3635
- for (var b = this.toBBox, V = []; d; ) {
3636
- for (var v = 0; v < d.children.length; v++) {
3637
- var S = d.children[v], z = d.leaf ? b(S) : S;
3638
- x(m, z) && (d.leaf ? g.push(S) : w(m, z) ? this._all(S, g) : V.push(S));
3632
+ }, r.prototype.search = function(d) {
3633
+ var f = this.data, p = [];
3634
+ if (!x(d, f)) return p;
3635
+ for (var b = this.toBBox, z = []; f; ) {
3636
+ for (var v = 0; v < f.children.length; v++) {
3637
+ var S = f.children[v], V = f.leaf ? b(S) : S;
3638
+ x(d, V) && (f.leaf ? p.push(S) : w(d, V) ? this._all(S, p) : z.push(S));
3639
3639
  }
3640
- d = V.pop();
3640
+ f = z.pop();
3641
3641
  }
3642
- return g;
3643
- }, r.prototype.collides = function(m) {
3644
- var d = this.data;
3645
- if (!x(m, d)) return !1;
3646
- for (var g = []; d; ) {
3647
- for (var b = 0; b < d.children.length; b++) {
3648
- var V = d.children[b], v = d.leaf ? this.toBBox(V) : V;
3649
- if (x(m, v)) {
3650
- if (d.leaf || w(m, v)) return !0;
3651
- g.push(V);
3642
+ return p;
3643
+ }, r.prototype.collides = function(d) {
3644
+ var f = this.data;
3645
+ if (!x(d, f)) return !1;
3646
+ for (var p = []; f; ) {
3647
+ for (var b = 0; b < f.children.length; b++) {
3648
+ var z = f.children[b], v = f.leaf ? this.toBBox(z) : z;
3649
+ if (x(d, v)) {
3650
+ if (f.leaf || w(d, v)) return !0;
3651
+ p.push(z);
3652
3652
  }
3653
3653
  }
3654
- d = g.pop();
3654
+ f = p.pop();
3655
3655
  }
3656
3656
  return !1;
3657
- }, r.prototype.load = function(m) {
3658
- if (!m || !m.length) return this;
3659
- if (m.length < this._minEntries) {
3660
- for (var d = 0; d < m.length; d++) this.insert(m[d]);
3657
+ }, r.prototype.load = function(d) {
3658
+ if (!d || !d.length) return this;
3659
+ if (d.length < this._minEntries) {
3660
+ for (var f = 0; f < d.length; f++) this.insert(d[f]);
3661
3661
  return this;
3662
3662
  }
3663
- var g = this._build(m.slice(), 0, m.length - 1, 0);
3664
- if (this.data.children.length) if (this.data.height === g.height) this._splitRoot(this.data, g);
3663
+ var p = this._build(d.slice(), 0, d.length - 1, 0);
3664
+ if (this.data.children.length) if (this.data.height === p.height) this._splitRoot(this.data, p);
3665
3665
  else {
3666
- if (this.data.height < g.height) {
3666
+ if (this.data.height < p.height) {
3667
3667
  var b = this.data;
3668
- this.data = g, g = b;
3668
+ this.data = p, p = b;
3669
3669
  }
3670
- this._insert(g, this.data.height - g.height - 1, !0);
3670
+ this._insert(p, this.data.height - p.height - 1, !0);
3671
3671
  }
3672
- else this.data = g;
3672
+ else this.data = p;
3673
3673
  return this;
3674
- }, r.prototype.insert = function(m) {
3675
- return m && this._insert(m, this.data.height - 1), this;
3674
+ }, r.prototype.insert = function(d) {
3675
+ return d && this._insert(d, this.data.height - 1), this;
3676
3676
  }, r.prototype.clear = function() {
3677
3677
  return this.data = P([]), this;
3678
- }, r.prototype.remove = function(m, d) {
3679
- if (!m) return this;
3680
- for (var g, b, V, v = this.data, S = this.toBBox(m), z = [], D = []; v || z.length; ) {
3681
- if (v || (v = z.pop(), b = z[z.length - 1], g = D.pop(), V = !0), v.leaf) {
3682
- var _ = s(m, v.children, d);
3683
- if (_ !== -1) return v.children.splice(_, 1), z.push(v), this._condense(z), this;
3678
+ }, r.prototype.remove = function(d, f) {
3679
+ if (!d) return this;
3680
+ for (var p, b, z, v = this.data, S = this.toBBox(d), V = [], D = []; v || V.length; ) {
3681
+ if (v || (v = V.pop(), b = V[V.length - 1], p = D.pop(), z = !0), v.leaf) {
3682
+ var _ = s(d, v.children, f);
3683
+ if (_ !== -1) return v.children.splice(_, 1), V.push(v), this._condense(V), this;
3684
3684
  }
3685
- V || v.leaf || !w(v, S) ? b ? (g++, v = b.children[g], V = !1) : v = null : (z.push(v), D.push(g), g = 0, b = v, v = v.children[0]);
3685
+ z || v.leaf || !w(v, S) ? b ? (p++, v = b.children[p], z = !1) : v = null : (V.push(v), D.push(p), p = 0, b = v, v = v.children[0]);
3686
3686
  }
3687
3687
  return this;
3688
- }, r.prototype.toBBox = function(m) {
3689
- return m;
3690
- }, r.prototype.compareMinX = function(m, d) {
3691
- return m.minX - d.minX;
3692
- }, r.prototype.compareMinY = function(m, d) {
3693
- return m.minY - d.minY;
3688
+ }, r.prototype.toBBox = function(d) {
3689
+ return d;
3690
+ }, r.prototype.compareMinX = function(d, f) {
3691
+ return d.minX - f.minX;
3692
+ }, r.prototype.compareMinY = function(d, f) {
3693
+ return d.minY - f.minY;
3694
3694
  }, r.prototype.toJSON = function() {
3695
3695
  return this.data;
3696
- }, r.prototype.fromJSON = function(m) {
3697
- return this.data = m, this;
3698
- }, r.prototype._all = function(m, d) {
3699
- for (var g = []; m; ) m.leaf ? d.push.apply(d, m.children) : g.push.apply(g, m.children), m = g.pop();
3700
- return d;
3701
- }, r.prototype._build = function(m, d, g, b) {
3702
- var V, v = g - d + 1, S = this._maxEntries;
3703
- if (v <= S) return a(V = P(m.slice(d, g + 1)), this.toBBox), V;
3704
- b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (V = P([])).leaf = !1, V.height = b;
3705
- var z = Math.ceil(v / S), D = z * Math.ceil(Math.sqrt(S));
3706
- M(m, d, g, D, this.compareMinX);
3707
- for (var _ = d; _ <= g; _ += D) {
3708
- var T = Math.min(_ + D - 1, g);
3709
- M(m, _, T, z, this.compareMinY);
3710
- for (var E = _; E <= T; E += z) {
3711
- var A = Math.min(E + z - 1, T);
3712
- V.children.push(this._build(m, E, A, b - 1));
3696
+ }, r.prototype.fromJSON = function(d) {
3697
+ return this.data = d, this;
3698
+ }, r.prototype._all = function(d, f) {
3699
+ for (var p = []; d; ) d.leaf ? f.push.apply(f, d.children) : p.push.apply(p, d.children), d = p.pop();
3700
+ return f;
3701
+ }, r.prototype._build = function(d, f, p, b) {
3702
+ var z, v = p - f + 1, S = this._maxEntries;
3703
+ if (v <= S) return a(z = P(d.slice(f, p + 1)), this.toBBox), z;
3704
+ b || (b = Math.ceil(Math.log(v) / Math.log(S)), S = Math.ceil(v / Math.pow(S, b - 1))), (z = P([])).leaf = !1, z.height = b;
3705
+ var V = Math.ceil(v / S), D = V * Math.ceil(Math.sqrt(S));
3706
+ M(d, f, p, D, this.compareMinX);
3707
+ for (var _ = f; _ <= p; _ += D) {
3708
+ var T = Math.min(_ + D - 1, p);
3709
+ M(d, _, T, V, this.compareMinY);
3710
+ for (var E = _; E <= T; E += V) {
3711
+ var A = Math.min(E + V - 1, T);
3712
+ z.children.push(this._build(d, E, A, b - 1));
3713
3713
  }
3714
3714
  }
3715
- return a(V, this.toBBox), V;
3716
- }, r.prototype._chooseSubtree = function(m, d, g, b) {
3717
- for (; b.push(d), !d.leaf && b.length - 1 !== g; ) {
3718
- for (var V = 1 / 0, v = 1 / 0, S = void 0, z = 0; z < d.children.length; z++) {
3719
- var D = d.children[z], _ = u(D), T = (E = m, A = D, (Math.max(A.maxX, E.maxX) - Math.min(A.minX, E.minX)) * (Math.max(A.maxY, E.maxY) - Math.min(A.minY, E.minY)) - _);
3720
- T < v ? (v = T, V = _ < V ? _ : V, S = D) : T === v && _ < V && (V = _, S = D);
3715
+ return a(z, this.toBBox), z;
3716
+ }, r.prototype._chooseSubtree = function(d, f, p, b) {
3717
+ for (; b.push(f), !f.leaf && b.length - 1 !== p; ) {
3718
+ for (var z = 1 / 0, v = 1 / 0, S = void 0, V = 0; V < f.children.length; V++) {
3719
+ var D = f.children[V], _ = c(D), T = (E = d, A = D, (Math.max(A.maxX, E.maxX) - Math.min(A.minX, E.minX)) * (Math.max(A.maxY, E.maxY) - Math.min(A.minY, E.minY)) - _);
3720
+ T < v ? (v = T, z = _ < z ? _ : z, S = D) : T === v && _ < z && (z = _, S = D);
3721
3721
  }
3722
- d = S || d.children[0];
3722
+ f = S || f.children[0];
3723
3723
  }
3724
3724
  var E, A;
3725
- return d;
3726
- }, r.prototype._insert = function(m, d, g) {
3727
- var b = g ? m : this.toBBox(m), V = [], v = this._chooseSubtree(b, this.data, d, V);
3728
- for (v.children.push(m), c(v, b); d >= 0 && V[d].children.length > this._maxEntries; ) this._split(V, d), d--;
3729
- this._adjustParentBBoxes(b, V, d);
3730
- }, r.prototype._split = function(m, d) {
3731
- var g = m[d], b = g.children.length, V = this._minEntries;
3732
- this._chooseSplitAxis(g, V, b);
3733
- var v = this._chooseSplitIndex(g, V, b), S = P(g.children.splice(v, g.children.length - v));
3734
- S.height = g.height, S.leaf = g.leaf, a(g, this.toBBox), a(S, this.toBBox), d ? m[d - 1].children.push(S) : this._splitRoot(g, S);
3735
- }, r.prototype._splitRoot = function(m, d) {
3736
- this.data = P([m, d]), this.data.height = m.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3737
- }, r.prototype._chooseSplitIndex = function(m, d, g) {
3738
- for (var b, V, v, S, z, D, _, T = 1 / 0, E = 1 / 0, A = d; A <= g - d; A++) {
3739
- var O = l(m, 0, A, this.toBBox), I = l(m, A, g, this.toBBox), B = (V = O, v = I, S = void 0, z = void 0, D = void 0, _ = void 0, S = Math.max(V.minX, v.minX), z = Math.max(V.minY, v.minY), D = Math.min(V.maxX, v.maxX), _ = Math.min(V.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - z)), R = u(O) + u(I);
3725
+ return f;
3726
+ }, r.prototype._insert = function(d, f, p) {
3727
+ var b = p ? d : this.toBBox(d), z = [], v = this._chooseSubtree(b, this.data, f, z);
3728
+ for (v.children.push(d), u(v, b); f >= 0 && z[f].children.length > this._maxEntries; ) this._split(z, f), f--;
3729
+ this._adjustParentBBoxes(b, z, f);
3730
+ }, r.prototype._split = function(d, f) {
3731
+ var p = d[f], b = p.children.length, z = this._minEntries;
3732
+ this._chooseSplitAxis(p, z, b);
3733
+ var v = this._chooseSplitIndex(p, z, b), S = P(p.children.splice(v, p.children.length - v));
3734
+ S.height = p.height, S.leaf = p.leaf, a(p, this.toBBox), a(S, this.toBBox), f ? d[f - 1].children.push(S) : this._splitRoot(p, S);
3735
+ }, r.prototype._splitRoot = function(d, f) {
3736
+ this.data = P([d, f]), this.data.height = d.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
3737
+ }, r.prototype._chooseSplitIndex = function(d, f, p) {
3738
+ for (var b, z, v, S, V, D, _, T = 1 / 0, E = 1 / 0, A = f; A <= p - f; A++) {
3739
+ var O = l(d, 0, A, this.toBBox), I = l(d, A, p, this.toBBox), B = (z = O, v = I, S = void 0, V = void 0, D = void 0, _ = void 0, S = Math.max(z.minX, v.minX), V = Math.max(z.minY, v.minY), D = Math.min(z.maxX, v.maxX), _ = Math.min(z.maxY, v.maxY), Math.max(0, D - S) * Math.max(0, _ - V)), R = c(O) + c(I);
3740
3740
  B < T ? (T = B, b = A, E = R < E ? R : E) : B === T && R < E && (E = R, b = A);
3741
3741
  }
3742
- return b || g - d;
3743
- }, r.prototype._chooseSplitAxis = function(m, d, g) {
3744
- var b = m.leaf ? this.compareMinX : h, V = m.leaf ? this.compareMinY : f;
3745
- this._allDistMargin(m, d, g, b) < this._allDistMargin(m, d, g, V) && m.children.sort(b);
3746
- }, r.prototype._allDistMargin = function(m, d, g, b) {
3747
- m.children.sort(b);
3748
- for (var V = this.toBBox, v = l(m, 0, d, V), S = l(m, g - d, g, V), z = p(v) + p(S), D = d; D < g - d; D++) {
3749
- var _ = m.children[D];
3750
- c(v, m.leaf ? V(_) : _), z += p(v);
3742
+ return b || p - f;
3743
+ }, r.prototype._chooseSplitAxis = function(d, f, p) {
3744
+ var b = d.leaf ? this.compareMinX : h, z = d.leaf ? this.compareMinY : g;
3745
+ this._allDistMargin(d, f, p, b) < this._allDistMargin(d, f, p, z) && d.children.sort(b);
3746
+ }, r.prototype._allDistMargin = function(d, f, p, b) {
3747
+ d.children.sort(b);
3748
+ for (var z = this.toBBox, v = l(d, 0, f, z), S = l(d, p - f, p, z), V = m(v) + m(S), D = f; D < p - f; D++) {
3749
+ var _ = d.children[D];
3750
+ u(v, d.leaf ? z(_) : _), V += m(v);
3751
3751
  }
3752
- for (var T = g - d - 1; T >= d; T--) {
3753
- var E = m.children[T];
3754
- c(S, m.leaf ? V(E) : E), z += p(S);
3752
+ for (var T = p - f - 1; T >= f; T--) {
3753
+ var E = d.children[T];
3754
+ u(S, d.leaf ? z(E) : E), V += m(S);
3755
3755
  }
3756
- return z;
3757
- }, r.prototype._adjustParentBBoxes = function(m, d, g) {
3758
- for (var b = g; b >= 0; b--) c(d[b], m);
3759
- }, r.prototype._condense = function(m) {
3760
- for (var d = m.length - 1, g = void 0; d >= 0; d--) m[d].children.length === 0 ? d > 0 ? (g = m[d - 1].children).splice(g.indexOf(m[d]), 1) : this.clear() : a(m[d], this.toBBox);
3756
+ return V;
3757
+ }, r.prototype._adjustParentBBoxes = function(d, f, p) {
3758
+ for (var b = p; b >= 0; b--) u(f[b], d);
3759
+ }, r.prototype._condense = function(d) {
3760
+ for (var f = d.length - 1, p = void 0; f >= 0; f--) d[f].children.length === 0 ? f > 0 ? (p = d[f - 1].children).splice(p.indexOf(d[f]), 1) : this.clear() : a(d[f], this.toBBox);
3761
3761
  }, r;
3762
3762
  });
3763
3763
  })(On);
@@ -3808,16 +3808,16 @@ const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3808
3808
  var ke = { exports: {} }, cr = function(t, e, o, i) {
3809
3809
  var r = t[0], s = t[1], a = !1;
3810
3810
  o === void 0 && (o = 0), i === void 0 && (i = e.length);
3811
- for (var l = (i - o) / 2, c = 0, h = l - 1; c < l; h = c++) {
3812
- var f = e[o + c * 2 + 0], u = e[o + c * 2 + 1], p = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
3811
+ for (var l = (i - o) / 2, u = 0, h = l - 1; u < l; h = u++) {
3812
+ var g = e[o + u * 2 + 0], c = e[o + u * 2 + 1], m = e[o + h * 2 + 0], w = e[o + h * 2 + 1], x = c > s != w > s && r < (m - g) * (s - c) / (w - c) + g;
3813
3813
  x && (a = !a);
3814
3814
  }
3815
3815
  return a;
3816
3816
  }, ur = function(t, e, o, i) {
3817
3817
  var r = t[0], s = t[1], a = !1;
3818
3818
  o === void 0 && (o = 0), i === void 0 && (i = e.length);
3819
- for (var l = i - o, c = 0, h = l - 1; c < l; h = c++) {
3820
- var f = e[c + o][0], u = e[c + o][1], p = e[h + o][0], w = e[h + o][1], x = u > s != w > s && r < (p - f) * (s - u) / (w - u) + f;
3819
+ for (var l = i - o, u = 0, h = l - 1; u < l; h = u++) {
3820
+ var g = e[u + o][0], c = e[u + o][1], m = e[h + o][0], w = e[h + o][1], x = c > s != w > s && r < (m - g) * (s - c) / (w - c) + g;
3821
3821
  x && (a = !a);
3822
3822
  }
3823
3823
  return a;
@@ -3833,43 +3833,43 @@ var hr = ke.exports, je = { exports: {} };
3833
3833
  o(t);
3834
3834
  })(Fn, function(e) {
3835
3835
  const i = 33306690738754706e-32;
3836
- function r(x, P, M, m, d) {
3837
- let g, b, V, v, S = P[0], z = m[0], D = 0, _ = 0;
3838
- z > S == z > -S ? (g = S, S = P[++D]) : (g = z, z = m[++_]);
3836
+ function r(x, P, M, d, f) {
3837
+ let p, b, z, v, S = P[0], V = d[0], D = 0, _ = 0;
3838
+ V > S == V > -S ? (p = S, S = P[++D]) : (p = V, V = d[++_]);
3839
3839
  let T = 0;
3840
- if (D < x && _ < M) for (z > S == z > -S ? (V = g - ((b = S + g) - S), S = P[++D]) : (V = g - ((b = z + g) - z), z = m[++_]), g = b, V !== 0 && (d[T++] = V); D < x && _ < M; ) z > S == z > -S ? (V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D]) : (V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_]), g = b, V !== 0 && (d[T++] = V);
3841
- for (; D < x; ) V = g - ((b = g + S) - (v = b - g)) + (S - v), S = P[++D], g = b, V !== 0 && (d[T++] = V);
3842
- for (; _ < M; ) V = g - ((b = g + z) - (v = b - g)) + (z - v), z = m[++_], g = b, V !== 0 && (d[T++] = V);
3843
- return g === 0 && T !== 0 || (d[T++] = g), T;
3840
+ if (D < x && _ < M) for (V > S == V > -S ? (z = p - ((b = S + p) - S), S = P[++D]) : (z = p - ((b = V + p) - V), V = d[++_]), p = b, z !== 0 && (f[T++] = z); D < x && _ < M; ) V > S == V > -S ? (z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D]) : (z = p - ((b = p + V) - (v = b - p)) + (V - v), V = d[++_]), p = b, z !== 0 && (f[T++] = z);
3841
+ for (; D < x; ) z = p - ((b = p + S) - (v = b - p)) + (S - v), S = P[++D], p = b, z !== 0 && (f[T++] = z);
3842
+ for (; _ < M; ) z = p - ((b = p + V) - (v = b - p)) + (V - v), V = d[++_], p = b, z !== 0 && (f[T++] = z);
3843
+ return p === 0 && T !== 0 || (f[T++] = p), T;
3844
3844
  }
3845
3845
  function s(x) {
3846
3846
  return new Float64Array(x);
3847
3847
  }
3848
- const a = 33306690738754716e-32, l = 22204460492503146e-32, c = 11093356479670487e-47, h = s(4), f = s(8), u = s(12), p = s(16), w = s(4);
3849
- e.orient2d = function(x, P, M, m, d, g) {
3850
- const b = (P - g) * (M - d), V = (x - d) * (m - g), v = b - V;
3851
- if (b === 0 || V === 0 || b > 0 != V > 0) return v;
3852
- const S = Math.abs(b + V);
3853
- return Math.abs(v) >= a * S ? v : -function(z, D, _, T, E, A, O) {
3848
+ const a = 33306690738754716e-32, l = 22204460492503146e-32, u = 11093356479670487e-47, h = s(4), g = s(8), c = s(12), m = s(16), w = s(4);
3849
+ e.orient2d = function(x, P, M, d, f, p) {
3850
+ const b = (P - p) * (M - f), z = (x - f) * (d - p), v = b - z;
3851
+ if (b === 0 || z === 0 || b > 0 != z > 0) return v;
3852
+ const S = Math.abs(b + z);
3853
+ return Math.abs(v) >= a * S ? v : -function(V, D, _, T, E, A, O) {
3854
3854
  let I, B, R, W, C, L, H, X, ot, K, G, ut, rt, F, Y, Mt, Zt, Nt;
3855
- const Lt = z - E, _t = _ - E, Tt = D - A, Ft = T - A;
3855
+ const Lt = V - E, _t = _ - E, Tt = D - A, Ft = T - A;
3856
3856
  C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = Lt * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = Tt * _t) - H * ot - X * ot - H * K))), h[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), h[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, h[2] = ut - (Nt - C) + (G - C), h[3] = Nt;
3857
3857
  let tt = function(Et, qt) {
3858
3858
  let J = qt[0];
3859
3859
  for (let ct = 1; ct < Et; ct++) J += qt[ct];
3860
3860
  return J;
3861
3861
  }(4, h), lt = l * O;
3862
- if (tt >= lt || -tt >= lt || (I = z - (Lt + (C = z - Lt)) + (C - E), R = _ - (_t + (C = _ - _t)) + (C - E), B = D - (Tt + (C = D - Tt)) + (C - A), W = T - (Ft + (C = T - Ft)) + (C - A), I === 0 && B === 0 && R === 0 && W === 0) || (lt = c * O + i * Math.abs(tt), (tt += Lt * W + Ft * I - (Tt * R + _t * B)) >= lt || -tt >= lt)) return tt;
3862
+ if (tt >= lt || -tt >= lt || (I = V - (Lt + (C = V - Lt)) + (C - E), R = _ - (_t + (C = _ - _t)) + (C - E), B = D - (Tt + (C = D - Tt)) + (C - A), W = T - (Ft + (C = T - Ft)) + (C - A), I === 0 && B === 0 && R === 0 && W === 0) || (lt = u * O + i * Math.abs(tt), (tt += Lt * W + Ft * I - (Tt * R + _t * B)) >= lt || -tt >= lt)) return tt;
3863
3863
  C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = Ft - (ot = (L = 134217729 * Ft) - (L - Ft))) - ((F = I * Ft) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = _t - (ot = (L = 134217729 * _t) - (L - _t))) - ((Mt = B * _t) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3864
- const q = r(4, h, 4, w, f);
3864
+ const q = r(4, h, 4, w, g);
3865
3865
  C = (Y = (X = Lt - (H = (L = 134217729 * Lt) - (L - Lt))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = Lt * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = Tt - (H = (L = 134217729 * Tt) - (L - Tt))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = Tt * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3866
- const j = r(q, f, 4, w, u);
3866
+ const j = r(q, g, 4, w, c);
3867
3867
  C = (Y = (X = I - (H = (L = 134217729 * I) - (L - I))) * (K = W - (ot = (L = 134217729 * W) - (L - W))) - ((F = I * W) - H * ot - X * ot - H * K)) - (G = Y - (Zt = (X = B - (H = (L = 134217729 * B) - (L - B))) * (K = R - (ot = (L = 134217729 * R) - (L - R))) - ((Mt = B * R) - H * ot - X * ot - H * K))), w[0] = Y - (G + C) + (C - Zt), C = (rt = F - ((ut = F + G) - (C = ut - F)) + (G - C)) - (G = rt - Mt), w[1] = rt - (G + C) + (C - Mt), C = (Nt = ut + G) - ut, w[2] = ut - (Nt - C) + (G - C), w[3] = Nt;
3868
- const Wt = r(j, u, 4, w, p);
3869
- return p[Wt - 1];
3870
- }(x, P, M, m, d, g, S);
3871
- }, e.orient2dfast = function(x, P, M, m, d, g) {
3872
- return (P - g) * (M - d) - (x - d) * (m - g);
3868
+ const Wt = r(j, c, 4, w, m);
3869
+ return m[Wt - 1];
3870
+ }(x, P, M, d, f, p, S);
3871
+ }, e.orient2dfast = function(x, P, M, d, f, p) {
3872
+ return (P - p) * (M - f) - (x - f) * (d - p);
3873
3873
  }, Object.defineProperty(e, "__esModule", { value: !0 });
3874
3874
  });
3875
3875
  })(je, je.exports);
@@ -3880,50 +3880,50 @@ Ze.exports.default = qn;
3880
3880
  function qn(n, t, e) {
3881
3881
  t = Math.max(0, t === void 0 ? 2 : t), e = e || 0;
3882
3882
  var o = wr(n), i = new pn(16);
3883
- i.toBBox = function(m) {
3883
+ i.toBBox = function(d) {
3884
3884
  return {
3885
- minX: m[0],
3886
- minY: m[1],
3887
- maxX: m[0],
3888
- maxY: m[1]
3885
+ minX: d[0],
3886
+ minY: d[1],
3887
+ maxX: d[0],
3888
+ maxY: d[1]
3889
3889
  };
3890
- }, i.compareMinX = function(m, d) {
3891
- return m[0] - d[0];
3892
- }, i.compareMinY = function(m, d) {
3893
- return m[1] - d[1];
3890
+ }, i.compareMinX = function(d, f) {
3891
+ return d[0] - f[0];
3892
+ }, i.compareMinY = function(d, f) {
3893
+ return d[1] - f[1];
3894
3894
  }, i.load(n);
3895
3895
  for (var r = [], s = 0, a; s < o.length; s++) {
3896
3896
  var l = o[s];
3897
3897
  i.remove(l), a = wn(l, a), r.push(a);
3898
3898
  }
3899
- var c = new pn(16);
3900
- for (s = 0; s < r.length; s++) c.insert(qe(r[s]));
3901
- for (var h = t * t, f = e * e; r.length; ) {
3902
- var u = r.shift(), p = u.p, w = u.next.p, x = Xe(p, w);
3903
- if (!(x < f)) {
3899
+ var u = new pn(16);
3900
+ for (s = 0; s < r.length; s++) u.insert(qe(r[s]));
3901
+ for (var h = t * t, g = e * e; r.length; ) {
3902
+ var c = r.shift(), m = c.p, w = c.next.p, x = Xe(m, w);
3903
+ if (!(x < g)) {
3904
3904
  var P = x / h;
3905
- l = gr(i, u.prev.p, p, w, u.next.next.p, P, c), l && Math.min(Xe(l, p), Xe(l, w)) <= P && (r.push(u), r.push(wn(l, u)), i.remove(l), c.remove(u), c.insert(qe(u)), c.insert(qe(u.next)));
3905
+ l = gr(i, c.prev.p, m, w, c.next.next.p, P, u), l && Math.min(Xe(l, m), Xe(l, w)) <= P && (r.push(c), r.push(wn(l, c)), i.remove(l), u.remove(c), u.insert(qe(c)), u.insert(qe(c.next)));
3906
3906
  }
3907
3907
  }
3908
- u = a;
3908
+ c = a;
3909
3909
  var M = [];
3910
3910
  do
3911
- M.push(u.p), u = u.next;
3912
- while (u !== a);
3913
- return M.push(u.p), M;
3911
+ M.push(c.p), c = c.next;
3912
+ while (c !== a);
3913
+ return M.push(c.p), M;
3914
3914
  }
3915
3915
  function gr(n, t, e, o, i, r, s) {
3916
3916
  for (var a = new Ae([], pr), l = n.data; l; ) {
3917
- for (var c = 0; c < l.children.length; c++) {
3918
- var h = l.children[c], f = l.leaf ? He(h, e, o) : yr(e, o, h);
3919
- f > r || a.push({
3917
+ for (var u = 0; u < l.children.length; u++) {
3918
+ var h = l.children[u], g = l.leaf ? He(h, e, o) : yr(e, o, h);
3919
+ g > r || a.push({
3920
3920
  node: h,
3921
- dist: f
3921
+ dist: g
3922
3922
  });
3923
3923
  }
3924
3924
  for (; a.length && !a.peek().node.children; ) {
3925
- var u = a.pop(), p = u.node, w = He(p, t, e), x = He(p, o, i);
3926
- if (u.dist < w && u.dist < x && xn(e, p, s) && xn(o, p, s)) return p;
3925
+ var c = a.pop(), m = c.node, w = He(m, t, e), x = He(m, o, i);
3926
+ if (c.dist < w && c.dist < x && xn(e, m, s) && xn(o, m, s)) return m;
3927
3927
  }
3928
3928
  l = a.pop(), l && (l = l.node);
3929
3929
  }
@@ -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 Te(n, t, e, o, i, r, s, a) {
3999
- var l = e - n, c = o - t, h = s - i, f = a - r, u = n - i, p = t - r, w = l * l + c * c, x = l * h + c * f, P = h * h + f * f, M = l * u + c * p, m = h * u + f * p, d = w * P - x * x, g, b, V, v, S = d, z = d;
4000
- d === 0 ? (b = 0, S = 1, v = m, z = P) : (b = x * m - P * M, v = w * m - x * M, b < 0 ? (b = 0, v = m, z = P) : b > S && (b = S, v = m + x, z = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > z && (v = z, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), g = b === 0 ? 0 : b / S, V = v === 0 ? 0 : v / z;
4001
- var D = (1 - g) * n + g * e, _ = (1 - g) * t + g * o, T = (1 - V) * i + V * s, E = (1 - V) * r + V * a, A = T - D, O = E - _;
3999
+ var l = e - n, u = o - t, h = s - i, g = a - r, c = n - i, m = t - r, w = l * l + u * u, x = l * h + u * g, P = h * h + g * g, M = l * c + u * m, d = h * c + g * m, f = w * P - x * x, p, b, z, v, S = f, V = f;
4000
+ f === 0 ? (b = 0, S = 1, v = d, V = P) : (b = x * d - P * M, v = w * d - x * M, b < 0 ? (b = 0, v = d, V = P) : b > S && (b = S, v = d + x, V = P)), v < 0 ? (v = 0, -M < 0 ? b = 0 : -M > w ? b = S : (b = -M, S = w)) : v > V && (v = V, -M + x < 0 ? b = 0 : -M + x > w ? b = S : (b = -M + x, S = w)), p = b === 0 ? 0 : b / S, z = v === 0 ? 0 : v / V;
4001
+ var D = (1 - p) * n + p * e, _ = (1 - p) * t + p * o, T = (1 - z) * i + z * s, E = (1 - z) * r + z * a, A = T - D, O = E - _;
4002
4002
  return A * A + O * O;
4003
4003
  }
4004
4004
  function br(n, t) {
@@ -4091,9 +4091,9 @@ function _r(n, t, e) {
4091
4091
  a > Math.PI && (a -= 2 * Math.PI);
4092
4092
  const l = Math.log(
4093
4093
  Math.tan(r / 2 + Math.PI / 4) / Math.tan(i / 2 + Math.PI / 4)
4094
- ), c = Math.abs(l) > 1e-11 ? s / l : Math.cos(i);
4094
+ ), u = Math.abs(l) > 1e-11 ? s / l : Math.cos(i);
4095
4095
  return Math.sqrt(
4096
- s * s + c * c * a * a
4096
+ s * s + u * u * a * a
4097
4097
  ) * o;
4098
4098
  }
4099
4099
  function Tr(n, t, e, o = {}) {
@@ -4114,14 +4114,14 @@ function Tr(n, t, e, o = {}) {
4114
4114
  function Er(n, t, e, o) {
4115
4115
  o = o === void 0 ? Yt : Number(o);
4116
4116
  const i = t / o, r = n[0] * Math.PI / 180, s = ie(n[1]), a = ie(e), l = i * Math.cos(a);
4117
- let c = s + l;
4118
- Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);
4117
+ let u = s + l;
4118
+ Math.abs(u) > Math.PI / 2 && (u = u > 0 ? Math.PI - u : -Math.PI - u);
4119
4119
  const h = Math.log(
4120
- Math.tan(c / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4)
4121
- ), f = Math.abs(h) > 1e-11 ? l / h : Math.cos(s), u = i * Math.sin(a) / f;
4120
+ Math.tan(u / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4)
4121
+ ), g = Math.abs(h) > 1e-11 ? l / h : Math.cos(s), c = i * Math.sin(a) / g;
4122
4122
  return [
4123
- ((r + u) * 180 / Math.PI + 540) % 360 - 180,
4124
- c * 180 / Math.PI
4123
+ ((r + c) * 180 / Math.PI + 540) % 360 - 180,
4124
+ u * 180 / Math.PI
4125
4125
  ];
4126
4126
  }
4127
4127
  function Ar(n) {
@@ -4193,8 +4193,8 @@ 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 = vr(r, s) + t, c = Dr(r, s), h = Sr(
4197
- Tr(r, c, l)
4196
+ const l = vr(r, s) + t, u = Dr(r, s), h = Sr(
4197
+ Tr(r, u, l)
4198
4198
  );
4199
4199
  s[0] = h[0], s[1] = h[1];
4200
4200
  }), n;
@@ -4202,8 +4202,8 @@ function Pn(n, t, e) {
4202
4202
  function Gn(n, t, e = {}) {
4203
4203
  if (e.final === !0)
4204
4204
  return Ir(n, t);
4205
- const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), c = Math.sin(s - r) * Math.cos(l), h = Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - r);
4206
- return Rn(Math.atan2(c, h));
4205
+ const o = se(n), i = se(t), r = ie(o[0]), s = ie(i[0]), a = ie(o[1]), l = ie(i[1]), u = Math.sin(s - r) * Math.cos(l), h = Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - r);
4206
+ return Rn(Math.atan2(u, h));
4207
4207
  }
4208
4208
  function Ir(n, t) {
4209
4209
  let e = Gn(t, n);
@@ -4272,8 +4272,8 @@ function zn(n) {
4272
4272
  if (t <= 2) return 0;
4273
4273
  let e = 0, o = 0;
4274
4274
  for (; o < t; ) {
4275
- const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] * Ye, l = r[1] * Ye, c = s[0] * Ye;
4276
- e += (c - a) * Math.sin(l), o++;
4275
+ const i = n[o], r = n[o + 1 === t ? 0 : o + 1], s = n[o + 2 >= t ? (o + 2) % t : o + 2], a = i[0] * Ye, l = r[1] * Ye, u = s[0] * Ye;
4276
+ e += (u - a) * Math.sin(l), o++;
4277
4277
  }
4278
4278
  return e * Or;
4279
4279
  }
@@ -4286,8 +4286,8 @@ function Wr(n) {
4286
4286
  for (let s = 0; s < o.length - 1; s++) {
4287
4287
  let a = Gn(o[s], o[s + 1]), l = Pn(t, -1 * a, {
4288
4288
  pivot: e
4289
- }), c = Rr(l), h = Lr(c);
4290
- h < i && (i = h, r = Pn(c, a, {
4289
+ }), u = Rr(l), h = Lr(u);
4290
+ h < i && (i = h, r = Pn(u, a, {
4291
4291
  pivot: e
4292
4292
  }));
4293
4293
  }
@@ -4345,37 +4345,37 @@ class Ie extends An {
4345
4345
  static fromByPath2D(t, e, o, i = new Ie()) {
4346
4346
  const r = Wr({
4347
4347
  type: "Polygon",
4348
- coordinates: [t.map((p) => [p.x, p.y])]
4348
+ coordinates: [t.map((m) => [m.x, m.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]), c = Math.atan2(s[1][1] - s[0][1], s[1][0] - s[0][0]);
4352
- Ee.set(a, l, o), Sn.set(0, 0, c);
4353
- const [h, f] = Nr(s);
4354
- return e.x = h, e.y = f, this.from(Ee, e, Sn, i);
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
+ Ee.set(a, l, o), Sn.set(0, 0, u);
4353
+ const [h, g] = Nr(s);
4354
+ return e.x = h, e.y = g, this.from(Ee, e, Sn, i);
4355
4355
  }
4356
4356
  }
4357
4357
  const le = new y.Matrix4(), fe = new y.Quaternion(), Sn = new y.Euler(), qr = new y.Vector3(1, 1, 1), Ee = new y.Vector3(), Xr = new y.Box3();
4358
4358
  function Hr(n, t, e = 5e-3, o = 0.2) {
4359
4359
  if (!n.length || !t.length) return 0;
4360
- const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (f, u, p) => `${Math.floor(f / i)},${Math.floor(u / i)},${Math.floor(p / i)}`;
4361
- for (const f of t) {
4362
- const u = a(f.x, f.y, f.z);
4363
- s.has(u) || s.set(u, []), s.get(u).push(f);
4360
+ const i = Math.max(e, 0.03), r = e * e, s = /* @__PURE__ */ new Map(), a = (g, c, m) => `${Math.floor(g / i)},${Math.floor(c / i)},${Math.floor(m / i)}`;
4361
+ for (const g of t) {
4362
+ const c = a(g.x, g.y, g.z);
4363
+ s.has(c) || s.set(c, []), s.get(c).push(g);
4364
4364
  }
4365
4365
  let l = 0;
4366
- const c = Math.ceil(e / i) + 1, h = [];
4367
- for (let f = -c; f <= c; f++)
4368
- for (let u = -c; u <= c; u++)
4369
- for (let p = -c; p <= c; p++)
4370
- f * f + u * u + p * p <= c * c && h.push([f, u, p]);
4371
- for (const f of n) {
4372
- const u = Math.floor(f.x / i), p = Math.floor(f.y / i), w = Math.floor(f.z / i);
4366
+ const u = Math.ceil(e / i) + 1, h = [];
4367
+ for (let g = -u; g <= u; g++)
4368
+ for (let c = -u; c <= u; c++)
4369
+ for (let m = -u; m <= u; m++)
4370
+ g * g + c * c + m * m <= u * u && h.push([g, c, m]);
4371
+ for (const g of n) {
4372
+ const c = Math.floor(g.x / i), m = Math.floor(g.y / i), w = Math.floor(g.z / i);
4373
4373
  let x = !1;
4374
- for (const [P, M, m] of h) {
4375
- const d = `${u + P},${p + M},${w + m}`;
4376
- if (s.has(d)) {
4377
- for (const g of s.get(d))
4378
- if (f.distanceToSquared(g) < r) {
4374
+ for (const [P, M, d] of h) {
4375
+ const f = `${c + P},${m + M},${w + d}`;
4376
+ if (s.has(f)) {
4377
+ for (const p of s.get(f))
4378
+ if (g.distanceToSquared(p) < r) {
4379
4379
  x = !0;
4380
4380
  break;
4381
4381
  }
@@ -4453,39 +4453,39 @@ const gi = (n) => {
4453
4453
  for (let r = 0; r < n.length; r++) {
4454
4454
  let s = n[r].points.map((P) => [P.x, P.y]), a = n[r].obj_id;
4455
4455
  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];
4456
- const l = a.indexOf("_") + 1, c = a.lastIndexOf("_"), h = a.substring(l, c);
4456
+ const l = a.indexOf("_") + 1, u = a.lastIndexOf("_"), h = a.substring(l, u);
4457
4457
  if (h === "wall")
4458
4458
  continue;
4459
- let f = [];
4459
+ let g = [];
4460
4460
  for (let P = 0; P < n[r].points.length; P++)
4461
- f.push(new y.Vector3(
4461
+ g.push(new y.Vector3(
4462
4462
  n[r].points[P].x,
4463
4463
  n[r].points[P].y,
4464
4464
  n[r].points[P].z
4465
4465
  ));
4466
- let u = -99999;
4466
+ let c = -99999;
4467
4467
  if (h === "floor") {
4468
4468
  let P = /* @__PURE__ */ new Map();
4469
- for (let m = 0; m < n[r].points.length; m++) {
4470
- let d = n[r].points[m].z;
4471
- if (d = Math.floor(d * 10) / 10, P.has(d)) {
4472
- const g = P.get(d);
4473
- g.num += 1, g.points.push(n[r].points[m]), P.set(d, g);
4469
+ for (let d = 0; d < n[r].points.length; d++) {
4470
+ let f = n[r].points[d].z;
4471
+ if (f = Math.floor(f * 10) / 10, P.has(f)) {
4472
+ const p = P.get(f);
4473
+ p.num += 1, p.points.push(n[r].points[d]), P.set(f, p);
4474
4474
  } else
4475
- P.set(d, { num: 1, points: [n[r].points[m]] });
4475
+ P.set(f, { num: 1, points: [n[r].points[d]] });
4476
4476
  }
4477
4477
  let M = [...P.entries()].reduce(
4478
- (m, d) => d[1].num > m[1].num ? d : m
4478
+ (d, f) => f[1].num > d[1].num ? f : d
4479
4479
  );
4480
- s = [], s = M[1].points.map((m) => [m.x, m.y]), f = [], f = M[1].points.map((m) => new y.Vector3(m.x, m.y, m.z)), u = M[0];
4480
+ s = [], s = M[1].points.map((d) => [d.x, d.y]), g = [], g = M[1].points.map((d) => new y.Vector3(d.x, d.y, d.z)), c = M[0];
4481
4481
  }
4482
- const p = Dn(f), w = {
4483
- points: f,
4482
+ const m = Dn(g), w = {
4483
+ points: g,
4484
4484
  path: cn(s),
4485
- h: p.h,
4486
- minz: p.minz,
4487
- maxz: p.maxz,
4488
- center: { x: p.x, y: p.y, z: p.z },
4485
+ h: m.h,
4486
+ minz: m.minz,
4487
+ maxz: m.maxz,
4488
+ center: { x: m.x, y: m.y, z: m.z },
4489
4489
  obj_id: n[r].obj_id,
4490
4490
  type: h,
4491
4491
  averagePz: n[r].averagePz,
@@ -4504,19 +4504,19 @@ const gi = (n) => {
4504
4504
  if (x != -1 ? t[x].array.push(w) : t.push({
4505
4505
  type: h,
4506
4506
  array: [w]
4507
- }), h == "floor" && u != -99999)
4508
- if (e.has(u)) {
4509
- const P = e.get(u);
4510
- P.num += w.points.length, P.datas.push(w), e.set(u, P);
4507
+ }), h == "floor" && c != -99999)
4508
+ if (e.has(c)) {
4509
+ const P = e.get(c);
4510
+ P.num += w.points.length, P.datas.push(w), e.set(c, P);
4511
4511
  } else
4512
- e.set(u, { num: w.points.length, datas: [w] });
4512
+ e.set(c, { num: w.points.length, datas: [w] });
4513
4513
  }
4514
4514
  let o = -1 / 0;
4515
4515
  if (e.size > 0) {
4516
4516
  let r = [];
4517
4517
  for (const [s, a] of e.entries()) {
4518
- const { num: l, datas: c } = a;
4519
- l > 3e3 && (s > o && (o = s), r.push(...c));
4518
+ const { num: l, datas: u } = a;
4519
+ l > 3e3 && (s > o && (o = s), r.push(...u));
4520
4520
  }
4521
4521
  for (let s = 0; s < t.length; s++)
4522
4522
  if (t[s].type == "floor") {
@@ -4529,29 +4529,29 @@ const gi = (n) => {
4529
4529
  for (let h = 0; h < s.length; h++) {
4530
4530
  if (s[h].obb == null || a.includes(h))
4531
4531
  continue;
4532
- const f = {
4532
+ const g = {
4533
4533
  ...s[h],
4534
4534
  obb: s[h].obb.clone()
4535
4535
  };
4536
- for (let u = h + 1; u < s.length; u++) {
4537
- if (s[u].obb == null || a.includes(u))
4536
+ for (let c = h + 1; c < s.length; c++) {
4537
+ if (s[c].obb == null || a.includes(c))
4538
4538
  continue;
4539
- if (f.obb.intersectsOBB(s[u].obb)) {
4540
- a.push(u);
4541
- for (let P = 0; P < s[u].points.length; P++)
4542
- (s[u].points[P].z > o && s[u].points[P].z - o > 0.1 || f.type == "floor") && f.points.push(s[u].points[P]);
4543
- const w = f.points.map((P) => [P.x, P.y]);
4544
- f.path = cn(w);
4545
- const x = Dn(f.points);
4546
- f.h = x.h, f.minz = x.minz, f.maxz = x.maxz, f.center = { x: x.x, y: x.y, z: x.z }, f.obb = _n(f.path, f.center, f.h, (f.maxz + f.minz) / 2), f.positionArr.push(...s[u].positionArr), u = h;
4539
+ if (g.obb.intersectsOBB(s[c].obb)) {
4540
+ a.push(c);
4541
+ for (let P = 0; P < s[c].points.length; P++)
4542
+ (s[c].points[P].z > o && s[c].points[P].z - o > 0.1 || g.type == "floor") && g.points.push(s[c].points[P]);
4543
+ const w = g.points.map((P) => [P.x, P.y]);
4544
+ g.path = cn(w);
4545
+ const x = Dn(g.points);
4546
+ g.h = x.h, g.minz = x.minz, g.maxz = x.maxz, g.center = { x: x.x, y: x.y, z: x.z }, g.obb = _n(g.path, g.center, g.h, (g.maxz + g.minz) / 2), g.positionArr.push(...s[c].positionArr), c = h;
4547
4547
  }
4548
4548
  }
4549
- f.path.length > s[h].path.length && (a.push(h), l.push(f));
4549
+ g.path.length > s[h].path.length && (a.push(h), l.push(g));
4550
4550
  }
4551
- const c = [];
4551
+ const u = [];
4552
4552
  for (let h = 0; h < s.length; h++)
4553
- a.includes(h) || c.push(s[h]);
4554
- c.push(...l), t[r].array = c;
4553
+ a.includes(h) || u.push(s[h]);
4554
+ u.push(...l), t[r].array = u;
4555
4555
  }
4556
4556
  for (let r = 0; r < t.length; r++) {
4557
4557
  const s = t[r].type;
@@ -4559,78 +4559,78 @@ const gi = (n) => {
4559
4559
  continue;
4560
4560
  const a = t[r].array;
4561
4561
  for (let l = 0; l < a.length; l++) {
4562
- const c = a[l].obb, h = a[l].minz;
4562
+ const u = a[l].obb, h = a[l].minz;
4563
4563
  a[l].maxz;
4564
- const f = a[l].averagePz;
4564
+ const g = a[l].averagePz;
4565
4565
  if (s === "window" || s === "door" || s === "tv" || s === "chair" || s === "cabinet" || s === "table") {
4566
- const u = new y.Vector3();
4567
- c.getSize(u);
4568
- const p = [u.x, u.y, u.z];
4566
+ const c = new y.Vector3();
4567
+ u.getSize(c);
4568
+ const m = [c.x, c.y, c.z];
4569
4569
  let w = 0;
4570
- for (const x of p)
4570
+ for (const x of m)
4571
4571
  if (x < 0.2 && (w++, w === 2)) {
4572
4572
  a[l].isDel = !0;
4573
4573
  break;
4574
4574
  }
4575
4575
  }
4576
4576
  if (!a[l].isDel)
4577
- for (let u = r + 1; u < t.length; u++) {
4578
- const p = t[u].type;
4579
- if (p === "people" || p === "floor")
4577
+ for (let c = r + 1; c < t.length; c++) {
4578
+ const m = t[c].type;
4579
+ if (m === "people" || m === "floor")
4580
4580
  continue;
4581
- const w = t[u].array;
4581
+ const w = t[c].array;
4582
4582
  for (let x = 0; x < w.length; x++) {
4583
4583
  if (w[x].isDel) continue;
4584
4584
  const P = w[x].obb, M = w[x].minz;
4585
- if (w[x].maxz, c.intersectsOBB(P)) {
4586
- pe(w[x].points, c);
4587
- const m = pe(a[l].points, P), d = vn(c, P);
4588
- if (m >= 0.3 && d == -1) {
4585
+ if (w[x].maxz, u.intersectsOBB(P)) {
4586
+ pe(w[x].points, u);
4587
+ const d = pe(a[l].points, P), f = vn(u, P);
4588
+ if (d >= 0.3 && f == -1) {
4589
4589
  a[l].isDel = !0;
4590
4590
  break;
4591
4591
  }
4592
4592
  if (s !== "wall" && s !== "floor" && s !== "roof") {
4593
4593
  if (s === "window") {
4594
- if (p === "balcony railing" && we(c, w[x].points)) {
4594
+ if (m === "balcony railing" && we(u, w[x].points)) {
4595
4595
  w[x].isDel = !0;
4596
4596
  continue;
4597
4597
  }
4598
- if (p === "balcony railing" && we(P, a[l].points)) {
4598
+ if (m === "balcony railing" && we(P, a[l].points)) {
4599
4599
  a[l].isDel = !0;
4600
4600
  break;
4601
4601
  }
4602
- if (p === "balcony railing" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - f) > 0.3)) {
4602
+ if (m === "balcony railing" && $e(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(M - g) > 0.3)) {
4603
4603
  w[x].isDel = !0;
4604
4604
  continue;
4605
4605
  }
4606
4606
  } else if (s === "balcony railing") {
4607
- if (p === "window" && we(c, w[x].points)) {
4607
+ if (m === "window" && we(u, w[x].points)) {
4608
4608
  w[x].isDel = !0;
4609
4609
  continue;
4610
4610
  }
4611
- if (p === "window" && we(P, a[l].points)) {
4611
+ if (m === "window" && we(P, a[l].points)) {
4612
4612
  a[l].isDel = !0;
4613
4613
  break;
4614
4614
  }
4615
- if (p === "window" && $e(c, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - f) > 0.3)) {
4615
+ if (m === "window" && $e(u, P, a[l].points, w[x].points) && (Math.abs(h - M) < 0.1 || Math.abs(h - g) > 0.3)) {
4616
4616
  a[l].isDel = !0;
4617
4617
  break;
4618
4618
  }
4619
4619
  }
4620
- let g = !1, b = [], V = [];
4620
+ let p = !1, b = [], z = [];
4621
4621
  const v = a[l].points, S = w[x].points;
4622
- if (v.length > S.length ? (g = !0, b = v, V = S) : (b = S, V = v), Hr(V, b, 0.03, 0.5) > 0.5)
4623
- if (g)
4622
+ if (v.length > S.length ? (p = !0, b = v, z = S) : (b = S, z = v), Hr(z, b, 0.03, 0.5) > 0.5)
4623
+ if (p)
4624
4624
  w[x].isDel = !0;
4625
4625
  else {
4626
4626
  a[l].isDel = !0;
4627
4627
  break;
4628
4628
  }
4629
- else if ($e(c, P)) {
4630
- const D = vn(c, P);
4629
+ else if ($e(u, P)) {
4630
+ const D = vn(u, P);
4631
4631
  if (D === 1 || D === 0) {
4632
- if (p === "switch") continue;
4633
- v.length > S.length ? pe(V, c) >= 0.5 && (w[x].isDel = !0) : pe(b, c) >= 0.5 && (w[x].isDel = !0);
4632
+ if (m === "switch") continue;
4633
+ v.length > S.length ? pe(z, u) >= 0.5 && (w[x].isDel = !0) : pe(b, u) >= 0.5 && (w[x].isDel = !0);
4634
4634
  } else {
4635
4635
  if (s === "switch") continue;
4636
4636
  if (v.length > S.length) {
@@ -4638,7 +4638,7 @@ const gi = (n) => {
4638
4638
  a[l].isDel = !0;
4639
4639
  break;
4640
4640
  }
4641
- } else if (pe(V, P) >= 0.5) {
4641
+ } else if (pe(z, P) >= 0.5) {
4642
4642
  a[l].isDel = !0;
4643
4643
  break;
4644
4644
  }
@@ -4654,21 +4654,21 @@ const gi = (n) => {
4654
4654
  for (let r = 0; r < t.length; r++) {
4655
4655
  const s = t[r].type, a = t[r].array;
4656
4656
  for (let l = 0; l < a.length; l++) {
4657
- let c = a[l].maxz, h = a[l].minz, f = s === "switch" ? 0.1 : 0.3;
4658
- const u = a[l].averagePz;
4659
- if (Math.abs(c - u) < f) {
4657
+ let u = a[l].maxz, h = a[l].minz, g = s === "switch" ? 0.1 : 0.3;
4658
+ const c = a[l].averagePz;
4659
+ if (Math.abs(u - c) < g) {
4660
4660
  a[l].isDel = !0;
4661
4661
  continue;
4662
4662
  }
4663
4663
  if (s === "window" || s === "door" || s === "tv") {
4664
- const p = Math.abs(c - u), w = Math.abs(h - u);
4665
- (s === "tv" && w < 1.6 || s !== "window" && p < 1.6) && (a[l].isDel = !0), s === "window" && p < 1 && (a[l].isDel = !0);
4664
+ const m = Math.abs(u - c), w = Math.abs(h - c);
4665
+ (s === "tv" && w < 1.6 || s !== "window" && m < 1.6) && (a[l].isDel = !0), s === "window" && m < 1 && (a[l].isDel = !0);
4666
4666
  }
4667
4667
  if (s === "chair") {
4668
- const p = new y.Vector3();
4669
- a[l].obb.getSize(p), (p.x < 0.1 || p.y < 0.1 || p.z < 0.2) && (a[l].isDel = !0);
4668
+ const m = new y.Vector3();
4669
+ a[l].obb.getSize(m), (m.x < 0.1 || m.y < 0.1 || m.z < 0.2) && (a[l].isDel = !0);
4670
4670
  }
4671
- s === "balcony railing" && (Math.abs(c - h) < 0.4 && (a[l].isDel = !0), (h < u && Math.abs(h - u) > 1 || h > u && Math.abs(h - u) > 1) && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "people" && (Math.abs(c - h) < 1 && (a[l].isDel = !0), h > u && h - u > 0.3 && (a[l].isDel = !0), c < u && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
4671
+ s === "balcony railing" && (Math.abs(u - h) < 0.4 && (a[l].isDel = !0), (h < c && Math.abs(h - c) > 1 || h > c && Math.abs(h - c) > 1) && (a[l].isDel = !0), u < c && (a[l].isDel = !0)), s === "people" && (Math.abs(u - h) < 1 && (a[l].isDel = !0), h > c && h - c > 0.3 && (a[l].isDel = !0), u < c && (a[l].isDel = !0)), s === "floor" && a[l].points.length < 500 && (a[l].isDel = !0);
4672
4672
  }
4673
4673
  }
4674
4674
  for (let r = 0; r < t.length; r++)
@@ -4697,16 +4697,16 @@ function be(n, t) {
4697
4697
  function Yr(n) {
4698
4698
  let t = 0, e = 0, o = 0;
4699
4699
  for (let i = 0; i < 4; i++) {
4700
- const r = n[i], s = n[(i + 1) % 4], a = s.x - r.x, l = s.y - r.y, c = Math.sqrt(a * a + l * l);
4701
- c > t && (t = c, e = a / c, o = l / c);
4700
+ const r = n[i], s = n[(i + 1) % 4], a = s.x - r.x, l = s.y - r.y, u = Math.sqrt(a * a + l * l);
4701
+ u > t && (t = u, e = a / u, o = l / u);
4702
4702
  }
4703
4703
  return { longSide: t, dirX: e, dirY: o };
4704
4704
  }
4705
4705
  function jn(n, t, e) {
4706
4706
  const i = [];
4707
4707
  for (const r of n) {
4708
- const s = (r.start.x + r.end.x) / 2, a = (r.start.y + r.end.y) / 2, l = s - t, c = a - e;
4709
- l * l + c * c <= 3 * 3 && i.push(r.start.z, r.end.z);
4708
+ const s = (r.start.x + r.end.x) / 2, a = (r.start.y + r.end.y) / 2, l = s - t, u = a - e;
4709
+ l * l + u * u <= 3 * 3 && i.push(r.start.z, r.end.z);
4710
4710
  }
4711
4711
  if (i.length === 0) {
4712
4712
  const r = [];
@@ -4719,8 +4719,8 @@ function Un(n, t, e, o, i, r) {
4719
4719
  const s = i - e, a = r - o, l = s * s + a * a;
4720
4720
  if (l < 1e-12)
4721
4721
  return { dist: Math.sqrt((n - e) ** 2 + (t - o) ** 2), t: 0 };
4722
- const c = n - e, h = t - o, f = (c * s + h * a) / l, u = e + f * s, p = o + f * a;
4723
- return { dist: Math.sqrt((n - u) ** 2 + (t - p) ** 2), t: f };
4722
+ const u = n - e, h = t - o, g = (u * s + h * a) / l, c = e + g * s, m = o + g * a;
4723
+ return { dist: Math.sqrt((n - c) ** 2 + (t - m) ** 2), t: g };
4724
4724
  }
4725
4725
  function $r(n, t, e = 0.15) {
4726
4726
  let o = 0, i = 0;
@@ -4742,22 +4742,22 @@ function jr(n, t, e = 0.15) {
4742
4742
  const o = n.end.x - n.start.x, i = n.end.y - n.start.y, r = Math.sqrt(o * o + i * i);
4743
4743
  if (r < 1e-12) return 0;
4744
4744
  const s = -i / r, a = o / r, l = [[], []];
4745
- for (let f = 0; f < 2; f++) {
4746
- const u = f === 0 ? n.start : n.end;
4747
- for (const p of t) {
4748
- if (p === n) continue;
4749
- const w = be(u, p.start), x = be(u, p.end);
4745
+ for (let g = 0; g < 2; g++) {
4746
+ const c = g === 0 ? n.start : n.end;
4747
+ for (const m of t) {
4748
+ if (m === n) continue;
4749
+ const w = be(c, m.start), x = be(c, m.end);
4750
4750
  let P = null;
4751
- if (w <= e ? P = p.end : x <= e && (P = p.start), !P) continue;
4752
- const M = p.end.x - p.start.x, m = p.end.y - p.start.y, d = Math.sqrt(M * M + m * m);
4753
- if (d < 1e-12 || Math.abs(o * M + i * m) / (r * d) >= 0.342) continue;
4754
- const b = (P.x - u.x) * s + (P.y - u.y) * a;
4755
- l[f].push(b > 0 ? 1 : -1);
4751
+ if (w <= e ? P = m.end : x <= e && (P = m.start), !P) continue;
4752
+ const M = m.end.x - m.start.x, d = m.end.y - m.start.y, f = Math.sqrt(M * M + d * d);
4753
+ if (f < 1e-12 || Math.abs(o * M + i * d) / (r * f) >= 0.342) continue;
4754
+ const b = (P.x - c.x) * s + (P.y - c.y) * a;
4755
+ l[g].push(b > 0 ? 1 : -1);
4756
4756
  }
4757
4757
  }
4758
4758
  if (l[0].length === 0 || l[1].length === 0) return 0;
4759
- const c = [...l[0], ...l[1]];
4760
- return c.every((f) => f === c[0]) ? 2 : 1;
4759
+ const u = [...l[0], ...l[1]];
4760
+ return u.every((g) => g === u[0]) ? 2 : 1;
4761
4761
  }
4762
4762
  function Ur(n, t, e) {
4763
4763
  const o = $r(n, e), i = Gr(n, t), r = jr(n, e);
@@ -4799,18 +4799,18 @@ function Qr(n, t = 0.05) {
4799
4799
  function Jr(n, t, e, o, i) {
4800
4800
  const r = [];
4801
4801
  for (const a of n) {
4802
- const l = a.seg, c = (l.start.x - t.start.x) * e + (l.start.y - t.start.y) * o, h = (l.end.x - t.start.x) * e + (l.end.y - t.start.y) * o;
4803
- r.push({ l: Math.min(c, h), r: Math.max(c, h), idx: a.idx });
4802
+ const l = a.seg, u = (l.start.x - t.start.x) * e + (l.start.y - t.start.y) * o, h = (l.end.x - t.start.x) * e + (l.end.y - t.start.y) * o;
4803
+ r.push({ l: Math.min(u, h), r: Math.max(u, h), idx: a.idx });
4804
4804
  }
4805
4805
  r.sort((a, l) => a.l - l.l);
4806
4806
  const s = [];
4807
- for (const { l: a, r: l, idx: c } of r) {
4807
+ for (const { l: a, r: l, idx: u } of r) {
4808
4808
  if (s.length === 0) {
4809
- s.push({ l: a, r: l, srcIdxs: [c] });
4809
+ s.push({ l: a, r: l, srcIdxs: [u] });
4810
4810
  continue;
4811
4811
  }
4812
4812
  const h = s[s.length - 1];
4813
- a <= h.r + i ? (h.r = Math.max(h.r, l), h.srcIdxs.includes(c) || h.srcIdxs.push(c)) : s.push({ l: a, r: l, srcIdxs: [c] });
4813
+ a <= h.r + i ? (h.r = Math.max(h.r, l), h.srcIdxs.includes(u) || h.srcIdxs.push(u)) : s.push({ l: a, r: l, srcIdxs: [u] });
4814
4814
  }
4815
4815
  return s;
4816
4816
  }
@@ -4827,41 +4827,41 @@ function ei(n, t) {
4827
4827
  const r = n[o], s = n[i];
4828
4828
  if (r.rooftopPz !== void 0 && s.rooftopPz !== void 0 && Math.abs(r.rooftopPz - s.rooftopPz) > 0.05)
4829
4829
  continue;
4830
- const a = Math.abs(r.end.x - s.start.x) < 1e-3 && Math.abs(r.end.y - s.start.y) < 1e-3, l = Math.abs(r.start.x - s.end.x) < 1e-3 && Math.abs(r.start.y - s.end.y) < 1e-3, c = Math.abs(r.end.x - s.end.x) < 1e-3 && Math.abs(r.end.y - s.end.y) < 1e-3, h = Math.abs(r.start.x - s.start.x) < 1e-3 && Math.abs(r.start.y - s.start.y) < 1e-3;
4831
- if (!(a || l || c || h) || r.direction.x * s.direction.x + r.direction.y * s.direction.y < 0.98) continue;
4832
- let u = r.start, p = r.end;
4833
- a ? p = s.end : l ? u = s.start : c ? p = s.start : h && (u = s.end);
4834
- const w = Math.hypot(p.x - u.x, p.y - u.y), x = { ...r };
4835
- x.start = u, x.end = p, x.length = w, x.direction = { x: (p.x - u.x) / w, y: (p.y - u.y) / w, z: 0 }, x.rooftopPz = r.rooftopPz !== void 0 ? r.rooftopPz : s.rooftopPz, x.buildRosource = r.buildRosource || s.buildRosource, x.isRebuild = !1, x.doorAndBeamData || (x.doorAndBeamData = []), x.insetionArr || (x.insetionArr = []), n[o] = x, t[o] = [.../* @__PURE__ */ new Set([...t[o], ...t[i]])], n.splice(i, 1), t.splice(i, 1), i--, e = !0;
4830
+ const a = Math.abs(r.end.x - s.start.x) < 1e-3 && Math.abs(r.end.y - s.start.y) < 1e-3, l = Math.abs(r.start.x - s.end.x) < 1e-3 && Math.abs(r.start.y - s.end.y) < 1e-3, u = Math.abs(r.end.x - s.end.x) < 1e-3 && Math.abs(r.end.y - s.end.y) < 1e-3, h = Math.abs(r.start.x - s.start.x) < 1e-3 && Math.abs(r.start.y - s.start.y) < 1e-3;
4831
+ if (!(a || l || u || h) || r.direction.x * s.direction.x + r.direction.y * s.direction.y < 0.98) continue;
4832
+ let c = r.start, m = r.end;
4833
+ a ? m = s.end : l ? c = s.start : u ? m = s.start : h && (c = s.end);
4834
+ const w = Math.hypot(m.x - c.x, m.y - c.y), x = { ...r };
4835
+ x.start = c, x.end = m, x.length = w, x.direction = { x: (m.x - c.x) / w, y: (m.y - c.y) / w, z: 0 }, x.rooftopPz = r.rooftopPz !== void 0 ? r.rooftopPz : s.rooftopPz, x.buildRosource = r.buildRosource || s.buildRosource, x.isRebuild = !1, x.doorAndBeamData || (x.doorAndBeamData = []), x.insetionArr || (x.insetionArr = []), n[o] = x, t[o] = [.../* @__PURE__ */ new Set([...t[o], ...t[i]])], n.splice(i, 1), t.splice(i, 1), i--, e = !0;
4836
4836
  }
4837
4837
  }
4838
4838
  return { segments: n, sourceMap: t };
4839
4839
  }
4840
4840
  function Zn(n, t = 5, e = 0.05) {
4841
4841
  if (n.length <= 1)
4842
- return { segments: n, sourceMap: n.map((l, c) => [c]) };
4843
- const o = n.map((l, c) => ({ seg: l, angle: Zr(l), idx: c }));
4844
- o.sort((l, c) => l.angle - c.angle);
4842
+ return { segments: n, sourceMap: n.map((l, u) => [u]) };
4843
+ const o = n.map((l, u) => ({ seg: l, angle: Zr(l), idx: u }));
4844
+ o.sort((l, u) => l.angle - u.angle);
4845
4845
  const i = Kr(o, t), r = [], s = [], a = [];
4846
4846
  for (const l of i) {
4847
- let c = l[0].seg;
4847
+ let u = l[0].seg;
4848
4848
  for (const M of l)
4849
- M.seg.length > c.length && (c = M.seg);
4850
- const h = c.end.x - c.start.x, f = c.end.y - c.start.y, u = Math.sqrt(h * h + f * f);
4851
- if (u < 1e-12) continue;
4852
- const p = -f / u, w = h / u, x = l.map((M) => {
4853
- const m = M.seg.start.x - c.start.x, d = M.seg.start.y - c.start.y;
4854
- return { seg: M.seg, offset: Math.abs(m * p + d * w), idx: M.idx };
4849
+ M.seg.length > u.length && (u = M.seg);
4850
+ const h = u.end.x - u.start.x, g = u.end.y - u.start.y, c = Math.sqrt(h * h + g * g);
4851
+ if (c < 1e-12) continue;
4852
+ const m = -g / c, w = h / c, x = l.map((M) => {
4853
+ const d = M.seg.start.x - u.start.x, f = M.seg.start.y - u.start.y;
4854
+ return { seg: M.seg, offset: Math.abs(d * m + f * w), idx: M.idx };
4855
4855
  });
4856
- x.sort((M, m) => M.offset - m.offset);
4856
+ x.sort((M, d) => M.offset - d.offset);
4857
4857
  const P = Qr(x);
4858
4858
  for (const M of P) {
4859
- let m = M[0].seg;
4859
+ let d = M[0].seg;
4860
4860
  for (const T of M)
4861
- T.seg.length > m.length && (m = T.seg);
4862
- const d = m.end.x - m.start.x, g = m.end.y - m.start.y, b = Math.sqrt(d * d + g * g);
4861
+ T.seg.length > d.length && (d = T.seg);
4862
+ const f = d.end.x - d.start.x, p = d.end.y - d.start.y, b = Math.sqrt(f * f + p * p);
4863
4863
  if (b < 1e-12) continue;
4864
- const V = d / b, v = g / b, S = M.map((T) => T.seg.rooftopPz ?? 0), z = Math.max(...S), D = [...new Set(S.map((T) => T.toFixed(3)))];
4864
+ const z = f / b, v = p / b, S = M.map((T) => T.seg.rooftopPz ?? 0), V = Math.max(...S), D = [...new Set(S.map((T) => T.toFixed(3)))];
4865
4865
  if (D.length > 1) {
4866
4866
  const T = M.map((E) => ({
4867
4867
  idx: E.idx,
@@ -4873,10 +4873,10 @@ function Zn(n, t = 5, e = 0.05) {
4873
4873
  a.push({ values: [...D], segments: T });
4874
4874
  }
4875
4875
  [...new Set(M.map((T) => String(T.seg.buildRosource)))];
4876
- const _ = Jr(M, m, V, v, e);
4876
+ const _ = Jr(M, d, z, v, e);
4877
4877
  for (const { l: T, r: E, srcIdxs: A } of _) {
4878
4878
  if (E - T < 0.01) continue;
4879
- const O = ti(m, T, E, V, v, z, m.buildRosource);
4879
+ const O = ti(d, T, E, z, v, V, d.buildRosource);
4880
4880
  r.push(O), s.push(A);
4881
4881
  }
4882
4882
  }
@@ -4911,38 +4911,38 @@ function ri(n, t, e, o, i, r, s) {
4911
4911
  { margin: 0.4, maxDist: 0.65, label: "宽松" }
4912
4912
  ];
4913
4913
  let l = [];
4914
- for (const c of a) {
4914
+ for (const u of a) {
4915
4915
  if (l.length > 0) break;
4916
4916
  for (const h of n) {
4917
- const f = t * r.minLengthRatio;
4918
- if (h.length < f)
4917
+ const g = t * r.minLengthRatio;
4918
+ if (h.length < g)
4919
4919
  continue;
4920
- const { start: u, end: p } = h;
4920
+ const { start: c, end: m } = h;
4921
4921
  let w = !1, x = 1 / 0;
4922
4922
  for (const S of i) {
4923
- const { dist: z, t: D } = Un(S.x, S.y, u.x, u.y, p.x, p.y);
4924
- D >= -c.margin && D <= 1 + c.margin && z <= c.maxDist && (w = !0, x = Math.min(x, z));
4923
+ const { dist: V, t: D } = Un(S.x, S.y, c.x, c.y, m.x, m.y);
4924
+ D >= -u.margin && D <= 1 + u.margin && V <= u.maxDist && (w = !0, x = Math.min(x, V));
4925
4925
  }
4926
4926
  if (!w) {
4927
- `${c.maxDist}${(-c.margin).toFixed(1)}${(1 + c.margin).toFixed(1)}`;
4927
+ `${u.maxDist}${(-u.margin).toFixed(1)}${(1 + u.margin).toFixed(1)}`;
4928
4928
  continue;
4929
4929
  }
4930
- const P = Math.sqrt((p.x - u.x) ** 2 + (p.y - u.y) ** 2);
4930
+ const P = Math.sqrt((m.x - c.x) ** 2 + (m.y - c.y) ** 2);
4931
4931
  if (P < 1e-12) continue;
4932
- const M = (p.x - u.x) / P, m = (p.y - u.y) / P, d = Math.abs(e * M + o * m), g = Math.abs(-o * M + e * m), b = Math.max(d, g), V = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
4933
- if (V > r.angleThreshold) {
4934
- `${V.toFixed(1)}${r.angleThreshold}`;
4932
+ const M = (m.x - c.x) / P, d = (m.y - c.y) / P, f = Math.abs(e * M + o * d), p = Math.abs(-o * M + e * d), b = Math.max(f, p), z = Math.acos(Math.min(b, 1)) * (180 / Math.PI);
4933
+ if (z > r.angleThreshold) {
4934
+ `${z.toFixed(1)}${r.angleThreshold}`;
4935
4935
  continue;
4936
4936
  }
4937
4937
  let v = 0;
4938
4938
  if (P > 0.01) {
4939
4939
  const S = [];
4940
4940
  for (let _ = 1; _ <= 4; _++) {
4941
- const T = i[_], E = T.x - u.x, A = T.y - u.y, O = (E * M + A * m) / P;
4941
+ const T = i[_], E = T.x - c.x, A = T.y - c.y, O = (E * M + A * d) / P;
4942
4942
  S.push(O);
4943
4943
  }
4944
- const z = Math.min(...S), D = Math.max(...S);
4945
- D > z && (v = Math.max(0, Math.min(1, D) - Math.max(0, z)) / (D - z));
4944
+ const V = Math.min(...S), D = Math.max(...S);
4945
+ D > V && (v = Math.max(0, Math.min(1, D) - Math.max(0, V)) / (D - V));
4946
4946
  }
4947
4947
  l.push({
4948
4948
  seg: h,
@@ -4966,97 +4966,103 @@ function ii(n, t, e, o) {
4966
4966
  return n.sort((i, r) => r.embedRatio - i.embedRatio || r.score - i.score || i.minDist - r.minDist), n;
4967
4967
  }
4968
4968
  function si(n, t, e, o) {
4969
- const i = n.end.x - n.start.x, r = n.end.y - n.start.y, s = Math.sqrt(i * i + r * r), a = i / s, l = r / s, c = t.map((v) => {
4970
- const S = v.x - n.start.x, z = v.y - n.start.y;
4971
- return (S * a + z * l) / s;
4972
- }), h = Math.min(...c), f = Math.max(...c), u = (f - h) * s, p = (h + f) / 2, w = n.start.x + p * i, x = n.start.y + p * r, P = e.box.min.z, M = e.box.max.z, m = Math.abs(M - P), d = jn(o, n.start.x, n.start.y), g = Math.max(0, P - d), b = h <= 0 && f >= 1, V = n.start.z + p * (n.end.z - n.start.z);
4969
+ const i = n.end.x - n.start.x, r = n.end.y - n.start.y, s = Math.sqrt(i * i + r * r), a = i / s, l = r / s, u = t.map((v) => {
4970
+ const S = v.x - n.start.x, V = v.y - n.start.y;
4971
+ return (S * a + V * l) / s;
4972
+ }), h = Math.min(...u), g = Math.max(...u), c = (g - h) * s, m = (h + g) / 2, w = n.start.x + m * i, x = n.start.y + m * r, P = e.box.min.z, M = e.box.max.z, d = Math.abs(M - P), f = jn(o, n.start.x, n.start.y), p = Math.max(0, P - f), b = h <= 0 && g >= 1, z = n.start.z + m * (n.end.z - n.start.z);
4973
4973
  return {
4974
- p: { x: w, y: x, z: V },
4975
- width: u,
4974
+ p: { x: w, y: x, z },
4975
+ width: c,
4976
4976
  full: b,
4977
- height: m,
4978
- groundClearance: g
4977
+ height: d,
4978
+ groundClearance: p
4979
4979
  };
4980
4980
  }
4981
4981
  function Kn(n, t, e) {
4982
- var h, f, u, p, w;
4982
+ var h, g, c, m, w;
4983
4983
  const o = t.map((x) => e[x]), i = [], r = [], s = [], a = [], l = [];
4984
- let c;
4984
+ let u;
4985
4985
  for (const x of o) {
4986
4986
  if ((h = x.points) != null && h.length) for (const P of x.points) i.push(P);
4987
- if ((f = x.originalPoints) != null && f.length) for (const P of x.originalPoints) r.push(P);
4988
- if ((u = x.doorAndBeamData) != null && u.length) for (const P of x.doorAndBeamData) s.push(P);
4989
- if ((p = x.insetionArr) != null && p.length) for (const P of x.insetionArr) a.push(P);
4987
+ if ((g = x.originalPoints) != null && g.length) for (const P of x.originalPoints) r.push(P);
4988
+ if ((c = x.doorAndBeamData) != null && c.length) for (const P of x.doorAndBeamData) s.push(P);
4989
+ if ((m = x.insetionArr) != null && m.length) for (const P of x.insetionArr) a.push(P);
4990
4990
  if ((w = x.drawWindow) != null && w.length) for (const P of x.drawWindow) l.push(P);
4991
- x.boxData && !c && (c = x.boxData);
4991
+ x.boxData && !u && (u = x.boxData);
4992
4992
  }
4993
- i.length && (n.points = i), r.length && (n.originalPoints = r), s.length && (n.doorAndBeamData = s), a.length && (n.insetionArr = a), l.length && (n.drawWindow = l), c && (n.boxData = c);
4993
+ i.length && (n.points = i), r.length && (n.originalPoints = r), s.length && (n.doorAndBeamData = s), a.length && (n.insetionArr = a), l.length && (n.drawWindow = l), u && (n.boxData = u);
4994
4994
  }
4995
- function ai(n, t, e) {
4996
- var l;
4997
- const o = ni(e), i = [], { segments: r, sourceMap: s } = Zn(t), a = r;
4998
- for (const c of n) {
4999
- const h = (l = c.coordinatesByArea) == null ? void 0 : l.coordinates;
5000
- if (!h || h.length < 4)
4995
+ function ai(n, t, e, o) {
4996
+ var u;
4997
+ const i = ni(e), r = [], { segments: s, sourceMap: a } = o ?? Zn(t), l = s;
4998
+ for (const h of n) {
4999
+ const g = (u = h.coordinatesByArea) == null ? void 0 : u.coordinates;
5000
+ if (!g || g.length < 4)
5001
5001
  continue;
5002
- const f = h.slice(0, 4), u = f.reduce((z, D) => z + D.x, 0) / 4, p = f.reduce((z, D) => z + D.y, 0) / 4, { longSide: w, dirX: x, dirY: P } = Yr(f);
5003
- if (w < 0.01)
5002
+ const c = g.slice(0, 4), m = c.reduce((D, _) => D + _.x, 0) / 4, w = c.reduce((D, _) => D + _.y, 0) / 4, { longSide: x, dirX: P, dirY: M } = Yr(c);
5003
+ if (x < 0.01)
5004
5004
  continue;
5005
- const M = f.reduce((z, D) => z + D.z, 0) / 4, m = jn(t, u, p);
5006
- if (M < m - 0.3)
5005
+ const d = c.reduce((D, _) => D + _.z, 0) / 4, f = jn(t, m, w);
5006
+ if (d < f - 0.3)
5007
5007
  continue;
5008
- const d = oi(f, u, p);
5009
- c.name;
5010
- let g = ri(a, w, x, P, d, o, c.name);
5011
- g = ii(g, d, t, c.name);
5012
- let b = null, V = 1 / 0, v = 0;
5013
- if (g.length > 0) {
5014
- const z = g[0];
5015
- b = z.seg, V = z.minDist, v = z.ratio;
5008
+ const p = oi(c, m, w);
5009
+ h.name;
5010
+ let b = ri(l, x, P, M, p, i, h.name);
5011
+ b = ii(b, p, t, h.name);
5012
+ let z = null, v = 1 / 0, S = 0;
5013
+ if (b.length > 0) {
5014
+ const D = b[0];
5015
+ z = D.seg, v = D.minDist, S = D.ratio;
5016
5016
  }
5017
- let S;
5018
- if (b && (S = si(b, f, c, r), !o.printOnly)) {
5019
- const z = b;
5020
- z.drawWindow || (z.drawWindow = []), z.drawWindow.push(S);
5017
+ let V;
5018
+ if (z && (V = si(z, c, h, s), !i.printOnly)) {
5019
+ const D = z;
5020
+ D.drawWindow || (D.drawWindow = []), D.drawWindow.push(V);
5021
5021
  }
5022
- b && i.push({
5023
- windowName: c.name,
5024
- windowCategory: c.category,
5025
- windowCenter: c.center,
5026
- wallSegment: b,
5027
- distance: V,
5028
- wallLengthRatio: v,
5029
- drawWindow: S
5022
+ z && r.push({
5023
+ windowName: h.name,
5024
+ windowCategory: h.category,
5025
+ windowCenter: h.center,
5026
+ wallSegment: z,
5027
+ distance: v,
5028
+ wallLengthRatio: S,
5029
+ drawWindow: V
5030
5030
  });
5031
5031
  }
5032
- for (const c of i) {
5033
- const h = c.wallSegment, f = r.indexOf(h);
5034
- if (f === -1) continue;
5035
- const u = s[f];
5036
- !u || u.length <= 1 || Kn(h, u, t);
5032
+ for (const h of r) {
5033
+ const g = h.wallSegment, c = s.indexOf(g);
5034
+ if (c === -1) continue;
5035
+ const m = a[c];
5036
+ !m || m.length <= 1 || Kn(g, m, t);
5037
5037
  }
5038
- return i;
5038
+ return r;
5039
5039
  }
5040
5040
  function pi(n, t, e) {
5041
5041
  const o = {
5042
5042
  printOnly: !1,
5043
5043
  ...e
5044
- }, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], r = ai(i, n, o), { segments: s, sourceMap: a } = Zn(n);
5045
- for (let c = 0; c < s.length; c++) {
5046
- const h = a[c];
5047
- h && Kn(s[c], h, n);
5044
+ }, i = Array.isArray(t) ? t.filter((c) => c && c.category === "window" && !c.isBayWindowObj) : [], { segments: r, sourceMap: s } = Zn(n), a = ai(i, n, o, { segments: r, sourceMap: s }), l = /* @__PURE__ */ new Set();
5045
+ for (const c of a) {
5046
+ const m = r.indexOf(c.wallSegment);
5047
+ m >= 0 && l.add(m);
5048
+ }
5049
+ const u = [], h = /* @__PURE__ */ new Set();
5050
+ for (const c of l) {
5051
+ const m = s[c];
5052
+ if (m) {
5053
+ Kn(r[c], m, n);
5054
+ for (const w of m) h.add(w);
5055
+ }
5056
+ u.push(r[c]);
5048
5057
  }
5049
- const l = new Set(r.map((c) => c.windowName));
5058
+ for (let c = 0; c < n.length; c++)
5059
+ h.has(c) || u.push(n[c]);
5060
+ const g = new Set(a.map((c) => c.windowName));
5050
5061
  for (const c of t)
5051
- c && c.category === "window" && !c.isBayWindowObj && (l.has(c.name) ? delete c.AbnormalWindow : c.AbnormalWindow = !0);
5052
- for (const c of r)
5053
- if (c.drawWindow) {
5054
- const h = s.find(
5055
- (f) => Math.abs(f.start.x - c.wallSegment.start.x) < 0.01 && Math.abs(f.start.y - c.wallSegment.start.y) < 0.01 && Math.abs(f.end.x - c.wallSegment.end.x) < 0.01 && Math.abs(f.end.y - c.wallSegment.end.y) < 0.01
5056
- );
5057
- h && (h.drawWindow || (h.drawWindow = []), h.drawWindow.push(c.drawWindow));
5058
- }
5059
- return { segments: s, matches: r, sourceMap: a };
5062
+ c && c.category === "window" && !c.isBayWindowObj && (g.has(c.name) ? delete c.AbnormalWindow : c.AbnormalWindow = !0);
5063
+ for (const c of a)
5064
+ c.drawWindow && c.wallSegment && (c.wallSegment.drawWindow || (c.wallSegment.drawWindow = []), c.wallSegment.drawWindow.push(c.drawWindow));
5065
+ return { segments: u, matches: a };
5060
5066
  }
5061
5067
  export {
5062
5068
  cn as computeContour,