rm-graphical-computing-node 1.0.144 → 1.0.146

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 +98 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -9511,7 +9511,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
9511
9511
  }
9512
9512
  return colDatas;
9513
9513
  };
9514
- var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01) => {
9514
+ var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01, dir = null) => {
9515
9515
  if (!finalLines.length) return finalLines;
9516
9516
  for (let v2 = 0; v2 < finalLines.length; v2++) {
9517
9517
  for (let i = 0; i < finalLines[v2].checkResults.length; i++) {
@@ -9522,7 +9522,10 @@ var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsets
9522
9522
  }
9523
9523
  }
9524
9524
  const t = performance.now();
9525
- const pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
9525
+ let pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
9526
+ if (dir != null) {
9527
+ pcdDir = `${collectDataPath}/${dir}`;
9528
+ }
9526
9529
  const floatArray = await gfx.squareBackfacePointCloudTestAsync({
9527
9530
  base: type === "normal" || "res" ? `${collectDataPath}` : `${collectDataPath}/customData`,
9528
9531
  lines: finalLines,
@@ -15909,6 +15912,98 @@ var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, point
15909
15912
  }
15910
15913
  return lines;
15911
15914
  };
15915
+ var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir, pointCloudCluster = null) => {
15916
+ if (!lines.length)
15917
+ return;
15918
+ const windowLines = [];
15919
+ for (let i = 0; i < lines.length; i++) {
15920
+ const line2 = lines[i];
15921
+ if (line2.drawWindow && line2.drawWindow.length) {
15922
+ line2.saveExistSegments = true;
15923
+ getOneLineCheckResults(line2, false);
15924
+ const drawWindow = line2.drawWindow || [];
15925
+ const direction = getPt3(line2.direction).normalize();
15926
+ let checkResults = [];
15927
+ for (let j = 0; j < drawWindow.length; j++) {
15928
+ let p = getPt3(drawWindow[j].p);
15929
+ let st = p.clone().addScaledVector(direction, drawWindow[j].width / 2);
15930
+ let ed = p.clone().addScaledVector(direction, -drawWindow[j].width / 2);
15931
+ st.z = ed.z = 0;
15932
+ let Line36 = new THREE10.Line3(st, ed);
15933
+ for (let g = 0; g < line2.existSegments.length; g++) {
15934
+ const allCenterPoints = line2.existSegments[g].allCenterPoints;
15935
+ let minZ = p.z + drawWindow[j].groundClearance;
15936
+ let maxZ = p.z + drawWindow[j].groundClearance + drawWindow[j].height;
15937
+ let indexs = /* @__PURE__ */ new Set();
15938
+ for (let k = 0; k < allCenterPoints.length; k++) {
15939
+ if (indexs.has(k))
15940
+ continue;
15941
+ let cp = getPt3(allCenterPoints[k]);
15942
+ let originZ = cp.z;
15943
+ cp.z = 0;
15944
+ let isOnLine = isPointOnLine(Line36, cp, 1e-3);
15945
+ if (isOnLine && originZ >= minZ && originZ <= maxZ) {
15946
+ indexs.add(k);
15947
+ }
15948
+ }
15949
+ let checkResult = { allCenterPoints: [], originalVertices: [] };
15950
+ for (const idx of indexs) {
15951
+ checkResult.allCenterPoints.push(line2.existSegments[g].allCenterPoints[idx]);
15952
+ checkResult.originalVertices.push(line2.existSegments[g].originalVertices[idx]);
15953
+ }
15954
+ checkResults.push(checkResult);
15955
+ }
15956
+ }
15957
+ line2.checkResults = checkResults;
15958
+ windowLines.push(line2);
15959
+ }
15960
+ }
15961
+ let trajectoryObj = {};
15962
+ for (let r = 0; r < runDataList.length; r++) {
15963
+ trajectoryObj[r] = runDataList[r];
15964
+ trajectoryObj[r].qx = 0;
15965
+ trajectoryObj[r].qy = 0;
15966
+ trajectoryObj[r].qz = 0;
15967
+ trajectoryObj[r].qw = 0;
15968
+ }
15969
+ await penetratingTask(windowLines, trajectoryObj, collectDataPath, 0.5, "normal", 0.01, dir);
15970
+ for (let i = 0; i < windowLines.length; i++) {
15971
+ let len = 0;
15972
+ for (let u4 = 0; u4 < windowLines[i].checkResults.length; u4++)
15973
+ len += windowLines[i].checkResults[u4].allCenterPoints.length;
15974
+ const allCenterPoints = windowLines[i].allCenterPoints;
15975
+ if (!allCenterPoints || !allCenterPoints.length)
15976
+ continue;
15977
+ let newPoints = [];
15978
+ if (pointCloudCluster != null) {
15979
+ let clusterResult = pointCloudCluster([allCenterPoints], {
15980
+ tolerance: 0.2,
15981
+ minClusterSize: 30,
15982
+ maxClusterSize: 1e7,
15983
+ threadCount: 1
15984
+ });
15985
+ if (clusterResult.length > 0) {
15986
+ let maxNum = 0;
15987
+ for (const cluster of clusterResult[0]) {
15988
+ if (cluster.length < 50) continue;
15989
+ const newOriginalPoints = cluster.map((i2) => allCenterPoints[i2]);
15990
+ if (maxNum < newOriginalPoints.length) {
15991
+ maxNum = newOriginalPoints.length;
15992
+ newPoints = newOriginalPoints;
15993
+ }
15994
+ }
15995
+ } else
15996
+ newPoints = allCenterPoints;
15997
+ } else
15998
+ newPoints = allCenterPoints;
15999
+ let retNum = newPoints.length;
16000
+ let ps = retNum / len * 100;
16001
+ if (ps < 80) {
16002
+ windowLines[i].isRebuild = true;
16003
+ }
16004
+ }
16005
+ return lines;
16006
+ };
15912
16007
  var getWindowPcdData = (lines, pcdData) => {
15913
16008
  if (!lines || !lines.length || !pcdData || !pcdData.length)
15914
16009
  return lines;
@@ -22815,6 +22910,7 @@ export {
22815
22910
  checkBeamIsReasonable,
22816
22911
  checkSwitchSizeIsTrue,
22817
22912
  checkWindowAndDoorIsTrue,
22913
+ checkWindowAndDoorIsTrue2,
22818
22914
  classifyWallByPointCloudPCA,
22819
22915
  processPipeline2 as classifyWallShapes,
22820
22916
  computeContour2 as computeContour,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.144",
3
+ "version": "1.0.146",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",