rm-graphical-computing-node 1.0.84 → 1.0.86
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 +138 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5812,8 +5812,26 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
|
|
|
5812
5812
|
y: p.y
|
|
5813
5813
|
})
|
|
5814
5814
|
});
|
|
5815
|
+
function lineSkip(line2) {
|
|
5816
|
+
if (!line2 || line2.isDoor || line2.doorAndBeamData && line2.doorAndBeamData.length > 0 || line2.drawWindow && line2.drawWindow.length > 0 || line2.isHoleWindow)
|
|
5817
|
+
return true;
|
|
5818
|
+
return false;
|
|
5819
|
+
}
|
|
5815
5820
|
for (let i = 0; i < result.length; i++) {
|
|
5816
|
-
|
|
5821
|
+
result[i].isSkip = false;
|
|
5822
|
+
if (result[i].uuids.length < 4 || result[i].area < minArea || result[i].area > maxArea) {
|
|
5823
|
+
result[i].isSkip = true;
|
|
5824
|
+
continue;
|
|
5825
|
+
}
|
|
5826
|
+
for (let j = 0; j < result[i].lineIndexes.length; j++) {
|
|
5827
|
+
if (lineSkip(lines[result[i].lineIndexes[j]])) {
|
|
5828
|
+
result[i].isSkip = true;
|
|
5829
|
+
break;
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
for (let i = 0; i < result.length; i++) {
|
|
5834
|
+
if (result[i].isSkip)
|
|
5817
5835
|
continue;
|
|
5818
5836
|
let isRect = false;
|
|
5819
5837
|
let overlapWallLines = [];
|
|
@@ -6134,7 +6152,7 @@ var getColLine = async (lines, runDataList, collectDataPath, pointCloudCluster =
|
|
|
6134
6152
|
if (tmpLineData.checkResults.length != 1) continue;
|
|
6135
6153
|
lines2.push(tmpLineData);
|
|
6136
6154
|
}
|
|
6137
|
-
await penetratingTask(lines2, trajectoryObj, collectDataPath, 0.
|
|
6155
|
+
await penetratingTask(lines2, trajectoryObj, collectDataPath, 0.3);
|
|
6138
6156
|
for (let i = 0; i < lines2.length; i++) {
|
|
6139
6157
|
let len = lines2[i].checkResults[0].allCenterPoints.length;
|
|
6140
6158
|
const allCenterPoints = lines2[i].allCenterPoints;
|
|
@@ -12484,7 +12502,7 @@ var getWindowPcdData = (lines, pcdData) => {
|
|
|
12484
12502
|
// src/geometry/door.mjs
|
|
12485
12503
|
import * as THREE11 from "three";
|
|
12486
12504
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
12487
|
-
var getDoorPcdData = (lines, pcdData) => {
|
|
12505
|
+
var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
12488
12506
|
if (!lines || !lines.length || !pcdData || !pcdData.length)
|
|
12489
12507
|
return lines;
|
|
12490
12508
|
const pcdToLineDist = 0.1;
|
|
@@ -12557,8 +12575,21 @@ var getDoorPcdData = (lines, pcdData) => {
|
|
|
12557
12575
|
const line2 = tmpLines[maxIndex];
|
|
12558
12576
|
let ptStart = getPt3(line2.start);
|
|
12559
12577
|
let ptEnd = getPt3(line2.end);
|
|
12560
|
-
let
|
|
12561
|
-
let
|
|
12578
|
+
let vec1 = getVector3(ptStart, ptEnd);
|
|
12579
|
+
let vec2 = getVector3(ptShortSt1, ptShortEd1);
|
|
12580
|
+
let vec32 = getVector3(ptShortSt2, ptShortEd2);
|
|
12581
|
+
let tmpPtStart = ptStart.clone().addScaledVector(vec1, -pcdToLineDist);
|
|
12582
|
+
let tmpPtEnd = ptEnd.clone().addScaledVector(vec1, pcdToLineDist);
|
|
12583
|
+
let tmpPtShortSt1 = ptShortSt1.clone().addScaledVector(vec2, -pcdToLineDist);
|
|
12584
|
+
let tmpPtShortEd1 = ptShortEd1.clone().addScaledVector(vec2, pcdToLineDist);
|
|
12585
|
+
let tmpPtShortSt2 = ptShortSt2.clone().addScaledVector(vec32, -pcdToLineDist);
|
|
12586
|
+
let tmpPtShortEd2 = ptShortEd2.clone().addScaledVector(vec32, pcdToLineDist);
|
|
12587
|
+
let intersect1 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt1, tmpPtShortEd1, pcdToLineDist);
|
|
12588
|
+
let intersect2 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt2, tmpPtShortEd2, pcdToLineDist);
|
|
12589
|
+
console.log(intersect1, intersect2);
|
|
12590
|
+
let newDoorSt = null;
|
|
12591
|
+
let newDoorEd = null;
|
|
12592
|
+
let doorAddGroundClearance = 0;
|
|
12562
12593
|
if (intersect1 != null && intersect2 != null) {
|
|
12563
12594
|
if (line2.mergeIndexs) {
|
|
12564
12595
|
let tmpIndex = [];
|
|
@@ -12592,6 +12623,7 @@ var getDoorPcdData = (lines, pcdData) => {
|
|
|
12592
12623
|
}
|
|
12593
12624
|
let groundClearance = minZ - line2.start.z;
|
|
12594
12625
|
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12626
|
+
doorAddGroundClearance = line2.start.z + groundClearance;
|
|
12595
12627
|
let newLine1 = {
|
|
12596
12628
|
start: ptStart,
|
|
12597
12629
|
end: ptDoorSt,
|
|
@@ -12641,6 +12673,8 @@ var getDoorPcdData = (lines, pcdData) => {
|
|
|
12641
12673
|
lines.push(newLine3);
|
|
12642
12674
|
pcd.isFindDoor = true;
|
|
12643
12675
|
line2.isRebuild = true;
|
|
12676
|
+
newDoorSt = newLine2.drawDoorData.start.clone();
|
|
12677
|
+
newDoorEd = newLine2.drawDoorData.end.clone();
|
|
12644
12678
|
} else if (intersect1 == null && intersect2 == null) {
|
|
12645
12679
|
ptShortSt1.z = ptShortEd1.z = ptShortSt2.z = ptShortEd2.z = line2.start.z;
|
|
12646
12680
|
let shortLine1 = new THREE11.Line3(ptShortSt1, ptShortEd1);
|
|
@@ -12689,6 +12723,7 @@ var getDoorPcdData = (lines, pcdData) => {
|
|
|
12689
12723
|
}
|
|
12690
12724
|
let groundClearance = minZ - line2.start.z;
|
|
12691
12725
|
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12726
|
+
doorAddGroundClearance = line2.start.z + groundClearance;
|
|
12692
12727
|
let newLine1 = {
|
|
12693
12728
|
start: ptStart,
|
|
12694
12729
|
end: ptDoorSt,
|
|
@@ -12738,6 +12773,104 @@ var getDoorPcdData = (lines, pcdData) => {
|
|
|
12738
12773
|
lines.push(newLine3);
|
|
12739
12774
|
pcd.isFindDoor = true;
|
|
12740
12775
|
line2.isRebuild = true;
|
|
12776
|
+
newDoorSt = newLine2.drawDoorData.start.clone();
|
|
12777
|
+
newDoorEd = newLine2.drawDoorData.end.clone();
|
|
12778
|
+
}
|
|
12779
|
+
}
|
|
12780
|
+
if (newDoorSt != null && newDoorEd != null && needFindOtherDoor) {
|
|
12781
|
+
const newDoorLength = newDoorSt.distanceTo(newDoorEd);
|
|
12782
|
+
let isFind = false;
|
|
12783
|
+
for (let u4 = 0; u4 < lines.length; u4++) {
|
|
12784
|
+
const lineTmp = lines[u4];
|
|
12785
|
+
let ptLineSt = getPt3(lineTmp.start);
|
|
12786
|
+
let ptLineEd = getPt3(lineTmp.end);
|
|
12787
|
+
let line3 = new THREE11.Line3(ptLineSt, ptLineEd);
|
|
12788
|
+
if (!lineTmp || lineTmp.isRebuild || !lineTmp.doorAndBeamData || lineTmp.doorAndBeamData.length <= 0)
|
|
12789
|
+
continue;
|
|
12790
|
+
for (let w = 0; w < lineTmp.doorAndBeamData.length; w++) {
|
|
12791
|
+
const oldDoorData = lineTmp.doorAndBeamData[w];
|
|
12792
|
+
const doorStart = getPt3(oldDoorData.doorStart);
|
|
12793
|
+
const doorEnd = getPt3(oldDoorData.doorEnd);
|
|
12794
|
+
doorStart.z = doorEnd.z = newDoorSt.z;
|
|
12795
|
+
let classify = classifySegments(newDoorSt, newDoorEd, doorStart, doorEnd);
|
|
12796
|
+
if (classify && classify.type == "collinear_overlap" && classify.maxPerpendicularDistance < 0.3 && Math.abs(classify.overlap - newDoorLength) < 0.15) {
|
|
12797
|
+
let originDoorZ = newDoorSt.z;
|
|
12798
|
+
newDoorSt.z = newDoorEd.z = ptLineSt.z;
|
|
12799
|
+
let ptNewDoorSt = line3.closestPointToPoint(newDoorSt, false, new THREE11.Vector3());
|
|
12800
|
+
let ptNewDoorEd = line3.closestPointToPoint(newDoorEd, false, new THREE11.Vector3());
|
|
12801
|
+
if (ptLineSt.distanceTo(ptNewDoorSt) > ptLineSt.distanceTo(ptNewDoorEd))
|
|
12802
|
+
[ptNewDoorSt, ptNewDoorEd] = [ptNewDoorEd, ptNewDoorSt];
|
|
12803
|
+
const newOriginPts1 = getProjectedPointOnLine(ptLineSt, ptNewDoorSt, lineTmp.originalPoints);
|
|
12804
|
+
const newOriginPts2 = getProjectedPointOnLine(ptNewDoorSt, ptNewDoorEd, lineTmp.originalPoints);
|
|
12805
|
+
const newOriginPts3 = getProjectedPointOnLine(ptNewDoorEd, ptLineEd, lineTmp.originalPoints);
|
|
12806
|
+
const newDoorAndBeamData1 = [];
|
|
12807
|
+
const newDoorAndBeamData2 = [];
|
|
12808
|
+
const newDoorAndBeamData3 = [];
|
|
12809
|
+
if (lineTmp.doorAndBeamData) {
|
|
12810
|
+
for (let a = 0; a < lineTmp.doorAndBeamData.length; a++) {
|
|
12811
|
+
let doorStart2 = lineTmp.doorAndBeamData[a].doorStart;
|
|
12812
|
+
let doorEnd2 = lineTmp.doorAndBeamData[a].doorEnd;
|
|
12813
|
+
if (isPointOnLine2(ptLineSt, ptNewDoorSt, doorStart2, 1e-3, true) && isPointOnLine2(ptLineSt, ptNewDoorSt, doorEnd2, 1e-3, true))
|
|
12814
|
+
newDoorAndBeamData1.push(lineTmp.doorAndBeamData[a]);
|
|
12815
|
+
else if (isPointOnLine2(ptNewDoorEd, ptLineEd, doorStart2, 1e-3, true) && isPointOnLine2(ptNewDoorEd, ptLineEd, doorEnd2, 1e-3, true))
|
|
12816
|
+
newDoorAndBeamData3.push(lineTmp.doorAndBeamData[a]);
|
|
12817
|
+
}
|
|
12818
|
+
}
|
|
12819
|
+
let groundClearance = doorAddGroundClearance - lineTmp.start.z;
|
|
12820
|
+
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12821
|
+
let newLine1 = {
|
|
12822
|
+
start: ptLineSt,
|
|
12823
|
+
end: ptNewDoorSt,
|
|
12824
|
+
length: ptLineSt.distanceTo(ptNewDoorSt),
|
|
12825
|
+
originalPoints: newOriginPts1.newOriginalPoints,
|
|
12826
|
+
doorAndBeamData: newDoorAndBeamData1,
|
|
12827
|
+
id: randomUUID2(),
|
|
12828
|
+
rooftopPz: lineTmp.rooftopPz,
|
|
12829
|
+
isRebuild: false,
|
|
12830
|
+
direction: lineTmp.direction
|
|
12831
|
+
};
|
|
12832
|
+
let newLine2 = {
|
|
12833
|
+
start: ptNewDoorSt,
|
|
12834
|
+
end: ptNewDoorEd,
|
|
12835
|
+
length: ptNewDoorSt.distanceTo(ptNewDoorEd),
|
|
12836
|
+
originalPoints: newOriginPts2.newOriginalPoints,
|
|
12837
|
+
doorAndBeamData: newDoorAndBeamData2,
|
|
12838
|
+
id: randomUUID2(),
|
|
12839
|
+
rooftopPz: lineTmp.rooftopPz,
|
|
12840
|
+
isRebuild: false,
|
|
12841
|
+
direction: lineTmp.direction,
|
|
12842
|
+
drawDoorData: {
|
|
12843
|
+
start: new THREE11.Vector3(ptNewDoorSt.x, ptNewDoorSt.y, lineTmp.start.z),
|
|
12844
|
+
end: new THREE11.Vector3(ptNewDoorEd.x, ptNewDoorEd.y, lineTmp.start.z),
|
|
12845
|
+
n: new THREE11.Vector3(0, 0, 0),
|
|
12846
|
+
height,
|
|
12847
|
+
groundClearance
|
|
12848
|
+
},
|
|
12849
|
+
isDoor: true
|
|
12850
|
+
};
|
|
12851
|
+
let newLine3 = {
|
|
12852
|
+
start: ptNewDoorEd,
|
|
12853
|
+
end: ptLineEd,
|
|
12854
|
+
length: ptNewDoorEd.distanceTo(ptLineEd),
|
|
12855
|
+
originalPoints: newOriginPts3.newOriginalPoints,
|
|
12856
|
+
doorAndBeamData: newDoorAndBeamData3,
|
|
12857
|
+
id: randomUUID2(),
|
|
12858
|
+
rooftopPz: lineTmp.rooftopPz,
|
|
12859
|
+
isRebuild: false,
|
|
12860
|
+
direction: lineTmp.direction
|
|
12861
|
+
};
|
|
12862
|
+
if (newLine1.originalPoints.length > 0 && newLine1.length > 0.01)
|
|
12863
|
+
lines.push(newLine1);
|
|
12864
|
+
if (newLine2.originalPoints.length > 0 && newLine2.length > 0.01)
|
|
12865
|
+
lines.push(newLine2);
|
|
12866
|
+
if (newLine3.originalPoints.length > 0 && newLine3.length > 0.01)
|
|
12867
|
+
lines.push(newLine3);
|
|
12868
|
+
lineTmp.isRebuild = true;
|
|
12869
|
+
isFind = true;
|
|
12870
|
+
break;
|
|
12871
|
+
}
|
|
12872
|
+
}
|
|
12873
|
+
if (isFind) break;
|
|
12741
12874
|
}
|
|
12742
12875
|
}
|
|
12743
12876
|
}
|