rm-graphical-computing-node 1.0.113 → 1.0.115
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 +683 -65
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3943,6 +3943,7 @@ function getTrendLineEndpoints(points, options = {}) {
|
|
|
3943
3943
|
}
|
|
3944
3944
|
|
|
3945
3945
|
// src/geometry/beamLine.mjs
|
|
3946
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3946
3947
|
import { Const } from "three/tsl";
|
|
3947
3948
|
var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, onProgress = null) => {
|
|
3948
3949
|
removeNoisePoints(lines, lineReader, lineEditor);
|
|
@@ -4069,8 +4070,9 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4069
4070
|
maxZ: door.coordinatesByArea.heightData.maxZ,
|
|
4070
4071
|
index: i,
|
|
4071
4072
|
isFind: false,
|
|
4072
|
-
inWall: false
|
|
4073
|
+
inWall: false,
|
|
4073
4074
|
//是否在墙内
|
|
4075
|
+
category: door.category
|
|
4074
4076
|
});
|
|
4075
4077
|
}
|
|
4076
4078
|
if (door.category == "door frame") {
|
|
@@ -4081,7 +4083,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4081
4083
|
boxPoints,
|
|
4082
4084
|
index: i,
|
|
4083
4085
|
minZ: door.coordinatesByArea.heightData.minZ,
|
|
4084
|
-
maxZ: door.coordinatesByArea.heightData.maxZ
|
|
4086
|
+
maxZ: door.coordinatesByArea.heightData.maxZ,
|
|
4087
|
+
category: door.category
|
|
4085
4088
|
});
|
|
4086
4089
|
}
|
|
4087
4090
|
}
|
|
@@ -4253,6 +4256,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4253
4256
|
continue;
|
|
4254
4257
|
let addData = false;
|
|
4255
4258
|
let isDoor = false;
|
|
4259
|
+
let findDoorFrame = false;
|
|
4256
4260
|
let beforePcdDoorIsFindBeam = false;
|
|
4257
4261
|
let doorOpenEndPoint = new THREE5.Vector3(0, 0, 0);
|
|
4258
4262
|
let doorOpenVector = new THREE5.Vector3(0, 0, 0);
|
|
@@ -4545,15 +4549,17 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4545
4549
|
length2 = beamTmpEd.distanceTo(beamTmpSt);
|
|
4546
4550
|
}
|
|
4547
4551
|
if (lengthPercentage < 85 && length2 > 0.3 || length2 > 0.7 && height > floorHeightTmp - floorHeightTmp / 2) {
|
|
4552
|
+
const doorAndDoorFrameDatas = [...doorDatas];
|
|
4553
|
+
doorAndDoorFrameDatas.push(...doorFrame);
|
|
4548
4554
|
if (!line2.isLine2) {
|
|
4549
4555
|
if (length2 < 3.5) {
|
|
4550
|
-
for (let n = 0; n <
|
|
4551
|
-
let doorSt = new THREE5.Vector3(
|
|
4552
|
-
let doorEd = new THREE5.Vector3(
|
|
4556
|
+
for (let n = 0; n < doorAndDoorFrameDatas.length; n++) {
|
|
4557
|
+
let doorSt = new THREE5.Vector3(doorAndDoorFrameDatas[n].doorStartPt.x, doorAndDoorFrameDatas[n].doorStartPt.y, 0);
|
|
4558
|
+
let doorEd = new THREE5.Vector3(doorAndDoorFrameDatas[n].doorEndPt.x, doorAndDoorFrameDatas[n].doorEndPt.y, 0);
|
|
4553
4559
|
let beamSt = new THREE5.Vector3(tmpRegion.facePoints[0].x, tmpRegion.facePoints[0].y, 0);
|
|
4554
4560
|
let beamEd = new THREE5.Vector3(tmpRegion.facePoints[1].x, tmpRegion.facePoints[1].y, 0);
|
|
4555
|
-
let bIsTrue = tmpRegion.facePoints[2].z <
|
|
4556
|
-
let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z -
|
|
4561
|
+
let bIsTrue = tmpRegion.facePoints[2].z < doorAndDoorFrameDatas[n].maxZ || Math.abs(tmpRegion.facePoints[2].z - doorAndDoorFrameDatas[n].maxZ) < 0.3;
|
|
4562
|
+
let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - doorAndDoorFrameDatas[n].maxZ) > 0.2;
|
|
4557
4563
|
if (bIsTrue) {
|
|
4558
4564
|
let result = classifySegments(doorSt.clone(), doorEd.clone(), beamSt.clone(), beamEd.clone(), {
|
|
4559
4565
|
distanceThreshold: 2
|
|
@@ -4567,20 +4573,24 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4567
4573
|
if (dist2 < 0.2) {
|
|
4568
4574
|
let dist1 = beamSt.distanceTo(doorSt);
|
|
4569
4575
|
let dist22 = beamEd.distanceTo(doorSt);
|
|
4570
|
-
if (dist1 > 0.
|
|
4576
|
+
if (dist1 > 0.35 && dist22 > 0.35) {
|
|
4571
4577
|
let dist3 = beamSt.distanceTo(doorEd);
|
|
4572
4578
|
let dist4 = beamEd.distanceTo(doorEd);
|
|
4573
|
-
if (dist3 > 0.
|
|
4579
|
+
if (dist3 > 0.35 && dist4 > 0.35) {
|
|
4574
4580
|
continue;
|
|
4575
4581
|
}
|
|
4576
4582
|
}
|
|
4583
|
+
if (doorAndDoorFrameDatas[n].category == "door frame") {
|
|
4584
|
+
findDoorFrame = true;
|
|
4585
|
+
continue;
|
|
4586
|
+
}
|
|
4577
4587
|
isDoor = true;
|
|
4578
4588
|
isPullOutDoor = true;
|
|
4579
|
-
pcbDoorIndexs.push(
|
|
4580
|
-
|
|
4589
|
+
pcbDoorIndexs.push(doorAndDoorFrameDatas[n].index);
|
|
4590
|
+
doorAndDoorFrameDatas[n].isFind = true;
|
|
4581
4591
|
findDoorDataIndex = n;
|
|
4582
|
-
beforePcdDoorIsFindBeam = pcdData[
|
|
4583
|
-
pcdData[
|
|
4592
|
+
beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
|
|
4593
|
+
pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
|
|
4584
4594
|
let beamVec = new THREE5.Vector3().subVectors(beamSt, beamEd).normalize();
|
|
4585
4595
|
let doorLength = doorSt.distanceTo(doorEd) - result.overlap;
|
|
4586
4596
|
if (dist22 < dist1)
|
|
@@ -4603,7 +4613,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4603
4613
|
let distTmp1 = beamSt.distanceTo(beamEd);
|
|
4604
4614
|
let distTmp2 = doorEd.distanceTo(doorSt);
|
|
4605
4615
|
if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
|
|
4606
|
-
if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 1) {
|
|
4616
|
+
if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 1 && doorAndDoorFrameDatas[n].category === "door") {
|
|
4607
4617
|
let dist1 = beamSt.distanceTo(doorSt);
|
|
4608
4618
|
let dist2 = beamSt.distanceTo(doorEd);
|
|
4609
4619
|
let dist3 = beamEd.distanceTo(doorSt);
|
|
@@ -4628,12 +4638,16 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4628
4638
|
}
|
|
4629
4639
|
}
|
|
4630
4640
|
if (length2 > 1.5) {
|
|
4641
|
+
if (doorAndDoorFrameDatas[n].category === "door frame") {
|
|
4642
|
+
findDoorFrame = true;
|
|
4643
|
+
continue;
|
|
4644
|
+
}
|
|
4631
4645
|
isDoor = true;
|
|
4632
4646
|
isPullOutDoor = true;
|
|
4633
|
-
pcbDoorIndexs.push(
|
|
4634
|
-
|
|
4635
|
-
beforePcdDoorIsFindBeam = pcdData[
|
|
4636
|
-
pcdData[
|
|
4647
|
+
pcbDoorIndexs.push(doorAndDoorFrameDatas[n].index);
|
|
4648
|
+
doorAndDoorFrameDatas[n].isFind = true;
|
|
4649
|
+
beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
|
|
4650
|
+
pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
|
|
4637
4651
|
findDoorDataIndex = n;
|
|
4638
4652
|
}
|
|
4639
4653
|
}
|
|
@@ -4645,10 +4659,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4645
4659
|
/**!isPullOutDoor && */
|
|
4646
4660
|
length2 < 1.6
|
|
4647
4661
|
) {
|
|
4648
|
-
for (let n = 0; n <
|
|
4649
|
-
if (
|
|
4650
|
-
let doorSt = new THREE5.Vector3(
|
|
4651
|
-
let doorEd = new THREE5.Vector3(
|
|
4662
|
+
for (let n = 0; n < doorAndDoorFrameDatas.length; n++) {
|
|
4663
|
+
if (doorAndDoorFrameDatas[n].inWall) continue;
|
|
4664
|
+
let doorSt = new THREE5.Vector3(doorAndDoorFrameDatas[n].doorStartPt.x, doorAndDoorFrameDatas[n].doorStartPt.y, 0);
|
|
4665
|
+
let doorEd = new THREE5.Vector3(doorAndDoorFrameDatas[n].doorEndPt.x, doorAndDoorFrameDatas[n].doorEndPt.y, 0);
|
|
4652
4666
|
let beamSt = new THREE5.Vector3(beamTmpEd.x, beamTmpEd.y, 0);
|
|
4653
4667
|
let beamEd = new THREE5.Vector3(beamTmpSt.x, beamTmpSt.y, 0);
|
|
4654
4668
|
let vec1 = new THREE5.Vector3().subVectors(doorSt, doorEd).normalize();
|
|
@@ -4669,6 +4683,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4669
4683
|
let dist44 = doorEd.distanceTo(beamEd);
|
|
4670
4684
|
let isNear = dist11 < nearDist || dist22 < nearDist || dist33 < nearDist || dist44 < nearDist;
|
|
4671
4685
|
if ((isNear || insertPt) && bIsTrue) {
|
|
4686
|
+
if (doorAndDoorFrameDatas[n].category == "door frame") {
|
|
4687
|
+
findDoorFrame = true;
|
|
4688
|
+
continue;
|
|
4689
|
+
}
|
|
4672
4690
|
let tmppLine3 = new THREE5.Line3(beamSt, beamEd);
|
|
4673
4691
|
if (dist11 < nearDist || dist33 < nearDist) {
|
|
4674
4692
|
doorOpenEndPoint = beamSt.clone();
|
|
@@ -4706,10 +4724,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4706
4724
|
doorOpenVector = new THREE5.Vector3().subVectors(doorStExtended, ptCloseTmppp).normalize();
|
|
4707
4725
|
}
|
|
4708
4726
|
}
|
|
4709
|
-
beforePcdDoorIsFindBeam = pcdData[
|
|
4710
|
-
pcdData[
|
|
4727
|
+
beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
|
|
4728
|
+
pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
|
|
4711
4729
|
isDoor = true;
|
|
4712
|
-
|
|
4730
|
+
doorAndDoorFrameDatas[n].isFind = true;
|
|
4713
4731
|
findDoorDataIndex = n;
|
|
4714
4732
|
}
|
|
4715
4733
|
}
|
|
@@ -4776,8 +4794,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4776
4794
|
lineIsOnlyBeam: false,
|
|
4777
4795
|
groundClearance
|
|
4778
4796
|
};
|
|
4779
|
-
if (doorAndBeamDataObj.beamHeight < 0.1)
|
|
4780
|
-
continue;
|
|
4781
4797
|
let nearDistTmp = Infinity;
|
|
4782
4798
|
let findNearDoorIndex = false;
|
|
4783
4799
|
let nearBeamSt = new THREE5.Vector3();
|
|
@@ -4804,7 +4820,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4804
4820
|
let lineLen = startPt2.distanceTo(endPt2);
|
|
4805
4821
|
let doorLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
4806
4822
|
let tmpLine66 = new THREE5.Line3(startPt2, endPt2);
|
|
4807
|
-
let tmpPt66 =
|
|
4823
|
+
let tmpPt66 = getMid(doorTmpSt, doorTmpEd);
|
|
4824
|
+
tmpPt66.z = startPt2.z;
|
|
4808
4825
|
let ptClose66 = tmpLine66.closestPointToPoint(tmpPt66, true, new THREE5.Vector3());
|
|
4809
4826
|
let isPPPP = perpendicularInfo(ptClose66, tmpPt66, doorTmpSt, doorTmpEd);
|
|
4810
4827
|
if (doorLen > lineLen) {
|
|
@@ -4812,14 +4829,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4812
4829
|
new THREE5.Vector3(doorTmpSt.x, doorTmpSt.y, startPt2.z),
|
|
4813
4830
|
new THREE5.Vector3(doorTmpEd.x, doorTmpEd.y, startPt2.z)
|
|
4814
4831
|
);
|
|
4815
|
-
tmpPt66 = startPt2
|
|
4832
|
+
tmpPt66 = getMid(startPt2, endPt2);
|
|
4816
4833
|
ptClose66 = tmpLine66.closestPointToPoint(tmpPt66, true, new THREE5.Vector3());
|
|
4817
4834
|
isPPPP = perpendicularInfo(ptClose66, tmpPt66, doorTmpSt, doorTmpEd);
|
|
4818
4835
|
[ptClose66, tmpPt66] = [tmpPt66, ptClose66];
|
|
4819
4836
|
}
|
|
4820
4837
|
if (isPPPP && isPPPP.angle > 85 && !wallBelowBeam) {
|
|
4821
4838
|
doorAndBeamDataObj.beamNearWallVec = new THREE5.Vector3().subVectors(ptClose66, tmpPt66).normalize();
|
|
4822
|
-
if (doorAndBeamDataObj.beamStart.z > lines[x].rooftopPz - 0.
|
|
4839
|
+
if (doorAndBeamDataObj.beamStart.z > lines[x].rooftopPz - 0.08 && length2 > 1) {
|
|
4823
4840
|
wallBelowBeam = true;
|
|
4824
4841
|
} else
|
|
4825
4842
|
wallBelowBeam = false;
|
|
@@ -4927,8 +4944,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4927
4944
|
dataType = /**nearWall && lineLength > 0.8 ? "beam" : */
|
|
4928
4945
|
"hole";
|
|
4929
4946
|
}
|
|
4947
|
+
if (dataType == "beam" && findDoorFrame) {
|
|
4948
|
+
console.log("id", id, lineLength);
|
|
4949
|
+
dataType = "hole";
|
|
4950
|
+
}
|
|
4930
4951
|
doorAndBeamDataObj.type = dataType;
|
|
4931
4952
|
doorAndBeamDataObj.wallBelowBeam = wallBelowBeam;
|
|
4953
|
+
if (doorAndBeamDataObj.beamHeight < 0.1 && doorAndBeamDataObj.type == "beam")
|
|
4954
|
+
continue;
|
|
4932
4955
|
if (doorFrame && doorFrame.length > 0 && doorAndBeamDataObj.type == "door") {
|
|
4933
4956
|
let doorLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
4934
4957
|
let lineStart2 = getPt3(line2.start);
|
|
@@ -5054,12 +5077,12 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5054
5077
|
else if (doorAndBeamDataObj.isPullOutDoor)
|
|
5055
5078
|
tmpDoorBeamData.isPullOutDoor = true;
|
|
5056
5079
|
const hasCommon = pcbDoorIndexs.some((item) => tmpDoorBeamData.pcbDoorIndexs.includes(item));
|
|
5057
|
-
if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam" || doorAndBeamDataObj.type == "hole" && tmpDoorBeamData.type == "hole") {
|
|
5080
|
+
if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam" || doorAndBeamDataObj.type == "hole" && tmpDoorBeamData.type == "hole" || doorAndBeamDataObj.type == "door" && tmpDoorBeamData.type == "door" && (doorAndBeamDataObj.isPullOutDoor || tmpDoorBeamData.isPullOutDoor)) {
|
|
5058
5081
|
if (length22 > length1) {
|
|
5059
5082
|
doorAndBeamDataObj.isExtend = true;
|
|
5060
5083
|
}
|
|
5061
5084
|
if (length1 > length22) {
|
|
5062
|
-
|
|
5085
|
+
tmpDoorBeamData.isExtend = true;
|
|
5063
5086
|
}
|
|
5064
5087
|
}
|
|
5065
5088
|
let lineIsOnlyBeam1 = false;
|
|
@@ -5100,12 +5123,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5100
5123
|
}
|
|
5101
5124
|
let holeTyp1 = doorAndBeamDataObj.type == "hole" && length1 > length22;
|
|
5102
5125
|
let holeTyp2 = doorAndBeamDataObj.type == "hole" && length1 < length22;
|
|
5103
|
-
|
|
5104
|
-
|
|
5126
|
+
let pullDoorTyp1 = doorAndBeamDataObj.isPullOutDoor && length1 > length22;
|
|
5127
|
+
let pullDoorTyp2 = doorAndBeamDataObj.isPullOutDoor && length1 < length22;
|
|
5128
|
+
if (length1 < length22 && !lineIsOnlyBeam2 && doorAndBeamDataObj.type != "hole" || lineIsOnlyBeam1 || holeTyp1 || pullDoorTyp1) {
|
|
5129
|
+
if (lineIsOnlyBeam1 || holeTyp1 || pullDoorTyp1) {
|
|
5105
5130
|
vecNegate = vecNegate.negate();
|
|
5106
5131
|
vec2 = vec2.negate();
|
|
5107
5132
|
}
|
|
5108
|
-
if (length1 > minDoorLength2 && !tmpDoorBeamData.isPullOutDoor && !lineIsOnlyBeam1) {
|
|
5133
|
+
if (length1 > minDoorLength2 && !tmpDoorBeamData.isPullOutDoor && !lineIsOnlyBeam1 || holeTyp1 || pullDoorTyp1) {
|
|
5109
5134
|
tmpDoorBeamData.beamStart = doorAndBeamDataObj.beamStart.clone().addScaledVector(vecNegate, dist2);
|
|
5110
5135
|
tmpDoorBeamData.beamEnd = doorAndBeamDataObj.beamEnd.clone().addScaledVector(vecNegate, dist2);
|
|
5111
5136
|
tmpDoorBeamData.doorStart = doorAndBeamDataObj.doorStart.clone().addScaledVector(vecNegate, dist2);
|
|
@@ -5114,7 +5139,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5114
5139
|
tmpDoorBeamData.beamStart.z = tmpDoorBeamData.beamEnd.z = tmpDoorBeamData.doorStart.z + tmpDoorBeamData.doorHeight;
|
|
5115
5140
|
tmpDoorBeamData.doorOpenEndPoint = doorAndBeamDataObj.doorOpenEndPoint.clone();
|
|
5116
5141
|
tmpDoorBeamData.doorOpenVector = doorAndBeamDataObj.doorOpenVector.clone();
|
|
5117
|
-
} else if (!isPullOutDoor || isPullOutDoor && tmpDoorBeamData.isPullOutDoor && hasCommon) {
|
|
5142
|
+
} else if (!isPullOutDoor && !lineIsOnlyBeam1 || isPullOutDoor && tmpDoorBeamData.isPullOutDoor && hasCommon && !lineIsOnlyBeam1) {
|
|
5118
5143
|
doorAndBeamDataObj.beamStart = tmpDoorBeamData.beamStart.clone().addScaledVector(vec2, dist2);
|
|
5119
5144
|
doorAndBeamDataObj.beamEnd = tmpDoorBeamData.beamEnd.clone().addScaledVector(vec2, dist2);
|
|
5120
5145
|
doorAndBeamDataObj.doorStart = tmpDoorBeamData.doorStart.clone().addScaledVector(vec2, dist2);
|
|
@@ -5133,12 +5158,12 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5133
5158
|
tmpDoorBeamData.doorOpenEndPoint = doorAndBeamDataObj.doorOpenEndPoint.clone();
|
|
5134
5159
|
tmpDoorBeamData.doorOpenVector = doorAndBeamDataObj.doorOpenVector.clone();
|
|
5135
5160
|
}
|
|
5136
|
-
} else if (length1 > length22 && !lineIsOnlyBeam1 && doorAndBeamDataObj.type != "hole" || lineIsOnlyBeam2 || holeTyp2) {
|
|
5137
|
-
if (lineIsOnlyBeam2 || holeTyp2) {
|
|
5161
|
+
} else if (length1 > length22 && !lineIsOnlyBeam1 && doorAndBeamDataObj.type != "hole" || lineIsOnlyBeam2 || holeTyp2 || pullDoorTyp2) {
|
|
5162
|
+
if (lineIsOnlyBeam2 || holeTyp2 || pullDoorTyp2) {
|
|
5138
5163
|
vecNegate = vecNegate.negate();
|
|
5139
5164
|
vec2 = vec2.negate();
|
|
5140
5165
|
}
|
|
5141
|
-
if (length22 > minDoorLength2 && !isPullOutDoor && !lineIsOnlyBeam2) {
|
|
5166
|
+
if (length22 > minDoorLength2 && !isPullOutDoor && !lineIsOnlyBeam2 || holeTyp2 || pullDoorTyp2) {
|
|
5142
5167
|
doorAndBeamDataObj.beamStart = tmpDoorBeamData.beamStart.clone().addScaledVector(vecNegate, dist2);
|
|
5143
5168
|
doorAndBeamDataObj.beamEnd = tmpDoorBeamData.beamEnd.clone().addScaledVector(vecNegate, dist2);
|
|
5144
5169
|
doorAndBeamDataObj.doorStart = tmpDoorBeamData.doorStart.clone().addScaledVector(vecNegate, dist2);
|
|
@@ -5147,7 +5172,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5147
5172
|
doorAndBeamDataObj.beamStart.z = doorAndBeamDataObj.beamEnd.z = doorAndBeamDataObj.doorStart.z + doorAndBeamDataObj.doorHeight;
|
|
5148
5173
|
doorAndBeamDataObj.doorOpenEndPoint = tmpDoorBeamData.doorOpenEndPoint.clone();
|
|
5149
5174
|
doorAndBeamDataObj.doorOpenVector = tmpDoorBeamData.doorOpenVector.clone();
|
|
5150
|
-
} else if (!tmpDoorBeamData.isPullOutDoor || isPullOutDoor && tmpDoorBeamData.isPullOutDoor && hasCommon) {
|
|
5175
|
+
} else if (!tmpDoorBeamData.isPullOutDoor && !lineIsOnlyBeam2 || isPullOutDoor && tmpDoorBeamData.isPullOutDoor && hasCommon && !lineIsOnlyBeam2) {
|
|
5151
5176
|
tmpDoorBeamData.beamStart = doorAndBeamDataObj.beamStart.clone().addScaledVector(vec2, dist2);
|
|
5152
5177
|
tmpDoorBeamData.beamEnd = doorAndBeamDataObj.beamEnd.clone().addScaledVector(vec2, dist2);
|
|
5153
5178
|
tmpDoorBeamData.doorStart = doorAndBeamDataObj.doorStart.clone().addScaledVector(vec2, dist2);
|
|
@@ -5222,17 +5247,59 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5222
5247
|
line2.mergeCheckRegion = null;
|
|
5223
5248
|
}
|
|
5224
5249
|
if (findDoorIndexs.length > 1) {
|
|
5250
|
+
let tol = 0.1;
|
|
5251
|
+
for (let j = 0; j < findDoorIndexs.length; j++) {
|
|
5252
|
+
let lineIndex = findDoorIndexs[j];
|
|
5253
|
+
for (let d = 0; d < lines[lineIndex].doorAndBeamData.length; d++) {
|
|
5254
|
+
const doorAndBeamData = lines[lineIndex].doorAndBeamData[d];
|
|
5255
|
+
if (doorAndBeamData.type === "beam" && (doorAndBeamData.beamNearWallVec.x == 0 && doorAndBeamData.beamNearWallVec.y == 0 && doorAndBeamData.beamNearWallVec.z == 0 && doorAndBeamData.nearId == -1 || !doorAndBeamData.wallBelowBeam && doorAndBeamData.nearId == -1)) {
|
|
5256
|
+
const start1 = doorAndBeamData.beamStart.clone();
|
|
5257
|
+
const end1 = doorAndBeamData.beamEnd.clone();
|
|
5258
|
+
start1.z = end1.z = 0;
|
|
5259
|
+
let startIsEq = false;
|
|
5260
|
+
let endIsEq = false;
|
|
5261
|
+
let beamNearWallVec = null;
|
|
5262
|
+
for (let g = 0; g < findDoorIndexs.length; g++) {
|
|
5263
|
+
if (j == g)
|
|
5264
|
+
continue;
|
|
5265
|
+
const start2 = lines[findDoorIndexs[g]].start.clone();
|
|
5266
|
+
const end2 = lines[findDoorIndexs[g]].end.clone();
|
|
5267
|
+
start2.z = end2.z = 0;
|
|
5268
|
+
if (ptIsEqual(start1, start2, tol) || ptIsEqual(start1, end2, tol)) {
|
|
5269
|
+
startIsEq = true;
|
|
5270
|
+
beamNearWallVec = getVector3(end2, start2);
|
|
5271
|
+
}
|
|
5272
|
+
if (ptIsEqual(end1, end2, tol) || ptIsEqual(end1, start2, tol)) {
|
|
5273
|
+
endIsEq = true;
|
|
5274
|
+
beamNearWallVec = getVector3(start2, end2);
|
|
5275
|
+
}
|
|
5276
|
+
if (startIsEq && endIsEq)
|
|
5277
|
+
break;
|
|
5278
|
+
if (startIsEq && endIsEq)
|
|
5279
|
+
break;
|
|
5280
|
+
}
|
|
5281
|
+
if (startIsEq && endIsEq) {
|
|
5282
|
+
if (doorAndBeamData.beamNearWallVec.x == 0 && doorAndBeamData.beamNearWallVec.y == 0 && doorAndBeamData.beamNearWallVec.z == 0)
|
|
5283
|
+
doorAndBeamData.beamNearWallVec = beamNearWallVec.clone();
|
|
5284
|
+
doorAndBeamData.notDel = true;
|
|
5285
|
+
}
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
}
|
|
5225
5289
|
for (let j = 0; j < findDoorIndexs.length; j++) {
|
|
5226
5290
|
if (onProgress != null)
|
|
5227
5291
|
onProgress(60 + (j + 1) / findDoorIndexs.length * 5);
|
|
5228
5292
|
let savedata2 = [];
|
|
5229
5293
|
for (let d = 0; d < lines[findDoorIndexs[j]].doorAndBeamData.length; d++) {
|
|
5294
|
+
const doorAndBeamData = lines[findDoorIndexs[j]].doorAndBeamData[d];
|
|
5230
5295
|
let isDel = false;
|
|
5231
|
-
if (
|
|
5232
|
-
if (!
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5296
|
+
if (!doorAndBeamData.notDel) {
|
|
5297
|
+
if (doorAndBeamData.type === "beam" && (doorAndBeamData.beamNearWallVec.x == 0 && doorAndBeamData.beamNearWallVec.y == 0 && doorAndBeamData.beamNearWallVec.z == 0 && doorAndBeamData.nearId == -1 || !doorAndBeamData.wallBelowBeam && doorAndBeamData.nearId == -1)) {
|
|
5298
|
+
if (!doorAndBeamData.lineIsOnlyBeam)
|
|
5299
|
+
doorAndBeamData.type = "hole";
|
|
5300
|
+
else
|
|
5301
|
+
isDel = true;
|
|
5302
|
+
}
|
|
5236
5303
|
}
|
|
5237
5304
|
if (!isDel) {
|
|
5238
5305
|
let doorSt1 = lines[findDoorIndexs[j]].doorAndBeamData[d].doorStart.clone();
|
|
@@ -5434,6 +5501,541 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5434
5501
|
}
|
|
5435
5502
|
lines.length = 0;
|
|
5436
5503
|
lines.push(...tmpLines);
|
|
5504
|
+
let maxNearDist = 0.3;
|
|
5505
|
+
let maxHeightDiff = 0.1;
|
|
5506
|
+
let pointsUtils = new PointsUtils();
|
|
5507
|
+
for (let i = 0; i < lines.length; i++) {
|
|
5508
|
+
const line2 = lines[i];
|
|
5509
|
+
if (!line2.doorAndBeamData || line2.doorAndBeamData.length == 0 || line2.isRebuild)
|
|
5510
|
+
continue;
|
|
5511
|
+
const line1Start = new THREE5.Vector3(line2.start.x, line2.start.y, line2.start.z);
|
|
5512
|
+
const line1End = new THREE5.Vector3(line2.end.x, line2.end.y, line2.end.z);
|
|
5513
|
+
let isMerge = false;
|
|
5514
|
+
for (let j = 0; j < line2.doorAndBeamData.length; j++) {
|
|
5515
|
+
const data1 = line2.doorAndBeamData[j];
|
|
5516
|
+
if (data1.type == "door" || data1.type == "onlyDoor" || data1.type == "hole" || data1.isDel) continue;
|
|
5517
|
+
for (let x = 0; x < line2.doorAndBeamData.length; x++) {
|
|
5518
|
+
const data2 = line2.doorAndBeamData[x];
|
|
5519
|
+
if (data2.type == "door" || data2.type == "onlyDoor" || j == x || data2.isDel) continue;
|
|
5520
|
+
let heightDiff = Math.abs(data1.beamStart.z - data2.beamStart.z);
|
|
5521
|
+
if (data1.nearId == -1 && data2.nearId == -1 && heightDiff < maxHeightDiff) {
|
|
5522
|
+
let tmpDoorPoints = [data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd];
|
|
5523
|
+
let dist1 = data1.doorStart.distanceTo(data2.doorStart);
|
|
5524
|
+
let dist2 = data1.doorStart.distanceTo(data2.doorEnd);
|
|
5525
|
+
let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
|
|
5526
|
+
let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
|
|
5527
|
+
let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
|
|
5528
|
+
if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
|
|
5529
|
+
continue;
|
|
5530
|
+
let twoPoint = getFarthestPoints(tmpDoorPoints);
|
|
5531
|
+
if (twoPoint.length != 2) continue;
|
|
5532
|
+
let newData = {
|
|
5533
|
+
id,
|
|
5534
|
+
beamStart: new THREE5.Vector3(twoPoint[0].x, twoPoint[0].y, data1.beamStart.z),
|
|
5535
|
+
beamEnd: new THREE5.Vector3(twoPoint[1].x, twoPoint[1].y, data1.beamStart.z),
|
|
5536
|
+
beamHeight: data1.beamHeight,
|
|
5537
|
+
doorStart: twoPoint[1],
|
|
5538
|
+
doorEnd: twoPoint[0],
|
|
5539
|
+
doorHeight: data1.doorHeight,
|
|
5540
|
+
nearId: -1,
|
|
5541
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5542
|
+
type: "beam",
|
|
5543
|
+
isExtend: data1.isExtend || data2.isExtend,
|
|
5544
|
+
isDoor: false,
|
|
5545
|
+
isPullOutDoor: false,
|
|
5546
|
+
pcbDoorIndexs: [],
|
|
5547
|
+
beamNearWallVec: data1.beamNearWallVec,
|
|
5548
|
+
doorType: "",
|
|
5549
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5550
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5551
|
+
lineIsOnlyBeam: data1.lineIsOnlyBeam,
|
|
5552
|
+
groundClearance: data1.groundClearance
|
|
5553
|
+
};
|
|
5554
|
+
data1.isDel = true;
|
|
5555
|
+
data2.isDel = true;
|
|
5556
|
+
line2.doorAndBeamData.push(newData);
|
|
5557
|
+
for (let w = 0; w < line2.doorAndBeamIdToCheckResults.length; w++) {
|
|
5558
|
+
const results = line2.doorAndBeamIdToCheckResults[w];
|
|
5559
|
+
if (results[1] == data1.id || results[1] == data2.id)
|
|
5560
|
+
results[1] = newData.id;
|
|
5561
|
+
}
|
|
5562
|
+
j = -1;
|
|
5563
|
+
id++;
|
|
5564
|
+
break;
|
|
5565
|
+
}
|
|
5566
|
+
if (data1.nearId != -1 && data2.nearId != -1 && heightDiff < maxHeightDiff) {
|
|
5567
|
+
let tmpDoorPoints = [data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd];
|
|
5568
|
+
let dist1 = data1.doorStart.distanceTo(data2.doorStart);
|
|
5569
|
+
let dist2 = data1.doorStart.distanceTo(data2.doorEnd);
|
|
5570
|
+
let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
|
|
5571
|
+
let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
|
|
5572
|
+
let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
|
|
5573
|
+
if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
|
|
5574
|
+
continue;
|
|
5575
|
+
let twoPoint = getFarthestPoints(tmpDoorPoints);
|
|
5576
|
+
if (twoPoint.length != 2) continue;
|
|
5577
|
+
let data1NearIdIndex = [];
|
|
5578
|
+
let data2NearIdIndex = [];
|
|
5579
|
+
for (let u4 = 0; u4 < lines.length; u4++) {
|
|
5580
|
+
if (lines[u4].doorAndBeamData) {
|
|
5581
|
+
for (let t = 0; t < lines[u4].doorAndBeamData.length; t++) {
|
|
5582
|
+
if (data1.nearId == lines[u4].doorAndBeamData[t].id)
|
|
5583
|
+
data1NearIdIndex = [u4, t];
|
|
5584
|
+
if (data2.nearId == lines[u4].doorAndBeamData[t].id)
|
|
5585
|
+
data2NearIdIndex = [u4, t];
|
|
5586
|
+
if (data1NearIdIndex.length == 2 && data2NearIdIndex.length == 2)
|
|
5587
|
+
break;
|
|
5588
|
+
}
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
if (data1NearIdIndex.length != 2 || data2NearIdIndex.length != 2)
|
|
5592
|
+
continue;
|
|
5593
|
+
const line3 = lines[data1NearIdIndex[0]];
|
|
5594
|
+
const line4 = lines[data2NearIdIndex[0]];
|
|
5595
|
+
if (line3.isRebuild || line4.isRebuild) continue;
|
|
5596
|
+
const line3Start = new THREE5.Vector3(line3.start.x, line3.start.y, line3.start.z);
|
|
5597
|
+
const line3End = new THREE5.Vector3(line3.end.x, line3.end.y, line3.end.z);
|
|
5598
|
+
const line4Start = new THREE5.Vector3(line4.start.x, line4.start.y, line4.start.z);
|
|
5599
|
+
const line4End = new THREE5.Vector3(line4.end.x, line4.end.y, line4.end.z);
|
|
5600
|
+
let isLine3AndLine4 = classifySegments(line3Start, line3End, line4Start, line4End);
|
|
5601
|
+
let isSameLine = data1NearIdIndex[0] == data2NearIdIndex[0];
|
|
5602
|
+
if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" && !isSameLine)
|
|
5603
|
+
continue;
|
|
5604
|
+
const data3 = line3.doorAndBeamData[data1NearIdIndex[1]];
|
|
5605
|
+
const data4 = line4.doorAndBeamData[data2NearIdIndex[1]];
|
|
5606
|
+
let isData3AndData4 = classifySegments(data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd);
|
|
5607
|
+
if (!isData3AndData4 || isData3AndData4.type != "collinear_gap")
|
|
5608
|
+
continue;
|
|
5609
|
+
let newData = {
|
|
5610
|
+
id,
|
|
5611
|
+
beamStart: new THREE5.Vector3(twoPoint[0].x, twoPoint[0].y, data1.beamStart.z),
|
|
5612
|
+
beamEnd: new THREE5.Vector3(twoPoint[1].x, twoPoint[1].y, data1.beamStart.z),
|
|
5613
|
+
beamHeight: data1.beamHeight,
|
|
5614
|
+
doorStart: twoPoint[1],
|
|
5615
|
+
doorEnd: twoPoint[0],
|
|
5616
|
+
doorHeight: data1.doorHeight,
|
|
5617
|
+
nearId: id + 1,
|
|
5618
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5619
|
+
type: "beam",
|
|
5620
|
+
isExtend: data1.isExtend || data2.isExtend,
|
|
5621
|
+
isDoor: false,
|
|
5622
|
+
isPullOutDoor: false,
|
|
5623
|
+
pcbDoorIndexs: [],
|
|
5624
|
+
beamNearWallVec: data1.beamNearWallVec,
|
|
5625
|
+
doorType: "",
|
|
5626
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5627
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5628
|
+
lineIsOnlyBeam: data1.lineIsOnlyBeam,
|
|
5629
|
+
groundClearance: data1.groundClearance
|
|
5630
|
+
};
|
|
5631
|
+
data1.isDel = true;
|
|
5632
|
+
data2.isDel = true;
|
|
5633
|
+
line2.doorAndBeamData.push(newData);
|
|
5634
|
+
for (let w = 0; w < line2.doorAndBeamIdToCheckResults.length; w++) {
|
|
5635
|
+
const results = line2.doorAndBeamIdToCheckResults[w];
|
|
5636
|
+
if (results[1] == data1.id || results[1] == data2.id)
|
|
5637
|
+
results[1] = newData.id;
|
|
5638
|
+
}
|
|
5639
|
+
id++;
|
|
5640
|
+
let tmpDoorPoints2 = [data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd];
|
|
5641
|
+
let twoPoint2 = getFarthestPoints(tmpDoorPoints2);
|
|
5642
|
+
let newData2 = {
|
|
5643
|
+
id,
|
|
5644
|
+
beamStart: new THREE5.Vector3(twoPoint2[0].x, twoPoint2[0].y, data3.beamStart.z),
|
|
5645
|
+
beamEnd: new THREE5.Vector3(twoPoint2[1].x, twoPoint2[1].y, data3.beamStart.z),
|
|
5646
|
+
beamHeight: data3.beamHeight,
|
|
5647
|
+
doorStart: twoPoint2[1],
|
|
5648
|
+
doorEnd: twoPoint2[0],
|
|
5649
|
+
doorHeight: data3.doorHeight,
|
|
5650
|
+
nearId: id - 1,
|
|
5651
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5652
|
+
type: "beam",
|
|
5653
|
+
isExtend: data3.isExtend || data4.isExtend,
|
|
5654
|
+
isDoor: false,
|
|
5655
|
+
isPullOutDoor: false,
|
|
5656
|
+
pcbDoorIndexs: [],
|
|
5657
|
+
beamNearWallVec: data3.beamNearWallVec,
|
|
5658
|
+
doorType: "",
|
|
5659
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5660
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5661
|
+
lineIsOnlyBeam: data3.lineIsOnlyBeam,
|
|
5662
|
+
groundClearance: data3.groundClearance
|
|
5663
|
+
};
|
|
5664
|
+
data3.isDel = true;
|
|
5665
|
+
data4.isDel = true;
|
|
5666
|
+
const newDoorAndBeamData = line3.doorAndBeamData;
|
|
5667
|
+
newDoorAndBeamData.push(...line4.doorAndBeamData);
|
|
5668
|
+
newDoorAndBeamData.push(newData2);
|
|
5669
|
+
let data1LineIndex = lineReader.readLineById(line3.id);
|
|
5670
|
+
data1LineIndex.originalPoints = lineReader.getOriginalPointsById(line3.id);
|
|
5671
|
+
data1LineIndex.checkResults = lineReader.getLineCheckReultsById(line3.id);
|
|
5672
|
+
let data2LineIndex = lineReader.readLineById(line4.id);
|
|
5673
|
+
data2LineIndex.originalPoints = lineReader.getOriginalPointsById(line4.id);
|
|
5674
|
+
data2LineIndex.checkResults = lineReader.getLineCheckReultsById(line4.id);
|
|
5675
|
+
const newOriginalPoints = data1LineIndex.originalPoints;
|
|
5676
|
+
const newCheckResults = data1LineIndex.checkResults;
|
|
5677
|
+
for (let w = 0; w < data2LineIndex.originalPoints.length; w++)
|
|
5678
|
+
newOriginalPoints.push(data2LineIndex.originalPoints[w]);
|
|
5679
|
+
for (let w = 0; w < data2LineIndex.checkResults.length; w++)
|
|
5680
|
+
newCheckResults.push(data2LineIndex.checkResults[w]);
|
|
5681
|
+
line3.isRebuild = true;
|
|
5682
|
+
line4.isRebuild = true;
|
|
5683
|
+
const newDoorAndBeamIdToCheckResults = [];
|
|
5684
|
+
if (isSameLine) {
|
|
5685
|
+
for (let h = 0; h < line3.doorAndBeamIdToCheckResults.length; h++) {
|
|
5686
|
+
if (line3.doorAndBeamIdToCheckResults[h][1] == data3.id || line3.doorAndBeamIdToCheckResults[h][1] == data4.id)
|
|
5687
|
+
newDoorAndBeamIdToCheckResults.push([line3.doorAndBeamIdToCheckResults[h][0], id]);
|
|
5688
|
+
else
|
|
5689
|
+
newDoorAndBeamIdToCheckResults.push(line3.doorAndBeamIdToCheckResults[h]);
|
|
5690
|
+
}
|
|
5691
|
+
} else {
|
|
5692
|
+
for (let h = 0; h < line3.doorAndBeamIdToCheckResults.length; h++) {
|
|
5693
|
+
if (line3.doorAndBeamIdToCheckResults[h][1] == data3.id)
|
|
5694
|
+
newDoorAndBeamIdToCheckResults.push([line3.doorAndBeamIdToCheckResults[h][0], id]);
|
|
5695
|
+
else
|
|
5696
|
+
newDoorAndBeamIdToCheckResults.push(line3.doorAndBeamIdToCheckResults[h]);
|
|
5697
|
+
}
|
|
5698
|
+
for (let h = 0; h < line4.doorAndBeamIdToCheckResults.length; h++) {
|
|
5699
|
+
if (line4.doorAndBeamIdToCheckResults[h][1] == data4.id)
|
|
5700
|
+
newDoorAndBeamIdToCheckResults.push([line4.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, id]);
|
|
5701
|
+
else
|
|
5702
|
+
newDoorAndBeamIdToCheckResults.push(line4.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, line4.doorAndBeamIdToCheckResults[h][1]);
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
let tmpDoorPoints3 = [line3.start, line3.end, line4.start, line4.end];
|
|
5706
|
+
let twoPoint3 = getFarthestPoints(tmpDoorPoints3);
|
|
5707
|
+
const newLine = {
|
|
5708
|
+
checkResults: newCheckResults,
|
|
5709
|
+
originalPoints: pointsUtils.vector3ArrToFloat32Array(newOriginalPoints),
|
|
5710
|
+
id: randomUUID2(),
|
|
5711
|
+
direction: line3.direction,
|
|
5712
|
+
doorAndBeamIdToCheckResults: newDoorAndBeamIdToCheckResults,
|
|
5713
|
+
doorAndBeamData: newDoorAndBeamData,
|
|
5714
|
+
start: twoPoint3[0],
|
|
5715
|
+
end: twoPoint3[1],
|
|
5716
|
+
isRebuild: false,
|
|
5717
|
+
length: twoPoint3[0].distanceTo(twoPoint3[1]),
|
|
5718
|
+
rooftopPz: line3.rooftopPz
|
|
5719
|
+
};
|
|
5720
|
+
lineReader.appendLine(newLine);
|
|
5721
|
+
newLine.checkResults = [];
|
|
5722
|
+
newLine.originalPoints = [];
|
|
5723
|
+
lines.push(newLine);
|
|
5724
|
+
id++;
|
|
5725
|
+
j = -1;
|
|
5726
|
+
break;
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5730
|
+
for (let j = 0; j < line2.doorAndBeamData.length; j++) {
|
|
5731
|
+
const data1 = line2.doorAndBeamData[j];
|
|
5732
|
+
if (data1.type == "door" || data1.type == "onlyDoor" || data1.type == "hole" || data1.isDel) continue;
|
|
5733
|
+
for (let p = 0; p < lines.length; p++) {
|
|
5734
|
+
const line22 = lines[p];
|
|
5735
|
+
const line2Start = new THREE5.Vector3(line22.start.x, line22.start.y, line22.start.z);
|
|
5736
|
+
const line2End = new THREE5.Vector3(line22.end.x, line22.end.y, line22.end.z);
|
|
5737
|
+
let isPPP = classifySegments(line1Start, line1End, line2Start, line2End);
|
|
5738
|
+
if (p == i || line22.isRebuild || !isPPP || isPPP.type != "collinear_gap") continue;
|
|
5739
|
+
for (let x = 0; x < line22.doorAndBeamData.length; x++) {
|
|
5740
|
+
const data2 = line22.doorAndBeamData[x];
|
|
5741
|
+
if (data2.type == "door" || data2.type == "onlyDoor" || data2.isDel) continue;
|
|
5742
|
+
let heightDiff = Math.abs(data1.beamStart.z - data2.beamStart.z);
|
|
5743
|
+
if (data1.nearId == -1 && data2.nearId == -1 && heightDiff < maxHeightDiff) {
|
|
5744
|
+
let tmpDoorPoints = [data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd];
|
|
5745
|
+
let dist1 = data1.doorStart.distanceTo(data2.doorStart);
|
|
5746
|
+
let dist2 = data1.doorStart.distanceTo(data2.doorEnd);
|
|
5747
|
+
let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
|
|
5748
|
+
let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
|
|
5749
|
+
let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
|
|
5750
|
+
if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
|
|
5751
|
+
continue;
|
|
5752
|
+
let twoPoint = getFarthestPoints(tmpDoorPoints);
|
|
5753
|
+
if (twoPoint.length != 2) continue;
|
|
5754
|
+
let newData = {
|
|
5755
|
+
id,
|
|
5756
|
+
beamStart: new THREE5.Vector3(twoPoint[0].x, twoPoint[0].y, data1.beamStart.z),
|
|
5757
|
+
beamEnd: new THREE5.Vector3(twoPoint[1].x, twoPoint[1].y, data1.beamStart.z),
|
|
5758
|
+
beamHeight: data1.beamHeight,
|
|
5759
|
+
doorStart: twoPoint[1],
|
|
5760
|
+
doorEnd: twoPoint[0],
|
|
5761
|
+
doorHeight: data1.doorHeight,
|
|
5762
|
+
nearId: -1,
|
|
5763
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5764
|
+
type: "beam",
|
|
5765
|
+
isExtend: data1.isExtend || data2.isExtend,
|
|
5766
|
+
isDoor: false,
|
|
5767
|
+
isPullOutDoor: false,
|
|
5768
|
+
pcbDoorIndexs: [],
|
|
5769
|
+
beamNearWallVec: data1.beamNearWallVec,
|
|
5770
|
+
doorType: "",
|
|
5771
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5772
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5773
|
+
lineIsOnlyBeam: data1.lineIsOnlyBeam,
|
|
5774
|
+
groundClearance: data1.groundClearance
|
|
5775
|
+
};
|
|
5776
|
+
data1.isDel = true;
|
|
5777
|
+
data2.isDel = true;
|
|
5778
|
+
line2.doorAndBeamData.push(newData);
|
|
5779
|
+
const newDoorAndBeamData = line2.doorAndBeamData;
|
|
5780
|
+
newDoorAndBeamData.push(...line22.doorAndBeamData);
|
|
5781
|
+
let data1LineIndex = lineReader.readLineById(line2.id);
|
|
5782
|
+
data1LineIndex.originalPoints = lineReader.getOriginalPointsById(line2.id);
|
|
5783
|
+
data1LineIndex.checkResults = lineReader.getLineCheckReultsById(line2.id);
|
|
5784
|
+
let data2LineIndex = lineReader.readLineById(line22.id);
|
|
5785
|
+
data2LineIndex.originalPoints = lineReader.getOriginalPointsById(line22.id);
|
|
5786
|
+
data2LineIndex.checkResults = lineReader.getLineCheckReultsById(line22.id);
|
|
5787
|
+
const newOriginalPoints = data1LineIndex.originalPoints;
|
|
5788
|
+
const newCheckResults = data1LineIndex.checkResults;
|
|
5789
|
+
for (let w = 0; w < data2LineIndex.originalPoints.length; w++)
|
|
5790
|
+
newOriginalPoints.push(data2LineIndex.originalPoints[w]);
|
|
5791
|
+
for (let w = 0; w < data2LineIndex.checkResults.length; w++)
|
|
5792
|
+
newCheckResults.push(data2LineIndex.checkResults[w]);
|
|
5793
|
+
line2.isRebuild = true;
|
|
5794
|
+
line22.isRebuild = true;
|
|
5795
|
+
const newDoorAndBeamIdToCheckResults = [];
|
|
5796
|
+
for (let h = 0; h < line2.doorAndBeamIdToCheckResults.length; h++) {
|
|
5797
|
+
if (line2.doorAndBeamIdToCheckResults[h][1] == data1.id)
|
|
5798
|
+
newDoorAndBeamIdToCheckResults.push([line2.doorAndBeamIdToCheckResults[h][0], id]);
|
|
5799
|
+
else
|
|
5800
|
+
newDoorAndBeamIdToCheckResults.push(line2.doorAndBeamIdToCheckResults[h]);
|
|
5801
|
+
}
|
|
5802
|
+
for (let h = 0; h < line22.doorAndBeamIdToCheckResults.length; h++) {
|
|
5803
|
+
if (line22.doorAndBeamIdToCheckResults[h][1] == data2.id)
|
|
5804
|
+
newDoorAndBeamIdToCheckResults.push([line22.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, id]);
|
|
5805
|
+
else
|
|
5806
|
+
newDoorAndBeamIdToCheckResults.push(line22.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, line22.doorAndBeamIdToCheckResults[h][1]);
|
|
5807
|
+
}
|
|
5808
|
+
let tmpDoorPoints3 = [line2.start, line2.end, line22.start, line22.end];
|
|
5809
|
+
let twoPoint3 = getFarthestPoints(tmpDoorPoints3);
|
|
5810
|
+
const newLine = {
|
|
5811
|
+
checkResults: newCheckResults,
|
|
5812
|
+
originalPoints: pointsUtils.vector3ArrToFloat32Array(newOriginalPoints),
|
|
5813
|
+
id: randomUUID2(),
|
|
5814
|
+
direction: line2.direction,
|
|
5815
|
+
doorAndBeamIdToCheckResults: newDoorAndBeamIdToCheckResults,
|
|
5816
|
+
doorAndBeamData: newDoorAndBeamData,
|
|
5817
|
+
start: twoPoint3[0],
|
|
5818
|
+
end: twoPoint3[1],
|
|
5819
|
+
isRebuild: false,
|
|
5820
|
+
length: twoPoint3[0].distanceTo(twoPoint3[1]),
|
|
5821
|
+
rooftopPz: line2.rooftopPz
|
|
5822
|
+
};
|
|
5823
|
+
lineReader.appendLine(newLine);
|
|
5824
|
+
newLine.checkResults = [];
|
|
5825
|
+
newLine.originalPoints = [];
|
|
5826
|
+
lines.push(newLine);
|
|
5827
|
+
i = -1;
|
|
5828
|
+
id++;
|
|
5829
|
+
isMerge = true;
|
|
5830
|
+
break;
|
|
5831
|
+
}
|
|
5832
|
+
if (isMerge) break;
|
|
5833
|
+
if (data1.nearId != -1 && data2.nearId != -1 && heightDiff < maxHeightDiff) {
|
|
5834
|
+
let tmpDoorPoints = [data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd];
|
|
5835
|
+
let dist1 = data1.doorStart.distanceTo(data2.doorStart);
|
|
5836
|
+
let dist2 = data1.doorStart.distanceTo(data2.doorEnd);
|
|
5837
|
+
let dist3 = data1.doorEnd.distanceTo(data2.doorStart);
|
|
5838
|
+
let dist4 = data1.doorEnd.distanceTo(data2.doorEnd);
|
|
5839
|
+
let isData1AndData2 = classifySegments(data1.doorStart, data1.doorEnd, data2.doorStart, data2.doorEnd);
|
|
5840
|
+
if (dist1 > maxNearDist && dist2 > maxNearDist && dist3 > maxNearDist && dist4 > maxNearDist || !isData1AndData2 || isData1AndData2.type != "collinear_gap")
|
|
5841
|
+
continue;
|
|
5842
|
+
let twoPoint = getFarthestPoints(tmpDoorPoints);
|
|
5843
|
+
if (twoPoint.length != 2) continue;
|
|
5844
|
+
let data1NearIdIndex = [];
|
|
5845
|
+
let data2NearIdIndex = [];
|
|
5846
|
+
for (let u4 = 0; u4 < lines.length; u4++) {
|
|
5847
|
+
if (lines[u4].doorAndBeamData) {
|
|
5848
|
+
for (let t = 0; t < lines[u4].doorAndBeamData.length; t++) {
|
|
5849
|
+
if (data1.nearId == lines[u4].doorAndBeamData[t].id)
|
|
5850
|
+
data1NearIdIndex = [u4, t];
|
|
5851
|
+
if (data2.nearId == lines[u4].doorAndBeamData[t].id)
|
|
5852
|
+
data2NearIdIndex = [u4, t];
|
|
5853
|
+
if (data1NearIdIndex.length == 2 && data2NearIdIndex.length == 2)
|
|
5854
|
+
break;
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
if (data1NearIdIndex.length != 2 || data2NearIdIndex.length != 2)
|
|
5859
|
+
continue;
|
|
5860
|
+
const line3 = lines[data1NearIdIndex[0]];
|
|
5861
|
+
const line4 = lines[data2NearIdIndex[0]];
|
|
5862
|
+
if (line3.isRebuild || line4.isRebuild) continue;
|
|
5863
|
+
const line3Start = new THREE5.Vector3(line3.start.x, line3.start.y, line3.start.z);
|
|
5864
|
+
const line3End = new THREE5.Vector3(line3.end.x, line3.end.y, line3.end.z);
|
|
5865
|
+
const line4Start = new THREE5.Vector3(line4.start.x, line4.start.y, line4.start.z);
|
|
5866
|
+
const line4End = new THREE5.Vector3(line4.end.x, line4.end.y, line4.end.z);
|
|
5867
|
+
let isLine3AndLine4 = classifySegments(line3Start, line3End, line4Start, line4End);
|
|
5868
|
+
if (!isLine3AndLine4 || isLine3AndLine4.type != "collinear_gap" && lines[data1NearIdIndex[0]] != lines[data2NearIdIndex[0]])
|
|
5869
|
+
continue;
|
|
5870
|
+
const data3 = line3.doorAndBeamData[data1NearIdIndex[1]];
|
|
5871
|
+
const data4 = line4.doorAndBeamData[data2NearIdIndex[1]];
|
|
5872
|
+
let isData3AndData4 = classifySegments(data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd);
|
|
5873
|
+
if (!isData3AndData4 || isData3AndData4.type != "collinear_gap")
|
|
5874
|
+
continue;
|
|
5875
|
+
let newData = {
|
|
5876
|
+
id,
|
|
5877
|
+
beamStart: new THREE5.Vector3(twoPoint[0].x, twoPoint[0].y, data1.beamStart.z),
|
|
5878
|
+
beamEnd: new THREE5.Vector3(twoPoint[1].x, twoPoint[1].y, data1.beamStart.z),
|
|
5879
|
+
beamHeight: data1.beamHeight,
|
|
5880
|
+
doorStart: twoPoint[1],
|
|
5881
|
+
doorEnd: twoPoint[0],
|
|
5882
|
+
doorHeight: data1.doorHeight,
|
|
5883
|
+
nearId: id + 1,
|
|
5884
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5885
|
+
type: "beam",
|
|
5886
|
+
isExtend: data1.isExtend || data2.isExtend,
|
|
5887
|
+
isDoor: false,
|
|
5888
|
+
isPullOutDoor: false,
|
|
5889
|
+
pcbDoorIndexs: [],
|
|
5890
|
+
beamNearWallVec: data1.beamNearWallVec,
|
|
5891
|
+
doorType: "",
|
|
5892
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5893
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5894
|
+
lineIsOnlyBeam: data1.lineIsOnlyBeam,
|
|
5895
|
+
groundClearance: data1.groundClearance
|
|
5896
|
+
};
|
|
5897
|
+
data1.isDel = true;
|
|
5898
|
+
data2.isDel = true;
|
|
5899
|
+
line2.doorAndBeamData.push(newData);
|
|
5900
|
+
id++;
|
|
5901
|
+
const newDoorAndBeamData = line2.doorAndBeamData;
|
|
5902
|
+
newDoorAndBeamData.push(...line22.doorAndBeamData);
|
|
5903
|
+
let data1LineIndex = lineReader.readLineById(line2.id);
|
|
5904
|
+
data1LineIndex.originalPoints = lineReader.getOriginalPointsById(line2.id);
|
|
5905
|
+
data1LineIndex.checkResults = lineReader.getLineCheckReultsById(line2.id);
|
|
5906
|
+
let data2LineIndex = lineReader.readLineById(line22.id);
|
|
5907
|
+
data2LineIndex.originalPoints = lineReader.getOriginalPointsById(line22.id);
|
|
5908
|
+
data2LineIndex.checkResults = lineReader.getLineCheckReultsById(line22.id);
|
|
5909
|
+
const newOriginalPoints = data1LineIndex.originalPoints;
|
|
5910
|
+
const newCheckResults = data1LineIndex.checkResults;
|
|
5911
|
+
for (let w = 0; w < data2LineIndex.originalPoints.length; w++)
|
|
5912
|
+
newOriginalPoints.push(data2LineIndex.originalPoints[w]);
|
|
5913
|
+
for (let w = 0; w < data2LineIndex.checkResults.length; w++)
|
|
5914
|
+
newCheckResults.push(data2LineIndex.checkResults[w]);
|
|
5915
|
+
line2.isRebuild = true;
|
|
5916
|
+
line22.isRebuild = true;
|
|
5917
|
+
const newDoorAndBeamIdToCheckResults = [];
|
|
5918
|
+
for (let h = 0; h < line2.doorAndBeamIdToCheckResults.length; h++) {
|
|
5919
|
+
if (line2.doorAndBeamIdToCheckResults[h][1] == data1.id)
|
|
5920
|
+
newDoorAndBeamIdToCheckResults.push([line2.doorAndBeamIdToCheckResults[h][0], id]);
|
|
5921
|
+
else
|
|
5922
|
+
newDoorAndBeamIdToCheckResults.push(line2.doorAndBeamIdToCheckResults[h]);
|
|
5923
|
+
}
|
|
5924
|
+
for (let h = 0; h < line22.doorAndBeamIdToCheckResults.length; h++) {
|
|
5925
|
+
if (line22.doorAndBeamIdToCheckResults[h][1] == data2.id)
|
|
5926
|
+
newDoorAndBeamIdToCheckResults.push([line22.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, id]);
|
|
5927
|
+
else
|
|
5928
|
+
newDoorAndBeamIdToCheckResults.push(line22.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, line22.doorAndBeamIdToCheckResults[h][1]);
|
|
5929
|
+
}
|
|
5930
|
+
let tmpDoorPoints3 = [line2.start, line2.end, line22.start, line22.end];
|
|
5931
|
+
let twoPoint3 = getFarthestPoints(tmpDoorPoints3);
|
|
5932
|
+
const newLine = {
|
|
5933
|
+
checkResults: newCheckResults,
|
|
5934
|
+
originalPoints: pointsUtils.vector3ArrToFloat32Array(newOriginalPoints),
|
|
5935
|
+
id: randomUUID2(),
|
|
5936
|
+
direction: line2.direction,
|
|
5937
|
+
doorAndBeamIdToCheckResults: newDoorAndBeamIdToCheckResults,
|
|
5938
|
+
doorAndBeamData: newDoorAndBeamData,
|
|
5939
|
+
start: twoPoint3[0],
|
|
5940
|
+
end: twoPoint3[1],
|
|
5941
|
+
isRebuild: false,
|
|
5942
|
+
length: twoPoint3[0].distanceTo(twoPoint3[1]),
|
|
5943
|
+
rooftopPz: line2.rooftopPz
|
|
5944
|
+
};
|
|
5945
|
+
lineReader.appendLine(newLine);
|
|
5946
|
+
newLine.checkResults = [];
|
|
5947
|
+
newLine.originalPoints = [];
|
|
5948
|
+
lines.push(newLine);
|
|
5949
|
+
let tmpDoorPoints2 = [data3.doorStart, data3.doorEnd, data4.doorStart, data4.doorEnd];
|
|
5950
|
+
let twoPoint2 = getFarthestPoints(tmpDoorPoints2);
|
|
5951
|
+
let newData2 = {
|
|
5952
|
+
id,
|
|
5953
|
+
beamStart: new THREE5.Vector3(twoPoint2[0].x, twoPoint2[0].y, data3.beamStart.z),
|
|
5954
|
+
beamEnd: new THREE5.Vector3(twoPoint2[1].x, twoPoint2[1].y, data3.beamStart.z),
|
|
5955
|
+
beamHeight: data3.beamHeight,
|
|
5956
|
+
doorStart: twoPoint2[1],
|
|
5957
|
+
doorEnd: twoPoint2[0],
|
|
5958
|
+
doorHeight: data3.doorHeight,
|
|
5959
|
+
nearId: id - 1,
|
|
5960
|
+
// type: isExtendBeam ? "extendBeam" : "doorBeam",
|
|
5961
|
+
type: "beam",
|
|
5962
|
+
isExtend: data3.isExtend || data4.isExtend,
|
|
5963
|
+
isDoor: false,
|
|
5964
|
+
isPullOutDoor: false,
|
|
5965
|
+
pcbDoorIndexs: [],
|
|
5966
|
+
beamNearWallVec: data3.beamNearWallVec,
|
|
5967
|
+
doorType: "",
|
|
5968
|
+
doorOpenEndPoint: new THREE5.Vector3(0, 0, 0),
|
|
5969
|
+
doorOpenVector: new THREE5.Vector3(0, 0, 0),
|
|
5970
|
+
lineIsOnlyBeam: data3.lineIsOnlyBeam,
|
|
5971
|
+
groundClearance: data3.groundClearance
|
|
5972
|
+
};
|
|
5973
|
+
data3.isDel = true;
|
|
5974
|
+
data4.isDel = true;
|
|
5975
|
+
const newDoorAndBeamData2 = line3.doorAndBeamData;
|
|
5976
|
+
newDoorAndBeamData2.push(...line4.doorAndBeamData);
|
|
5977
|
+
newDoorAndBeamData2.push(newData2);
|
|
5978
|
+
let data1LineIndex2 = lineReader.readLineById(line3.id);
|
|
5979
|
+
data1LineIndex2.originalPoints = lineReader.getOriginalPointsById(line3.id);
|
|
5980
|
+
data1LineIndex2.checkResults = lineReader.getLineCheckReultsById(line3.id);
|
|
5981
|
+
let data2LineIndex2 = lineReader.readLineById(line4.id);
|
|
5982
|
+
data2LineIndex2.originalPoints = lineReader.getOriginalPointsById(line4.id);
|
|
5983
|
+
data2LineIndex2.checkResults = lineReader.getLineCheckReultsById(line4.id);
|
|
5984
|
+
const newOriginalPoints2 = data1LineIndex2.originalPoints;
|
|
5985
|
+
const newCheckResults2 = data1LineIndex2.checkResults;
|
|
5986
|
+
for (let w = 0; w < data2LineIndex2.originalPoints.length; w++)
|
|
5987
|
+
newOriginalPoints2.push(data2LineIndex2.originalPoints[w]);
|
|
5988
|
+
for (let w = 0; w < data2LineIndex2.checkResults.length; w++)
|
|
5989
|
+
newCheckResults2.push(data2LineIndex2.checkResults[w]);
|
|
5990
|
+
line3.isRebuild = true;
|
|
5991
|
+
line4.isRebuild = true;
|
|
5992
|
+
const newDoorAndBeamIdToCheckResults2 = [];
|
|
5993
|
+
for (let h = 0; h < line3.doorAndBeamIdToCheckResults.length; h++) {
|
|
5994
|
+
if (line3.doorAndBeamIdToCheckResults[h][1] == data3.id)
|
|
5995
|
+
newDoorAndBeamIdToCheckResults2.push([line3.doorAndBeamIdToCheckResults[h][0], id]);
|
|
5996
|
+
else
|
|
5997
|
+
newDoorAndBeamIdToCheckResults2.push(line3.doorAndBeamIdToCheckResults[h]);
|
|
5998
|
+
}
|
|
5999
|
+
for (let h = 0; h < line4.doorAndBeamIdToCheckResults.length; h++) {
|
|
6000
|
+
if (line4.doorAndBeamIdToCheckResults[h][1] == data4.id)
|
|
6001
|
+
newDoorAndBeamIdToCheckResults2.push([line4.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, id]);
|
|
6002
|
+
else
|
|
6003
|
+
newDoorAndBeamIdToCheckResults2.push(line4.doorAndBeamIdToCheckResults[h][0] + data1LineIndex.checkResults.length, line4.doorAndBeamIdToCheckResults[h][1]);
|
|
6004
|
+
}
|
|
6005
|
+
let tmpDoorPoints4 = [line3.start, line3.end, line4.start, line4.end];
|
|
6006
|
+
let twoPoint4 = getFarthestPoints(tmpDoorPoints4);
|
|
6007
|
+
const newLine2 = {
|
|
6008
|
+
checkResults: newCheckResults2,
|
|
6009
|
+
originalPoints: pointsUtils.vector3ArrToFloat32Array(newOriginalPoints2),
|
|
6010
|
+
id: randomUUID2(),
|
|
6011
|
+
direction: line3.direction,
|
|
6012
|
+
doorAndBeamIdToCheckResults: newDoorAndBeamIdToCheckResults2,
|
|
6013
|
+
doorAndBeamData: newDoorAndBeamData2,
|
|
6014
|
+
start: twoPoint4[0],
|
|
6015
|
+
end: twoPoint4[1],
|
|
6016
|
+
isRebuild: false,
|
|
6017
|
+
length: twoPoint4[0].distanceTo(twoPoint4[1]),
|
|
6018
|
+
rooftopPz: line3.rooftopPz
|
|
6019
|
+
};
|
|
6020
|
+
lineReader.appendLine(newLine2);
|
|
6021
|
+
newLine2.checkResults = [];
|
|
6022
|
+
newLine2.originalPoints = [];
|
|
6023
|
+
lines.push(newLine2);
|
|
6024
|
+
id++;
|
|
6025
|
+
isMerge = true;
|
|
6026
|
+
break;
|
|
6027
|
+
}
|
|
6028
|
+
if (isMerge) break;
|
|
6029
|
+
}
|
|
6030
|
+
if (isMerge) break;
|
|
6031
|
+
}
|
|
6032
|
+
if (isMerge) break;
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
for (let i = 0; i < lines.length; i++) {
|
|
6036
|
+
lines[i].doorAndBeamData = lines[i].doorAndBeamData.filter((d) => !d.isDel);
|
|
6037
|
+
}
|
|
6038
|
+
lines = lines.filter((l) => !l.isRebuild);
|
|
5437
6039
|
return { lines, beamGroup, pcdData };
|
|
5438
6040
|
};
|
|
5439
6041
|
var checkBeamIsReasonable = async (lines, lineReader) => {
|
|
@@ -13833,7 +14435,7 @@ var getOBB = (contour) => {
|
|
|
13833
14435
|
// src/geometry/window.mjs
|
|
13834
14436
|
import * as THREE10 from "three";
|
|
13835
14437
|
import { mergeGeometries as mergeGeometries5 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
13836
|
-
import { randomUUID as
|
|
14438
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
13837
14439
|
import { retarget } from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
13838
14440
|
var getWindowData = (lines, pcdData, lineReader) => {
|
|
13839
14441
|
if (lines.length <= 0 || !pcdData)
|
|
@@ -13919,7 +14521,6 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
13919
14521
|
val2.gridHeight,
|
|
13920
14522
|
val2.centerPts
|
|
13921
14523
|
);
|
|
13922
|
-
val2.centerPts = null;
|
|
13923
14524
|
val2.facePoints = facePoints;
|
|
13924
14525
|
val2.boxArea = boxArea;
|
|
13925
14526
|
val2.totalInPlaneNum = totalInPlaneNum;
|
|
@@ -14071,7 +14672,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14071
14672
|
let length2 = tmpRegion.facePoints[0].distanceTo(tmpRegion.facePoints[1]);
|
|
14072
14673
|
let height = tmpRegion.facePoints[0].distanceTo(tmpRegion.facePoints[3]);
|
|
14073
14674
|
let lengthPercentage = length2 / line2.length * 100;
|
|
14074
|
-
if (length2 < 0.2 || height < 0.2)
|
|
14675
|
+
if (length2 < 0.2 || height < 0.2 || region.centerPts.length < 20)
|
|
14075
14676
|
continue;
|
|
14076
14677
|
let addData = false;
|
|
14077
14678
|
let isWindow = false;
|
|
@@ -14084,6 +14685,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14084
14685
|
let doorTmpSt = tmpRegion.facePoints[0].clone();
|
|
14085
14686
|
let doorTmpEd = tmpRegion.facePoints[1].clone();
|
|
14086
14687
|
let findDoorDataIndex = -1;
|
|
14688
|
+
let windowToWallAngle = -1;
|
|
14087
14689
|
if (Math.abs(tmpRegion.facePoints[0].z - line2.start.z) > 0.25 || Math.abs(tmpRegion.facePoints[0].z - line2.start.z) < 0.25 && height > 1) {
|
|
14088
14690
|
const { newOriginalPoints } = getProjectedPointOnLine(doorTmpSt, doorTmpEd, line2.originalPoints);
|
|
14089
14691
|
const topPoints = [];
|
|
@@ -14106,14 +14708,14 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14106
14708
|
if (length2 < 3.5) {
|
|
14107
14709
|
for (let n = 0; n < windowDatas.length; n++) {
|
|
14108
14710
|
if (windowDatas[n].isFind) {
|
|
14109
|
-
if (line2.length < lines[windowDatas[n].findLineIndex[0]]
|
|
14711
|
+
if (line2.length < lines[windowDatas[n].findLineIndex[0]]?.length)
|
|
14110
14712
|
continue;
|
|
14111
14713
|
}
|
|
14112
14714
|
let doorSt = new THREE10.Vector3(windowDatas[n].windowStartPt.x, windowDatas[n].windowStartPt.y, 0);
|
|
14113
14715
|
let doorEd = new THREE10.Vector3(windowDatas[n].windowEndPt.x, windowDatas[n].windowEndPt.y, 0);
|
|
14114
14716
|
let beamSt = new THREE10.Vector3(tmpRegion.facePoints[0].x, tmpRegion.facePoints[0].y, 0);
|
|
14115
14717
|
let beamEd = new THREE10.Vector3(tmpRegion.facePoints[1].x, tmpRegion.facePoints[1].y, 0);
|
|
14116
|
-
let bIsTrue =
|
|
14718
|
+
let bIsTrue = true;
|
|
14117
14719
|
let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - windowDatas[n].maxZ) > 0.2;
|
|
14118
14720
|
if (bIsTrue) {
|
|
14119
14721
|
let result = classifySegments(doorSt.clone(), doorEd.clone(), beamSt.clone(), beamEd.clone(), {
|
|
@@ -14139,6 +14741,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14139
14741
|
pcbDoorIndexs.push(windowDatas[n].index);
|
|
14140
14742
|
windowDatas[n].isFind = true;
|
|
14141
14743
|
windowObj_id = windowDatas[n].obj_id;
|
|
14744
|
+
windowToWallAngle = 0;
|
|
14142
14745
|
findDoorDataIndex = n;
|
|
14143
14746
|
beforePcdDoorisFindWindow = pcdData[windowDatas[n].index].isFindWindow;
|
|
14144
14747
|
pcdData[windowDatas[n].index].isFindWindow = true;
|
|
@@ -14165,6 +14768,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14165
14768
|
let distTmp2 = doorEd.distanceTo(doorSt);
|
|
14166
14769
|
if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
|
|
14167
14770
|
if (length2 > 0.3) {
|
|
14771
|
+
windowToWallAngle = 0;
|
|
14168
14772
|
isWindow = true;
|
|
14169
14773
|
pcbDoorIndexs.push(windowDatas[n].index);
|
|
14170
14774
|
windowDatas[n].isFind = true;
|
|
@@ -14193,8 +14797,9 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14193
14797
|
let beamStExtended = beamSt.clone().addScaledVector(vec2, nExtend);
|
|
14194
14798
|
let beamEdExtended = beamEd.clone().addScaledVector(vec2.clone().negate(), nExtend);
|
|
14195
14799
|
let isPPP = getParallelism(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
|
|
14196
|
-
if (isPPP.isParallel
|
|
14800
|
+
if (isPPP.isParallel)
|
|
14197
14801
|
continue;
|
|
14802
|
+
windowToWallAngle = isPPP.angleDeg;
|
|
14198
14803
|
let insertPt = segmentsIntersect2D(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
|
|
14199
14804
|
let bIsTrue = true;
|
|
14200
14805
|
let dist11 = doorSt.distanceTo(beamSt);
|
|
@@ -14322,7 +14927,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14322
14927
|
let windowHeight = beamTmpSt.z - doorTmpSt.z;
|
|
14323
14928
|
const windowLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
14324
14929
|
let changeWindowSize = false;
|
|
14325
|
-
let windowSizeThreshold = 0.
|
|
14930
|
+
let windowSizeThreshold = 0.3;
|
|
14326
14931
|
if ((Math.abs(windowPcdLen - windowLen) < windowSizeThreshold || windowPcdLen > windowLen) && (Math.abs(windowPcdHeight - windowHeight) < windowSizeThreshold || windowPcdHeight > windowHeight)) {
|
|
14327
14932
|
changeWindowSize = true;
|
|
14328
14933
|
} else {
|
|
@@ -14447,6 +15052,19 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
14447
15052
|
groundClearance,
|
|
14448
15053
|
obj_id: windowObj_id
|
|
14449
15054
|
};
|
|
15055
|
+
if (windowToWallAngle > 60 && changeWindowSize) {
|
|
15056
|
+
let rectPts = [doorAndBeamDataObj.windowBottomSt, doorAndBeamDataObj.windowBottomEd, doorAndBeamDataObj.windowTopEd, doorAndBeamDataObj.windowTopSt];
|
|
15057
|
+
let checkResultsNum = region.centerPts ? region.centerPts.length : 0;
|
|
15058
|
+
let inRectNum = 0;
|
|
15059
|
+
for (let b = 0; b < checkResultsNum; b++) {
|
|
15060
|
+
let pt = region.centerPts[b];
|
|
15061
|
+
if (pointInRectRegion(pt, rectPts, 0.01))
|
|
15062
|
+
inRectNum++;
|
|
15063
|
+
}
|
|
15064
|
+
let inRectPercentage = inRectNum / checkResultsNum;
|
|
15065
|
+
if (inRectPercentage < 0.8)
|
|
15066
|
+
continue;
|
|
15067
|
+
}
|
|
14450
15068
|
line2.windowIdToCheckResults.push([region.index, id]);
|
|
14451
15069
|
if (windowDatas[findDoorDataIndex].findLineIndex.length > 0) {
|
|
14452
15070
|
let lineIndex = windowDatas[findDoorDataIndex].findLineIndex[0];
|
|
@@ -14855,7 +15473,7 @@ var getWindowPcdData = (lines, pcdData) => {
|
|
|
14855
15473
|
length: tmpPtStart.distanceTo(ptWindowSt),
|
|
14856
15474
|
originalPoints: newOriginPts1.newOriginalPoints,
|
|
14857
15475
|
doorAndBeamData: newDoorAndBeamData1,
|
|
14858
|
-
id:
|
|
15476
|
+
id: randomUUID3(),
|
|
14859
15477
|
rooftopPz: line2.rooftopPz,
|
|
14860
15478
|
isRebuild: false,
|
|
14861
15479
|
direction: line2.direction
|
|
@@ -14866,7 +15484,7 @@ var getWindowPcdData = (lines, pcdData) => {
|
|
|
14866
15484
|
length: ptWindowSt.distanceTo(ptWindowEd),
|
|
14867
15485
|
originalPoints: newOriginPts2.newOriginalPoints,
|
|
14868
15486
|
doorAndBeamData: newDoorAndBeamData2,
|
|
14869
|
-
id:
|
|
15487
|
+
id: randomUUID3(),
|
|
14870
15488
|
rooftopPz: line2.rooftopPz,
|
|
14871
15489
|
isRebuild: false,
|
|
14872
15490
|
direction: line2.direction,
|
|
@@ -14879,7 +15497,7 @@ var getWindowPcdData = (lines, pcdData) => {
|
|
|
14879
15497
|
length: ptWindowEd.distanceTo(tmpPtEnd),
|
|
14880
15498
|
originalPoints: newOriginPts3.newOriginalPoints,
|
|
14881
15499
|
doorAndBeamData: newDoorAndBeamData3,
|
|
14882
|
-
id:
|
|
15500
|
+
id: randomUUID3(),
|
|
14883
15501
|
rooftopPz: line2.rooftopPz,
|
|
14884
15502
|
isRebuild: false,
|
|
14885
15503
|
direction: line2.direction
|
|
@@ -14924,7 +15542,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
|
|
|
14924
15542
|
|
|
14925
15543
|
// src/geometry/door.mjs
|
|
14926
15544
|
import * as THREE11 from "three";
|
|
14927
|
-
import { randomUUID as
|
|
15545
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
14928
15546
|
var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
14929
15547
|
if (!lines || !lines.length || !pcdData || !pcdData.length)
|
|
14930
15548
|
return lines;
|
|
@@ -15052,7 +15670,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15052
15670
|
length: ptStart.distanceTo(ptDoorSt),
|
|
15053
15671
|
originalPoints: newOriginPts1.newOriginalPoints,
|
|
15054
15672
|
doorAndBeamData: newDoorAndBeamData1,
|
|
15055
|
-
id:
|
|
15673
|
+
id: randomUUID4(),
|
|
15056
15674
|
rooftopPz: line2.rooftopPz,
|
|
15057
15675
|
isRebuild: false,
|
|
15058
15676
|
direction: line2.direction
|
|
@@ -15063,7 +15681,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15063
15681
|
length: ptDoorSt.distanceTo(ptDoorEd),
|
|
15064
15682
|
originalPoints: newOriginPts2.newOriginalPoints,
|
|
15065
15683
|
doorAndBeamData: newDoorAndBeamData2,
|
|
15066
|
-
id:
|
|
15684
|
+
id: randomUUID4(),
|
|
15067
15685
|
rooftopPz: line2.rooftopPz,
|
|
15068
15686
|
isRebuild: false,
|
|
15069
15687
|
direction: line2.direction,
|
|
@@ -15082,7 +15700,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15082
15700
|
length: ptDoorEd.distanceTo(ptEnd),
|
|
15083
15701
|
originalPoints: newOriginPts3.newOriginalPoints,
|
|
15084
15702
|
doorAndBeamData: newDoorAndBeamData3,
|
|
15085
|
-
id:
|
|
15703
|
+
id: randomUUID4(),
|
|
15086
15704
|
rooftopPz: line2.rooftopPz,
|
|
15087
15705
|
isRebuild: false,
|
|
15088
15706
|
direction: line2.direction
|
|
@@ -15152,7 +15770,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15152
15770
|
length: ptStart.distanceTo(ptDoorSt),
|
|
15153
15771
|
originalPoints: newOriginPts1.newOriginalPoints,
|
|
15154
15772
|
doorAndBeamData: newDoorAndBeamData1,
|
|
15155
|
-
id:
|
|
15773
|
+
id: randomUUID4(),
|
|
15156
15774
|
rooftopPz: line2.rooftopPz,
|
|
15157
15775
|
isRebuild: false,
|
|
15158
15776
|
direction: line2.direction
|
|
@@ -15163,7 +15781,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15163
15781
|
length: ptDoorSt.distanceTo(ptDoorEd),
|
|
15164
15782
|
originalPoints: newOriginPts2.newOriginalPoints,
|
|
15165
15783
|
doorAndBeamData: newDoorAndBeamData2,
|
|
15166
|
-
id:
|
|
15784
|
+
id: randomUUID4(),
|
|
15167
15785
|
rooftopPz: line2.rooftopPz,
|
|
15168
15786
|
isRebuild: false,
|
|
15169
15787
|
direction: line2.direction,
|
|
@@ -15182,7 +15800,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15182
15800
|
length: ptDoorEd.distanceTo(ptEnd),
|
|
15183
15801
|
originalPoints: newOriginPts3.newOriginalPoints,
|
|
15184
15802
|
doorAndBeamData: newDoorAndBeamData3,
|
|
15185
|
-
id:
|
|
15803
|
+
id: randomUUID4(),
|
|
15186
15804
|
rooftopPz: line2.rooftopPz,
|
|
15187
15805
|
isRebuild: false,
|
|
15188
15806
|
direction: line2.direction
|
|
@@ -15246,7 +15864,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15246
15864
|
length: ptLineSt.distanceTo(ptNewDoorSt),
|
|
15247
15865
|
originalPoints: newOriginPts1.newOriginalPoints,
|
|
15248
15866
|
doorAndBeamData: newDoorAndBeamData1,
|
|
15249
|
-
id:
|
|
15867
|
+
id: randomUUID4(),
|
|
15250
15868
|
rooftopPz: lineTmp.rooftopPz,
|
|
15251
15869
|
isRebuild: false,
|
|
15252
15870
|
direction: lineTmp.direction
|
|
@@ -15257,7 +15875,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15257
15875
|
length: ptNewDoorSt.distanceTo(ptNewDoorEd),
|
|
15258
15876
|
originalPoints: newOriginPts2.newOriginalPoints,
|
|
15259
15877
|
doorAndBeamData: newDoorAndBeamData2,
|
|
15260
|
-
id:
|
|
15878
|
+
id: randomUUID4(),
|
|
15261
15879
|
rooftopPz: lineTmp.rooftopPz,
|
|
15262
15880
|
isRebuild: false,
|
|
15263
15881
|
direction: lineTmp.direction,
|
|
@@ -15276,7 +15894,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
|
|
|
15276
15894
|
length: ptNewDoorEd.distanceTo(ptLineEd),
|
|
15277
15895
|
originalPoints: newOriginPts3.newOriginalPoints,
|
|
15278
15896
|
doorAndBeamData: newDoorAndBeamData3,
|
|
15279
|
-
id:
|
|
15897
|
+
id: randomUUID4(),
|
|
15280
15898
|
rooftopPz: lineTmp.rooftopPz,
|
|
15281
15899
|
isRebuild: false,
|
|
15282
15900
|
direction: lineTmp.direction
|