rm-graphical-computing-node 1.0.155 → 1.0.157

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 +75 -47
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8144,10 +8144,11 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8144
8144
  }
8145
8145
  const doorDatas = [];
8146
8146
  const doorFrame = [];
8147
+ const metalFraming = [];
8147
8148
  for (let i = 0; i < pcdData.length; i++) {
8148
8149
  const door = pcdData[i];
8149
8150
  door.isFindBeam = false;
8150
- if (door.category == "door" || door.category == "door frame") {
8151
+ if (door.category == "door" || door.category == "door frame" || door.category == "metal framing of interior glass partitions") {
8151
8152
  let boxPoints = [];
8152
8153
  door.coordinatesByArea.coordinates.forEach((p) => {
8153
8154
  boxPoints.push(new THREE5.Vector3(p.x, p.y, p.z));
@@ -8195,6 +8196,19 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8195
8196
  width
8196
8197
  });
8197
8198
  }
8199
+ if (door.category == "metal framing of interior glass partitions") {
8200
+ metalFraming.push({
8201
+ doorStartPt,
8202
+ doorEndPt,
8203
+ boxPoints,
8204
+ index: i,
8205
+ minZ: door.coordinatesByArea.heightData.minZ,
8206
+ maxZ: door.coordinatesByArea.heightData.maxZ,
8207
+ category: door.category,
8208
+ length: length2,
8209
+ width
8210
+ });
8211
+ }
8198
8212
  }
8199
8213
  }
8200
8214
  for (let y = 0; y < doorDatas.length; y++) {
@@ -8364,6 +8378,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8364
8378
  let isDoor = false;
8365
8379
  let obj_id = null;
8366
8380
  let findDoorFrame = false;
8381
+ let findMetalFraming = false;
8367
8382
  let beforePcdDoorIsFindBeam = false;
8368
8383
  let doorOpenEndPoint = new THREE5.Vector3(0, 0, 0);
8369
8384
  let doorOpenVector = new THREE5.Vector3(0, 0, 0);
@@ -8672,6 +8687,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8672
8687
  if (lengthPercentage < 85 && length2 > 0.3 || length2 > 0.7 && height > floorHeightTmp - floorHeightTmp / 2) {
8673
8688
  const doorAndDoorFrameDatas = [...doorDatas];
8674
8689
  doorAndDoorFrameDatas.push(...doorFrame);
8690
+ doorAndDoorFrameDatas.push(...metalFraming);
8675
8691
  if (!line2.isLine2) {
8676
8692
  if (length2 < 2.5) {
8677
8693
  for (let n = 0; n < doorAndDoorFrameDatas.length; n++) {
@@ -8734,7 +8750,9 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8734
8750
  } else if (result && result.type == "collinear_overlap" && result.maxPerpendicularDistance < 0.35) {
8735
8751
  let distTmp1 = beamSt.distanceTo(beamEd);
8736
8752
  let distTmp2 = doorEd.distanceTo(doorSt);
8737
- if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
8753
+ let tol = doorAndDoorFrameDatas[n].category == "door" ? 0.25 : 0.5;
8754
+ let lenTol = doorAndDoorFrameDatas[n].category == "door" ? 1.3 : 1;
8755
+ if (Math.abs(distTmp1 - result.overlap) < tol || Math.abs(distTmp2 - result.overlap) < tol) {
8738
8756
  if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 0.5 && doorAndDoorFrameDatas[n].category === "door") {
8739
8757
  let Line3Tmp = new THREE5.Line3(getPt3(line2.start), getPt3(line2.end));
8740
8758
  let tmpDoorSt = doorSt.clone();
@@ -8754,11 +8772,15 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8754
8772
  beamTmpSt.z = beamTmpEd.z = tmpRegion.facePoints[2].z;
8755
8773
  length2 = beamTmpSt.distanceTo(beamTmpEd);
8756
8774
  }
8757
- if (length2 > 1.3) {
8775
+ if (length2 > lenTol) {
8758
8776
  if (doorAndDoorFrameDatas[n].category === "door frame") {
8759
8777
  findDoorFrame = true;
8760
8778
  continue;
8761
8779
  }
8780
+ if (doorAndDoorFrameDatas[n].category == "metal framing of interior glass partitions") {
8781
+ findMetalFraming = true;
8782
+ continue;
8783
+ }
8762
8784
  obj_id = doorAndDoorFrameDatas[n].obj_id;
8763
8785
  isDoor = true;
8764
8786
  isPullOutDoor = true;
@@ -9069,15 +9091,18 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
9069
9091
  doorAndBeamDataObj.wallBelowBeam = wallBelowBeam;
9070
9092
  if (doorAndBeamDataObj.beamHeight < 0.1 && doorAndBeamDataObj.type == "beam")
9071
9093
  continue;
9072
- if (doorFrame && doorFrame.length > 0 && doorAndBeamDataObj.type == "door") {
9094
+ const isDoorFrame = doorFrame && doorFrame.length > 0 && doorAndBeamDataObj.type == "door";
9095
+ const isFindMetalFraming = findMetalFraming && metalFraming && metalFraming.length > 0 && doorAndBeamDataObj.type != "door" && (doorAndBeamDataObj.type == "hole" || !doorAndBeamDataObj.lineIsOnlyBeam);
9096
+ if (isDoorFrame || isFindMetalFraming) {
9073
9097
  let doorLen = doorTmpSt.distanceTo(doorTmpEd);
9074
9098
  let lineStart2 = getPt3(line2.start);
9075
9099
  let lineEnd2 = getPt3(line2.end);
9076
9100
  const pcdToLineDist = 0.1;
9077
- for (let x = 0; x < doorFrame.length; x++) {
9078
- const ptArray = doorFrame[x].boxPoints;
9079
- const doorFrameStart = getPt3(doorFrame[x].doorStartPt);
9080
- const doorFrameEnd = getPt3(doorFrame[x].doorEndPt);
9101
+ let dataArray = isDoorFrame ? doorFrame : metalFraming;
9102
+ for (let x = 0; x < dataArray.length; x++) {
9103
+ const ptArray = dataArray[x].boxPoints;
9104
+ const doorFrameStart = getPt3(dataArray[x].doorStartPt);
9105
+ const doorFrameEnd = getPt3(dataArray[x].doorEndPt);
9081
9106
  doorFrameStart.z = doorFrameEnd.z = doorTmpSt.z;
9082
9107
  let doorFrameLen = doorFrameStart.distanceTo(doorFrameEnd);
9083
9108
  if (Math.abs(doorFrameLen - doorLen) > 0.5) continue;
@@ -9115,8 +9140,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
9115
9140
  if (intersect1 != null && intersect2 != null) {
9116
9141
  const ptIntersect1 = intersect1.point;
9117
9142
  const ptIntersect2 = intersect2.point;
9118
- let ptOnLine1 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpSt, 1e-3, true);
9119
- let ptOnLine2 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpEd, 1e-3, true);
9143
+ let ptOnLine1 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpSt, 0.1, true);
9144
+ let ptOnLine2 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpEd, 0.1, true);
9120
9145
  if (ptOnLine1 && ptOnLine2) {
9121
9146
  let originZ = doorTmpSt.z;
9122
9147
  doorTmpSt = ptIntersect1.clone();
@@ -9124,11 +9149,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
9124
9149
  doorTmpSt.z = doorTmpEd.z = originZ;
9125
9150
  doorAndBeamDataObj.doorStart = doorTmpSt.clone();
9126
9151
  doorAndBeamDataObj.doorEnd = doorTmpEd.clone();
9127
- doorAndBeamDataObj.doorHeight = doorFrame[x].maxZ - doorAndBeamDataObj.doorStart.z;
9152
+ doorAndBeamDataObj.doorHeight = dataArray[x].maxZ - doorAndBeamDataObj.doorStart.z;
9128
9153
  doorAndBeamDataObj.beamStart = doorTmpSt.clone();
9129
9154
  doorAndBeamDataObj.beamEnd = doorTmpEd.clone();
9130
9155
  doorAndBeamDataObj.beamStart.z = doorAndBeamDataObj.beamEnd.z = doorAndBeamDataObj.doorStart.z + doorAndBeamDataObj.doorHeight;
9131
9156
  doorAndBeamDataObj.beamHeight = line2.rooftopPz - doorAndBeamDataObj.beamStart.z;
9157
+ doorAndBeamDataObj.type = "door";
9158
+ doorAndBeamDataObj.isDoor = true;
9159
+ dataType = "door";
9132
9160
  break;
9133
9161
  }
9134
9162
  }
@@ -14390,8 +14418,9 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14390
14418
  delData.add(k);
14391
14419
  let threePoints = [];
14392
14420
  let threePointsStr = [];
14421
+ let isTrueType = cloneData.type == "floor" || cloneData.type == "Staircase" || cloneData.type == "window" || cloneData.type == "metal framing of interior glass partitions" || cloneData.type == "door" || cloneData.type == "balcony railing";
14393
14422
  for (let m = 0; m < array[k].points.length; m++) {
14394
- if (array[k].points[m].z > averagePz2 && array[k].points[m].z - averagePz2 > 0.1 || cloneData.type == "floor" || cloneData.type == "Staircase") {
14423
+ if (array[k].points[m].z > averagePz2 && array[k].points[m].z - averagePz2 > 0.1 || isTrueType) {
14395
14424
  cloneData.points.push(array[k].points[m]);
14396
14425
  threePoints.push(array[k].points[m]);
14397
14426
  threePointsStr.push(`${array[k].points[m].x},${array[k].points[m].y},${array[k].points[m].z}`);
@@ -14413,7 +14442,7 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14413
14442
  cloneData.obb = newObb;
14414
14443
  cloneData.positionArr.push(...array[k].positionArr);
14415
14444
  boxVecJ = getObbLongSideDirection(cloneData.obb);
14416
- k = j;
14445
+ k = -1;
14417
14446
  finMergeObj = true;
14418
14447
  }
14419
14448
  }
@@ -14454,40 +14483,9 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14454
14483
  });
14455
14484
  let beforeLength = newArray.length;
14456
14485
  if (clusterResult.length > 0 && clusterResult[0].length > 1) {
14457
- if (type2 != "window") {
14458
- for (const cluster of clusterResult[0]) {
14459
- if (cluster.length < 50) continue;
14460
- const newOriginalPoints = cluster.map((i2) => points[i2]);
14461
- const centerData = getCenterAndPointHeight(newOriginalPoints);
14462
- let pathPoints = newOriginalPoints.map((p) => [p.x, p.y]);
14463
- const data = {
14464
- points: newOriginalPoints,
14465
- path: computeContour(pathPoints),
14466
- h: centerData.h,
14467
- minz: centerData.minz,
14468
- maxz: centerData.maxz,
14469
- center: { x: centerData.x, y: centerData.y, z: centerData.z },
14470
- type: type2,
14471
- averagePz: averagePz3,
14472
- obb: null,
14473
- obj_id,
14474
- positionArr,
14475
- isStaircaseBalconyRailing,
14476
- mapPosition: array[j]?.mapPosition
14477
- };
14478
- data.obb = getObb(data.path, data.center, data.h, (data.maxz + data.minz) / 2);
14479
- if (data.obb == null) continue;
14480
- newArray.push(data);
14481
- }
14482
- } else {
14483
- const newOriginalPoints = [];
14484
- for (const cluster of clusterResult[0]) {
14485
- if (cluster.length < 50) continue;
14486
- let tmpPts = cluster.map((i2) => points[i2]);
14487
- for (const p of tmpPts) {
14488
- newOriginalPoints.push(p);
14489
- }
14490
- }
14486
+ for (const cluster of clusterResult[0]) {
14487
+ if (cluster.length < 50) continue;
14488
+ const newOriginalPoints = cluster.map((i2) => points[i2]);
14491
14489
  const centerData = getCenterAndPointHeight(newOriginalPoints);
14492
14490
  let pathPoints = newOriginalPoints.map((p) => [p.x, p.y]);
14493
14491
  const data = {
@@ -14524,6 +14522,36 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14524
14522
  }
14525
14523
  }
14526
14524
  }
14525
+ const windowArray = pcdPointsArr.find((item) => item.type === "window");
14526
+ if (windowArray) {
14527
+ const delData = /* @__PURE__ */ new Set();
14528
+ const array = windowArray.array;
14529
+ for (let j = 0; j < array.length; j++) {
14530
+ if (array[j].obb == null || delData.has(j))
14531
+ continue;
14532
+ const arrayJ = array[j];
14533
+ if (arrayJ.obb == null)
14534
+ continue;
14535
+ for (let k = 0; k < array.length; k++) {
14536
+ if (array[k].obb == null || delData.has(k) || j == k)
14537
+ continue;
14538
+ let polygonK = array[k].path.map((point2) => new THREE8.Vector3(point2[0], point2[1], 0));
14539
+ let polygonJ = arrayJ.path.map((point2) => new THREE8.Vector3(point2[0], point2[1], 0));
14540
+ let f = getPolygonIntersectionRatio(polygonK, polygonJ);
14541
+ if (f > 80) {
14542
+ delData.add(k);
14543
+ k = -1;
14544
+ continue;
14545
+ }
14546
+ }
14547
+ }
14548
+ const newData = [];
14549
+ for (let j = 0; j < array.length; j++) {
14550
+ if (!delData.has(j))
14551
+ newData.push(array[j]);
14552
+ }
14553
+ windowArray.array = newData;
14554
+ }
14527
14555
  for (let i = 0; i < pcdPointsArr.length; i++) {
14528
14556
  const type1 = pcdPointsArr[i].type;
14529
14557
  if (type1 === "people" || type1 === "floor")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.155",
3
+ "version": "1.0.157",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",