rm-graphical-computing-node 1.0.144 → 1.0.145
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 +90 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9511,7 +9511,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
|
|
|
9511
9511
|
}
|
|
9512
9512
|
return colDatas;
|
|
9513
9513
|
};
|
|
9514
|
-
var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01) => {
|
|
9514
|
+
var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsetsNum = 0.5, type = "normal", diff = 0.01, dir = null) => {
|
|
9515
9515
|
if (!finalLines.length) return finalLines;
|
|
9516
9516
|
for (let v2 = 0; v2 < finalLines.length; v2++) {
|
|
9517
9517
|
for (let i = 0; i < finalLines[v2].checkResults.length; i++) {
|
|
@@ -9522,7 +9522,10 @@ var penetratingTask = async (finalLines, trajectoryObj, collectDataPath, offsets
|
|
|
9522
9522
|
}
|
|
9523
9523
|
}
|
|
9524
9524
|
const t = performance.now();
|
|
9525
|
-
|
|
9525
|
+
let pcdDir = type === "normal" || "res" ? `${collectDataPath}/pcd` : `${collectDataPath}/customData/pcd`;
|
|
9526
|
+
if (dir != null) {
|
|
9527
|
+
pcdDir = `${collectDataPath}/${dir}`;
|
|
9528
|
+
}
|
|
9526
9529
|
const floatArray = await gfx.squareBackfacePointCloudTestAsync({
|
|
9527
9530
|
base: type === "normal" || "res" ? `${collectDataPath}` : `${collectDataPath}/customData`,
|
|
9528
9531
|
lines: finalLines,
|
|
@@ -15909,6 +15912,90 @@ var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, point
|
|
|
15909
15912
|
}
|
|
15910
15913
|
return lines;
|
|
15911
15914
|
};
|
|
15915
|
+
var checkWindowAndDoorIsTrue2 = async (lines, runDataList, collectDataPath, dir, pointCloudCluster = null) => {
|
|
15916
|
+
if (!lines.length)
|
|
15917
|
+
return;
|
|
15918
|
+
const windowLines = [];
|
|
15919
|
+
for (let i = 0; i < lines.length; i++) {
|
|
15920
|
+
const line2 = lines[i];
|
|
15921
|
+
if (line2.drawWindow && line2.drawWindow.length || line2.drawDoorData && line2.drawDoorData.start) {
|
|
15922
|
+
line2.saveExistSegments = true;
|
|
15923
|
+
getOneLineCheckResults(line2, false);
|
|
15924
|
+
let indexs = /* @__PURE__ */ new Set();
|
|
15925
|
+
const drawWindow = line2.drawWindow || [];
|
|
15926
|
+
const direction = getPt3(line2.direction).normalize();
|
|
15927
|
+
let checkResults = { allCenterPoints: [], originalVertices: [] };
|
|
15928
|
+
for (let j = 0; j < drawWindow.length; j++) {
|
|
15929
|
+
let p = getPt3(drawWindow[j].p);
|
|
15930
|
+
let st = p.clone().addScaledVector(direction, drawWindow[j].width / 2);
|
|
15931
|
+
let ed = p.clone().addScaledVector(direction, -drawWindow[j].width / 2);
|
|
15932
|
+
st.z = ed.z = 0;
|
|
15933
|
+
let Line36 = new THREE10.Line3(st, ed);
|
|
15934
|
+
const allCenterPoints = line2.existSegments.allCenterPoints;
|
|
15935
|
+
let minZ = p.z + drawWindow[j].groundClearance;
|
|
15936
|
+
let maxZ = p.z + drawWindow[j].groundClearance + drawWindow[j].height;
|
|
15937
|
+
for (let k = 0; k < allCenterPoints.length; k++) {
|
|
15938
|
+
if (indexs.has(k))
|
|
15939
|
+
continue;
|
|
15940
|
+
let cp = getPt3(allCenterPoints[k]);
|
|
15941
|
+
let originZ = cp.z;
|
|
15942
|
+
cp.z = 0;
|
|
15943
|
+
let isOnLine = isPointOnLine(Line36, cp, 1e-3);
|
|
15944
|
+
if (isOnLine && originZ >= minZ && originZ <= maxZ) {
|
|
15945
|
+
indexs.add(k);
|
|
15946
|
+
}
|
|
15947
|
+
}
|
|
15948
|
+
}
|
|
15949
|
+
for (const idx of indexs) {
|
|
15950
|
+
checkResults.allCenterPoints.push(line2.existSegments.allCenterPoints[idx]);
|
|
15951
|
+
checkResults.originalVertices.push(line2.existSegments.originalVertices[idx]);
|
|
15952
|
+
}
|
|
15953
|
+
line2.checkResults = checkResults;
|
|
15954
|
+
windowLines.push(line2);
|
|
15955
|
+
}
|
|
15956
|
+
}
|
|
15957
|
+
let trajectoryObj = {};
|
|
15958
|
+
for (let r = 0; r < runDataList.length; r++) {
|
|
15959
|
+
trajectoryObj[r] = runDataList[r];
|
|
15960
|
+
}
|
|
15961
|
+
await penetratingTask(windowLines, trajectoryObj, collectDataPath, 1, "normal", 0.01, dir);
|
|
15962
|
+
for (let i = 0; i < windowLines.length; i++) {
|
|
15963
|
+
let len = 0;
|
|
15964
|
+
for (let u4 = 0; u4 < windowLines[i].checkResults.length; u4++)
|
|
15965
|
+
len = windowLines[i].checkResults[u4].allCenterPoints.length;
|
|
15966
|
+
const allCenterPoints = windowLines[i].allCenterPoints;
|
|
15967
|
+
if (!allCenterPoints || !allCenterPoints.length)
|
|
15968
|
+
continue;
|
|
15969
|
+
let newPoints = [];
|
|
15970
|
+
if (pointCloudCluster != null) {
|
|
15971
|
+
let clusterResult = pointCloudCluster([allCenterPoints], {
|
|
15972
|
+
tolerance: 0.2,
|
|
15973
|
+
minClusterSize: 30,
|
|
15974
|
+
maxClusterSize: 1e7,
|
|
15975
|
+
threadCount: 1
|
|
15976
|
+
});
|
|
15977
|
+
if (clusterResult.length > 0) {
|
|
15978
|
+
let maxNum = 0;
|
|
15979
|
+
for (const cluster of clusterResult[0]) {
|
|
15980
|
+
if (cluster.length < 50) continue;
|
|
15981
|
+
const newOriginalPoints = cluster.map((i2) => allCenterPoints[i2]);
|
|
15982
|
+
if (maxNum < newOriginalPoints.length) {
|
|
15983
|
+
maxNum = newOriginalPoints.length;
|
|
15984
|
+
newPoints = newOriginalPoints;
|
|
15985
|
+
}
|
|
15986
|
+
}
|
|
15987
|
+
} else
|
|
15988
|
+
newPoints = allCenterPoints;
|
|
15989
|
+
} else
|
|
15990
|
+
newPoints = allCenterPoints;
|
|
15991
|
+
let retNum = newPoints.length;
|
|
15992
|
+
let ps = retNum / len * 100;
|
|
15993
|
+
if (ps < 60) {
|
|
15994
|
+
windowLines[i].isRebuild = true;
|
|
15995
|
+
}
|
|
15996
|
+
}
|
|
15997
|
+
return lines;
|
|
15998
|
+
};
|
|
15912
15999
|
var getWindowPcdData = (lines, pcdData) => {
|
|
15913
16000
|
if (!lines || !lines.length || !pcdData || !pcdData.length)
|
|
15914
16001
|
return lines;
|
|
@@ -22815,6 +22902,7 @@ export {
|
|
|
22815
22902
|
checkBeamIsReasonable,
|
|
22816
22903
|
checkSwitchSizeIsTrue,
|
|
22817
22904
|
checkWindowAndDoorIsTrue,
|
|
22905
|
+
checkWindowAndDoorIsTrue2,
|
|
22818
22906
|
classifyWallByPointCloudPCA,
|
|
22819
22907
|
processPipeline2 as classifyWallShapes,
|
|
22820
22908
|
computeContour2 as computeContour,
|