rm-graphical-computing-node 1.0.67 → 1.0.69

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 +122 -11
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5155,6 +5155,15 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
5155
5155
  if (onProgress != null)
5156
5156
  onProgress(100);
5157
5157
  }
5158
+ let tmpLines = [];
5159
+ for (let i = 0; i < lines.length; i++) {
5160
+ if (!lines[i].isLine2)
5161
+ tmpLines.push(lines[i]);
5162
+ if (lines[i].isLine2 && lines[i].doorAndBeamData.length != 0)
5163
+ tmpLines.push(lines[i]);
5164
+ }
5165
+ lines.length = 0;
5166
+ lines.push(...tmpLines);
5158
5167
  return { lines, beamGroup, pcdData };
5159
5168
  };
5160
5169
  var checkBeamIsReasonable = async (lines, lineReader) => {
@@ -10870,6 +10879,7 @@ var getSlabData = (lines, runDataList, pointCloudCluster = null, getOblique = fa
10870
10879
  flatSlabPoints.push(lines[i]);
10871
10880
  }
10872
10881
  const flatSlabDatas = getFlatSlabData(flatSlabPoints, runDataList, pointCloudCluster);
10882
+ const flatFloorDatas = getFlatFloorData(flatSlabPoints, runDataList, pointCloudCluster);
10873
10883
  const obliqueSlabDatas = getObliqueSlabData(obliqueSlabPoints, runDataList, pointCloudCluster);
10874
10884
  return { flatSlabDatas, obliqueSlabDatas };
10875
10885
  };
@@ -10984,6 +10994,117 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
10984
10994
  }
10985
10995
  return slabDatas;
10986
10996
  };
10997
+ var getFlatFloorData = (lines, runDataList, pointCloudCluster = null) => {
10998
+ if (lines.length === 0) return;
10999
+ let floorDatas = [];
11000
+ let maxHeightTrajectoryPt = new THREE9.Vector3(runDataList[0].x, runDataList[0].y, runDataList[0].z);
11001
+ let totalZ = 0;
11002
+ for (let i = 1; i < runDataList.length; i++) {
11003
+ totalZ += runDataList[i].z;
11004
+ if (runDataList[i].z > maxHeightTrajectoryPt.z) {
11005
+ maxHeightTrajectoryPt.set(runDataList[i].x, runDataList[i].y, runDataList[i].z);
11006
+ }
11007
+ }
11008
+ const averageZ = totalZ / (runDataList.length - 1);
11009
+ let maxPointsNum = 0;
11010
+ let maxPointsZ = 0;
11011
+ for (const line2 of lines) {
11012
+ let points = line2[1].points;
11013
+ if (points.length < 30) continue;
11014
+ let mapSortPoint = /* @__PURE__ */ new Map();
11015
+ for (let c = 0; c < points.length; c++) {
11016
+ let z = points[c].z;
11017
+ z = Math.floor(z * 10) / 10;
11018
+ if (mapSortPoint.has(z)) {
11019
+ const item = mapSortPoint.get(z);
11020
+ item.num += 1;
11021
+ item.points.push(points[c]);
11022
+ mapSortPoint.set(z, item);
11023
+ } else {
11024
+ mapSortPoint.set(z, { num: 1, points: [points[c]] });
11025
+ }
11026
+ }
11027
+ let mostFrequentEntry = [...mapSortPoint.entries()].reduce(
11028
+ (max2, cur) => cur[1].num > max2[1].num ? cur : max2
11029
+ );
11030
+ points = mostFrequentEntry[1].points.map((p) => new THREE9.Vector3(p.x, p.y, p.z));
11031
+ let newPoints = [];
11032
+ if (pointCloudCluster != null) {
11033
+ let clusterResult = pointCloudCluster([points], {
11034
+ tolerance: 0.1,
11035
+ minClusterSize: 30,
11036
+ maxClusterSize: 1e7,
11037
+ threadCount: 1
11038
+ });
11039
+ if (clusterResult.length > 0) {
11040
+ for (const cluster of clusterResult[0]) {
11041
+ if (cluster.length < 50) continue;
11042
+ const newOriginalPoints = cluster.map((i) => points[i]);
11043
+ newPoints.push(newOriginalPoints);
11044
+ }
11045
+ } else
11046
+ newPoints.push(points);
11047
+ } else
11048
+ newPoints.push(points);
11049
+ for (let u4 = 0; u4 < newPoints.length; u4++) {
11050
+ let { minZ, maxZ, averagePz: averagePz2 } = getPointsMinAndMax(newPoints[u4]);
11051
+ const height = maxZ - minZ;
11052
+ if (averageZ < maxZ) continue;
11053
+ let pathPoints = newPoints[u4].map((p) => [p.x, p.y]);
11054
+ let path3 = computeContour(pathPoints);
11055
+ let area2 = calculatePolygonArea(path3);
11056
+ if (area2 < 0.5) continue;
11057
+ const floorData = {
11058
+ contour: path3,
11059
+ averagePz: averagePz2,
11060
+ points: newPoints[u4]
11061
+ };
11062
+ if (newPoints[u4].length > maxPointsNum) {
11063
+ maxPointsNum = newPoints[u4].length;
11064
+ maxPointsZ = averagePz2;
11065
+ }
11066
+ floorDatas.push(floorData);
11067
+ }
11068
+ }
11069
+ const newFloorDatas = [];
11070
+ for (const floorData of floorDatas) {
11071
+ if (floorData.averagePz <= maxPointsZ || floorData.averagePz < averageZ) {
11072
+ newFloorDatas.push(floorData);
11073
+ }
11074
+ }
11075
+ let delIndex = /* @__PURE__ */ new Set();
11076
+ for (let j = 0; j < newFloorDatas.length; j++) {
11077
+ if (delIndex.has(j)) continue;
11078
+ const floorData1 = newFloorDatas[j];
11079
+ for (let k = 0; k < newFloorDatas.length; k++) {
11080
+ if (j == k || delIndex.has(k))
11081
+ continue;
11082
+ const floorData2 = newFloorDatas[k];
11083
+ if (Math.abs(floorData1.averagePz - floorData2.averagePz) > 0.05) continue;
11084
+ const isIntersect = contoursIntersect(floorData1.contour, floorData2.contour, 1e-3);
11085
+ if (isIntersect) {
11086
+ for (let b = 0; b < floorData2.points.length; b++)
11087
+ floorData1.points.push(floorData2.points[b]);
11088
+ let tmpPoints = floorData1.points.map((p) => [p.x, p.y]);
11089
+ tmpPoints = voxelDownsample2DForContour(tmpPoints, 0.1);
11090
+ let path3 = computeContour(tmpPoints);
11091
+ floorData1.contour = path3;
11092
+ delIndex.add(k);
11093
+ k = -1;
11094
+ }
11095
+ }
11096
+ }
11097
+ floorDatas = [];
11098
+ for (let j = 0; j < newFloorDatas.length; j++) {
11099
+ if (!delIndex.has(j))
11100
+ floorDatas.push({
11101
+ contour: newFloorDatas[j].contour,
11102
+ averagePz: newFloorDatas[j].averagePz
11103
+ // points: newFloorDatas[j].points
11104
+ });
11105
+ }
11106
+ return floorDatas;
11107
+ };
10987
11108
  var getObliqueSlabData = (lines, runDataList, pointCloudCluster = null) => {
10988
11109
  if (lines.length === 0) return [];
10989
11110
  let slabDatas = [];
@@ -11301,12 +11422,11 @@ var getWindowData = (lines, pcdData, lineReader) => {
11301
11422
  let nearDist = 0.25;
11302
11423
  for (let index = 0; index < lines.length; index++) {
11303
11424
  let line2 = lines[index];
11425
+ line2.windowData = [];
11304
11426
  if (line2.length < 0.5) continue;
11305
11427
  if (line2.noDetection) continue;
11306
11428
  line2.originalPoints = lineReader.getOriginalPointsById(line2.id);
11307
11429
  line2.checkResults = lineReader.getLineCheckReultsById(line2.id);
11308
- if (!line2.windowData)
11309
- line2.windowData = [];
11310
11430
  if (!line2.windowIdToCheckResults)
11311
11431
  line2.windowIdToCheckResults = [];
11312
11432
  if (!line2.mergeCheckRegion || line2.mergeCheckRegion.length == 0)
@@ -11822,15 +11942,6 @@ var getWindowData = (lines, pcdData, lineReader) => {
11822
11942
  lines[findDoorIndexs[j]].windowData = savedata2;
11823
11943
  }
11824
11944
  }
11825
- let tmpLines = [];
11826
- for (let i = 0; i < lines.length; i++) {
11827
- if (!lines[i].isLine2)
11828
- tmpLines.push(lines[i]);
11829
- if (lines[i].isLine2 && lines[i].windowData.length != 0)
11830
- tmpLines.push(lines[i]);
11831
- }
11832
- lines.length = 0;
11833
- lines.push(...tmpLines);
11834
11945
  return { lines, pcdData };
11835
11946
  };
11836
11947
  var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, pointCloudCluster = null) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",