rm-graphical-computing-node 1.0.59 → 1.0.61

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 +81 -12
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5264,9 +5264,12 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5264
5264
  let newDoorTmpEd = doorTmpEd.clone();
5265
5265
  const nearFloorPoints = [];
5266
5266
  const nearTopPoints = [];
5267
- 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());
5268
5270
  let tmpTarget33 = new THREE5.Vector3();
5269
5271
  let addHeight = 999999;
5272
+ let downHeight = 999999;
5270
5273
  originalPoints.forEach((point2) => {
5271
5274
  if (point2.z - doorTmpSt.z < height / 2 + 0.1 && point2.z - doorTmpSt.z > height / 2 - 0.1) {
5272
5275
  nearFloorPoints.push(point2);
@@ -5281,6 +5284,16 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5281
5284
  nearTopPoints.push(point2);
5282
5285
  }
5283
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
+ }
5284
5297
  });
5285
5298
  if (nearFloorPoints.length > 0) {
5286
5299
  const { newProjectPoints } = getProjectedPointOnLine(doorTmpSt, doorTmpEd, nearFloorPoints);
@@ -5330,6 +5343,19 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
5330
5343
  beamTmpEd.z += addHeight;
5331
5344
  height += addHeight;
5332
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
+ }
5333
5359
  return {
5334
5360
  pt1: doorTmpSt,
5335
5361
  pt2: doorTmpEd,
@@ -5988,7 +6014,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
5988
6014
  if (tmpLineData.checkResults.length != 1) continue;
5989
6015
  lines2.push(tmpLineData);
5990
6016
  }
5991
- await penetratingTask(lines2, trajectoryObj, collectDataPath);
6017
+ await penetratingTask(lines2, trajectoryObj, collectDataPath, 0.5);
5992
6018
  for (let i = 0; i < lines2.length; i++) {
5993
6019
  let len = lines2[i].checkResults[0].allCenterPoints.length;
5994
6020
  const allCenterPoints = lines2[i].allCenterPoints;
@@ -6016,6 +6042,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
6016
6042
  newPoints = allCenterPoints;
6017
6043
  let retNum = newPoints.length;
6018
6044
  let ps = retNum / len * 100;
6045
+ console.log(retNum, len, ps);
6019
6046
  if (ps < 60) {
6020
6047
  colDatas.threeEdgeRect[lines2[i].index].isDel = true;
6021
6048
  }
@@ -6024,13 +6051,16 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
6024
6051
  }
6025
6052
  return colDatas;
6026
6053
  };
6027
- var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, type = "normal", diff = 0.01) => {
6054
+ var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01) => {
6028
6055
  if (!finalLines.length) return finalLines;
6029
- const offsets = [];
6030
- for (let i = 0; i < finalLines[0].checkResults[0].originalVertices.length; i++) {
6031
- 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(offsetsNum);
6061
+ finalLines[v2].checkResults[i].offsets = offsets;
6062
+ }
6032
6063
  }
6033
- finalLines[0].checkResults[0].offsets = offsets;
6034
6064
  const t = performance.now();
6035
6065
  const pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
6036
6066
  const floatArray = await gfx.squareBackfacePointCloudTestAsync({
@@ -8751,7 +8781,7 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
8751
8781
  }
8752
8782
  }
8753
8783
  let mostFrequentEntry = [...mapSortPoint.entries()].reduce(
8754
- (max, cur) => cur[1].num > max[1].num ? cur : max
8784
+ (max2, cur) => cur[1].num > max2[1].num ? cur : max2
8755
8785
  );
8756
8786
  points = [];
8757
8787
  points = mostFrequentEntry[1].points.map((p) => [p.x, p.y]);
@@ -9340,7 +9370,7 @@ var getMergeFloorMeaning = (allProjectionResults) => {
9340
9370
  }
9341
9371
  }
9342
9372
  let mostFrequentEntry = [...mapSortPoint.entries()].reduce(
9343
- (max, cur) => cur[1].num > max[1].num ? cur : max
9373
+ (max2, cur) => cur[1].num > max2[1].num ? cur : max2
9344
9374
  );
9345
9375
  points = [];
9346
9376
  points = mostFrequentEntry[1].points.map((p) => [p.x, p.y]);
@@ -10832,6 +10862,7 @@ function computeContour2(points) {
10832
10862
 
10833
10863
  // src/geometry/slabLine.mjs
10834
10864
  import * as THREE9 from "three";
10865
+ import { max, min } from "three/tsl";
10835
10866
  var getSlabData = (lines, runDataList, pointCloudCluster = null, getOblique = false) => {
10836
10867
  const flatSlabPoints = [];
10837
10868
  const obliqueSlabPoints = [];
@@ -10884,7 +10915,7 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
10884
10915
  }
10885
10916
  }
10886
10917
  let mostFrequentEntry = [...mapSortPoint.entries()].reduce(
10887
- (max, cur) => cur[1].num > max[1].num ? cur : max
10918
+ (max2, cur) => cur[1].num > max2[1].num ? cur : max2
10888
10919
  );
10889
10920
  points = mostFrequentEntry[1].points.map((p) => new THREE9.Vector3(p.x, p.y, p.z));
10890
10921
  let newPoints = [];
@@ -11073,9 +11104,47 @@ var getObliqueSlabData = (lines, runDataList, pointCloudCluster = null) => {
11073
11104
  let area2 = calculatePolygonArea(path3);
11074
11105
  if (area2 < 1) continue;
11075
11106
  getPathZ(path3, newPoints[x]);
11076
- 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 * 1e3) / 1e3;
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 > 100) {
11128
+ minZ = z;
11129
+ break;
11130
+ }
11131
+ }
11132
+ mapSortPoint = new Map(
11133
+ [...mapSortPoint].sort((a, b) => b[0] - a[0])
11134
+ );
11135
+ for (const [z, item] of mapSortPoint) {
11136
+ if (item.num > numMax || item.num > 100) {
11137
+ maxZ = z;
11138
+ break;
11139
+ }
11140
+ }
11141
+ if (minZ == 0 || maxZ == 0) {
11142
+ const ret = getPointsMinAndMax(newPoints[x]);
11143
+ minZ = minZ == 0 ? ret.minZ : minZ;
11144
+ maxZ = maxZ == 0 ? ret.maxZ : maxZ;
11145
+ }
11077
11146
  slabDatas.push({
11078
- // points: newPoints[x],
11147
+ points: newPoints[x],
11079
11148
  contour: path3,
11080
11149
  minZ,
11081
11150
  maxZ,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",