rm-graphical-computing-node 1.0.153 → 1.0.155

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 +37 -14
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8044,9 +8044,10 @@ function getTrendLineEndpoints(points, options = {}) {
8044
8044
  // src/geometry/beamLine.mjs
8045
8045
  import { randomUUID as randomUUID2 } from "crypto";
8046
8046
  var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, onProgress = null) => {
8047
+ const beamGroup = [];
8047
8048
  removeNoisePoints(lines, lineReader, lineEditor);
8048
8049
  if (lines.length <= 0 || runDataList.length <= 0)
8049
- return lines;
8050
+ return { lines, beamGroup, pcdData };
8050
8051
  if (!pcdData) pcdData = [];
8051
8052
  for (let line2 of lines) {
8052
8053
  let allRegion = [];
@@ -8258,7 +8259,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8258
8259
  let doorBeamDataIndex = [];
8259
8260
  let findDoorIndexs = [];
8260
8261
  let allDoorLines1 = [];
8261
- const beamGroup = [];
8262
8262
  let nearDist = 0.15;
8263
8263
  for (let index = 0; index < lines.length; index++) {
8264
8264
  if (onProgress != null)
@@ -8286,7 +8286,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8286
8286
  const totalInPlaneNum = region.totalInPlaneNum;
8287
8287
  if (!facePoints || facePoints.length <= 0)
8288
8288
  continue;
8289
- let regionLength = facePoints[0].distanceTo(facePoints[1]);
8290
8289
  let regionHeight = facePoints[0].distanceTo(facePoints[3]);
8291
8290
  const centerHeight = region.gridHeight * (regionHeight / region.gridHeight / 3 * 2) + region.gridHeight / 2;
8292
8291
  let linePt1 = new THREE5.Vector3(facePoints[0].x, facePoints[0].y, facePoints[0].z + centerHeight);
@@ -8915,8 +8914,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
8915
8914
  groundClearance,
8916
8915
  obj_id
8917
8916
  };
8918
- let nearDistTmp = Infinity;
8919
- let findNearDoorIndex = false;
8920
8917
  let nearBeamSt = new THREE5.Vector3();
8921
8918
  let nearBeamEd = new THREE5.Vector3();
8922
8919
  let nearId = -1;
@@ -9320,7 +9317,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
9320
9317
  nearId = doorAndBeamDataObj.nearId;
9321
9318
  nearBeamSt = tmpDoorBeamData.beamStart.clone();
9322
9319
  nearBeamEd = tmpDoorBeamData.beamEnd.clone();
9323
- findNearDoorIndex = true;
9324
9320
  nearLineIndex = doorBeamDataIndex[w2].linesIndex;
9325
9321
  nearDoorIndex = doorBeamDataIndex[w2].doorIndex;
9326
9322
  break;
@@ -14071,7 +14067,7 @@ var drawStaircase = (pcdPointsArr, scene) => {
14071
14067
  }
14072
14068
  return pointCloudGroup;
14073
14069
  };
14074
- var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.2) => {
14070
+ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.2, wallLinesDelPs = 0.2) => {
14075
14071
  if (allProjectionResults.length == 0) return [];
14076
14072
  if (!averagePz2) averagePz2 = allProjectionResults[0].averagePz;
14077
14073
  const pcdPointsArr = [];
@@ -14131,9 +14127,14 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14131
14127
  threePointsStr.push(`${allProjectionResults[i].points[u4].x},${allProjectionResults[i].points[u4].y},${allProjectionResults[i].points[u4].z}`);
14132
14128
  }
14133
14129
  if (wallLines) {
14134
- if (wallVerifyType.type1 && wallVerifyType.type1.length && wallVerifyType.type1.includes(word))
14130
+ if (wallVerifyType.type1 && wallVerifyType.type1.length && wallVerifyType.type1.includes(word)) {
14131
+ let beforeLen = threePoints.length;
14135
14132
  threePoints = checkNearObjects(grid, rectRegions, threePoints);
14136
- else if (wallVerifyType.type2 && wallVerifyType.type2.length && wallVerifyType.type2.includes(word))
14133
+ let afterLen = threePoints.length;
14134
+ let ps = afterLen / beforeLen;
14135
+ if (ps < wallLinesDelPs)
14136
+ continue;
14137
+ } else if (wallVerifyType.type2 && wallVerifyType.type2.length && wallVerifyType.type2.includes(word))
14137
14138
  threePoints = checkNearObjects(grid, rectRegions, threePoints, true);
14138
14139
  }
14139
14140
  let floorZ = -99999;
@@ -14274,6 +14275,7 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14274
14275
  targetItem.points.push(sourceItem.points[m]);
14275
14276
  }
14276
14277
  let tmpPoints = targetItem.points.map((p) => [p.x, p.y]);
14278
+ tmpPoints = voxelDownsample2DForContour(tmpPoints, 0.1);
14277
14279
  if (targetType == "window" && sourceType == "metal framing of interior glass partitions") {
14278
14280
  targetItem.isHasTie = true;
14279
14281
  }
@@ -14347,14 +14349,14 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
14347
14349
  }
14348
14350
  if (
14349
14351
  /**array[k].type == 'door frame' || */
14350
- array[k].type == "window" || array[k].type == "metal framing of interior glass partitions"
14352
+ array[k].type == "window" || array[k].type == "metal framing of interior glass partitions" || array[k].type == "pipe"
14351
14353
  ) {
14352
14354
  let tol = array[k].type == "door frame" ? 0.5 : 0.5;
14353
14355
  let boxVecK = getObbLongSideDirection(array[k].obb);
14354
14356
  let polygonK = array[k].path.map((point2) => new THREE8.Vector3(point2[0], point2[1], 0));
14355
14357
  let polygonJ = cloneData.path.map((point2) => new THREE8.Vector3(point2[0], point2[1], 0));
14356
14358
  let f = getPolygonIntersectionRatio(polygonK, polygonJ);
14357
- if (boxVecJ.length > 0.2 && boxVecK.length > 0.2 || f > 0.3) {
14359
+ if (boxVecJ.length > 0.2 && boxVecK.length > 0.2 || f > 30) {
14358
14360
  let isPPPP = isParallel(boxVecJ.direction, boxVecK.direction, tol);
14359
14361
  if ((!isPPPP || !isPPPP.parallel) && f < 80) {
14360
14362
  continue;
@@ -17189,8 +17191,11 @@ var getWindowData = (lines, pcdData, lineReader) => {
17189
17191
  name: window.name,
17190
17192
  rectPts: window.coordinatesByArea.coordinates,
17191
17193
  obj_id: window.obj_id,
17192
- findLineIndex: []
17194
+ findLineIndex: [],
17193
17195
  //存储的数据格式是[[线索引,线的windowData索引]]
17196
+ mainId: -1,
17197
+ //存储主线索引,初始为-1
17198
+ mainLineLength: 0
17194
17199
  });
17195
17200
  }
17196
17201
  }
@@ -17292,7 +17297,8 @@ var getWindowData = (lines, pcdData, lineReader) => {
17292
17297
  if (length2 < 3.5) {
17293
17298
  for (let n = 0; n < windowDatas.length; n++) {
17294
17299
  if (windowDatas[n].isFind) {
17295
- continue;
17300
+ if (line2.length < windowDatas[n].mainLineLength)
17301
+ continue;
17296
17302
  }
17297
17303
  if (windowDatas[n].maxZ < tmpRegion.facePoints[0].z || windowDatas[n].minZ > tmpRegion.facePoints[2].z)
17298
17304
  continue;
@@ -17304,8 +17310,12 @@ var getWindowData = (lines, pcdData, lineReader) => {
17304
17310
  let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - windowDatas[n].maxZ) > 0.2;
17305
17311
  if (bIsTrue) {
17306
17312
  let result = classifySegments(doorSt.clone(), doorEd.clone(), beamSt.clone(), beamEd.clone(), {
17313
+ collinearAngleMax: THREE10.MathUtils.degToRad(10),
17307
17314
  distanceThreshold: 2
17308
17315
  });
17316
+ if (windowDatas[n].name == "210_front_window_001") {
17317
+ console.log(index, result);
17318
+ }
17309
17319
  if (result && result.type == "collinear_gap") {
17310
17320
  let ptCenter = getMid(doorSt, doorEd);
17311
17321
  let line3 = new THREE10.Line3(new THREE10.Vector3(line2.start.x, line2.start.y, 0), new THREE10.Vector3(line2.end.x, line2.end.y, 0));
@@ -17675,7 +17685,9 @@ var getWindowData = (lines, pcdData, lineReader) => {
17675
17685
  }
17676
17686
  line2.windowIdToCheckResults.push([region.index, id]);
17677
17687
  line2.windowData.push(doorAndBeamDataObj);
17678
- windowDatas[findDoorDataIndex].findLineIndex = [index, line2.windowData.length - 1];
17688
+ windowDatas[findDoorDataIndex].mainLineLength = line2.length;
17689
+ windowDatas[findDoorDataIndex].mainId = id;
17690
+ windowDatas[findDoorDataIndex].findLineIndex.push([index, id]);
17679
17691
  doorBeamDataIndex.push({
17680
17692
  linesIndex: index,
17681
17693
  doorIndex: line2.windowData.length - 1
@@ -17699,6 +17711,17 @@ var getWindowData = (lines, pcdData, lineReader) => {
17699
17711
  line2.originalPoints = null;
17700
17712
  }
17701
17713
  if (findDoorIndexs.length > 1) {
17714
+ for (let w = 0; w < windowDatas.length; w++) {
17715
+ if (windowDatas[w].mainId == -1 || windowDatas[w].findLineIndex.length == 1) continue;
17716
+ const mainId = windowDatas[w].mainId;
17717
+ for (let f = 0; f < windowDatas[w].findLineIndex.length; f++) {
17718
+ const windowDataIndex = windowDatas[w].findLineIndex[f];
17719
+ const line2 = lines[windowDataIndex[0]];
17720
+ const windowDataId = windowDataIndex[1];
17721
+ if (!line2 || line2.windowData.length == 0 || mainId == windowDataId) continue;
17722
+ line2.windowData = line2.windowData.filter((wd) => wd.id != windowDataId);
17723
+ }
17724
+ }
17702
17725
  for (let j = 0; j < findDoorIndexs.length; j++) {
17703
17726
  let savedata2 = [];
17704
17727
  for (let d = 0; d < lines[findDoorIndexs[j]].windowData.length; d++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.153",
3
+ "version": "1.0.155",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",