build-dxf 0.0.20-14 → 0.0.20-15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.0.20-14",
3
+ "version": "0.0.20-15",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -689,6 +689,30 @@ class b {
689
689
  set(t, e) {
690
690
  this.start.copy(t), this.end.copy(e);
691
691
  }
692
+ /**
693
+ * 是否有相同端点
694
+ * @param line
695
+ * @returns
696
+ */
697
+ sameEndpoint(t) {
698
+ return this.start.equal(t.start) || this.start.equal(t.end) || this.end.equal(t.start) || this.end.equal(t.end);
699
+ }
700
+ /**
701
+ * 相同端点是否为开始
702
+ * @param line
703
+ * @returns
704
+ */
705
+ sameEndpointAsStart(t) {
706
+ return this.start.equal(t.start) || this.start.equal(t.end);
707
+ }
708
+ /**
709
+ * 相同端点是否为结束
710
+ * @param line
711
+ * @returns
712
+ */
713
+ sameEndpointAsEnd(t) {
714
+ return this.end.equal(t.start) || this.end.equal(t.end);
715
+ }
692
716
  /** 膨胀
693
717
  * @description 向线段的两个端点分别膨胀 width
694
718
  * @param width
@@ -886,7 +910,7 @@ class b {
886
910
  );
887
911
  }
888
912
  }
889
- async function j(g, t = !0) {
913
+ async function q(g, t = !0) {
890
914
  if (typeof global < "u" && typeof require < "u")
891
915
  return require(g);
892
916
  {
@@ -1294,7 +1318,7 @@ class I extends X {
1294
1318
  if (typeof window < "u") {
1295
1319
  const n = this.toDxfBlob(e), i = document.createElement("a");
1296
1320
  i.href = URL.createObjectURL(n), i.download = t + ".dxf", i.click();
1297
- } else typeof global < "u" && (await j("fs", !1)).writeFileSync(t, this.toDxfString(e));
1321
+ } else typeof global < "u" && (await q("fs", !1)).writeFileSync(t, this.toDxfString(e));
1298
1322
  }
1299
1323
  /**
1300
1324
  * 计算原始数据的边界框
@@ -1787,13 +1811,13 @@ class it {
1787
1811
  const E = e.findIndex((R) => R.point === P[L].point), Y = t[y].uuid, G = e[E].uuid;
1788
1812
  if (S.has(`${Y}.${G}`)) continue;
1789
1813
  S.add(`${Y}.${G}`), S.add(`${G}.${Y}`);
1790
- const Z = P[L].point, q = new b(u.clone(), Z.clone());
1791
- if (q.direction().angleBetween(D, "angle") < i) {
1814
+ const Z = P[L].point, j = new b(u.clone(), Z.clone());
1815
+ if (j.direction().angleBetween(D, "angle") < i) {
1792
1816
  const R = t[E].line.direction();
1793
- P[L].userData.start.equal(P[L].point) && R.multiplyScalar(-1), q.direction().multiplyScalar(-1).angleBetween(R, "angle") < i && (s.queryLineSegment(q).length || v.push({
1817
+ P[L].userData.start.equal(P[L].point) && R.multiplyScalar(-1), j.direction().multiplyScalar(-1).angleBetween(R, "angle") < i && (s.queryLineSegment(j).length || v.push({
1794
1818
  findData: P[L],
1795
1819
  findUuid: G,
1796
- doorLine: q,
1820
+ doorLine: j,
1797
1821
  doorUuid: Y
1798
1822
  }));
1799
1823
  }
@@ -2195,7 +2219,7 @@ class J extends X {
2195
2219
  });
2196
2220
  else if (typeof global != "function")
2197
2221
  try {
2198
- const n = await j("obj2gltf", !0), i = await j("fs", !1), o = await this.toOBJ();
2222
+ const n = await q("obj2gltf", !0), i = await q("fs", !1), o = await this.toOBJ();
2199
2223
  i.writeFileSync(this.uuid, o);
2200
2224
  const s = await n(this.uuid, {
2201
2225
  binary: t
@@ -2238,7 +2262,7 @@ class J extends X {
2238
2262
  n.href = URL.createObjectURL(e), n.download = t, n.click();
2239
2263
  } else if (typeof global < "u") {
2240
2264
  const e = await this.toOBJ();
2241
- e && (await j("fs", !1)).writeFileSync(t, e);
2265
+ e && (await q("fs", !1)).writeFileSync(t, e);
2242
2266
  }
2243
2267
  }
2244
2268
  /**
@@ -2254,7 +2278,7 @@ class J extends X {
2254
2278
  i.href = URL.createObjectURL(n), i.download = t, i.click();
2255
2279
  } else if (typeof global < "u") {
2256
2280
  const n = await this.toGltf(e);
2257
- n && (await j("fs", !1)).writeFileSync(t, e ? n : Buffer.from(n));
2281
+ n && (await q("fs", !1)).writeFileSync(t, e ? n : Buffer.from(n));
2258
2282
  }
2259
2283
  }
2260
2284
  }