rm-graphical-computing-node 1.0.95 → 1.0.97

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 +111 -93
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -9157,6 +9157,69 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9157
9157
  newData.push(...mergeData);
9158
9158
  pcdPointsArr[i].array = newData;
9159
9159
  }
9160
+ if (pointCloudCluster != null) {
9161
+ for (let i = 0; i < pcdPointsArr.length; i++) {
9162
+ let type = pcdPointsArr[i].type;
9163
+ if (type == "floor") continue;
9164
+ let array = pcdPointsArr[i].array;
9165
+ let delArray = /* @__PURE__ */ new Set();
9166
+ let newArray = [];
9167
+ for (let j = 0; j < array.length; j++) {
9168
+ if (delArray.has(j)) continue;
9169
+ let points = array[j].points;
9170
+ let obj_id = array[j].obj_id;
9171
+ let type2 = array[j].type;
9172
+ let averagePz3 = array[j].averagePz;
9173
+ let positionArr = array[j].positionArr;
9174
+ let isStaircaseBalconyRailing = array[j].isStaircaseBalconyRailing;
9175
+ if (points.length < 50)
9176
+ continue;
9177
+ let clusterResult = pointCloudCluster([points], {
9178
+ tolerance: tolerancePointCloudCluster,
9179
+ minClusterSize: 50,
9180
+ maxClusterSize: 1e7,
9181
+ threadCount: 1
9182
+ });
9183
+ let beforeLength = newArray.length;
9184
+ if (clusterResult.length > 0 && clusterResult[0].length > 1) {
9185
+ for (const cluster of clusterResult[0]) {
9186
+ if (cluster.length < 50) continue;
9187
+ const newOriginalPoints = cluster.map((i2) => points[i2]);
9188
+ const centerData = getCenterAndPointHeight(newOriginalPoints);
9189
+ let pathPoints = newOriginalPoints.map((p) => [p.x, p.y]);
9190
+ const data = {
9191
+ points: newOriginalPoints,
9192
+ path: computeContour(pathPoints),
9193
+ h: centerData.h,
9194
+ minz: centerData.minz,
9195
+ maxz: centerData.maxz,
9196
+ center: { x: centerData.x, y: centerData.y, z: centerData.z },
9197
+ type: type2,
9198
+ averagePz: averagePz3,
9199
+ obb: null,
9200
+ obj_id,
9201
+ positionArr,
9202
+ isStaircaseBalconyRailing
9203
+ };
9204
+ data.obb = getObb(data.path, data.center, data.h, (data.maxz + data.minz) / 2);
9205
+ if (data.obb == null) continue;
9206
+ newArray.push(data);
9207
+ }
9208
+ }
9209
+ if (newArray.length != beforeLength) {
9210
+ delArray.add(j);
9211
+ }
9212
+ }
9213
+ if (delArray.size > 0) {
9214
+ for (let j = 0; j < array.length; j++) {
9215
+ if (!delArray.has(j)) {
9216
+ newArray.push(array[j]);
9217
+ }
9218
+ }
9219
+ pcdPointsArr[i].array = newArray;
9220
+ }
9221
+ }
9222
+ }
9160
9223
  for (let i = 0; i < pcdPointsArr.length; i++) {
9161
9224
  const type1 = pcdPointsArr[i].type;
9162
9225
  if (type1 === "people" || type1 === "floor")
@@ -9290,17 +9353,36 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9290
9353
  break;
9291
9354
  }
9292
9355
  } else {
9356
+ const ratio2 = calculateClosePointRatioWithGrid2(array2[k].points, array1[e].points, 0.03, 0.3);
9357
+ if (ratio2 > 0.3) {
9358
+ if (containsObbPoints(obb1, array2[k].points)) {
9359
+ array2[k].isDel = true;
9360
+ continue;
9361
+ }
9362
+ if (containsObbPoints(obb2, array1[e].points)) {
9363
+ array2[k].isDel = true;
9364
+ continue;
9365
+ }
9366
+ if (obb1.intersectsOBB(obb2)) {
9367
+ array2[k].isDel = true;
9368
+ continue;
9369
+ }
9370
+ }
9371
+ }
9372
+ } else if (type2 === "door") {
9373
+ const ratio2 = calculateClosePointRatioWithGrid2(array1[e].points, array2[k].points, 0.03, 0.3);
9374
+ if (ratio2 > 0.3) {
9293
9375
  if (containsObbPoints(obb1, array2[k].points)) {
9294
- array2[k].isDel = true;
9295
- continue;
9376
+ array1[e].isDel = true;
9377
+ break;
9296
9378
  }
9297
9379
  if (containsObbPoints(obb2, array1[e].points)) {
9298
- array2[k].isDel = true;
9299
- continue;
9380
+ array1[e].isDel = true;
9381
+ break;
9300
9382
  }
9301
9383
  if (obb1.intersectsOBB(obb2)) {
9302
- array2[k].isDel = true;
9303
- continue;
9384
+ array1[e].isDel = true;
9385
+ break;
9304
9386
  }
9305
9387
  }
9306
9388
  } else if (type1 === "window sill") {
@@ -9356,19 +9438,6 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9356
9438
  if (type2 === "window sill" && obb1.intersectsOBB(obb2)) {
9357
9439
  continue;
9358
9440
  }
9359
- } else if (type2 === "door") {
9360
- if (containsObbPoints(obb1, array2[k].points)) {
9361
- array1[e].isDel = true;
9362
- break;
9363
- }
9364
- if (containsObbPoints(obb2, array1[e].points)) {
9365
- array1[e].isDel = true;
9366
- break;
9367
- }
9368
- if (obb1.intersectsOBB(obb2)) {
9369
- array1[e].isDel = true;
9370
- break;
9371
- }
9372
9441
  }
9373
9442
  let isMax = false;
9374
9443
  let majorPoints = [];
@@ -9503,69 +9572,6 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9503
9572
  for (let i = 0; i < pcdPointsArr.length; i++) {
9504
9573
  pcdPointsArr[i].array = pcdPointsArr[i].array.filter((item) => !item.isDel);
9505
9574
  }
9506
- if (pointCloudCluster != null) {
9507
- for (let i = 0; i < pcdPointsArr.length; i++) {
9508
- let type = pcdPointsArr[i].type;
9509
- if (type == "floor") continue;
9510
- let array = pcdPointsArr[i].array;
9511
- let delArray = /* @__PURE__ */ new Set();
9512
- let newArray = [];
9513
- for (let j = 0; j < array.length; j++) {
9514
- if (delArray.has(j)) continue;
9515
- let points = array[j].points;
9516
- let obj_id = array[j].obj_id;
9517
- let type2 = array[j].type;
9518
- let averagePz3 = array[j].averagePz;
9519
- let positionArr = array[j].positionArr;
9520
- let isStaircaseBalconyRailing = array[j].isStaircaseBalconyRailing;
9521
- if (points.length < 50)
9522
- continue;
9523
- let clusterResult = pointCloudCluster([points], {
9524
- tolerance: tolerancePointCloudCluster,
9525
- minClusterSize: 50,
9526
- maxClusterSize: 1e7,
9527
- threadCount: 1
9528
- });
9529
- let beforeLength = newArray.length;
9530
- if (clusterResult.length > 0 && clusterResult[0].length > 1) {
9531
- for (const cluster of clusterResult[0]) {
9532
- if (cluster.length < 50) continue;
9533
- const newOriginalPoints = cluster.map((i2) => points[i2]);
9534
- const centerData = getCenterAndPointHeight(newOriginalPoints);
9535
- let pathPoints = newOriginalPoints.map((p) => [p.x, p.y]);
9536
- const data = {
9537
- points: newOriginalPoints,
9538
- path: computeContour(pathPoints),
9539
- h: centerData.h,
9540
- minz: centerData.minz,
9541
- maxz: centerData.maxz,
9542
- center: { x: centerData.x, y: centerData.y, z: centerData.z },
9543
- type: type2,
9544
- averagePz: averagePz3,
9545
- obb: null,
9546
- obj_id,
9547
- positionArr,
9548
- isStaircaseBalconyRailing
9549
- };
9550
- data.obb = getObb(data.path, data.center, data.h, (data.maxz + data.minz) / 2);
9551
- if (data.obb == null) continue;
9552
- newArray.push(data);
9553
- }
9554
- }
9555
- if (newArray.length != beforeLength) {
9556
- delArray.add(j);
9557
- }
9558
- }
9559
- if (delArray.size > 0) {
9560
- for (let j = 0; j < array.length; j++) {
9561
- if (!delArray.has(j)) {
9562
- newArray.push(array[j]);
9563
- }
9564
- }
9565
- pcdPointsArr[i].array = newArray;
9566
- }
9567
- }
9568
- }
9569
9575
  const retPcdPointArr = [];
9570
9576
  for (let i = 0; i < pcdPointsArr.length; i++) {
9571
9577
  const array = pcdPointsArr[i].array;
@@ -11201,6 +11207,7 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
11201
11207
  contour: path3,
11202
11208
  averagePz: averagePz2,
11203
11209
  points: newPoints[u4]
11210
+ // points: retPoints,
11204
11211
  };
11205
11212
  if (newPoints[u4].length > maxPointsNum) {
11206
11213
  maxPointsNum = newPoints[u4].length;
@@ -11219,22 +11226,33 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
11219
11226
  for (let j = 0; j < newSlabDatas.length; j++) {
11220
11227
  if (delIndex.has(j)) continue;
11221
11228
  const slabData1 = newSlabDatas[j];
11229
+ let mergeSlabArray = [slabData1];
11222
11230
  for (let k = 0; k < newSlabDatas.length; k++) {
11223
11231
  if (j == k || delIndex.has(k))
11224
11232
  continue;
11225
11233
  const slabData2 = newSlabDatas[k];
11226
- if (Math.abs(slabData1.averagePz - slabData2.averagePz) > 0.05) continue;
11227
- const isIntersect = contoursIntersect(slabData1.contour, slabData2.contour, 1e-3);
11228
- if (isIntersect) {
11234
+ for (let c = 0; c < mergeSlabArray.length; c++) {
11235
+ const slabData3 = mergeSlabArray[c];
11236
+ if (Math.abs(slabData3.averagePz - slabData2.averagePz) > 0.05) continue;
11237
+ const isIntersect = contoursIntersect(slabData3.contour, slabData2.contour, 1e-3);
11238
+ if (isIntersect) {
11239
+ mergeSlabArray.push(slabData2);
11240
+ delIndex.add(k);
11241
+ k = -1;
11242
+ break;
11243
+ }
11244
+ }
11245
+ }
11246
+ if (mergeSlabArray.length > 1) {
11247
+ for (let c = 1; c < mergeSlabArray.length; c++) {
11248
+ const slabData2 = mergeSlabArray[c];
11229
11249
  for (let b = 0; b < slabData2.points.length; b++)
11230
11250
  slabData1.points.push(slabData2.points[b]);
11231
- let tmpPoints = slabData1.points.map((p) => [p.x, p.y]);
11232
- tmpPoints = voxelDownsample2DForContour(tmpPoints, 0.1);
11233
- let path3 = computeContour(tmpPoints);
11234
- slabData1.contour = path3;
11235
- delIndex.add(k);
11236
- k = -1;
11237
11251
  }
11252
+ let tmpPoints = slabData1.points.map((p) => [p.x, p.y]);
11253
+ tmpPoints = voxelDownsample2DForContour(tmpPoints, 0.2);
11254
+ let path3 = computeContour(tmpPoints);
11255
+ slabData1.contour = path3;
11238
11256
  }
11239
11257
  }
11240
11258
  slabDatas = [];
@@ -11242,8 +11260,8 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
11242
11260
  if (!delIndex.has(j))
11243
11261
  slabDatas.push({
11244
11262
  contour: newSlabDatas[j].contour,
11245
- averagePz: newSlabDatas[j].averagePz
11246
- // points: newSlabDatas[j].points
11263
+ averagePz: newSlabDatas[j].averagePz,
11264
+ points: newSlabDatas[j].points
11247
11265
  });
11248
11266
  }
11249
11267
  return slabDatas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",