rm-graphical-computing-node 1.0.87 → 1.0.89
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 +106 -24
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -4012,10 +4012,11 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4012
4012
|
line2.mergeCheckRegion = allRegion;
|
|
4013
4013
|
}
|
|
4014
4014
|
const doorDatas = [];
|
|
4015
|
+
const doorFrame = [];
|
|
4015
4016
|
for (let i = 0; i < pcdData.length; i++) {
|
|
4016
4017
|
const door = pcdData[i];
|
|
4017
4018
|
door.isFindBeam = false;
|
|
4018
|
-
if (door.category == "door") {
|
|
4019
|
+
if (door.category == "door" || door.category == "door frame") {
|
|
4019
4020
|
let boxPoints = [];
|
|
4020
4021
|
door.coordinatesByArea.coordinates.forEach((p) => {
|
|
4021
4022
|
boxPoints.push(new THREE5.Vector3(p.x, p.y, p.z));
|
|
@@ -4030,17 +4031,31 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4030
4031
|
}
|
|
4031
4032
|
let doorStartPt = getMid(boxPoints[0], boxPoints[3], true);
|
|
4032
4033
|
let doorEndPt = getMid(boxPoints[1], boxPoints[2], true);
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4034
|
+
let vecDoorFrame = new THREE5.Vector3().subVectors(doorEndPt, doorStartPt).normalize();
|
|
4035
|
+
if (door.category == "door") {
|
|
4036
|
+
doorDatas.push({
|
|
4037
|
+
doorStartPt,
|
|
4038
|
+
doorEndPt,
|
|
4039
|
+
boxPoints,
|
|
4040
|
+
minZ: door.coordinatesByArea.heightData.minZ,
|
|
4041
|
+
maxZ: door.coordinatesByArea.heightData.maxZ,
|
|
4042
|
+
index: i,
|
|
4043
|
+
isFind: false,
|
|
4044
|
+
inWall: false
|
|
4045
|
+
//是否在墙内
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4048
|
+
if (door.category == "door frame") {
|
|
4049
|
+
doorFrame.push({
|
|
4050
|
+
doorStartPt,
|
|
4051
|
+
doorEndPt,
|
|
4052
|
+
vecDoorFrame,
|
|
4053
|
+
boxPoints,
|
|
4054
|
+
index: i,
|
|
4055
|
+
minZ: door.coordinatesByArea.heightData.minZ,
|
|
4056
|
+
maxZ: door.coordinatesByArea.heightData.maxZ
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4044
4059
|
}
|
|
4045
4060
|
}
|
|
4046
4061
|
for (let y = 0; y < doorDatas.length; y++) {
|
|
@@ -4600,7 +4615,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4600
4615
|
}
|
|
4601
4616
|
if (
|
|
4602
4617
|
/**!isPullOutDoor && */
|
|
4603
|
-
length2 < 1.
|
|
4618
|
+
length2 < 1.6
|
|
4604
4619
|
) {
|
|
4605
4620
|
for (let n = 0; n < doorDatas.length; n++) {
|
|
4606
4621
|
if (doorDatas[n].inWall) continue;
|
|
@@ -4885,6 +4900,74 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4885
4900
|
}
|
|
4886
4901
|
doorAndBeamDataObj.type = dataType;
|
|
4887
4902
|
doorAndBeamDataObj.wallBelowBeam = wallBelowBeam;
|
|
4903
|
+
if (doorFrame && doorFrame.length > 0) {
|
|
4904
|
+
let doorLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
4905
|
+
let lineStart2 = getPt3(line2.start);
|
|
4906
|
+
let lineEnd2 = getPt3(line2.end);
|
|
4907
|
+
const pcdToLineDist = 0.1;
|
|
4908
|
+
for (let x = 0; x < doorFrame.length; x++) {
|
|
4909
|
+
const ptArray = doorFrame[x].boxPoints;
|
|
4910
|
+
const doorFrameStart = getPt3(doorFrame[x].doorStartPt);
|
|
4911
|
+
const doorFrameEnd = getPt3(doorFrame[x].doorEndPt);
|
|
4912
|
+
doorFrameStart.z = doorFrameEnd.z = doorTmpSt.z;
|
|
4913
|
+
let doorFrameLen = doorFrameStart.distanceTo(doorFrameEnd);
|
|
4914
|
+
if (Math.abs(doorFrameLen - doorLen) > 0.5) continue;
|
|
4915
|
+
let result = getParallelism(doorFrameStart, doorFrameEnd, doorTmpSt, doorTmpEd);
|
|
4916
|
+
if (result && result.angleDeg < 15) {
|
|
4917
|
+
let ptLongSt1 = getPt3(ptArray[0]);
|
|
4918
|
+
let ptLongEd1 = getPt3(ptArray[1]);
|
|
4919
|
+
let ptLongSt2 = getPt3(ptArray[2]);
|
|
4920
|
+
let ptLongEd2 = getPt3(ptArray[3]);
|
|
4921
|
+
let ptShortSt1 = getPt3(ptArray[1]);
|
|
4922
|
+
let ptShortEd1 = getPt3(ptArray[2]);
|
|
4923
|
+
let ptShortSt2 = getPt3(ptArray[3]);
|
|
4924
|
+
let ptShortEd2 = getPt3(ptArray[0]);
|
|
4925
|
+
if (ptLongSt1.distanceTo(ptLongEd1) < ptLongSt1.distanceTo(ptLongEd2)) {
|
|
4926
|
+
ptLongSt1 = getPt3(ptArray[1]);
|
|
4927
|
+
ptLongEd1 = getPt3(ptArray[2]);
|
|
4928
|
+
ptLongSt2 = getPt3(ptArray[3]);
|
|
4929
|
+
ptLongEd2 = getPt3(ptArray[0]);
|
|
4930
|
+
ptShortSt1 = getPt3(ptArray[0]);
|
|
4931
|
+
ptShortEd1 = getPt3(ptArray[1]);
|
|
4932
|
+
ptShortSt2 = getPt3(ptArray[2]);
|
|
4933
|
+
ptShortEd2 = getPt3(ptArray[3]);
|
|
4934
|
+
}
|
|
4935
|
+
let vec1 = getVector3(lineStart2, lineEnd2);
|
|
4936
|
+
let vec2 = getVector3(ptShortSt1, ptShortEd1);
|
|
4937
|
+
let vec32 = getVector3(ptShortSt2, ptShortEd2);
|
|
4938
|
+
let tmpPtStart = lineStart2.clone().addScaledVector(vec1, -pcdToLineDist);
|
|
4939
|
+
let tmpPtEnd = lineEnd2.clone().addScaledVector(vec1, pcdToLineDist);
|
|
4940
|
+
let tmpPtShortSt1 = ptShortSt1.clone().addScaledVector(vec2, -pcdToLineDist);
|
|
4941
|
+
let tmpPtShortEd1 = ptShortEd1.clone().addScaledVector(vec2, pcdToLineDist);
|
|
4942
|
+
let tmpPtShortSt2 = ptShortSt2.clone().addScaledVector(vec32, -pcdToLineDist);
|
|
4943
|
+
let tmpPtShortEd2 = ptShortEd2.clone().addScaledVector(vec32, pcdToLineDist);
|
|
4944
|
+
let intersect1 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt1, tmpPtShortEd1, pcdToLineDist);
|
|
4945
|
+
let intersect2 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt2, tmpPtShortEd2, pcdToLineDist);
|
|
4946
|
+
if (intersect1 != null && intersect2 != null) {
|
|
4947
|
+
const ptIntersect1 = intersect1.point;
|
|
4948
|
+
const ptIntersect2 = intersect2.point;
|
|
4949
|
+
let ptOnLine1 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpSt, 1e-3, true);
|
|
4950
|
+
let ptOnLine2 = isPointOnLine2(ptIntersect1, ptIntersect2, doorTmpEd, 1e-3, true);
|
|
4951
|
+
if (ptOnLine1 && ptOnLine2) {
|
|
4952
|
+
let originZ = doorTmpSt.z;
|
|
4953
|
+
doorTmpSt = ptIntersect1.clone();
|
|
4954
|
+
doorTmpEd = ptIntersect2.clone();
|
|
4955
|
+
doorTmpSt.z = doorTmpEd.z = originZ;
|
|
4956
|
+
doorAndBeamDataObj.doorStart = doorTmpSt.clone();
|
|
4957
|
+
doorAndBeamDataObj.doorEnd = doorTmpEd.clone();
|
|
4958
|
+
doorAndBeamDataObj.doorHeight = doorFrame[x].maxZ - doorAndBeamDataObj.doorStart.z;
|
|
4959
|
+
doorAndBeamDataObj.beamStart = doorTmpSt.clone();
|
|
4960
|
+
doorAndBeamDataObj.beamEnd = doorTmpEd.clone();
|
|
4961
|
+
doorAndBeamDataObj.beamStart.z = doorAndBeamDataObj.beamEnd.z = doorAndBeamDataObj.doorStart.z + doorAndBeamDataObj.doorHeight;
|
|
4962
|
+
doorAndBeamDataObj.beamHeight = line2.rooftopPz - doorAndBeamDataObj.beamStart.z;
|
|
4963
|
+
if (doorAndBeamDataObj.type != "door")
|
|
4964
|
+
doorAndBeamDataObj.type = "door";
|
|
4965
|
+
break;
|
|
4966
|
+
}
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4888
4971
|
for (let w2 = 0; w2 < doorBeamDataIndex.length; w2++) {
|
|
4889
4972
|
const tmpDoorBeamData = lines[doorBeamDataIndex[w2].linesIndex].doorAndBeamData[doorBeamDataIndex[w2].doorIndex];
|
|
4890
4973
|
if (tmpDoorBeamData.nearId != -1)
|
|
@@ -9116,7 +9199,7 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9116
9199
|
const f1 = calculateClosePointWithOBB(array2[k].points, obb1);
|
|
9117
9200
|
const f2 = calculateClosePointWithOBB(array1[e].points, obb2);
|
|
9118
9201
|
const isMaxBox = compareBoxVolume(obb1, obb2);
|
|
9119
|
-
if (type1 !== "wall" && type1 !== "floor" && type1 !== "roof") {
|
|
9202
|
+
if (type1 !== "wall" && type1 !== "floor" && type1 !== "roof" && type1 != "door frame" && type2 != "door frame") {
|
|
9120
9203
|
if (type1 === "window") {
|
|
9121
9204
|
const size1 = new THREE8.Vector3();
|
|
9122
9205
|
obb1.getSize(size1);
|
|
@@ -12586,7 +12669,6 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
12586
12669
|
let tmpPtShortEd2 = ptShortEd2.clone().addScaledVector(vec32, pcdToLineDist);
|
|
12587
12670
|
let intersect1 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt1, tmpPtShortEd1, pcdToLineDist);
|
|
12588
12671
|
let intersect2 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt2, tmpPtShortEd2, pcdToLineDist);
|
|
12589
|
-
console.log(intersect1, intersect2);
|
|
12590
12672
|
let newDoorSt = null;
|
|
12591
12673
|
let newDoorEd = null;
|
|
12592
12674
|
let doorAddGroundClearance = 0;
|
|
@@ -12665,11 +12747,11 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
12665
12747
|
isRebuild: false,
|
|
12666
12748
|
direction: line2.direction
|
|
12667
12749
|
};
|
|
12668
|
-
if (newLine1.originalPoints.length >
|
|
12750
|
+
if (newLine1.originalPoints.length > 10 && newLine1.length > 0.01)
|
|
12669
12751
|
lines.push(newLine1);
|
|
12670
|
-
if (newLine2.originalPoints.length >
|
|
12752
|
+
if (newLine2.originalPoints.length > 10 && newLine2.length > 0.01)
|
|
12671
12753
|
lines.push(newLine2);
|
|
12672
|
-
if (newLine3.originalPoints.length >
|
|
12754
|
+
if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
|
|
12673
12755
|
lines.push(newLine3);
|
|
12674
12756
|
pcd.isFindDoor = true;
|
|
12675
12757
|
line2.isRebuild = true;
|
|
@@ -12765,11 +12847,11 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
12765
12847
|
isRebuild: false,
|
|
12766
12848
|
direction: line2.direction
|
|
12767
12849
|
};
|
|
12768
|
-
if (newLine1.originalPoints.length >
|
|
12850
|
+
if (newLine1.originalPoints.length > 10 && newLine1.length > 0.01)
|
|
12769
12851
|
lines.push(newLine1);
|
|
12770
|
-
if (newLine2.originalPoints.length >
|
|
12852
|
+
if (newLine2.originalPoints.length > 10 && newLine2.length > 0.01)
|
|
12771
12853
|
lines.push(newLine2);
|
|
12772
|
-
if (newLine3.originalPoints.length >
|
|
12854
|
+
if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
|
|
12773
12855
|
lines.push(newLine3);
|
|
12774
12856
|
pcd.isFindDoor = true;
|
|
12775
12857
|
line2.isRebuild = true;
|
|
@@ -12859,11 +12941,11 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
12859
12941
|
isRebuild: false,
|
|
12860
12942
|
direction: lineTmp.direction
|
|
12861
12943
|
};
|
|
12862
|
-
if (newLine1.originalPoints.length >
|
|
12944
|
+
if (newLine1.originalPoints.length > 10 && newLine1.length > 0.01)
|
|
12863
12945
|
lines.push(newLine1);
|
|
12864
|
-
if (newLine2.originalPoints.length >
|
|
12946
|
+
if (newLine2.originalPoints.length > 10 && newLine2.length > 0.01)
|
|
12865
12947
|
lines.push(newLine2);
|
|
12866
|
-
if (newLine3.originalPoints.length >
|
|
12948
|
+
if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
|
|
12867
12949
|
lines.push(newLine3);
|
|
12868
12950
|
lineTmp.isRebuild = true;
|
|
12869
12951
|
isFind = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rm-graphical-computing-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.89",
|
|
4
4
|
"description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -20,10 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"d3-delaunay": "^6.0.4",
|
|
22
22
|
"geojson-minimum-bounding-rectangle": "^2.0.3",
|
|
23
|
-
"rm-graphical-computing-node": "^1.0.
|
|
23
|
+
"rm-graphical-computing-node": "^1.0.88",
|
|
24
24
|
"rm-gxf-computing-rusts": "^0.0.61",
|
|
25
25
|
"rm-point-cloud-calculation": "^1.0.4",
|
|
26
|
-
"rm-point-cloud-calculation-napi": "^1.0.9",
|
|
27
26
|
"three": "^0.184.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|