rm-graphical-computing-node 1.0.58 → 1.0.60

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 +80 -9
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -4093,7 +4093,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4093
4093
  let doorTmpEd = tmpRegion.facePoints[1].clone();
4094
4094
  let isExtendBeam = false;
4095
4095
  let findDoorDataIndex = -1;
4096
- if (Math.abs(tmpRegion.facePoints[0].z - line2.start.z) < 0.25) {
4096
+ let doorSill = 0.3;
4097
+ if (Math.abs(tmpRegion.facePoints[0].z - line2.start.z) < doorSill) {
4097
4098
  let isInsert = false;
4098
4099
  for (let k = 0; k < runDataList.length; k++) {
4099
4100
  let next = k + 1;
@@ -4469,7 +4470,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4469
4470
  }
4470
4471
  }
4471
4472
  }
4472
- if (!isPullOutDoor && length2 < 1.5) {
4473
+ if (
4474
+ /**!isPullOutDoor && */
4475
+ length2 < 1.5
4476
+ ) {
4473
4477
  for (let n = 0; n < doorDatas.length; n++) {
4474
4478
  if (doorDatas[n].inWall) continue;
4475
4479
  let doorSt = new THREE5.Vector3(doorDatas[n].doorStartPt.x, doorDatas[n].doorStartPt.y, 0);
@@ -5260,9 +5264,12 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5260
5264
  let newDoorTmpEd = doorTmpEd.clone();
5261
5265
  const nearFloorPoints = [];
5262
5266
  const nearTopPoints = [];
5263
- let topDoorSegLine = new THREE5.Line3(beamTmpSt, beamTmpEd);
5267
+ const nearBottomPoints = [];
5268
+ let topDoorSegLine = new THREE5.Line3(beamTmpSt.clone(), beamTmpEd.clone());
5269
+ let bottomDoorSegLine = new THREE5.Line3(doorTmpSt.clone(), doorTmpEd.clone());
5264
5270
  let tmpTarget33 = new THREE5.Vector3();
5265
5271
  let addHeight = 999999;
5272
+ let downHeight = 999999;
5266
5273
  originalPoints.forEach((point2) => {
5267
5274
  if (point2.z - doorTmpSt.z < height / 2 + 0.1 && point2.z - doorTmpSt.z > height / 2 - 0.1) {
5268
5275
  nearFloorPoints.push(point2);
@@ -5277,6 +5284,16 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5277
5284
  nearTopPoints.push(point2);
5278
5285
  }
5279
5286
  }
5287
+ if (point2.z < doorTmpSt.z) {
5288
+ let ptCloseTmp33 = bottomDoorSegLine.closestPointToPoint(point2, true, tmpTarget33);
5289
+ let tmpVec1 = new THREE5.Vector3().subVectors(ptCloseTmp33, doorTmpSt);
5290
+ let tmpVec2 = new THREE5.Vector3().subVectors(ptCloseTmp33, doorTmpEd);
5291
+ let resP1 = isParallel(doorVector1, tmpVec1);
5292
+ let resP2 = isParallel(doorVector2, tmpVec2);
5293
+ if (resP1 && resP1.parallel && !resP1.sameDirection && resP2 && resP2.parallel && !resP2.sameDirection) {
5294
+ nearBottomPoints.push(point2);
5295
+ }
5296
+ }
5280
5297
  });
5281
5298
  if (nearFloorPoints.length > 0) {
5282
5299
  const { newProjectPoints } = getProjectedPointOnLine(doorTmpSt, doorTmpEd, nearFloorPoints);
@@ -5326,6 +5343,19 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5326
5343
  beamTmpEd.z += addHeight;
5327
5344
  height += addHeight;
5328
5345
  }
5346
+ if (nearBottomPoints.length > 10) {
5347
+ const { newOnLinePoints } = getProjectedPointOnLine(doorTmpSt, doorTmpEd, nearBottomPoints);
5348
+ for (let n = 0; n < newOnLinePoints.length; n++) {
5349
+ let ptCloseTmp33 = bottomDoorSegLine.closestPointToPoint(newOnLinePoints[n], true, tmpTarget33);
5350
+ let add = ptCloseTmp33.distanceTo(newOnLinePoints[n]);
5351
+ if (add > 0.02) {
5352
+ if (downHeight > add)
5353
+ downHeight = add;
5354
+ }
5355
+ }
5356
+ doorTmpSt.z -= downHeight;
5357
+ doorTmpEd.z -= downHeight;
5358
+ }
5329
5359
  return {
5330
5360
  pt1: doorTmpSt,
5331
5361
  pt2: doorTmpEd,
@@ -5629,6 +5659,7 @@ function clonePoint(p) {
5629
5659
 
5630
5660
  // src/geometry/colLine.mjs
5631
5661
  import * as gfx from "rm-gxf-computing-rusts";
5662
+ import { existsSync } from "fs";
5632
5663
  var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster = null) => {
5633
5664
  if (!lines || lines.length <= 0) return;
5634
5665
  let colDatas = {
@@ -5958,7 +5989,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
5958
5989
  colDatas.threeEdgeRect.push(colIndexs);
5959
5990
  }
5960
5991
  }
5961
- if (colDatas.threeEdgeRect) {
5992
+ if (colDatas.threeEdgeRect.length > 0 && existsSync(collectDataPath)) {
5962
5993
  let trajectoryObj = {};
5963
5994
  for (let r = 0; r < runDataList.length; r++) {
5964
5995
  trajectoryObj[r] = runDataList[r];
@@ -6011,6 +6042,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
6011
6042
  newPoints = allCenterPoints;
6012
6043
  let retNum = newPoints.length;
6013
6044
  let ps = retNum / len * 100;
6045
+ console.log(retNum, len, ps);
6014
6046
  if (ps < 60) {
6015
6047
  colDatas.threeEdgeRect[lines2[i].index].isDel = true;
6016
6048
  }
@@ -6021,11 +6053,14 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
6021
6053
  };
6022
6054
  var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, type = "normal", diff = 0.01) => {
6023
6055
  if (!finalLines.length) return finalLines;
6024
- const offsets = [];
6025
- for (let i = 0; i < finalLines[0].checkResults[0].originalVertices.length; i++) {
6026
- offsets.push(0.01);
6056
+ for (let v2 = 0; v2 < finalLines.length; v2++) {
6057
+ for (let i = 0; i < finalLines[v2].checkResults.length; i++) {
6058
+ const offsets = [];
6059
+ for (let t2 = 0; t2 < finalLines[v2].checkResults[i].originalVertices.length; t2++)
6060
+ offsets.push(0.5);
6061
+ finalLines[v2].checkResults[i].offsets = offsets;
6062
+ }
6027
6063
  }
6028
- finalLines[0].checkResults[0].offsets = offsets;
6029
6064
  const t = performance.now();
6030
6065
  const pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
6031
6066
  const floatArray = await gfx.squareBackfacePointCloudTestAsync({
@@ -10827,6 +10862,7 @@ function computeContour2(points) {
10827
10862
 
10828
10863
  // src/geometry/slabLine.mjs
10829
10864
  import * as THREE9 from "three";
10865
+ import { min } from "three/tsl";
10830
10866
  var getSlabData = (lines, runDataList, pointCloudCluster = null, getOblique = false) => {
10831
10867
  const flatSlabPoints = [];
10832
10868
  const obliqueSlabPoints = [];
@@ -11068,7 +11104,42 @@ var getObliqueSlabData = (lines, runDataList, pointCloudCluster = null) => {
11068
11104
  let area2 = calculatePolygonArea(path3);
11069
11105
  if (area2 < 1) continue;
11070
11106
  getPathZ(path3, newPoints[x]);
11071
- const { minZ, maxZ } = getPointsMinAndMax(newPoints[x]);
11107
+ let mapSortPoint = /* @__PURE__ */ new Map();
11108
+ for (let c = 0; c < newPoints[x].length; c++) {
11109
+ let z = newPoints[x][c].z;
11110
+ z = Math.floor(z * 10) / 10;
11111
+ if (mapSortPoint.has(z)) {
11112
+ const item = mapSortPoint.get(z);
11113
+ item.num += 1;
11114
+ item.points.push(newPoints[x][c]);
11115
+ mapSortPoint.set(z, item);
11116
+ } else {
11117
+ mapSortPoint.set(z, { num: 1, points: [newPoints[x][c]] });
11118
+ }
11119
+ }
11120
+ mapSortPoint = new Map(
11121
+ [...mapSortPoint.entries()].sort((a, b) => a[0] - b[0])
11122
+ );
11123
+ let numMax = newPoints[x].length / 10;
11124
+ let minZ = 0;
11125
+ let maxZ = 0;
11126
+ for (const [z, item] of mapSortPoint) {
11127
+ if (item.num > numMax || item.num > 1800) {
11128
+ const ret = getPointsMinAndMax(item.points);
11129
+ minZ = ret.minZ;
11130
+ break;
11131
+ }
11132
+ }
11133
+ mapSortPoint = new Map(
11134
+ [...mapSortPoint].sort((a, b) => b[0] - a[0])
11135
+ );
11136
+ for (const [z, item] of mapSortPoint) {
11137
+ if (item.num > numMax || item.num > 1800) {
11138
+ const ret = getPointsMinAndMax(item.points);
11139
+ maxZ = ret.maxZ;
11140
+ break;
11141
+ }
11142
+ }
11072
11143
  slabDatas.push({
11073
11144
  // points: newPoints[x],
11074
11145
  contour: path3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",