rm-graphical-computing-node 1.0.59 → 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 +72 -6
  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,
@@ -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
  }
@@ -6026,11 +6053,14 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
6026
6053
  };
6027
6054
  var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, 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(0.5);
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({
@@ -10832,6 +10862,7 @@ function computeContour2(points) {
10832
10862
 
10833
10863
  // src/geometry/slabLine.mjs
10834
10864
  import * as THREE9 from "three";
10865
+ import { min } from "three/tsl";
10835
10866
  var getSlabData = (lines, runDataList, pointCloudCluster = null, getOblique = false) => {
10836
10867
  const flatSlabPoints = [];
10837
10868
  const obliqueSlabPoints = [];
@@ -11073,7 +11104,42 @@ 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 * 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
+ }
11077
11143
  slabDatas.push({
11078
11144
  // points: newPoints[x],
11079
11145
  contour: path3,
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.60",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",