rm-graphical-computing-node 1.0.36 → 1.0.38

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 (2) hide show
  1. package/dist/index.mjs +57 -25
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5590,6 +5590,7 @@ var getColLine = (lines, runDataList) => {
5590
5590
  if (result[i].uuids.length < 4 || result[i].area < minArea || result[i].area > maxArea)
5591
5591
  continue;
5592
5592
  let isRect = false;
5593
+ let overlapWallLines = [];
5593
5594
  for (let j = 0; j < result[i].lineIndexes.length; j++) {
5594
5595
  let length1 = lines[result[i].lineIndexes[j]].length;
5595
5596
  if (length1 < minColLineLength || length1 > maxColLineLength)
@@ -8271,21 +8272,26 @@ var OBB = class _OBB extends OBB_ {
8271
8272
  * @returns
8272
8273
  */
8273
8274
  static fromByPath2D(path3, origin, height, obb_ = new _OBB()) {
8274
- const result = smallestSurroundingRectangleByArea({
8275
- type: "Polygon",
8276
- coordinates: [path3.map((p) => [p.x, p.y])]
8277
- });
8278
- if (!result) throw new Error("2d obb \u83B7\u53D6\u5931\u8D25");
8279
- const rectangle = result.geometry.coordinates[0];
8280
- const width1 = distance(rectangle[0], rectangle[1]);
8281
- const width2 = distance(rectangle[1], rectangle[2]);
8282
- const angle = Math.atan2(rectangle[1][1] - rectangle[0][1], rectangle[1][0] - rectangle[0][0]);
8283
- vec3.set(width1, width2, height);
8284
- euler.set(0, 0, angle);
8285
- const [x, y] = getCenter(rectangle);
8286
- origin.x = x;
8287
- origin.y = y;
8288
- const obb = this.from(vec3, origin, euler, obb_);
8275
+ let obb = null;
8276
+ try {
8277
+ const result = smallestSurroundingRectangleByArea({
8278
+ type: "Polygon",
8279
+ coordinates: [path3.map((p) => [p.x, p.y])]
8280
+ });
8281
+ if (!result) throw new Error("2d obb \u83B7\u53D6\u5931\u8D25");
8282
+ const rectangle = result.geometry.coordinates[0];
8283
+ const width1 = distance(rectangle[0], rectangle[1]);
8284
+ const width2 = distance(rectangle[1], rectangle[2]);
8285
+ const angle = Math.atan2(rectangle[1][1] - rectangle[0][1], rectangle[1][0] - rectangle[0][0]);
8286
+ vec3.set(width1, width2, height);
8287
+ euler.set(0, 0, angle);
8288
+ const [x, y] = getCenter(rectangle);
8289
+ origin.x = x;
8290
+ origin.y = y;
8291
+ obb = this.from(vec3, origin, euler, obb_);
8292
+ } catch (error) {
8293
+ return null;
8294
+ }
8289
8295
  return obb;
8290
8296
  }
8291
8297
  };
@@ -8441,6 +8447,8 @@ function getObb(path3, center, h, z) {
8441
8447
  if (pathPoints.length == 0)
8442
8448
  return null;
8443
8449
  const obb = OBB.fromByPath2D(pathPoints, center, h);
8450
+ if (obb == null)
8451
+ return null;
8444
8452
  obb.center.z = z;
8445
8453
  return obb;
8446
8454
  }
@@ -8759,10 +8767,6 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
8759
8767
  const f1 = calculateClosePointWithOBB(array2[k].points, obb1);
8760
8768
  const f2 = calculateClosePointWithOBB(array1[e].points, obb2);
8761
8769
  const isMaxBox = compareBoxVolume(obb1, obb2);
8762
- if (f2 >= 0.5 && isMaxBox == -1 && type1 !== "Staircase" && type2 !== "Staircase") {
8763
- array1[e].isDel = true;
8764
- break;
8765
- }
8766
8770
  if (type1 !== "wall" && type1 !== "floor" && type1 !== "roof") {
8767
8771
  if (type1 === "window") {
8768
8772
  if (type2 === "balcony railing" && containsObbPoints(obb1, array2[k].points)) {
@@ -8813,19 +8817,47 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
8813
8817
  break;
8814
8818
  }
8815
8819
  } else if (type1 === "door") {
8816
- if (type2 === "window" && containsObbPoints(obb1, array2[k].points)) {
8817
- array1[e].isDel = true;
8818
- break;
8820
+ if (type2 === "window") {
8821
+ if (type2 === "window" && containsObbPoints(obb1, array2[k].points)) {
8822
+ array1[e].isDel = true;
8823
+ break;
8824
+ }
8825
+ if (type2 === "window" && containsObbPoints(obb2, array1[e].points)) {
8826
+ array1[e].isDel = true;
8827
+ break;
8828
+ }
8829
+ if (type2 === "window sill" && containsObbPoints(obb1, array2[k].points)) {
8830
+ array1[e].isDel = true;
8831
+ break;
8832
+ }
8833
+ if (type2 === "window sill" && containsObbPoints(obb2, array1[e].points)) {
8834
+ array1[e].isDel = true;
8835
+ break;
8836
+ }
8837
+ } else {
8838
+ if (containsObbPoints(obb1, array2[k].points)) {
8839
+ array2[k].isDel = true;
8840
+ continue;
8841
+ }
8842
+ if (containsObbPoints(obb2, array1[e].points)) {
8843
+ array2[k].isDel = true;
8844
+ continue;
8845
+ }
8846
+ if (obb1.intersectsOBB(obb2)) {
8847
+ array2[k].isDel = true;
8848
+ continue;
8849
+ }
8819
8850
  }
8820
- if (type2 === "window" && containsObbPoints(obb2, array1[e].points)) {
8851
+ } else if (type2 === "door") {
8852
+ if (containsObbPoints(obb1, array2[k].points)) {
8821
8853
  array1[e].isDel = true;
8822
8854
  break;
8823
8855
  }
8824
- if (type2 === "window sill" && containsObbPoints(obb1, array2[k].points)) {
8856
+ if (containsObbPoints(obb2, array1[e].points)) {
8825
8857
  array1[e].isDel = true;
8826
8858
  break;
8827
8859
  }
8828
- if (type2 === "window sill" && containsObbPoints(obb2, array1[e].points)) {
8860
+ if (obb1.intersectsOBB(obb2)) {
8829
8861
  array1[e].isDel = true;
8830
8862
  break;
8831
8863
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",