rm-graphical-computing-node 1.0.56 → 1.0.58
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.
- package/dist/index.mjs +98 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5629,7 +5629,7 @@ function clonePoint(p) {
|
|
|
5629
5629
|
|
|
5630
5630
|
// src/geometry/colLine.mjs
|
|
5631
5631
|
import * as gfx from "rm-gxf-computing-rusts";
|
|
5632
|
-
var getColLine = (lines, runDataList, collectDataPath, pointCloudCluster = null) => {
|
|
5632
|
+
var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster = null) => {
|
|
5633
5633
|
if (!lines || lines.length <= 0) return;
|
|
5634
5634
|
let colDatas = {
|
|
5635
5635
|
rectangles: [],
|
|
@@ -5958,8 +5958,105 @@ var getColLine = (lines, runDataList, collectDataPath, pointCloudCluster = null)
|
|
|
5958
5958
|
colDatas.threeEdgeRect.push(colIndexs);
|
|
5959
5959
|
}
|
|
5960
5960
|
}
|
|
5961
|
+
if (colDatas.threeEdgeRect) {
|
|
5962
|
+
let trajectoryObj = {};
|
|
5963
|
+
for (let r = 0; r < runDataList.length; r++) {
|
|
5964
|
+
trajectoryObj[r] = runDataList[r];
|
|
5965
|
+
}
|
|
5966
|
+
let lines2 = [];
|
|
5967
|
+
for (let i = 0; i < colDatas.threeEdgeRect.length; i++) {
|
|
5968
|
+
const data = colDatas.threeEdgeRect[i];
|
|
5969
|
+
const start = data.missingEdge.start;
|
|
5970
|
+
const end = data.missingEdge.end;
|
|
5971
|
+
const direction = new THREE6.Vector3().subVectors(end, start).normalize();
|
|
5972
|
+
let tmpLineData = {
|
|
5973
|
+
checkResults: [],
|
|
5974
|
+
direction,
|
|
5975
|
+
start,
|
|
5976
|
+
end,
|
|
5977
|
+
rooftopPz: data.rooftopPz,
|
|
5978
|
+
originalPoints: [],
|
|
5979
|
+
length: start.distanceTo(end),
|
|
5980
|
+
index: i
|
|
5981
|
+
};
|
|
5982
|
+
getOneLineCheckResults(tmpLineData);
|
|
5983
|
+
if (tmpLineData.checkResults.length != 1) continue;
|
|
5984
|
+
lines2.push(tmpLineData);
|
|
5985
|
+
}
|
|
5986
|
+
await penetratingTask(lines2, trajectoryObj, collectDataPath);
|
|
5987
|
+
for (let i = 0; i < lines2.length; i++) {
|
|
5988
|
+
let len = lines2[i].checkResults[0].allCenterPoints.length;
|
|
5989
|
+
const allCenterPoints = lines2[i].allCenterPoints;
|
|
5990
|
+
let newPoints = [];
|
|
5991
|
+
if (pointCloudCluster != null) {
|
|
5992
|
+
let clusterResult = pointCloudCluster([allCenterPoints], {
|
|
5993
|
+
tolerance: 0.1,
|
|
5994
|
+
minClusterSize: 30,
|
|
5995
|
+
maxClusterSize: 1e7,
|
|
5996
|
+
threadCount: 1
|
|
5997
|
+
});
|
|
5998
|
+
if (clusterResult.length > 0) {
|
|
5999
|
+
let maxNum = 0;
|
|
6000
|
+
for (const cluster of clusterResult[0]) {
|
|
6001
|
+
if (cluster.length < 50) continue;
|
|
6002
|
+
const newOriginalPoints = cluster.map((i2) => allCenterPoints[i2]);
|
|
6003
|
+
if (maxNum < newOriginalPoints.length) {
|
|
6004
|
+
maxNum = newOriginalPoints.length;
|
|
6005
|
+
newPoints = newOriginalPoints;
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
6008
|
+
} else
|
|
6009
|
+
newPoints = allCenterPoints;
|
|
6010
|
+
} else
|
|
6011
|
+
newPoints = allCenterPoints;
|
|
6012
|
+
let retNum = newPoints.length;
|
|
6013
|
+
let ps = retNum / len * 100;
|
|
6014
|
+
if (ps < 60) {
|
|
6015
|
+
colDatas.threeEdgeRect[lines2[i].index].isDel = true;
|
|
6016
|
+
}
|
|
6017
|
+
}
|
|
6018
|
+
colDatas.threeEdgeRect = colDatas.threeEdgeRect.filter((p) => !p.isDel);
|
|
6019
|
+
}
|
|
5961
6020
|
return colDatas;
|
|
5962
6021
|
};
|
|
6022
|
+
var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, type = "normal", diff = 0.01) => {
|
|
6023
|
+
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);
|
|
6027
|
+
}
|
|
6028
|
+
finalLines[0].checkResults[0].offsets = offsets;
|
|
6029
|
+
const t = performance.now();
|
|
6030
|
+
const pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
|
|
6031
|
+
const floatArray = await gfx.squareBackfacePointCloudTestAsync({
|
|
6032
|
+
base: type === "normal" || "res" ? `${collectDataPath}` : `${collectDataPath}/customData`,
|
|
6033
|
+
lines: finalLines,
|
|
6034
|
+
trajectorys: trajectoryObj,
|
|
6035
|
+
pcdDir,
|
|
6036
|
+
distProjection: false,
|
|
6037
|
+
view: false
|
|
6038
|
+
});
|
|
6039
|
+
console.log("\u6D88\u8017\u65F6\u95F4\uFF1A", performance.now() - t, "ms");
|
|
6040
|
+
const data = floatArray;
|
|
6041
|
+
finalLines.forEach((line2) => {
|
|
6042
|
+
line2.allNewPoints = [];
|
|
6043
|
+
line2.allNewSegments = [];
|
|
6044
|
+
});
|
|
6045
|
+
for (let n = 0; n < data.length; n += 4) {
|
|
6046
|
+
const i = data[n];
|
|
6047
|
+
const j = data[n + 1];
|
|
6048
|
+
const k = data[n + 2];
|
|
6049
|
+
const l = data[n + 3];
|
|
6050
|
+
const line2 = finalLines[i];
|
|
6051
|
+
const item = line2.checkResults[j];
|
|
6052
|
+
const vertices = item.originalVertices[k];
|
|
6053
|
+
const center = item.allCenterPoints[k];
|
|
6054
|
+
if (!line2.allCenterPoints)
|
|
6055
|
+
line2.allCenterPoints = [center];
|
|
6056
|
+
else
|
|
6057
|
+
line2.allCenterPoints.push(center);
|
|
6058
|
+
}
|
|
6059
|
+
};
|
|
5963
6060
|
|
|
5964
6061
|
// src/pointCloudProcessing/mergeMeaning.mjs
|
|
5965
6062
|
import * as THREE8 from "three";
|