build-dxf 0.0.20-25 → 0.0.20-26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/build.js CHANGED
@@ -207,8 +207,8 @@ class f {
207
207
  * @param angle 旋转角度,单位为弧度
208
208
  */
209
209
  rotate(t, e) {
210
- const n = this.x - t.x, i = this.y - t.y, s = Math.cos(e), o = Math.sin(e), r = n * s - i * o, c = n * o + i * s;
211
- return this.x = r + t.x, this.y = c + t.y, this;
210
+ const n = this.x - t.x, i = this.y - t.y, s = Math.cos(e), o = Math.sin(e), r = n * s - i * o, a = n * o + i * s;
211
+ return this.x = r + t.x, this.y = a + t.y, this;
212
212
  }
213
213
  /**
214
214
  * 保留小数位数
@@ -279,8 +279,8 @@ class f {
279
279
  angleBetween(t, e = "radian", n = "180") {
280
280
  const i = this.dot(t), s = this.magnitude(), o = t.magnitude();
281
281
  if (s === 0 || o === 0) return 0;
282
- const r = i / (s * o), c = Math.max(-1, Math.min(1, r));
283
- return e === "radian" ? Math.acos(c) : e === "cos" ? c : n === "180" || this.cross(t) < 0 ? Math.acos(c) / (Math.PI / 180) : 360 - Math.acos(c) / (Math.PI / 180);
282
+ const r = i / (s * o), a = Math.max(-1, Math.min(1, r));
283
+ return e === "radian" ? Math.acos(a) : e === "cos" ? a : n === "180" || this.cross(t) < 0 ? Math.acos(a) / (Math.PI / 180) : 360 - Math.acos(a) / (Math.PI / 180);
284
284
  }
285
285
  /** 获取向量长度
286
286
  */
@@ -376,13 +376,13 @@ class v {
376
376
  return this.minX <= e.x && e.x <= this.maxX && this.minY <= e.y && e.y <= this.maxY;
377
377
  let o = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
378
378
  if (i !== 0) {
379
- const c = (this.minX - e.x) / i, a = (this.maxX - e.x) / i;
380
- o = Math.max(o, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
379
+ const a = (this.minX - e.x) / i, c = (this.maxX - e.x) / i;
380
+ o = Math.max(o, Math.min(a, c)), r = Math.min(r, Math.max(a, c));
381
381
  } else if (e.x < this.minX || e.x > this.maxX)
382
382
  return !1;
383
383
  if (s !== 0) {
384
- const c = (this.minY - e.y) / s, a = (this.maxY - e.y) / s;
385
- o = Math.max(o, Math.min(c, a)), r = Math.min(r, Math.max(c, a));
384
+ const a = (this.minY - e.y) / s, c = (this.maxY - e.y) / s;
385
+ o = Math.max(o, Math.min(a, c)), r = Math.min(r, Math.max(a, c));
386
386
  } else if (e.y < this.minY || e.y > this.maxY)
387
387
  return !1;
388
388
  return o <= r && o <= 1 && r >= 0;
@@ -402,10 +402,10 @@ class v {
402
402
  intersectRectangle(t) {
403
403
  const e = (o) => this.minX <= o.x && o.x <= this.maxX && this.minY <= o.y && o.y <= this.maxY, n = (o) => {
404
404
  let r = 0;
405
- for (let c = 0; c < 4; c++) {
406
- const a = t.points[c], h = t.points[(c + 1) % 4], l = { x: h.x - a.x, y: h.y - a.y }, d = { x: o.x - a.x, y: o.y - a.y }, p = l.x * d.y - l.y * d.x;
405
+ for (let a = 0; a < 4; a++) {
406
+ const c = t.points[a], h = t.points[(a + 1) % 4], l = { x: h.x - c.x, y: h.y - c.y }, d = { x: o.x - c.x, y: o.y - c.y }, p = l.x * d.y - l.y * d.x;
407
407
  if (p === 0) {
408
- const m = l.x !== 0 ? (o.x - a.x) / l.x : (o.y - a.y) / l.y;
408
+ const m = l.x !== 0 ? (o.x - c.x) / l.x : (o.y - c.y) / l.y;
409
409
  if (m >= 0 && m <= 1) return !0;
410
410
  } else {
411
411
  const m = p > 0 ? 1 : -1;
@@ -413,18 +413,18 @@ class v {
413
413
  }
414
414
  }
415
415
  return !0;
416
- }, i = (o, r, c, a) => {
416
+ }, i = (o, r, a, c) => {
417
417
  const h = (u, x, w) => {
418
418
  const S = (x.y - u.y) * (w.x - x.x) - (x.x - u.x) * (w.y - x.y);
419
419
  return S === 0 ? 0 : S > 0 ? 1 : 2;
420
- }, l = (u, x, w) => Math.min(u.x, w.x) <= x.x && x.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= x.y && x.y <= Math.max(u.y, w.y), d = h(o, r, c), p = h(o, r, a), m = h(c, a, o), g = h(c, a, r);
421
- return !!(d !== p && m !== g || d === 0 && l(o, c, r) || p === 0 && l(o, a, r) || m === 0 && l(c, o, a) || g === 0 && l(c, r, a));
420
+ }, l = (u, x, w) => Math.min(u.x, w.x) <= x.x && x.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= x.y && x.y <= Math.max(u.y, w.y), d = h(o, r, a), p = h(o, r, c), m = h(a, c, o), g = h(a, c, r);
421
+ return !!(d !== p && m !== g || d === 0 && l(o, a, r) || p === 0 && l(o, c, r) || m === 0 && l(a, o, c) || g === 0 && l(a, r, c));
422
422
  }, s = this.points;
423
423
  for (let o = 0; o < 4; o++) {
424
- const r = s[o], c = s[(o + 1) % 4];
425
- for (let a = 0; a < 4; a++) {
426
- const h = t.points[a], l = t.points[(a + 1) % 4];
427
- if (i(r, c, h, l)) return !0;
424
+ const r = s[o], a = s[(o + 1) % 4];
425
+ for (let c = 0; c < 4; c++) {
426
+ const h = t.points[c], l = t.points[(c + 1) % 4];
427
+ if (i(r, a, h, l)) return !0;
428
428
  }
429
429
  }
430
430
  for (let o of t.points)
@@ -519,13 +519,13 @@ class v {
519
519
  );
520
520
  }
521
521
  }
522
- function z(y) {
522
+ function V(y) {
523
523
  if (y === null || typeof y != "object") return y;
524
524
  if (y instanceof Date) return new Date(y.getTime());
525
- if (Array.isArray(y)) return y.map(z);
525
+ if (Array.isArray(y)) return y.map(V);
526
526
  const t = {};
527
527
  for (const e in y)
528
- Object.prototype.hasOwnProperty.call(y, e) && (t[e] = z(y[e]));
528
+ Object.prototype.hasOwnProperty.call(y, e) && (t[e] = V(y[e]));
529
529
  return t;
530
530
  }
531
531
  class O {
@@ -577,12 +577,12 @@ class O {
577
577
  intersectLineSegment(t) {
578
578
  if (t.points.length !== 2)
579
579
  throw new Error("LineSegment must have exactly 2 points");
580
- const [e, n] = t.points, i = (s, o, r, c) => {
581
- const a = (g, u, x) => {
580
+ const [e, n] = t.points, i = (s, o, r, a) => {
581
+ const c = (g, u, x) => {
582
582
  const w = (u.y - g.y) * (x.x - u.x) - (u.x - g.x) * (x.y - u.y);
583
583
  return w === 0 ? 0 : w > 0 ? 1 : 2;
584
- }, h = (g, u, x) => Math.min(g.x, x.x) <= u.x && u.x <= Math.max(g.x, x.x) && Math.min(g.y, x.y) <= u.y && u.y <= Math.max(g.y, x.y), l = a(s, o, r), d = a(s, o, c), p = a(r, c, s), m = a(r, c, o);
585
- return !!(l !== d && p !== m || l === 0 && h(s, r, o) || d === 0 && h(s, c, o) || p === 0 && h(r, s, c) || m === 0 && h(r, o, c));
584
+ }, h = (g, u, x) => Math.min(g.x, x.x) <= u.x && u.x <= Math.max(g.x, x.x) && Math.min(g.y, x.y) <= u.y && u.y <= Math.max(g.y, x.y), l = c(s, o, r), d = c(s, o, a), p = c(r, a, s), m = c(r, a, o);
585
+ return !!(l !== d && p !== m || l === 0 && h(s, r, o) || d === 0 && h(s, a, o) || p === 0 && h(r, s, a) || m === 0 && h(r, o, a));
586
586
  };
587
587
  for (let s = 0; s < 4; s++) {
588
588
  const o = this.points[s], r = this.points[(s + 1) % 4];
@@ -602,9 +602,9 @@ class O {
602
602
  const e = (n) => {
603
603
  let i = 0;
604
604
  for (let s = 0; s < 4; s++) {
605
- const o = this.points[s], r = this.points[(s + 1) % 4], c = { x: r.x - o.x, y: r.y - o.y }, a = { x: n.x - o.x, y: n.y - o.y }, h = c.x * a.y - c.y * a.x;
605
+ const o = this.points[s], r = this.points[(s + 1) % 4], a = { x: r.x - o.x, y: r.y - o.y }, c = { x: n.x - o.x, y: n.y - o.y }, h = a.x * c.y - a.y * c.x;
606
606
  if (h === 0) {
607
- const l = c.x !== 0 ? (n.x - o.x) / c.x : (n.y - o.y) / c.y;
607
+ const l = a.x !== 0 ? (n.x - o.x) / a.x : (n.y - o.y) / a.y;
608
608
  if (l >= 0 && l <= 1) return !0;
609
609
  } else {
610
610
  const l = h > 0 ? 1 : -1;
@@ -632,7 +632,7 @@ class O {
632
632
  e.push(o.normal(r));
633
633
  }
634
634
  function n(s, o) {
635
- const r = s.points.map((c) => c.dot(o));
635
+ const r = s.points.map((a) => a.dot(o));
636
636
  return [Math.min(...r), Math.max(...r)];
637
637
  }
638
638
  function i(s, o) {
@@ -676,16 +676,16 @@ class O {
676
676
  * @returns
677
677
  */
678
678
  static fromByLineSegment(t, e = 0.1, n = !1, i = 0.5) {
679
- const s = t.points[0], o = t.points[1], r = o.normal(s), c = n ? o.direction(s).mutiplyScalar(e * i) : f.zero(), a = n ? s.direction(o).mutiplyScalar(e * i) : f.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
679
+ const s = t.points[0], o = t.points[1], r = o.normal(s), a = n ? o.direction(s).mutiplyScalar(e * i) : f.zero(), c = n ? s.direction(o).mutiplyScalar(e * i) : f.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
680
680
  return new O([
681
- new f(s.x + h, s.y + l).add(a),
682
- new f(o.x + h, o.y + l).add(c),
683
- new f(o.x - h, o.y - l).add(c),
684
- new f(s.x - h, s.y - l).add(a)
681
+ new f(s.x + h, s.y + l).add(c),
682
+ new f(o.x + h, o.y + l).add(a),
683
+ new f(o.x - h, o.y - l).add(a),
684
+ new f(s.x - h, s.y - l).add(c)
685
685
  ]);
686
686
  }
687
687
  }
688
- class b {
688
+ class L {
689
689
  points = [new f(), new f()];
690
690
  userData = {};
691
691
  line;
@@ -770,13 +770,13 @@ class b {
770
770
  * @returns {Rectangle}
771
771
  */
772
772
  expandToRectangle(t = 0.1, e = "all") {
773
- const n = this.start, i = this.end, s = i.normal(n), o = e === "bothSides" ? f.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? f.zero() : n.direction(i).mutiplyScalar(t * 0.5), c = s.x * t * 0.5, a = s.y * t * 0.5, h = [
773
+ const n = this.start, i = this.end, s = i.normal(n), o = e === "bothSides" ? f.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? f.zero() : n.direction(i).mutiplyScalar(t * 0.5), a = s.x * t * 0.5, c = s.y * t * 0.5, h = [
774
774
  // 第一条线
775
- new f(n.x + c, n.y + a).add(r),
776
- new f(i.x + c, i.y + a).add(o),
775
+ new f(n.x + a, n.y + c).add(r),
776
+ new f(i.x + a, i.y + c).add(o),
777
777
  // 第二条线
778
- new f(n.x - c, n.y - a).add(r),
779
- new f(i.x - c, i.y - a).add(o)
778
+ new f(n.x - a, n.y - c).add(r),
779
+ new f(i.x - a, i.y - c).add(o)
780
780
  ];
781
781
  return new O([0, 1, 3, 2].map((l) => h[l]));
782
782
  }
@@ -819,20 +819,20 @@ class b {
819
819
  if (o.x === 0 && o.y === 0)
820
820
  throw new Error("投影目标线段的两个点不能重合");
821
821
  const r = (m) => {
822
- const g = new f(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y, w = (g.x * o.x + g.y * o.y) / u, S = i.x + w * o.x, L = i.y + w * o.y;
823
- return new f(S, L);
822
+ const g = new f(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y, w = (g.x * o.x + g.y * o.y) / u, S = i.x + w * o.x, b = i.y + w * o.y;
823
+ return new f(S, b);
824
824
  };
825
- let c = r(e), a = r(n);
825
+ let a = r(e), c = r(n);
826
826
  const h = (m) => {
827
827
  const g = new f(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y;
828
828
  return (g.x * o.x + g.y * o.y) / u;
829
829
  };
830
- let l = h(c), d = h(a);
830
+ let l = h(a), d = h(c);
831
831
  const p = (m) => {
832
832
  const g = Math.max(0, Math.min(1, m)), u = i.x + g * o.x, x = i.y + g * o.y;
833
833
  return new f(u, x);
834
834
  };
835
- return (l < 0 || l > 1) && (c = p(l)), (d < 0 || d > 1) && (a = p(d)), c.x === a.x && c.y === a.y ? new b(c, c) : new b(c, a);
835
+ return (l < 0 || l > 1) && (a = p(l)), (d < 0 || d > 1) && (c = p(d)), a.x === c.x && a.y === c.y ? new L(a, a) : new L(a, c);
836
836
  }
837
837
  /**
838
838
  * 计算一条线段在另一条直线上的投影
@@ -849,11 +849,11 @@ class b {
849
849
  return new f(g, u);
850
850
  })(t);
851
851
  if (!e) return r;
852
- let a = ((h) => {
852
+ let c = ((h) => {
853
853
  const l = new f(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y;
854
854
  return (l.x * s.x + l.y * s.y) / d;
855
855
  })(r);
856
- return a < 0 || a > 1 ? null : r;
856
+ return c < 0 || c > 1 ? null : r;
857
857
  }
858
858
  /**
859
859
  * 判断线段是否与另一条线段相交(包含共用端点或部分重合的情况)
@@ -867,8 +867,8 @@ class b {
867
867
  function r(d, p, m) {
868
868
  return Math.min(p.x, m.x) - 1e-10 <= d.x && d.x <= Math.max(p.x, m.x) + 1e-10 && Math.min(p.y, m.y) - 1e-10 <= d.y && d.y <= Math.max(p.y, m.y) + 1e-10;
869
869
  }
870
- const c = o(e, n, i), a = o(e, n, s), h = o(i, s, e), l = o(i, s, n);
871
- return !!(c * a < 0 && h * l < 0 || Math.abs(c) < 1e-10 && r(i, e, n) || Math.abs(a) < 1e-10 && r(s, e, n) || Math.abs(h) < 1e-10 && r(e, i, s) || Math.abs(l) < 1e-10 && r(n, i, s));
870
+ const a = o(e, n, i), c = o(e, n, s), h = o(i, s, e), l = o(i, s, n);
871
+ return !!(a * c < 0 && h * l < 0 || Math.abs(a) < 1e-10 && r(i, e, n) || Math.abs(c) < 1e-10 && r(s, e, n) || Math.abs(h) < 1e-10 && r(e, i, s) || Math.abs(l) < 1e-10 && r(n, i, s));
872
872
  }
873
873
  /**
874
874
  * 获取交点
@@ -879,8 +879,8 @@ class b {
879
879
  const e = this.start, n = this.end, i = t.start, s = t.end, o = (e.x - n.x) * (i.y - s.y) - (e.y - n.y) * (i.x - s.x);
880
880
  if (Math.abs(o) < 1e-10)
881
881
  return null;
882
- const r = ((e.x - i.x) * (i.y - s.y) - (e.y - i.y) * (i.x - s.x)) / o, c = e.x + r * (n.x - e.x), a = e.y + r * (n.y - e.y);
883
- return new f(c, a);
882
+ const r = ((e.x - i.x) * (i.y - s.y) - (e.y - i.y) * (i.x - s.x)) / o, a = e.x + r * (n.x - e.x), c = e.y + r * (n.y - e.y);
883
+ return new f(a, c);
884
884
  }
885
885
  /**
886
886
  * 获取两条线段夹角
@@ -918,11 +918,11 @@ class b {
918
918
  * @returns
919
919
  */
920
920
  areLinesCoincident(t) {
921
- const e = this.start, n = this.end, i = t.start, s = t.end, o = (n.y - e.y) / (n.x - e.x), r = e.y - o * e.x, c = (s.y - i.y) / (s.x - i.x), a = i.y - c * i.x;
922
- return !isFinite(o) && !isFinite(c) ? e.x === i.x && n.x === i.x : Math.abs(o - c) < 1e-3 && Math.abs(r - a) < 1e-3;
921
+ const e = this.start, n = this.end, i = t.start, s = t.end, o = (n.y - e.y) / (n.x - e.x), r = e.y - o * e.x, a = (s.y - i.y) / (s.x - i.x), c = i.y - a * i.x;
922
+ return !isFinite(o) && !isFinite(a) ? e.x === i.x && n.x === i.x : Math.abs(o - a) < 1e-3 && Math.abs(r - c) < 1e-3;
923
923
  }
924
924
  clone() {
925
- const t = new b(
925
+ const t = new L(
926
926
  this.points[0].clone(),
927
927
  this.points[1].clone()
928
928
  );
@@ -987,7 +987,7 @@ const st = {
987
987
  function k(y) {
988
988
  const t = [];
989
989
  for (let e = 0; e < y.length; e++)
990
- t.push(new b(
990
+ t.push(new L(
991
991
  y[e].clone(),
992
992
  y[(e + 1) % y.length].clone()
993
993
  ));
@@ -1048,23 +1048,23 @@ class X extends j {
1048
1048
  const { default: o } = await import(
1049
1049
  /* @vite-ignore */
1050
1050
  "fs"
1051
- ), r = o.readFileSync(t), c = JSON.parse(r.toString("utf-8"));
1052
- return this.set(c, e, n);
1051
+ ), r = o.readFileSync(t), a = JSON.parse(r.toString("utf-8"));
1052
+ return this.set(a, e, n);
1053
1053
  } else
1054
1054
  throw new Error("非node环境不允许使用路径");
1055
1055
  this.scale = n, this.width = e, this.originalData = t, this.lineSegments.length = 0;
1056
1056
  const i = [];
1057
- this.data = t.map(({ start: s, end: o, insetionArr: r, isDoor: c = !1, ...a }, h) => {
1057
+ this.data = t.map(({ start: s, end: o, insetionArr: r, isDoor: a = !1, ...c }, h) => {
1058
1058
  i.push(s.z ?? 0, o.z ?? 0);
1059
- const l = new b(
1059
+ const l = new L(
1060
1060
  f.from(s).mutiplyScalar(n),
1061
1061
  f.from(o).mutiplyScalar(n)
1062
1062
  );
1063
- return l.userData = { isDoor: c, ...a }, this.lineSegments.push(l), [
1063
+ return l.userData = { isDoor: a, ...c }, this.lineSegments.push(l), [
1064
1064
  l.points[0],
1065
1065
  l.points[1],
1066
1066
  (r ?? []).map((d) => d.index),
1067
- c,
1067
+ a,
1068
1068
  h
1069
1069
  ];
1070
1070
  }), this.originalZAverage = i.reduce((s, o) => s + o, 0) / i.length, this.computedOriginalSize(t, this.originalBox), this.dispatchEvent({
@@ -1081,18 +1081,18 @@ class X extends j {
1081
1081
  * @returns
1082
1082
  */
1083
1083
  createGroups() {
1084
- const t = [], e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), s = (o, r, c = -1) => {
1085
- const [a, h, l, d] = this.data[o];
1084
+ const t = [], e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), s = (o, r, a = -1) => {
1085
+ const [c, h, l, d] = this.data[o];
1086
1086
  if (e.add(o), d)
1087
- return i.has(o) || i.set(o, []), i.get(o)?.push(c), n.add(this.data[o]);
1088
- r.push([a, h]), l.forEach((p) => {
1087
+ return i.has(o) || i.set(o, []), i.get(o)?.push(a), n.add(this.data[o]);
1088
+ r.push([c, h]), l.forEach((p) => {
1089
1089
  e.has(p) || s(p, r, o);
1090
1090
  });
1091
1091
  };
1092
1092
  return this.data.forEach((o, r) => {
1093
1093
  if (!e.has(r)) {
1094
- const c = [];
1095
- s(r, c), t.push(c);
1094
+ const a = [];
1095
+ s(r, a), t.push(a);
1096
1096
  }
1097
1097
  }), this.doors = [...n], this.pointsGroups = t, t;
1098
1098
  }
@@ -1102,7 +1102,7 @@ class X extends j {
1102
1102
  * @returns
1103
1103
  */
1104
1104
  computedSize() {
1105
- const t = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].x, c[1].x])), e = this.pointsGroups.flatMap((r) => r.flatMap((c) => [c[0].y, c[1].y])), n = Math.min(...t), i = Math.min(...e), s = Math.max(...t), o = Math.max(...e);
1105
+ const t = this.pointsGroups.flatMap((r) => r.flatMap((a) => [a[0].x, a[1].x])), e = this.pointsGroups.flatMap((r) => r.flatMap((a) => [a[0].y, a[1].y])), n = Math.min(...t), i = Math.min(...e), s = Math.max(...t), o = Math.max(...e);
1106
1106
  return this.box.set(n, i, s, o), this.box;
1107
1107
  }
1108
1108
  /** 线路拓扑
@@ -1112,12 +1112,12 @@ class X extends j {
1112
1112
  lineTopology(t) {
1113
1113
  const e = [];
1114
1114
  function n(s, o) {
1115
- const [r, c] = t[s];
1116
- e[s] = !0, o.push(c);
1117
- for (let a = 0; a < t.length; a++) {
1118
- const [h, l] = t[a];
1119
- if (!e[a] && Math.abs(c.x - h.x) < 1e-6 && Math.abs(c.y - h.y) < 1e-6)
1120
- return n(a, o);
1115
+ const [r, a] = t[s];
1116
+ e[s] = !0, o.push(a);
1117
+ for (let c = 0; c < t.length; c++) {
1118
+ const [h, l] = t[c];
1119
+ if (!e[c] && Math.abs(a.x - h.x) < 1e-6 && Math.abs(a.y - h.y) < 1e-6)
1120
+ return n(c, o);
1121
1121
  }
1122
1122
  }
1123
1123
  const i = [];
@@ -1154,9 +1154,9 @@ class X extends j {
1154
1154
  const i = t[n - 1], s = t[n];
1155
1155
  if (i.distance(s) < this.width * 0.5) {
1156
1156
  let r = 0;
1157
- for (let c = n + 1; c < t.length; c++) {
1158
- const a = t[c - 1], h = t[c];
1159
- if (a.distance(h) < this.width * 0.8) r++;
1157
+ for (let a = n + 1; a < t.length; a++) {
1158
+ const c = t[a - 1], h = t[a];
1159
+ if (c.distance(h) < this.width * 0.8) r++;
1160
1160
  else break;
1161
1161
  }
1162
1162
  r === 0 && n + r === t.length - 1 || n == 1 && r === 1 || (r === 3 ? (e.push(t[n + 1]), n += r) : r === 5 ? (e.push(t[n + 2]), n += r) : e.push(s));
@@ -1190,8 +1190,8 @@ class X extends j {
1190
1190
  n.push(s), n.push(r), i = i + 1;
1191
1191
  continue;
1192
1192
  }
1193
- const c = e[i + 2];
1194
- c && o.includedAngle(c) < 2 ? (i = i + 2, n.push(c)) : n.push(s);
1193
+ const a = e[i + 2];
1194
+ a && o.includedAngle(a) < 2 ? (i = i + 2, n.push(a)) : n.push(s);
1195
1195
  }
1196
1196
  return n.length > 3 ? J(this.mergeSameDirectionLine(n)) : [];
1197
1197
  }
@@ -1203,8 +1203,8 @@ class X extends j {
1203
1203
  removeShortLine(t, e = this.shortLine) {
1204
1204
  const n = k(t), i = [], s = Math.PI / 180;
1205
1205
  for (let o = 0; o < n.length; o++) {
1206
- const r = n[o], c = r.length(), a = o;
1207
- if (c > e || i.length === 0) {
1206
+ const r = n[o], a = r.length(), c = o;
1207
+ if (a > e || i.length === 0) {
1208
1208
  i.push(r);
1209
1209
  continue;
1210
1210
  }
@@ -1227,7 +1227,7 @@ class X extends j {
1227
1227
  l.points[1].copy(h.points[0]);
1228
1228
  i.push(h);
1229
1229
  } else
1230
- o = a;
1230
+ o = c;
1231
1231
  }
1232
1232
  return i.length > 3 ? J(i) : [];
1233
1233
  }
@@ -1238,10 +1238,10 @@ class X extends j {
1238
1238
  let i = new F.Paths();
1239
1239
  const s = new F.ClipperOffset(20, 0.25);
1240
1240
  return this.pointsGroups.forEach((o) => {
1241
- const r = this.lineTopology(o).map((c) => c.map((a) => a.clone().mutiplyScalar(n)));
1241
+ const r = this.lineTopology(o).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
1242
1242
  s.AddPaths(r, e, t);
1243
1243
  }), s.Execute(i, this.width / 2 * n), this.wallsGroup = i.map((o) => {
1244
- let r = o.map((c) => f.from(c).divisionScalar(n));
1244
+ let r = o.map((a) => f.from(a).divisionScalar(n));
1245
1245
  return r = this.lineSegmentStraightening(r), t == X.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r = this.removeShortLine(r), r;
1246
1246
  }), this.dispatchEvent({
1247
1247
  type: "lineOffset",
@@ -1255,8 +1255,8 @@ class X extends j {
1255
1255
  const n = [];
1256
1256
  return this.wallsGroup.forEach((i) => {
1257
1257
  for (let s = 0; s < i.length; s++) {
1258
- const o = i[s], r = s === i.length - 1 ? 0 : s + 1, c = i[r];
1259
- n.push(o.X * t, o.Y * t, e, c.X * t, c.Y * t, e);
1258
+ const o = i[s], r = s === i.length - 1 ? 0 : s + 1, a = i[r];
1259
+ n.push(o.X * t, o.Y * t, e, a.X * t, a.Y * t, e);
1260
1260
  }
1261
1261
  }), new Float32Array(n);
1262
1262
  }
@@ -1268,10 +1268,10 @@ class X extends j {
1268
1268
  */
1269
1269
  getArcAngleRange(t, e, n) {
1270
1270
  const i = e.x - t.x, s = e.y - t.y, o = n.x - t.x, r = n.y - t.y;
1271
- let c = Math.atan2(s, i), a = Math.atan2(r, o);
1272
- c = c < 0 ? c + 2 * Math.PI : c, a = a < 0 ? a + 2 * Math.PI : a;
1271
+ let a = Math.atan2(s, i), c = Math.atan2(r, o);
1272
+ a = a < 0 ? a + 2 * Math.PI : a, c = c < 0 ? c + 2 * Math.PI : c;
1273
1273
  let h, l;
1274
- return Math.abs(a - c) <= Math.PI ? (h = Math.min(c, a), l = Math.max(c, a)) : (h = Math.max(c, a), l = Math.min(c, a) + 2 * Math.PI), [h / (Math.PI / 180), l / (Math.PI / 180)];
1274
+ return Math.abs(c - a) <= Math.PI ? (h = Math.min(a, c), l = Math.max(a, c)) : (h = Math.max(a, c), l = Math.min(a, c) + 2 * Math.PI), [h / (Math.PI / 180), l / (Math.PI / 180)];
1275
1275
  }
1276
1276
  /**
1277
1277
  * 转为绘制数据
@@ -1288,61 +1288,61 @@ class X extends j {
1288
1288
  scale: e
1289
1289
  };
1290
1290
  let i = "white";
1291
- function s(a, h) {
1292
- n.line.push([a.X * e, a.Y * e, h.X * e, h.Y * e, i]);
1291
+ function s(c, h) {
1292
+ n.line.push([c.X * e, c.Y * e, h.X * e, h.Y * e, i]);
1293
1293
  }
1294
- function o(a, h, l, d) {
1294
+ function o(c, h, l, d) {
1295
1295
  n.arc.push([
1296
- a.x * e,
1297
- a.y * e,
1296
+ c.x * e,
1297
+ c.y * e,
1298
1298
  h * e,
1299
1299
  l,
1300
1300
  d,
1301
1301
  i
1302
1302
  ]);
1303
1303
  }
1304
- for (let a = 0; a < this.originalData.length; a++) {
1305
- const h = this.originalData[a];
1304
+ for (let c = 0; c < this.originalData.length; c++) {
1305
+ const h = this.originalData[c];
1306
1306
  if (h.isVerticalReferenceLine) {
1307
1307
  n.dimensionLine.push([h.start.x * e, h.start.y * e, h.end.x * e, h.end.y * e]);
1308
1308
  break;
1309
1309
  }
1310
1310
  }
1311
- this.wallsGroup.forEach((a) => {
1312
- for (let h = 0; h < a.length; h++) {
1313
- const l = a[h], d = h === a.length - 1 ? 0 : h + 1, p = a[d];
1311
+ this.wallsGroup.forEach((c) => {
1312
+ for (let h = 0; h < c.length; h++) {
1313
+ const l = c[h], d = h === c.length - 1 ? 0 : h + 1, p = c[d];
1314
1314
  s(l, p);
1315
1315
  }
1316
1316
  });
1317
- const r = this.width * 0.2, c = [];
1318
- return this.doorLineSegment.forEach((a) => {
1319
- if (a.length() < 0.4) return;
1320
- const h = a.clone().expansion(-this.width * 0.5);
1317
+ const r = this.width * 0.2, a = [];
1318
+ return this.doorLineSegment.forEach((c) => {
1319
+ if (c.length() < 0.4) return;
1320
+ const h = c.clone().expansion(-this.width * 0.5);
1321
1321
  if (i = "cyan", h.length() < 1.2) {
1322
1322
  h.expansion(-r * 0.5);
1323
- const l = a.normal();
1324
- let d = new b(
1323
+ const l = c.normal();
1324
+ let d = new L(
1325
1325
  h.start.clone(),
1326
1326
  h.start.clone().add(l.clone().multiplyScalar(h.length()))
1327
1327
  );
1328
1328
  const p = d.clone().directionMove(d.normal(), h.length() * -0.5).expandToRectangle(h.length(), "bothSides");
1329
- for (let L = 0; L < c.length; L++)
1330
- if (c[L].intersectRectangle(p)) {
1331
- d = new b(
1329
+ for (let b = 0; b < a.length; b++)
1330
+ if (a[b].intersectRectangle(p)) {
1331
+ d = new L(
1332
1332
  h.start.clone(),
1333
1333
  h.start.clone().add(l.clone().multiplyScalar(-h.length()))
1334
1334
  );
1335
1335
  break;
1336
1336
  }
1337
- d.expansion(-r * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((L, P) => s(L, P));
1337
+ d.expansion(-r * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((b, P) => s(b, P));
1338
1338
  const m = h.length(), g = d.length(), u = (m ** 2 + g ** 2) / (2 * g), x = d.end.clone().add(d.direction().multiplyScalar(-u)), [w, S] = this.getArcAngleRange(x, h.end, d.end);
1339
- o(x, u, Math.min(w, S), Math.max(w, S)), c.push(p);
1339
+ o(x, u, Math.min(w, S), Math.max(w, S)), a.push(p);
1340
1340
  } else
1341
1341
  h.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), r * 0.5).directionMove(h.direction(), r * 0.5).expansion(-h.length() * 0.45, "end").forward(r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), -r * 0.5).directionMove(h.direction(), -r * 0.5).expansion(-h.length() * 0.45, "start").forward(-r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d));
1342
- }), i = "yellow", this.lineSegments.forEach((a) => {
1343
- if (!a.userData.isWindow) return !1;
1344
- Array.isArray(a.userData.drawWindow) && a.userData.drawWindow.forEach((h) => {
1345
- const { p: l, width: d } = h, p = f.from(l), m = p.clone().add(a.direction().multiplyScalar(d * 0.5)), g = p.clone().add(a.direction().multiplyScalar(-d * 0.5)), u = new b(m, g);
1342
+ }), i = "yellow", this.lineSegments.forEach((c) => {
1343
+ if (!c.userData.isWindow) return !1;
1344
+ Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((h) => {
1345
+ const { p: l, width: d } = h, p = f.from(l), m = p.clone().add(c.direction().multiplyScalar(d * 0.5)), g = p.clone().add(c.direction().multiplyScalar(-d * 0.5)), u = new L(m, g);
1346
1346
  s(u.start, u.end), u.expandToRectangle(this.width, "bothSides").path2D((x, w) => s(x, w));
1347
1347
  });
1348
1348
  }), n;
@@ -1357,8 +1357,8 @@ class X extends j {
1357
1357
  if (typeof window < "u")
1358
1358
  s = document.createElement("canvas");
1359
1359
  else if (typeof global < "u") {
1360
- const { createCanvas: a } = await G("canvas");
1361
- s = a();
1360
+ const { createCanvas: c } = await G("canvas");
1361
+ s = c();
1362
1362
  } else
1363
1363
  throw new Error("创建画布失败");
1364
1364
  const o = 2 * i.scale, r = {
@@ -1367,18 +1367,18 @@ class X extends j {
1367
1367
  white: "white"
1368
1368
  };
1369
1369
  s.width = i.width + o * 2, s.height = i.height + o * 2;
1370
- const c = s.getContext("2d");
1371
- return n && (c.fillStyle = n, c.fillRect(0, 0, s.width, s.height)), c.translate(i.width * 0.5 + o, i.height * 0.5 + o), i.line.forEach(([a, h, l, d, p]) => {
1372
- c.strokeStyle = r[p], c.beginPath(), c.moveTo(a, h), c.lineTo(l, d), c.closePath(), c.stroke();
1373
- }), i.arc.forEach(([a, h, l, d, p, m]) => {
1374
- c.strokeStyle = r[m], c.beginPath(), c.arc(a, h, l, d * (Math.PI / 180), p * (Math.PI / 180)), c.stroke();
1375
- }), c.beginPath(), i.dimensionLine.forEach((a) => {
1376
- let [h, l, d, p] = a;
1370
+ const a = s.getContext("2d");
1371
+ return n && (a.fillStyle = n, a.fillRect(0, 0, s.width, s.height)), a.translate(i.width * 0.5 + o, i.height * 0.5 + o), i.line.forEach(([c, h, l, d, p]) => {
1372
+ a.strokeStyle = r[p], a.beginPath(), a.moveTo(c, h), a.lineTo(l, d), a.closePath(), a.stroke();
1373
+ }), i.arc.forEach(([c, h, l, d, p, m]) => {
1374
+ a.strokeStyle = r[m], a.beginPath(), a.arc(c, h, l, d * (Math.PI / 180), p * (Math.PI / 180)), a.stroke();
1375
+ }), a.beginPath(), i.dimensionLine.forEach((c) => {
1376
+ let [h, l, d, p] = c;
1377
1377
  const m = Math.min(l, p), g = Math.max(l, p), u = (s.width * 0.5 - 0.4 * i.scale) * (h < 0 ? -1 : 1), x = (g - m) * 0.45;
1378
- c.fillStyle = "#fff", c.font = `${0.15 * i.scale}px Arial`, c.textAlign = "center", c.textBaseline = "middle", c.fillText((g - m).toFixed(2) + "cm", u, m + (g - m) * 0.5), c.moveTo(u - 0.1 * i.scale, m), c.lineTo(u + 0.1 * i.scale, m), c.moveTo(u, m), c.lineTo(u, x + m), c.moveTo(u, g), c.lineTo(u, g - x), c.moveTo(u - 0.1 * i.scale, g), c.lineTo(u + 0.1 * i.scale, g);
1379
- }), c.closePath(), c.strokeStyle = "#fff", c.stroke(), "toBlob" in s ? new Promise((a) => {
1378
+ a.fillStyle = "#fff", a.font = `${0.15 * i.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.fillText((g - m).toFixed(2) + "cm", u, m + (g - m) * 0.5), a.moveTo(u - 0.1 * i.scale, m), a.lineTo(u + 0.1 * i.scale, m), a.moveTo(u, m), a.lineTo(u, x + m), a.moveTo(u, g), a.lineTo(u, g - x), a.moveTo(u - 0.1 * i.scale, g), a.lineTo(u + 0.1 * i.scale, g);
1379
+ }), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in s ? new Promise((c) => {
1380
1380
  s.toBlob((h) => {
1381
- a(h);
1381
+ c(h);
1382
1382
  }, e, 1);
1383
1383
  }) : s.toBuffer(e, { quality: 1 });
1384
1384
  }
@@ -1390,11 +1390,11 @@ class X extends j {
1390
1390
  e.setUnits(t), e.addLayer("cyan", R.ACI.CYAN, "DOTTED"), e.addLayer("yellow", R.ACI.YELLOW, "DOTTED"), e.addLayer("white", R.ACI.WHITE, "DOTTED");
1391
1391
  const n = this.toDrawDataJson();
1392
1392
  return n.line.forEach((i) => {
1393
- let [s, o, r, c, a] = i;
1394
- e.setActiveLayer(a), e.drawLine(s, o, r, c);
1393
+ let [s, o, r, a, c] = i;
1394
+ e.setActiveLayer(c), e.drawLine(s, o, r, a);
1395
1395
  }), n.arc.forEach((i) => {
1396
- const [s, o, r, c, a, h] = i;
1397
- e.setActiveLayer(h), e.drawArc(s, o, r, c, a);
1396
+ const [s, o, r, a, c, h] = i;
1397
+ e.setActiveLayer(h), e.drawArc(s, o, r, a, c);
1398
1398
  }), e.toDxfString();
1399
1399
  }
1400
1400
  /**
@@ -1433,8 +1433,8 @@ class X extends j {
1433
1433
  * @returns
1434
1434
  */
1435
1435
  computedOriginalSize(t, e = new v(0, 0, 0, 0)) {
1436
- const n = t.flatMap((a) => [a.start.x, a.end.x]), i = t.flatMap((a) => [a.start.y, a.end.y]), s = Math.min(...n), o = Math.min(...i), r = Math.max(...n), c = Math.max(...i);
1437
- return e.set(s, o, r, c), e;
1436
+ const n = t.flatMap((c) => [c.start.x, c.end.x]), i = t.flatMap((c) => [c.start.y, c.end.y]), s = Math.min(...n), o = Math.min(...i), r = Math.max(...n), a = Math.max(...i);
1437
+ return e.set(s, o, r, a), e;
1438
1438
  }
1439
1439
  /**
1440
1440
  * 创建数据
@@ -1444,14 +1444,14 @@ class X extends j {
1444
1444
  static createData(t, e = !0) {
1445
1445
  let n = 0;
1446
1446
  return t.flatMap((s) => {
1447
- const o = s.map((r, c) => {
1448
- const a = c === s.length - 1 ? 0 : c + 1, h = s[a];
1447
+ const o = s.map((r, a) => {
1448
+ const c = a === s.length - 1 ? 0 : a + 1, h = s[c];
1449
1449
  return {
1450
1450
  start: { x: r.x, y: r.y },
1451
1451
  end: { x: h.x, y: h.y },
1452
1452
  insetionArr: [
1453
1453
  {
1454
- index: a + n
1454
+ index: c + n
1455
1455
  }
1456
1456
  ]
1457
1457
  };
@@ -1460,7 +1460,7 @@ class X extends j {
1460
1460
  });
1461
1461
  }
1462
1462
  }
1463
- const I = new b();
1463
+ const I = new L();
1464
1464
  class ot extends X {
1465
1465
  static name = "AngleCorrectionDxf";
1466
1466
  onAddFromParent(t) {
@@ -1469,38 +1469,38 @@ class ot extends X {
1469
1469
  async update() {
1470
1470
  const t = this.parent, e = t.findComponentByName("Dxf"), n = t.findComponentByName("LineAnalysis");
1471
1471
  let i = 0, s = null;
1472
- for (let a = 0; a < e.originalData.length; a++) {
1473
- const h = e.originalData[a];
1472
+ for (let c = 0; c < e.originalData.length; c++) {
1473
+ const h = e.originalData[c];
1474
1474
  if (I.start.copy(h.start), I.end.copy(h.end), h.isVerticalReferenceLine) {
1475
1475
  const [l, d] = h.start.y < h.end.y ? [I.start, I.end] : [I.end, I.start];
1476
- i = -new b(l, d).direction().angleBetween(new f(0, 1), "angle", "360"), s = null;
1476
+ i = -new L(l, d).direction().angleBetween(new f(0, 1), "angle", "360"), s = null;
1477
1477
  break;
1478
1478
  }
1479
- (!s || I.length() > s.length()) && (s = I.clone(), s.userData.index = a);
1479
+ (!s || I.length() > s.length()) && (s = I.clone(), s.userData.index = c);
1480
1480
  }
1481
1481
  if (s) {
1482
1482
  e.originalData[s.userData.index].isVerticalReferenceLine = !0;
1483
- const [a, h] = s.start.y < s.end.y ? [s.start, s.end] : [s.end, s.start];
1484
- i = -new b(a, h).direction().angleBetween(new f(0, 1), "angle", "360");
1483
+ const [c, h] = s.start.y < s.end.y ? [s.start, s.end] : [s.end, s.start];
1484
+ i = -new L(c, h).direction().angleBetween(new f(0, 1), "angle", "360");
1485
1485
  }
1486
- const o = e.originalBox.center, r = f.zero(), c = e.originalData.map((a) => {
1487
- const h = r.copy(a.start).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(a.start.z), l = r.copy(a.end).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(a.end.z), d = Object.assign(z(a), { start: h, end: l });
1486
+ const o = e.originalBox.center, r = f.zero(), a = e.originalData.map((c) => {
1487
+ const h = r.copy(c.start).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(c.start.z), l = r.copy(c.end).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(c.end.z), d = Object.assign(V(c), { start: h, end: l });
1488
1488
  return d.drawWindow && d.drawWindow.forEach((p) => {
1489
1489
  p.p = r.copy(p.p).division(o).rotate(f.zero(), i * (Math.PI / 180)).toJson(p.p.z), p.p.y = -p.p.y;
1490
1490
  }), d;
1491
1491
  });
1492
- n.appendLineSegmentList.forEach((a) => {
1493
- const h = a.clone();
1494
- h.start.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(f.zero(), i * (Math.PI / 180)), c.push({
1492
+ n.appendLineSegmentList.forEach((c) => {
1493
+ const h = c.clone();
1494
+ h.start.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(f.zero(), i * (Math.PI / 180)), a.push({
1495
1495
  start: h.start.toJson(e.originalZAverage),
1496
1496
  end: h.end.toJson(e.originalZAverage),
1497
1497
  insetionArr: [],
1498
1498
  length: h.length()
1499
1499
  });
1500
- }), c.forEach((a) => {
1501
- a.start.y = -a.start.y, a.end.y = -a.end.y;
1502
- }), await this.set(c, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((a) => {
1503
- const h = a.clone();
1500
+ }), a.forEach((c) => {
1501
+ c.start.y = -c.start.y, c.end.y = -c.end.y;
1502
+ }), await this.set(a, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((c) => {
1503
+ const h = c.clone();
1504
1504
  return h.start.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(f.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1505
1505
  });
1506
1506
  }
@@ -1652,16 +1652,16 @@ class q {
1652
1652
  if (!this.bounds.intersectBox(i))
1653
1653
  return n;
1654
1654
  for (const s of this.nodes) {
1655
- const [o, r] = s.line.points, c = r.x - o.x, a = r.y - o.y, h = c * c + a * a;
1656
- let l = ((t.x - o.x) * c + (t.y - o.y) * a) / h;
1655
+ const [o, r] = s.line.points, a = r.x - o.x, c = r.y - o.y, h = a * a + c * c;
1656
+ let l = ((t.x - o.x) * a + (t.y - o.y) * c) / h;
1657
1657
  l = Math.max(0, Math.min(1, l));
1658
- const d = o.x + l * c, p = o.y + l * a;
1658
+ const d = o.x + l * a, p = o.y + l * c;
1659
1659
  t.distance(new f(d, p)) <= e && n.push(s);
1660
1660
  }
1661
1661
  if (!this.isLeaf)
1662
1662
  for (const s of this.children)
1663
1663
  n.push(...s.queryCircle(t, e));
1664
- return n;
1664
+ return n.sort((s) => s.line.length()), n;
1665
1665
  }
1666
1666
  /**
1667
1667
  * 查询与矩形相交的线段节点
@@ -1768,10 +1768,10 @@ class U {
1768
1768
  queryRect(t) {
1769
1769
  const e = t.toBox(), n = Math.ceil(e.minX / this.gridSize), i = Math.ceil(e.maxX / this.gridSize), s = Math.ceil(e.minY / this.gridSize), o = Math.ceil(e.maxY / this.gridSize);
1770
1770
  for (let r = n; r <= i; r++)
1771
- for (let c = s; c <= o; c++) {
1772
- const a = `${r}.${c}`;
1773
- if (!this.map.has(a)) continue;
1774
- this.map.get(a)?.forEach((l) => {
1771
+ for (let a = s; a <= o; a++) {
1772
+ const c = `${r}.${a}`;
1773
+ if (!this.map.has(c)) continue;
1774
+ this.map.get(c)?.forEach((l) => {
1775
1775
  t.containsPoint(l.point);
1776
1776
  });
1777
1777
  }
@@ -1783,16 +1783,16 @@ class U {
1783
1783
  * @returns 相交的节点数组
1784
1784
  */
1785
1785
  queryCircle(t, e) {
1786
- const n = new v(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), s = Math.ceil(n.maxX / this.gridSize), o = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), c = [];
1787
- for (let a = i; a <= s; a++)
1786
+ const n = new v(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), s = Math.ceil(n.maxX / this.gridSize), o = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), a = [];
1787
+ for (let c = i; c <= s; c++)
1788
1788
  for (let h = o; h <= r; h++) {
1789
- const l = `${a}.${h}`;
1789
+ const l = `${c}.${h}`;
1790
1790
  if (!this.map.has(l)) continue;
1791
1791
  this.map.get(l)?.forEach((p) => {
1792
- t.distance(p.point) <= e && c.push(p);
1792
+ t.distance(p.point) <= e && a.push(p);
1793
1793
  });
1794
1794
  }
1795
- return c;
1795
+ return a;
1796
1796
  }
1797
1797
  /**
1798
1798
  * 查询与包围盒相交的点
@@ -1802,10 +1802,10 @@ class U {
1802
1802
  queryBox(t) {
1803
1803
  const e = Math.ceil(t.minX / this.gridSize), n = Math.ceil(t.maxX / this.gridSize), i = Math.ceil(t.minY / this.gridSize), s = Math.ceil(t.maxY / this.gridSize), o = [];
1804
1804
  for (let r = e; r <= n; r++)
1805
- for (let c = i; c <= s; c++) {
1806
- const a = `${r}.${c}`;
1807
- if (!this.map.has(a)) continue;
1808
- this.map.get(a)?.forEach((l) => {
1805
+ for (let a = i; a <= s; a++) {
1806
+ const c = `${r}.${a}`;
1807
+ if (!this.map.has(c)) continue;
1808
+ this.map.get(c)?.forEach((l) => {
1809
1809
  t.containsPoint(l.point) && o.push(l);
1810
1810
  });
1811
1811
  }
@@ -1821,6 +1821,13 @@ class U {
1821
1821
  t.equal(s.point) && n.push(s);
1822
1822
  }), n;
1823
1823
  }
1824
+ /**
1825
+ * 查找点自己
1826
+ * @param point
1827
+ */
1828
+ queryPointSelf(t) {
1829
+ return t.userData.pointVirtualGrid && t.userData.pointVirtualGrid.target ? t.userData.pointVirtualGrid.target : null;
1830
+ }
1824
1831
  }
1825
1832
  class rt {
1826
1833
  // 所有可查找的点位
@@ -1856,33 +1863,33 @@ class rt {
1856
1863
  search(t, e = [], n = 0.6, i = this.doorSearchDistance, s = this.doorSearchNearAngle) {
1857
1864
  const o = this.dxf, r = this.searchNearby(t, e, i, s);
1858
1865
  r.push(
1859
- ...t.map((a) => {
1860
- const h = this.searchAlongDirection(a, i);
1866
+ ...t.map((c) => {
1867
+ const h = this.searchAlongDirection(c, i);
1861
1868
  if (h) return {
1862
- start: a.point,
1869
+ start: c.point,
1863
1870
  end: h.point
1864
1871
  };
1865
- const l = this.searchAlongNormalDirection(a, i);
1872
+ const l = this.searchAlongNormalDirection(c, i);
1866
1873
  if (l) return {
1867
- start: a.point,
1874
+ start: c.point,
1868
1875
  end: l.point
1869
1876
  };
1870
- }).filter((a) => !!a && a.start.distance(a.end) < i)
1877
+ }).filter((c) => !!c && c.start.distance(c.end) < i)
1871
1878
  );
1872
- const c = [];
1873
- return r.forEach((a) => {
1874
- const h = new b(a?.start, a?.end), l = h.length();
1879
+ const a = [];
1880
+ return r.forEach((c) => {
1881
+ const h = new L(c?.start, c?.end), l = h.length();
1875
1882
  if (l < n) return;
1876
1883
  const d = h.normal(), p = h.direction(), m = (l - o.width * 2) / 2;
1877
1884
  for (let g = 0; g < 3; g++) {
1878
- const u = h.start.clone().add(p.clone().multiplyScalar(o.width + m * g)), x = new b(
1885
+ const u = h.start.clone().add(p.clone().multiplyScalar(o.width + m * g)), x = new L(
1879
1886
  u,
1880
1887
  u.clone().add(d.clone().multiplyScalar(1))
1881
1888
  );
1882
1889
  if (x.directionMove(d, -0.5), this.quadtree.queryLineSegment(x).length) return;
1883
1890
  }
1884
- c.push(h);
1885
- }), c;
1891
+ a.push(h);
1892
+ }), a;
1886
1893
  }
1887
1894
  /** 添加可查找点的过滤规则
1888
1895
  * @param rule
@@ -1911,21 +1918,21 @@ class rt {
1911
1918
  return e.doors.forEach((i) => {
1912
1919
  const s = e.lineSegments[i[4]], o = e.originalData[i[4]];
1913
1920
  if (o.drawDoorData) {
1914
- const r = f.from(o.drawDoorData.start), c = f.from(o.drawDoorData.n), a = n.queryPoint(r).filter((h) => {
1921
+ const r = f.from(o.drawDoorData.start), a = f.from(o.drawDoorData.n), c = n.queryPoint(r).filter((h) => {
1915
1922
  if (h.userData === s) return !1;
1916
1923
  const l = h.userData, d = l.direction();
1917
1924
  l.start.equal(r) && d.multiplyScalar(-1);
1918
- const p = c.angleBetween(d, "angle");
1925
+ const p = a.angleBetween(d, "angle");
1919
1926
  return p > 80 || p < 10;
1920
1927
  });
1921
- a.length && t.push({
1922
- line: a[0].userData,
1928
+ c.length && t.push({
1929
+ line: c[0].userData,
1923
1930
  point: r,
1924
1931
  uuid: N()
1925
1932
  });
1926
1933
  } else if (o.doorDirectConnection) {
1927
1934
  this.continueFind = !1;
1928
- const r = new b(f.from(o.start), f.from(o.end));
1935
+ const r = new L(f.from(o.start), f.from(o.end));
1929
1936
  r.userData = {
1930
1937
  doorDirectConnection: !0,
1931
1938
  isDoor: !0
@@ -1941,8 +1948,8 @@ class rt {
1941
1948
  searchDoubleLinePoint() {
1942
1949
  const t = /* @__PURE__ */ new Map();
1943
1950
  return this.resultList.flatMap((e) => {
1944
- const n = this.lineSegments[e.sourceIndex], i = this.lineSegments[e.targetIndex], s = i.projectPoint(n.start), o = i.projectPoint(n.end), r = n.projectPoint(i.start), c = n.projectPoint(i.end), a = s && o ? -1 : s ? 0 : o ? 1 : -1, h = r && c ? -1 : r ? 0 : c ? 1 : -1;
1945
- t.has(e.sourceIndex) ? t.get(e.sourceIndex) != a && t.set(e.sourceIndex, -1) : t.set(e.sourceIndex, a), t.has(e.targetIndex) ? t.get(e.targetIndex) != h && t.set(e.targetIndex, -1) : t.set(e.targetIndex, h);
1951
+ const n = this.lineSegments[e.sourceIndex], i = this.lineSegments[e.targetIndex], s = i.projectPoint(n.start), o = i.projectPoint(n.end), r = n.projectPoint(i.start), a = n.projectPoint(i.end), c = s && o ? -1 : s ? 0 : o ? 1 : -1, h = r && a ? -1 : r ? 0 : a ? 1 : -1;
1952
+ t.has(e.sourceIndex) ? t.get(e.sourceIndex) != c && t.set(e.sourceIndex, -1) : t.set(e.sourceIndex, c), t.has(e.targetIndex) ? t.get(e.targetIndex) != h && t.set(e.targetIndex, -1) : t.set(e.targetIndex, h);
1946
1953
  }), t;
1947
1954
  }
1948
1955
  /** 查找方案一:最近点查找
@@ -1956,15 +1963,15 @@ class rt {
1956
1963
  searchNearby(t, e = [], n = this.doorSearchDistance, i = this.doorSearchNearAngle) {
1957
1964
  const s = this.findPointVirtualGrid, o = this.quadtree;
1958
1965
  function r({ point: u, line: x }, w, S) {
1959
- const L = x.direction();
1960
- x.start === u && L.multiplyScalar(-1);
1966
+ const b = x.direction();
1967
+ x.start === u && b.multiplyScalar(-1);
1961
1968
  const P = s.queryCircle(u, n).filter((D) => D.userData !== x).sort((D, E) => D.point.distance(u) - E.point.distance(u)), A = [];
1962
1969
  for (let D = 0; D < P.length; D++) {
1963
1970
  const E = e.findIndex((T) => T.point === P[D].point), B = t[w].uuid, Y = e[E].uuid;
1964
1971
  if (S.has(`${B}.${Y}`)) continue;
1965
1972
  S.add(`${B}.${Y}`), S.add(`${Y}.${B}`);
1966
- const Q = P[D].point, C = new b(u.clone(), Q.clone());
1967
- if (C.direction().angleBetween(L, "angle") < i) {
1973
+ const Q = P[D].point, C = new L(u.clone(), Q.clone());
1974
+ if (C.direction().angleBetween(b, "angle") < i) {
1968
1975
  const T = t[E].line.direction();
1969
1976
  P[D].userData.start.equal(P[D].point) && T.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(T, "angle") < i && (o.queryLineSegment(C).length || A.push({
1970
1977
  findData: P[D],
@@ -1976,27 +1983,27 @@ class rt {
1976
1983
  }
1977
1984
  return A;
1978
1985
  }
1979
- function c(u, x, w, S, L) {
1986
+ function a(u, x, w, S, b) {
1980
1987
  S.add(u);
1981
1988
  const P = [];
1982
- L && P.push(L);
1989
+ b && P.push(b);
1983
1990
  for (let A = 0; A < w.length; A++) {
1984
1991
  const D = w[A];
1985
1992
  if (x.has(D.findUuid)) {
1986
1993
  const E = x.get(D.findUuid);
1987
- c(D.findUuid, x, E, S, D) && P.push(D);
1994
+ a(D.findUuid, x, E, S, D) && P.push(D);
1988
1995
  } else P.push(D);
1989
1996
  }
1990
- return P.sort((A, D) => A.doorLine.length() - D.doorLine.length()), L && P[0] === L ? (w.splice(0), !0) : (w.splice(1), !1);
1997
+ return P.sort((A, D) => A.doorLine.length() - D.doorLine.length()), b && P[0] === b ? (w.splice(0), !0) : (w.splice(1), !1);
1991
1998
  }
1992
- const a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
1999
+ const c = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
1993
2000
  t.map((u, x) => {
1994
- const w = r(u, x, a);
2001
+ const w = r(u, x, c);
1995
2002
  w.length && h.set(u.uuid, w);
1996
- }), a.clear();
2003
+ }), c.clear();
1997
2004
  const l = /* @__PURE__ */ new Map();
1998
2005
  h.forEach((u, x) => {
1999
- if (!a.has(x) && u.length && c(x, h, u, a), u.length) {
2006
+ if (!c.has(x) && u.length && a(x, h, u, c), u.length) {
2000
2007
  const w = u[0];
2001
2008
  l.has(w.doorUuid) || l.set(w.doorUuid, []), l.get(w.doorUuid)?.push(w), l.has(w.findUuid) || l.set(w.findUuid, []), l.get(w.findUuid)?.push(w);
2002
2009
  }
@@ -2017,21 +2024,21 @@ class rt {
2017
2024
  });
2018
2025
  const g = [];
2019
2026
  return p.forEach((u) => {
2020
- const x = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), S = t[x].point.clone(), L = e[w].point.clone(), P = this.findLongLineSegment(t[x].line), A = this.findLongLineSegment(e[w].line), D = P.projectPoint(L);
2027
+ const x = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), S = t[x].point.clone(), b = e[w].point.clone(), P = this.findLongLineSegment(t[x].line), A = this.findLongLineSegment(e[w].line), D = P.projectPoint(b);
2021
2028
  if (D) {
2022
2029
  S.copy(D);
2023
- const E = new b(S, L), B = A.includedAngle(E);
2030
+ const E = new L(S, b), B = A.includedAngle(E);
2024
2031
  (B < 10 || B > 170 || Math.abs(90 - B) < 10) && g.push({
2025
2032
  start: S,
2026
- end: L
2033
+ end: b
2027
2034
  });
2028
2035
  } else {
2029
2036
  const E = A.projectPoint(S);
2030
- E && L.copy(E);
2031
- const B = new b(S, L), Y = P.includedAngle(B);
2037
+ E && b.copy(E);
2038
+ const B = new L(S, b), Y = P.includedAngle(B);
2032
2039
  (Y < 10 || Y > 170 || Math.abs(90 - Y) < 10) && g.push({
2033
2040
  start: S,
2034
- end: L
2041
+ end: b
2035
2042
  });
2036
2043
  }
2037
2044
  }), e.splice(
@@ -2052,14 +2059,14 @@ class rt {
2052
2059
  searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2053
2060
  const i = this.quadtree, s = e.direction();
2054
2061
  e.start === t && s.multiplyScalar(-1);
2055
- const o = t.clone().add(s.clone().multiplyScalar(n)), r = new b(t.clone(), o), c = i.queryLineSegment(r).map((a) => ({
2056
- point: a.line.getIntersection(r),
2057
- line: a.line
2058
- })).filter((a) => a.point).sort((a, h) => t.distance(a.point) - t.distance(h.point));
2059
- if (c.length) {
2060
- const a = c[0];
2061
- if (Math.abs(90 - a.line.direction().angleBetween(s, "angle")) < 5)
2062
- return a;
2062
+ const o = t.clone().add(s.clone().multiplyScalar(n)), r = new L(t.clone(), o), a = i.queryLineSegment(r).map((c) => ({
2063
+ point: c.line.getIntersection(r),
2064
+ line: c.line
2065
+ })).filter((c) => c.point).sort((c, h) => t.distance(c.point) - t.distance(h.point));
2066
+ if (a.length) {
2067
+ const c = a[0];
2068
+ if (Math.abs(90 - c.line.direction().angleBetween(s, "angle")) < 5)
2069
+ return c;
2063
2070
  }
2064
2071
  }
2065
2072
  /** 方案三: 沿法线方向查找
@@ -2069,17 +2076,17 @@ class rt {
2069
2076
  * @returns
2070
2077
  */
2071
2078
  searchAlongNormalDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2072
- const i = this.pointVirtualGrid, s = this.quadtree, o = e.direction(), r = e.start.normal(e.end), c = e.start.clone();
2073
- e.start === t && o.multiplyScalar(-1), e.start === t && c.copy(e.end);
2074
- const a = i.queryPoint(c).filter((d) => d.userData !== e);
2075
- for (let d = 0; d < a.length; d++) {
2076
- const p = a[d], m = p.userData, g = m.direction();
2079
+ const i = this.pointVirtualGrid, s = this.quadtree, o = e.direction(), r = e.start.normal(e.end), a = e.start.clone();
2080
+ e.start === t && o.multiplyScalar(-1), e.start === t && a.copy(e.end);
2081
+ const c = i.queryPoint(a).filter((d) => d.userData !== e);
2082
+ for (let d = 0; d < c.length; d++) {
2083
+ const p = c[d], m = p.userData, g = m.direction();
2077
2084
  if (m.start === p.point && o.multiplyScalar(-1), g.angleBetween(r) / (Math.PI / 180) > 90) {
2078
2085
  r.multiplyScalar(-1);
2079
2086
  break;
2080
2087
  }
2081
2088
  }
2082
- const h = new b(t.clone(), t.clone().add(r.multiplyScalar(n))), l = s.queryLineSegment(h).map((d) => ({
2089
+ const h = new L(t.clone(), t.clone().add(r.multiplyScalar(n))), l = s.queryLineSegment(h).map((d) => ({
2083
2090
  point: d.line.getIntersection(h),
2084
2091
  line: d.line
2085
2092
  })).filter((d) => d.point).sort((d, p) => t.distance(d.point) - t.distance(p.point));
@@ -2137,15 +2144,15 @@ class at extends j {
2137
2144
  * @returns
2138
2145
  */
2139
2146
  expandLineSegment(t, e, n = 0.1) {
2140
- const i = e.normal(t), s = e.direction(t).mutiplyScalar(n * 0.5), o = t.direction(e).mutiplyScalar(n * 0.5), r = i.x * n * 0.5, c = i.y * n * 0.5;
2147
+ const i = e.normal(t), s = e.direction(t).mutiplyScalar(n * 0.5), o = t.direction(e).mutiplyScalar(n * 0.5), r = i.x * n * 0.5, a = i.y * n * 0.5;
2141
2148
  return {
2142
2149
  points: [
2143
2150
  // 第一条线
2144
- new f(t.x + r, t.y + c).add(o),
2145
- new f(e.x + r, e.y + c).add(s),
2151
+ new f(t.x + r, t.y + a).add(o),
2152
+ new f(e.x + r, e.y + a).add(s),
2146
2153
  // 第二条线
2147
- new f(t.x - r, t.y - c).add(o),
2148
- new f(e.x - r, e.y - c).add(s)
2154
+ new f(t.x - r, t.y - a).add(o),
2155
+ new f(e.x - r, e.y - a).add(s)
2149
2156
  ],
2150
2157
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2151
2158
  rectIndices: [0, 1, 3, 2, 0]
@@ -2159,7 +2166,7 @@ class at extends j {
2159
2166
  */
2160
2167
  addData(t, e) {
2161
2168
  const n = this.Dxf;
2162
- n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new b(t.clone(), e.clone()));
2169
+ n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new L(t.clone(), e.clone()));
2163
2170
  }
2164
2171
  /** 结果分析创建矩形
2165
2172
  * @param result
@@ -2167,13 +2174,13 @@ class at extends j {
2167
2174
  createRectangle(t) {
2168
2175
  const e = this.Dxf, n = t.project, i = t.project2;
2169
2176
  n.includedAngle(i) > 135 && (i.points = [i.points[1], i.points[0]]), this.addData(n.points[0], i.points[0]), this.addData(n.points[1], i.points[1]);
2170
- const s = n.points[0].distance(i.points[0]), o = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(s, o) / e.width), c = s / r, a = o / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), p = n.points[1].clone(), m = p.direction(d);
2177
+ const s = n.points[0].distance(i.points[0]), o = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(s, o) / e.width), a = s / r, c = o / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), p = n.points[1].clone(), m = p.direction(d);
2171
2178
  m.multiplyScalar(e.width * 0.5);
2172
2179
  const g = d.clone().add(m), u = p.clone().add(m.multiplyScalar(-1)), x = d.direction(p), w = g.direction(u);
2173
2180
  if (!(x.x > 0 && w.x < 0 || x.x < 0 && w.x > 0 || x.y > 0 && w.y < 0 || x.y < 0 && w.y > 0)) {
2174
2181
  d.set(g.x, g.y), p.set(u.x, u.y);
2175
2182
  for (let S = 1; S < r; S++) {
2176
- const L = h.clone().multiplyScalar(c * S), P = l.clone().multiplyScalar(a * S), A = d.clone().add(L), D = p.clone().add(P);
2183
+ const b = h.clone().multiplyScalar(a * S), P = l.clone().multiplyScalar(c * S), A = d.clone().add(b), D = p.clone().add(P);
2177
2184
  this.addData(A, D);
2178
2185
  }
2179
2186
  }
@@ -2201,8 +2208,8 @@ class at extends j {
2201
2208
  this.buildQuadtree();
2202
2209
  const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), i = [];
2203
2210
  e.forEach((s, o) => {
2204
- const r = e[o], c = O.fromByLineSegment(r, this.width * 2, !1, -0.01);
2205
- t.queryRect(c).map((h) => h.userData).filter((h) => h !== o).forEach((h) => {
2211
+ const r = e[o], a = O.fromByLineSegment(r, this.width * 2, !1, -0.01);
2212
+ t.queryRect(a).map((h) => h.userData).filter((h) => h !== o).forEach((h) => {
2206
2213
  try {
2207
2214
  if (n.has(`${o}-${h}`) || n.has(`${h}-${o}`)) return;
2208
2215
  const l = this.projectionAnalysis(h, o, r, e);
@@ -2219,25 +2226,25 @@ class at extends j {
2219
2226
  * @returns
2220
2227
  */
2221
2228
  projectionAnalysis(t, e, n, i) {
2222
- const s = i[t], o = n.direction(), r = s.direction(), c = o.angleBetween(r) / (Math.PI / 180);
2223
- if (c < this.errorAngle || c > 180 - this.errorAngle) {
2224
- let a;
2229
+ const s = i[t], o = n.direction(), r = s.direction(), a = o.angleBetween(r) / (Math.PI / 180);
2230
+ if (a < this.errorAngle || a > 180 - this.errorAngle) {
2231
+ let c;
2225
2232
  const h = s.projectLineSegment(n), l = n.projectLineSegment(s);
2226
- return h.getLength() > l.getLength() ? a = {
2233
+ return h.getLength() > l.getLength() ? c = {
2227
2234
  target: s,
2228
2235
  targetIndex: t,
2229
2236
  source: n,
2230
2237
  sourceIndex: e,
2231
2238
  project: h,
2232
2239
  project2: l
2233
- } : a = {
2240
+ } : c = {
2234
2241
  target: n,
2235
2242
  targetIndex: e,
2236
2243
  source: s,
2237
2244
  sourceIndex: t,
2238
2245
  project: l,
2239
2246
  project2: h
2240
- }, !a || a.project.getLength() < 0.2 || a.project2.getLength() < 0.2 ? void 0 : a;
2247
+ }, !c || c.project.getLength() < 0.2 || c.project2.getLength() < 0.2 ? void 0 : c;
2241
2248
  }
2242
2249
  }
2243
2250
  doorSearchNearAngle = 110;
@@ -2310,7 +2317,7 @@ class H extends j {
2310
2317
  const t = this.Dxf;
2311
2318
  this.originalWhiteMode.clear(), this.whiteModelGroup.clear(), this.whiteModelLineGroup.clear(), this.whiteModelGroup.add(this.whiteModelLineGroup), this.whiteModelGroup.position.z = t.originalZAverage, this.originalWhiteMode.position.z = t.originalZAverage, t.wallsGroup.forEach((n) => {
2312
2319
  const i = new M.Shape();
2313
- n.forEach((r, c) => c === 0 ? i.moveTo(r.x / t.scale, r.y / t.scale) : i.lineTo(r.x / t.scale, r.y / t.scale));
2320
+ n.forEach((r, a) => a === 0 ? i.moveTo(r.x / t.scale, r.y / t.scale) : i.lineTo(r.x / t.scale, r.y / t.scale));
2314
2321
  const s = new M.ExtrudeGeometry(i, {
2315
2322
  depth: 2.8,
2316
2323
  bevelSize: 0
@@ -2319,18 +2326,18 @@ class H extends j {
2319
2326
  new M.LineSegments(new M.EdgesGeometry(s), new M.LineBasicMaterial({ color: 0 }))
2320
2327
  );
2321
2328
  }), t.originalData.map(({ start: n, end: i, insetionArr: s }) => {
2322
- const o = new f(n.x, n.y).mutiplyScalar(t.scale), r = new f(i.x, i.y).mutiplyScalar(t.scale), { points: c, indices: a, rectIndices: h } = dt(o, r, t.width);
2329
+ const o = new f(n.x, n.y).mutiplyScalar(t.scale), r = new f(i.x, i.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: h } = dt(o, r, t.width);
2323
2330
  return {
2324
- points: c,
2325
- indices: a,
2331
+ points: a,
2332
+ indices: c,
2326
2333
  rectIndices: h,
2327
2334
  insetions: (s ?? []).map((l) => l.index)
2328
2335
  };
2329
2336
  }).forEach((n) => {
2330
2337
  const i = new M.Shape();
2331
- n.rectIndices.forEach((r, c) => {
2332
- const a = n.points[r];
2333
- c === 0 ? i.moveTo(a.x, a.y) : i.lineTo(a.x, a.y);
2338
+ n.rectIndices.forEach((r, a) => {
2339
+ const c = n.points[r];
2340
+ a === 0 ? i.moveTo(c.x, c.y) : i.lineTo(c.x, c.y);
2334
2341
  });
2335
2342
  const s = new M.ExtrudeGeometry(i, {
2336
2343
  depth: 2.8,
@@ -2500,11 +2507,11 @@ class Z extends j {
2500
2507
  this.racasterHelper(n, i, s), i.z = 0;
2501
2508
  const r = new M.Raycaster(n, i, 0, s).intersectObject(t.originalWhiteMode);
2502
2509
  if (r.length) {
2503
- const { point: c } = r[0];
2510
+ const { point: a } = r[0];
2504
2511
  this.desPoints.push({
2505
2512
  message: e.desc,
2506
2513
  position: n,
2507
- intersection: c
2514
+ intersection: a
2508
2515
  });
2509
2516
  }
2510
2517
  }), this.dispatchEvent({
@@ -2566,7 +2573,7 @@ function mt() {
2566
2573
  function xt() {
2567
2574
  return import("./index3.js");
2568
2575
  }
2569
- let V = null;
2576
+ let z = null;
2570
2577
  async function Et(y, t, e = !1, n) {
2571
2578
  const i = await Promise.resolve().then(() => pt), s = await mt(), o = await xt(), r = new ct().usePlugin(i.ModelDataPlugin.create({
2572
2579
  detailsPoint: !1,
@@ -2577,32 +2584,33 @@ async function Et(y, t, e = !1, n) {
2577
2584
  detailsPoint: !1,
2578
2585
  orbitControls: e,
2579
2586
  camera: t
2580
- })).usePlugin(o.Editor.create({ viewPermission: n })), c = r.findComponentByType(s.components.DomContainer);
2581
- return c && y.appendChild(c.domElement), V = r, {
2587
+ })).usePlugin(o.Editor.create({ viewPermission: n })), a = r.findComponentByType(s.components.DomContainer);
2588
+ return a && y.appendChild(a.domElement), z = r, {
2582
2589
  dxfSystem: r,
2583
2590
  getFileAll: () => yt(r)
2584
2591
  };
2585
2592
  }
2586
- async function yt(y = V) {
2587
- const t = y.findComponentByName("WhiteModel"), e = new File([await y.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([y.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), s = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), r = new File([JSON.stringify(y.Dxf.originalData)], "json.json", { type: "application/json" });
2593
+ async function yt(y = z) {
2594
+ const t = y.findComponentByName("WhiteModel"), e = new File([await y.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([y.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([y.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(y.Dxf.originalData)], "json.json", { type: "application/json" });
2588
2595
  return {
2589
2596
  dxf: n,
2590
- obj: i,
2591
- glb: s,
2592
- gltf: o,
2593
- json: r,
2594
- jpg: e
2597
+ obj: s,
2598
+ glb: o,
2599
+ gltf: r,
2600
+ json: a,
2601
+ jpg: e,
2602
+ correctionDxf: i
2595
2603
  };
2596
2604
  }
2597
2605
  function At() {
2598
- return V;
2606
+ return z;
2599
2607
  }
2600
2608
  export {
2601
2609
  v as B,
2602
2610
  j as C,
2603
2611
  ct as D,
2604
2612
  $ as E,
2605
- b as L,
2613
+ L,
2606
2614
  ft as M,
2607
2615
  f as P,
2608
2616
  q as Q,
@@ -2613,5 +2621,6 @@ export {
2613
2621
  Et as c,
2614
2622
  At as d,
2615
2623
  yt as g,
2616
- ut as i
2624
+ ut as i,
2625
+ N as u
2617
2626
  };