rm-graphical-computing-node 1.0.146 → 1.0.147

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 +52 -43
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6349,7 +6349,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6349
6349
  category: door.category,
6350
6350
  length: length2,
6351
6351
  width,
6352
- rectPts: door.coordinatesByArea.coordinates
6352
+ rectPts: door.coordinatesByArea.coordinates,
6353
+ obj_id: door.obj_id
6353
6354
  });
6354
6355
  }
6355
6356
  if (door.category == "door frame") {
@@ -6535,6 +6536,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6535
6536
  continue;
6536
6537
  let addData = false;
6537
6538
  let isDoor = false;
6539
+ let obj_id = null;
6538
6540
  let findDoorFrame = false;
6539
6541
  let beforePcdDoorIsFindBeam = false;
6540
6542
  let doorOpenEndPoint = new THREE5.Vector3(0, 0, 0);
@@ -6642,7 +6644,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6642
6644
  const ptInsertTmp = segmentsIntersect2D(tmpLineStart, tmpLineEnd, tmpOtherLineStart, tmpOtherLineEnd, 0.1);
6643
6645
  let isPerpendicularInfo = perpendicularInfo(tmpLineStart, tmpLineEnd, tmpOtherLineStart, tmpOtherLineEnd);
6644
6646
  if (ptInsertTmp != null) {
6645
- if (isPerpendicularInfo && isPerpendicularInfo.angle > 79) {
6647
+ if (isPerpendicularInfo && isPerpendicularInfo.angle > 40) {
6646
6648
  let dist00 = ptInsertTmp.point.distanceTo(tmpLineStart);
6647
6649
  let dist01 = ptInsertTmp.point.distanceTo(tmpLineEnd);
6648
6650
  if (dist00 < 0.3) {
@@ -6749,7 +6751,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6749
6751
  const ptInsertTmp = segmentsIntersect2D(tmpLineStart, tmpLineEnd, tmpOtherLineStart, tmpOtherLineEnd, 0.03);
6750
6752
  let isPerpendicularInfo = perpendicularInfo(tmpLineStart, tmpLineEnd, tmpOtherLineStart, tmpOtherLineEnd);
6751
6753
  if (ptInsertTmp != null) {
6752
- if (isPerpendicularInfo && isPerpendicularInfo.angle > 79) {
6754
+ if (isPerpendicularInfo && isPerpendicularInfo.angle > 40) {
6753
6755
  let dist00 = ptInsertTmp.point.distanceTo(tmpLineStart);
6754
6756
  let dist01 = ptInsertTmp.point.distanceTo(tmpLineEnd);
6755
6757
  if (dist01 < 0.3) {
@@ -6880,6 +6882,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6880
6882
  isDoor = true;
6881
6883
  isPullOutDoor = true;
6882
6884
  pcbDoorIndexs.push(doorAndDoorFrameDatas[n].index);
6885
+ obj_id = doorAndDoorFrameDatas[n].obj_id;
6883
6886
  doorAndDoorFrameDatas[n].isFind = true;
6884
6887
  findDoorDataIndex = n;
6885
6888
  beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
@@ -6906,35 +6909,32 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
6906
6909
  let distTmp1 = beamSt.distanceTo(beamEd);
6907
6910
  let distTmp2 = doorEd.distanceTo(doorSt);
6908
6911
  if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
6909
- if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 1 && doorAndDoorFrameDatas[n].category === "door") {
6910
- let dist1 = beamSt.distanceTo(doorSt);
6911
- let dist2 = beamSt.distanceTo(doorEd);
6912
- let dist3 = beamEd.distanceTo(doorSt);
6913
- let dist4 = beamEd.distanceTo(doorEd);
6914
- let dist5 = dist1 < dist2 ? dist1 : dist2;
6915
- let dist6 = dist3 < dist4 ? dist3 : dist4;
6916
- let beamVec = new THREE5.Vector3().subVectors(beamSt, beamEd).normalize();
6917
- let addDoorLen = distTmp2 - result.overlap;
6918
- if (dist5 < dist6) {
6919
- beamVec.negate();
6920
- beamTmpSt = tmpRegion.facePoints[2].clone().addScaledVector(beamVec, addDoorLen);
6921
- beamTmpEd = tmpRegion.facePoints[3].clone();
6922
- doorTmpSt = beamTmpEd.clone();
6923
- doorTmpEd = beamTmpSt.clone();
6924
- doorTmpSt.z = doorTmpEd.z = tmpRegion.facePoints[0].z;
6925
- } else {
6926
- beamTmpSt = tmpRegion.facePoints[2].clone();
6927
- beamTmpEd = tmpRegion.facePoints[3].clone().addScaledVector(beamVec, addDoorLen);
6928
- doorTmpSt = beamTmpEd.clone();
6929
- doorTmpEd = beamTmpSt.clone();
6930
- doorTmpSt.z = doorTmpEd.z = tmpRegion.facePoints[0].z;
6931
- }
6912
+ if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 0.5 && doorAndDoorFrameDatas[n].category === "door") {
6913
+ let Line3Tmp = new THREE5.Line3(getPt3(line2.start), getPt3(line2.end));
6914
+ let tmpDoorSt = doorSt.clone();
6915
+ let tmpDoorEd = doorEd.clone();
6916
+ tmpDoorSt.z = tmpDoorEd.z = line2.start.z;
6917
+ let ptClose1 = Line3Tmp.closestPointToPoint(doorSt, true, new THREE5.Vector3());
6918
+ let ptClose2 = Line3Tmp.closestPointToPoint(doorEd, true, new THREE5.Vector3());
6919
+ ptClose1.z = ptClose2.z = doorTmpSt.z;
6920
+ let dist1 = ptClose1.distanceTo(doorTmpSt);
6921
+ let dist2 = ptClose2.distanceTo(doorTmpSt);
6922
+ if (dist1 > dist2)
6923
+ [ptClose1, ptClose2] = [ptClose2, ptClose1];
6924
+ doorTmpSt = ptClose1.clone();
6925
+ doorTmpEd = ptClose2.clone();
6926
+ beamTmpSt = doorTmpEd.clone();
6927
+ beamTmpEd = doorTmpSt.clone();
6928
+ beamTmpSt.z = beamTmpEd.z = tmpRegion.facePoints[2].z;
6929
+ length2 = beamTmpSt.distanceTo(beamTmpEd);
6930
+ console.log(111);
6932
6931
  }
6933
6932
  if (length2 > 1.3) {
6934
6933
  if (doorAndDoorFrameDatas[n].category === "door frame") {
6935
6934
  findDoorFrame = true;
6936
6935
  continue;
6937
6936
  }
6937
+ obj_id = doorAndDoorFrameDatas[n].obj_id;
6938
6938
  isDoor = true;
6939
6939
  isPullOutDoor = true;
6940
6940
  pcbDoorIndexs.push(doorAndDoorFrameDatas[n].index);
@@ -7020,6 +7020,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
7020
7020
  beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
7021
7021
  pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
7022
7022
  isDoor = true;
7023
+ obj_id = doorAndDoorFrameDatas[n].obj_id;
7023
7024
  doorAndDoorFrameDatas[n].isFind = true;
7024
7025
  findDoorDataIndex = n;
7025
7026
  }
@@ -7085,7 +7086,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
7085
7086
  doorOpenEndPoint,
7086
7087
  doorOpenVector,
7087
7088
  lineIsOnlyBeam: false,
7088
- groundClearance
7089
+ groundClearance,
7090
+ obj_id
7089
7091
  };
7090
7092
  let nearDistTmp = Infinity;
7091
7093
  let findNearDoorIndex = false;
@@ -7881,7 +7883,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
7881
7883
  type: "onlyDoor",
7882
7884
  isDoor: true,
7883
7885
  beamNearWallVec: new THREE5.Vector3(0, 0, 0),
7884
- groundClearance: 0
7886
+ groundClearance: 0,
7887
+ obj_id: doorDatas[n].obj_id
7885
7888
  });
7886
7889
  pcdData[doorDatas[n].index].isFindBeam = true;
7887
7890
  pcdData[doorDatas[n].index].isFindOnlyDoor = true;
@@ -7932,7 +7935,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
7932
7935
  let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
7933
7936
  let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
7934
7937
  let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
7935
- if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
7938
+ if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap" || isData1AndData2.maxPerpendicularDistance > 0.1)
7936
7939
  continue;
7937
7940
  let twoPoint = getFarthestPoints(tmpDoorPoints);
7938
7941
  if (twoPoint.length != 2) continue;
@@ -7977,7 +7980,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
7977
7980
  let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
7978
7981
  let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
7979
7982
  let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
7980
- if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
7983
+ if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap" || isData1AndData2.maxPerpendicularDistance > 0.1)
7981
7984
  continue;
7982
7985
  let twoPoint = getFarthestPoints(tmpDoorPoints);
7983
7986
  if (twoPoint.length != 2) continue;
@@ -8006,12 +8009,12 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8006
8009
  const line4End = new THREE5.Vector3(line4.end.x, line4.end.y, line4.end.z);
8007
8010
  let isLine3AndLine4 = classifySegments(line3Start, line3End, line4Start, line4End);
8008
8011
  let isSameLine = data1NearIdIndex[0] == data2NearIdIndex[0];
8009
- if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" && !isSameLine)
8012
+ if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" || isLine3AndLine4.maxPerpendicularDistance > 0.1 || !isSameLine)
8010
8013
  continue;
8011
8014
  const data3 = line3.doorAndBeamData[data1NearIdIndex[1]];
8012
8015
  const data4 = line4.doorAndBeamData[data2NearIdIndex[1]];
8013
8016
  let isData3AndData4 = classifySegments(data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd);
8014
- if (!isData3AndData4 || isData3AndData4.type != "collinear_gap")
8017
+ if (!isData3AndData4 || isData3AndData4.type != "collinear_gap" || isData3AndData4.maxPerpendicularDistance > 0.1)
8015
8018
  continue;
8016
8019
  let newData = {
8017
8020
  id,
@@ -8154,7 +8157,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8154
8157
  let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
8155
8158
  let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
8156
8159
  let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
8157
- if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
8160
+ if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap" || isData1AndData2.maxPerpendicularDistance > 0.1)
8158
8161
  continue;
8159
8162
  let twoPoint = getFarthestPoints(tmpDoorPoints);
8160
8163
  if (twoPoint.length != 2) continue;
@@ -8272,12 +8275,12 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8272
8275
  const line4Start = new THREE5.Vector3(line4.start.x, line4.start.y, line4.start.z);
8273
8276
  const line4End = new THREE5.Vector3(line4.end.x, line4.end.y, line4.end.z);
8274
8277
  let isLine3AndLine4 = classifySegments(line3Start, line3End, line4Start, line4End);
8275
- if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" && lines[data1NearIdIndex[0]] != lines[data2NearIdIndex[0]])
8278
+ if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" || isLine3AndLine4.maxPerpendicularDistance > 0.1)
8276
8279
  continue;
8277
8280
  const data3 = line3.doorAndBeamData[data1NearIdIndex[1]];
8278
8281
  const data4 = line4.doorAndBeamData[data2NearIdIndex[1]];
8279
8282
  let isData3AndData4 = classifySegments(data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd);
8280
- if (!isData3AndData4 || isData3AndData4.type != "collinear_gap")
8283
+ if (!isData3AndData4 || isData3AndData4.type != "collinear_gap" || isData3AndData4.maxPerpendicularDistance > 0.1)
8281
8284
  continue;
8282
8285
  let newData = {
8283
8286
  id,
@@ -9511,13 +9514,13 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
9511
9514
  }
9512
9515
  return colDatas;
9513
9516
  };
9514
- var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01, dir = null) => {
9517
+ var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, diff = 0.5, type = "normal", dir = null) => {
9515
9518
  if (!finalLines.length) return finalLines;
9516
9519
  for (let v2 = 0; v2 < finalLines.length; v2++) {
9517
9520
  for (let i = 0; i < finalLines[v2].checkResults.length; i++) {
9518
9521
  const offsets = [];
9519
9522
  for (let t2 = 0; t2 < finalLines[v2].checkResults[i].originalVertices.length; t2++)
9520
- offsets.push(offsetsNum);
9523
+ offsets.push(diff);
9521
9524
  finalLines[v2].checkResults[i].offsets = offsets;
9522
9525
  }
9523
9526
  }
@@ -15401,6 +15404,8 @@ var getWindowData = (lines, pcdData, lineReader) => {
15401
15404
  if (windowDatas[n].isFind) {
15402
15405
  continue;
15403
15406
  }
15407
+ if (windowDatas[n].maxZ < tmpRegion.facePoints[0].z || windowDatas[n].minZ > tmpRegion.facePoints[2].z)
15408
+ continue;
15404
15409
  let doorSt = new THREE10.Vector3(windowDatas[n].windowStartPt.x, windowDatas[n].windowStartPt.y, 0);
15405
15410
  let doorEd = new THREE10.Vector3(windowDatas[n].windowEndPt.x, windowDatas[n].windowEndPt.y, 0);
15406
15411
  let beamSt = new THREE10.Vector3(tmpRegion.facePoints[0].x, tmpRegion.facePoints[0].y, 0);
@@ -15912,7 +15917,7 @@ var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, point
15912
15917
  }
15913
15918
  return lines;
15914
15919
  };
15915
- var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir, pointCloudCluster = null) => {
15920
+ var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir, pointCloudCluster = null, Redundancy = 70) => {
15916
15921
  if (!lines.length)
15917
15922
  return;
15918
15923
  const windowLines = [];
@@ -15966,7 +15971,7 @@ var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir,
15966
15971
  trajectoryObj[r].qz = 0;
15967
15972
  trajectoryObj[r].qw = 0;
15968
15973
  }
15969
- await penetratingTask(windowLines, trajectoryObj, collectDataPath, 0.5, "normal", 0.01, dir);
15974
+ await penetratingTask(windowLines, trajectoryObj, collectDataPath, 0.1, "normal", dir);
15970
15975
  for (let i = 0; i < windowLines.length; i++) {
15971
15976
  let len = 0;
15972
15977
  for (let u4 = 0; u4 < windowLines[i].checkResults.length; u4++)
@@ -15998,7 +16003,8 @@ var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir,
15998
16003
  newPoints = allCenterPoints;
15999
16004
  let retNum = newPoints.length;
16000
16005
  let ps = retNum / len * 100;
16001
- if (ps < 80) {
16006
+ console.log(retNum, allCenterPoints.length, len, ps);
16007
+ if (ps < Redundancy) {
16002
16008
  windowLines[i].isRebuild = true;
16003
16009
  }
16004
16010
  }
@@ -16500,7 +16506,8 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
16500
16506
  end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, line2.start.z),
16501
16507
  n: new THREE11.Vector3(0, 0, 0),
16502
16508
  height,
16503
- groundClearance
16509
+ groundClearance,
16510
+ obj_id: pcd.obj_id
16504
16511
  },
16505
16512
  isDoor: true
16506
16513
  };
@@ -16600,7 +16607,8 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
16600
16607
  end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, line2.start.z),
16601
16608
  n: new THREE11.Vector3(0, 0, 0),
16602
16609
  height,
16603
- groundClearance
16610
+ groundClearance,
16611
+ obj_id: pcd.obj_id
16604
16612
  },
16605
16613
  isDoor: true
16606
16614
  };
@@ -16694,7 +16702,8 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
16694
16702
  end: new THREE11.Vector3(ptNewDoorEd.x, ptNewDoorEd.y, lineTmp.start.z),
16695
16703
  n: new THREE11.Vector3(0, 0, 0),
16696
16704
  height,
16697
- groundClearance
16705
+ groundClearance,
16706
+ obj_id: pcd.obj_id
16698
16707
  },
16699
16708
  isDoor: true
16700
16709
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.146",
3
+ "version": "1.0.147",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",