rm-graphical-computing-node 1.0.114 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +670 -56
  2. 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 < doorDatas.length; n++) {
4551
- let doorSt = new THREE5.Vector3(doorDatas[n].doorStartPt.x, doorDatas[n].doorStartPt.y, 0);
4552
- let doorEd = new THREE5.Vector3(doorDatas[n].doorEndPt.x, doorDatas[n].doorEndPt.y, 0);
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 < doorDatas[n].maxZ || Math.abs(tmpRegion.facePoints[2].z - doorDatas[n].maxZ) < 0.3;
4556
- let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - doorDatas[n].maxZ) > 0.2;
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
@@ -4564,8 +4570,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4564
4570
  let targeVec = new THREE5.Vector3();
4565
4571
  let ptClose = line3.closestPointToPoint(ptCenter, true, targeVec);
4566
4572
  let dist2 = ptCenter.distanceTo(ptClose);
4567
- if (id == 11 && index == 74 && n == 4)
4568
- console.log("dist", dist2);
4569
4573
  if (dist2 < 0.2) {
4570
4574
  let dist1 = beamSt.distanceTo(doorSt);
4571
4575
  let dist22 = beamEd.distanceTo(doorSt);
@@ -4576,13 +4580,17 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4576
4580
  continue;
4577
4581
  }
4578
4582
  }
4583
+ if (doorAndDoorFrameDatas[n].category == "door frame") {
4584
+ findDoorFrame = true;
4585
+ continue;
4586
+ }
4579
4587
  isDoor = true;
4580
4588
  isPullOutDoor = true;
4581
- pcbDoorIndexs.push(doorDatas[n].index);
4582
- doorDatas[n].isFind = true;
4589
+ pcbDoorIndexs.push(doorAndDoorFrameDatas[n].index);
4590
+ doorAndDoorFrameDatas[n].isFind = true;
4583
4591
  findDoorDataIndex = n;
4584
- beforePcdDoorIsFindBeam = pcdData[doorDatas[n].index].isFindBeam;
4585
- pcdData[doorDatas[n].index].isFindBeam = true;
4592
+ beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
4593
+ pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
4586
4594
  let beamVec = new THREE5.Vector3().subVectors(beamSt, beamEd).normalize();
4587
4595
  let doorLength = doorSt.distanceTo(doorEd) - result.overlap;
4588
4596
  if (dist22 < dist1)
@@ -4605,7 +4613,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4605
4613
  let distTmp1 = beamSt.distanceTo(beamEd);
4606
4614
  let distTmp2 = doorEd.distanceTo(doorSt);
4607
4615
  if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
4608
- if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 1) {
4616
+ if (distTmp2 > distTmp1 && Math.abs(distTmp2 - result.overlap) > 1 && doorAndDoorFrameDatas[n].category === "door") {
4609
4617
  let dist1 = beamSt.distanceTo(doorSt);
4610
4618
  let dist2 = beamSt.distanceTo(doorEd);
4611
4619
  let dist3 = beamEd.distanceTo(doorSt);
@@ -4630,12 +4638,16 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4630
4638
  }
4631
4639
  }
4632
4640
  if (length2 > 1.5) {
4641
+ if (doorAndDoorFrameDatas[n].category === "door frame") {
4642
+ findDoorFrame = true;
4643
+ continue;
4644
+ }
4633
4645
  isDoor = true;
4634
4646
  isPullOutDoor = true;
4635
- pcbDoorIndexs.push(doorDatas[n].index);
4636
- doorDatas[n].isFind = true;
4637
- beforePcdDoorIsFindBeam = pcdData[doorDatas[n].index].isFindBeam;
4638
- pcdData[doorDatas[n].index].isFindBeam = true;
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;
4639
4651
  findDoorDataIndex = n;
4640
4652
  }
4641
4653
  }
@@ -4647,10 +4659,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4647
4659
  /**!isPullOutDoor && */
4648
4660
  length2 < 1.6
4649
4661
  ) {
4650
- for (let n = 0; n < doorDatas.length; n++) {
4651
- if (doorDatas[n].inWall) continue;
4652
- let doorSt = new THREE5.Vector3(doorDatas[n].doorStartPt.x, doorDatas[n].doorStartPt.y, 0);
4653
- let doorEd = new THREE5.Vector3(doorDatas[n].doorEndPt.x, doorDatas[n].doorEndPt.y, 0);
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);
4654
4666
  let beamSt = new THREE5.Vector3(beamTmpEd.x, beamTmpEd.y, 0);
4655
4667
  let beamEd = new THREE5.Vector3(beamTmpSt.x, beamTmpSt.y, 0);
4656
4668
  let vec1 = new THREE5.Vector3().subVectors(doorSt, doorEd).normalize();
@@ -4671,6 +4683,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4671
4683
  let dist44 = doorEd.distanceTo(beamEd);
4672
4684
  let isNear = dist11 < nearDist || dist22 < nearDist || dist33 < nearDist || dist44 < nearDist;
4673
4685
  if ((isNear || insertPt) && bIsTrue) {
4686
+ if (doorAndDoorFrameDatas[n].category == "door frame") {
4687
+ findDoorFrame = true;
4688
+ continue;
4689
+ }
4674
4690
  let tmppLine3 = new THREE5.Line3(beamSt, beamEd);
4675
4691
  if (dist11 < nearDist || dist33 < nearDist) {
4676
4692
  doorOpenEndPoint = beamSt.clone();
@@ -4708,10 +4724,10 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4708
4724
  doorOpenVector = new THREE5.Vector3().subVectors(doorStExtended, ptCloseTmppp).normalize();
4709
4725
  }
4710
4726
  }
4711
- beforePcdDoorIsFindBeam = pcdData[doorDatas[n].index].isFindBeam;
4712
- pcdData[doorDatas[n].index].isFindBeam = true;
4727
+ beforePcdDoorIsFindBeam = pcdData[doorAndDoorFrameDatas[n].index].isFindBeam;
4728
+ pcdData[doorAndDoorFrameDatas[n].index].isFindBeam = true;
4713
4729
  isDoor = true;
4714
- doorDatas[n].isFind = true;
4730
+ doorAndDoorFrameDatas[n].isFind = true;
4715
4731
  findDoorDataIndex = n;
4716
4732
  }
4717
4733
  }
@@ -4778,8 +4794,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4778
4794
  lineIsOnlyBeam: false,
4779
4795
  groundClearance
4780
4796
  };
4781
- if (doorAndBeamDataObj.beamHeight < 0.1)
4782
- continue;
4783
4797
  let nearDistTmp = Infinity;
4784
4798
  let findNearDoorIndex = false;
4785
4799
  let nearBeamSt = new THREE5.Vector3();
@@ -4806,7 +4820,8 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4806
4820
  let lineLen = startPt2.distanceTo(endPt2);
4807
4821
  let doorLen = doorTmpSt.distanceTo(doorTmpEd);
4808
4822
  let tmpLine66 = new THREE5.Line3(startPt2, endPt2);
4809
- let tmpPt66 = new THREE5.Vector3(doorTmpSt.x, doorTmpSt.y, startPt2.z);
4823
+ let tmpPt66 = getMid(doorTmpSt, doorTmpEd);
4824
+ tmpPt66.z = startPt2.z;
4810
4825
  let ptClose66 = tmpLine66.closestPointToPoint(tmpPt66, true, new THREE5.Vector3());
4811
4826
  let isPPPP = perpendicularInfo(ptClose66, tmpPt66, doorTmpSt, doorTmpEd);
4812
4827
  if (doorLen > lineLen) {
@@ -4814,14 +4829,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4814
4829
  new THREE5.Vector3(doorTmpSt.x, doorTmpSt.y, startPt2.z),
4815
4830
  new THREE5.Vector3(doorTmpEd.x, doorTmpEd.y, startPt2.z)
4816
4831
  );
4817
- tmpPt66 = startPt2.clone();
4832
+ tmpPt66 = getMid(startPt2, endPt2);
4818
4833
  ptClose66 = tmpLine66.closestPointToPoint(tmpPt66, true, new THREE5.Vector3());
4819
4834
  isPPPP = perpendicularInfo(ptClose66, tmpPt66, doorTmpSt, doorTmpEd);
4820
4835
  [ptClose66, tmpPt66] = [tmpPt66, ptClose66];
4821
4836
  }
4822
4837
  if (isPPPP && isPPPP.angle > 85 && !wallBelowBeam) {
4823
4838
  doorAndBeamDataObj.beamNearWallVec = new THREE5.Vector3().subVectors(ptClose66, tmpPt66).normalize();
4824
- if (doorAndBeamDataObj.beamStart.z > lines[x].rooftopPz - 0.05 && length2 > 1) {
4839
+ if (doorAndBeamDataObj.beamStart.z > lines[x].rooftopPz - 0.08 && length2 > 1) {
4825
4840
  wallBelowBeam = true;
4826
4841
  } else
4827
4842
  wallBelowBeam = false;
@@ -4929,8 +4944,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4929
4944
  dataType = /**nearWall && lineLength > 0.8 ? "beam" : */
4930
4945
  "hole";
4931
4946
  }
4947
+ if (dataType == "beam" && findDoorFrame) {
4948
+ console.log("id", id, lineLength);
4949
+ dataType = "hole";
4950
+ }
4932
4951
  doorAndBeamDataObj.type = dataType;
4933
4952
  doorAndBeamDataObj.wallBelowBeam = wallBelowBeam;
4953
+ if (doorAndBeamDataObj.beamHeight < 0.1 && doorAndBeamDataObj.type == "beam")
4954
+ continue;
4934
4955
  if (doorFrame && doorFrame.length > 0 && doorAndBeamDataObj.type == "door") {
4935
4956
  let doorLen = doorTmpSt.distanceTo(doorTmpEd);
4936
4957
  let lineStart2 = getPt3(line2.start);
@@ -5056,12 +5077,12 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
5056
5077
  else if (doorAndBeamDataObj.isPullOutDoor)
5057
5078
  tmpDoorBeamData.isPullOutDoor = true;
5058
5079
  const hasCommon = pcbDoorIndexs.some((item) => tmpDoorBeamData.pcbDoorIndexs.includes(item));
5059
- if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam" || doorAndBeamDataObj.type == "hole" && tmpDoorBeamData.type == "hole" || doorAndBeamDataObj.type == "door" && tmpDoorBeamData.type == "door" && (doorAndBeamDataObj.isPullOutDoor && tmpDoorBeamData.isPullOutDoor)) {
5080
+ if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam" || doorAndBeamDataObj.type == "hole" && tmpDoorBeamData.type == "hole" || doorAndBeamDataObj.type == "door" && tmpDoorBeamData.type == "door" && (doorAndBeamDataObj.isPullOutDoor || tmpDoorBeamData.isPullOutDoor)) {
5060
5081
  if (length22 > length1) {
5061
5082
  doorAndBeamDataObj.isExtend = true;
5062
5083
  }
5063
5084
  if (length1 > length22) {
5064
- lines[doorBeamDataIndex[w2].linesIndex].isExtend = true;
5085
+ tmpDoorBeamData.isExtend = true;
5065
5086
  }
5066
5087
  }
5067
5088
  let lineIsOnlyBeam1 = false;
@@ -5226,17 +5247,59 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
5226
5247
  line2.mergeCheckRegion = null;
5227
5248
  }
5228
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
+ }
5229
5289
  for (let j = 0; j < findDoorIndexs.length; j++) {
5230
5290
  if (onProgress != null)
5231
5291
  onProgress(60 + (j + 1) / findDoorIndexs.length * 5);
5232
5292
  let savedata2 = [];
5233
5293
  for (let d = 0; d < lines[findDoorIndexs[j]].doorAndBeamData.length; d++) {
5294
+ const doorAndBeamData = lines[findDoorIndexs[j]].doorAndBeamData[d];
5234
5295
  let isDel = false;
5235
- if (lines[findDoorIndexs[j]].doorAndBeamData[d].type === "beam" && (lines[findDoorIndexs[j]].doorAndBeamData[d].beamNearWallVec.x == 0 && lines[findDoorIndexs[j]].doorAndBeamData[d].beamNearWallVec.y == 0 && lines[findDoorIndexs[j]].doorAndBeamData[d].beamNearWallVec.z == 0 && lines[findDoorIndexs[j]].doorAndBeamData[d].nearId == -1 || !lines[findDoorIndexs[j]].doorAndBeamData[d].wallBelowBeam && lines[findDoorIndexs[j]].doorAndBeamData[d].nearId == -1)) {
5236
- if (!lines[findDoorIndexs[j]].doorAndBeamData[d].lineIsOnlyBeam)
5237
- lines[findDoorIndexs[j]].doorAndBeamData[d].type = "hole";
5238
- else
5239
- isDel = true;
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
+ }
5240
5303
  }
5241
5304
  if (!isDel) {
5242
5305
  let doorSt1 = lines[findDoorIndexs[j]].doorAndBeamData[d].doorStart.clone();
@@ -5438,6 +5501,541 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
5438
5501
  }
5439
5502
  lines.length = 0;
5440
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);
5441
6039
  return { lines, beamGroup, pcdData };
5442
6040
  };
5443
6041
  var checkBeamIsReasonable = async (lines, lineReader) => {
@@ -13837,7 +14435,7 @@ var getOBB = (contour) => {
13837
14435
  // src/geometry/window.mjs
13838
14436
  import * as THREE10 from "three";
13839
14437
  import { mergeGeometries as mergeGeometries5 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
13840
- import { randomUUID as randomUUID2 } from "crypto";
14438
+ import { randomUUID as randomUUID3 } from "crypto";
13841
14439
  import { retarget } from "three/examples/jsm/utils/SkeletonUtils.js";
13842
14440
  var getWindowData = (lines, pcdData, lineReader) => {
13843
14441
  if (lines.length <= 0 || !pcdData)
@@ -13923,7 +14521,6 @@ var getWindowData = (lines, pcdData, lineReader) => {
13923
14521
  val2.gridHeight,
13924
14522
  val2.centerPts
13925
14523
  );
13926
- val2.centerPts = null;
13927
14524
  val2.facePoints = facePoints;
13928
14525
  val2.boxArea = boxArea;
13929
14526
  val2.totalInPlaneNum = totalInPlaneNum;
@@ -14075,7 +14672,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14075
14672
  let length2 = tmpRegion.facePoints[0].distanceTo(tmpRegion.facePoints[1]);
14076
14673
  let height = tmpRegion.facePoints[0].distanceTo(tmpRegion.facePoints[3]);
14077
14674
  let lengthPercentage = length2 / line2.length * 100;
14078
- if (length2 < 0.2 || height < 0.2)
14675
+ if (length2 < 0.2 || height < 0.2 || region.centerPts.length < 20)
14079
14676
  continue;
14080
14677
  let addData = false;
14081
14678
  let isWindow = false;
@@ -14088,6 +14685,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14088
14685
  let doorTmpSt = tmpRegion.facePoints[0].clone();
14089
14686
  let doorTmpEd = tmpRegion.facePoints[1].clone();
14090
14687
  let findDoorDataIndex = -1;
14688
+ let windowToWallAngle = -1;
14091
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) {
14092
14690
  const { newOriginalPoints } = getProjectedPointOnLine(doorTmpSt, doorTmpEd, line2.originalPoints);
14093
14691
  const topPoints = [];
@@ -14117,7 +14715,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14117
14715
  let doorEd = new THREE10.Vector3(windowDatas[n].windowEndPt.x, windowDatas[n].windowEndPt.y, 0);
14118
14716
  let beamSt = new THREE10.Vector3(tmpRegion.facePoints[0].x, tmpRegion.facePoints[0].y, 0);
14119
14717
  let beamEd = new THREE10.Vector3(tmpRegion.facePoints[1].x, tmpRegion.facePoints[1].y, 0);
14120
- let bIsTrue = tmpRegion.facePoints[2].z < windowDatas[n].maxZ || Math.abs(tmpRegion.facePoints[2].z - windowDatas[n].maxZ) < 0.3;
14718
+ let bIsTrue = true;
14121
14719
  let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - windowDatas[n].maxZ) > 0.2;
14122
14720
  if (bIsTrue) {
14123
14721
  let result = classifySegments(doorSt.clone(), doorEd.clone(), beamSt.clone(), beamEd.clone(), {
@@ -14143,6 +14741,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14143
14741
  pcbDoorIndexs.push(windowDatas[n].index);
14144
14742
  windowDatas[n].isFind = true;
14145
14743
  windowObj_id = windowDatas[n].obj_id;
14744
+ windowToWallAngle = 0;
14146
14745
  findDoorDataIndex = n;
14147
14746
  beforePcdDoorisFindWindow = pcdData[windowDatas[n].index].isFindWindow;
14148
14747
  pcdData[windowDatas[n].index].isFindWindow = true;
@@ -14169,6 +14768,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14169
14768
  let distTmp2 = doorEd.distanceTo(doorSt);
14170
14769
  if (Math.abs(distTmp1 - result.overlap) < 0.25 || Math.abs(distTmp2 - result.overlap) < 0.25) {
14171
14770
  if (length2 > 0.3) {
14771
+ windowToWallAngle = 0;
14172
14772
  isWindow = true;
14173
14773
  pcbDoorIndexs.push(windowDatas[n].index);
14174
14774
  windowDatas[n].isFind = true;
@@ -14197,8 +14797,9 @@ var getWindowData = (lines, pcdData, lineReader) => {
14197
14797
  let beamStExtended = beamSt.clone().addScaledVector(vec2, nExtend);
14198
14798
  let beamEdExtended = beamEd.clone().addScaledVector(vec2.clone().negate(), nExtend);
14199
14799
  let isPPP = getParallelism(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
14200
- if (isPPP.isParallel || isPPP.angleDeg > 45)
14800
+ if (isPPP.isParallel)
14201
14801
  continue;
14802
+ windowToWallAngle = isPPP.angleDeg;
14202
14803
  let insertPt = segmentsIntersect2D(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
14203
14804
  let bIsTrue = true;
14204
14805
  let dist11 = doorSt.distanceTo(beamSt);
@@ -14326,7 +14927,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
14326
14927
  let windowHeight = beamTmpSt.z - doorTmpSt.z;
14327
14928
  const windowLen = doorTmpSt.distanceTo(doorTmpEd);
14328
14929
  let changeWindowSize = false;
14329
- let windowSizeThreshold = 0.5;
14930
+ let windowSizeThreshold = 0.3;
14330
14931
  if ((Math.abs(windowPcdLen - windowLen) < windowSizeThreshold || windowPcdLen > windowLen) && (Math.abs(windowPcdHeight - windowHeight) < windowSizeThreshold || windowPcdHeight > windowHeight)) {
14331
14932
  changeWindowSize = true;
14332
14933
  } else {
@@ -14451,6 +15052,19 @@ var getWindowData = (lines, pcdData, lineReader) => {
14451
15052
  groundClearance,
14452
15053
  obj_id: windowObj_id
14453
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
+ }
14454
15068
  line2.windowIdToCheckResults.push([region.index, id]);
14455
15069
  if (windowDatas[findDoorDataIndex].findLineIndex.length > 0) {
14456
15070
  let lineIndex = windowDatas[findDoorDataIndex].findLineIndex[0];
@@ -14859,7 +15473,7 @@ var getWindowPcdData = (lines, pcdData) => {
14859
15473
  length: tmpPtStart.distanceTo(ptWindowSt),
14860
15474
  originalPoints: newOriginPts1.newOriginalPoints,
14861
15475
  doorAndBeamData: newDoorAndBeamData1,
14862
- id: randomUUID2(),
15476
+ id: randomUUID3(),
14863
15477
  rooftopPz: line2.rooftopPz,
14864
15478
  isRebuild: false,
14865
15479
  direction: line2.direction
@@ -14870,7 +15484,7 @@ var getWindowPcdData = (lines, pcdData) => {
14870
15484
  length: ptWindowSt.distanceTo(ptWindowEd),
14871
15485
  originalPoints: newOriginPts2.newOriginalPoints,
14872
15486
  doorAndBeamData: newDoorAndBeamData2,
14873
- id: randomUUID2(),
15487
+ id: randomUUID3(),
14874
15488
  rooftopPz: line2.rooftopPz,
14875
15489
  isRebuild: false,
14876
15490
  direction: line2.direction,
@@ -14883,7 +15497,7 @@ var getWindowPcdData = (lines, pcdData) => {
14883
15497
  length: ptWindowEd.distanceTo(tmpPtEnd),
14884
15498
  originalPoints: newOriginPts3.newOriginalPoints,
14885
15499
  doorAndBeamData: newDoorAndBeamData3,
14886
- id: randomUUID2(),
15500
+ id: randomUUID3(),
14887
15501
  rooftopPz: line2.rooftopPz,
14888
15502
  isRebuild: false,
14889
15503
  direction: line2.direction
@@ -14928,7 +15542,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
14928
15542
 
14929
15543
  // src/geometry/door.mjs
14930
15544
  import * as THREE11 from "three";
14931
- import { randomUUID as randomUUID3 } from "crypto";
15545
+ import { randomUUID as randomUUID4 } from "crypto";
14932
15546
  var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14933
15547
  if (!lines || !lines.length || !pcdData || !pcdData.length)
14934
15548
  return lines;
@@ -15056,7 +15670,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15056
15670
  length: ptStart.distanceTo(ptDoorSt),
15057
15671
  originalPoints: newOriginPts1.newOriginalPoints,
15058
15672
  doorAndBeamData: newDoorAndBeamData1,
15059
- id: randomUUID3(),
15673
+ id: randomUUID4(),
15060
15674
  rooftopPz: line2.rooftopPz,
15061
15675
  isRebuild: false,
15062
15676
  direction: line2.direction
@@ -15067,7 +15681,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15067
15681
  length: ptDoorSt.distanceTo(ptDoorEd),
15068
15682
  originalPoints: newOriginPts2.newOriginalPoints,
15069
15683
  doorAndBeamData: newDoorAndBeamData2,
15070
- id: randomUUID3(),
15684
+ id: randomUUID4(),
15071
15685
  rooftopPz: line2.rooftopPz,
15072
15686
  isRebuild: false,
15073
15687
  direction: line2.direction,
@@ -15086,7 +15700,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15086
15700
  length: ptDoorEd.distanceTo(ptEnd),
15087
15701
  originalPoints: newOriginPts3.newOriginalPoints,
15088
15702
  doorAndBeamData: newDoorAndBeamData3,
15089
- id: randomUUID3(),
15703
+ id: randomUUID4(),
15090
15704
  rooftopPz: line2.rooftopPz,
15091
15705
  isRebuild: false,
15092
15706
  direction: line2.direction
@@ -15156,7 +15770,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15156
15770
  length: ptStart.distanceTo(ptDoorSt),
15157
15771
  originalPoints: newOriginPts1.newOriginalPoints,
15158
15772
  doorAndBeamData: newDoorAndBeamData1,
15159
- id: randomUUID3(),
15773
+ id: randomUUID4(),
15160
15774
  rooftopPz: line2.rooftopPz,
15161
15775
  isRebuild: false,
15162
15776
  direction: line2.direction
@@ -15167,7 +15781,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15167
15781
  length: ptDoorSt.distanceTo(ptDoorEd),
15168
15782
  originalPoints: newOriginPts2.newOriginalPoints,
15169
15783
  doorAndBeamData: newDoorAndBeamData2,
15170
- id: randomUUID3(),
15784
+ id: randomUUID4(),
15171
15785
  rooftopPz: line2.rooftopPz,
15172
15786
  isRebuild: false,
15173
15787
  direction: line2.direction,
@@ -15186,7 +15800,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15186
15800
  length: ptDoorEd.distanceTo(ptEnd),
15187
15801
  originalPoints: newOriginPts3.newOriginalPoints,
15188
15802
  doorAndBeamData: newDoorAndBeamData3,
15189
- id: randomUUID3(),
15803
+ id: randomUUID4(),
15190
15804
  rooftopPz: line2.rooftopPz,
15191
15805
  isRebuild: false,
15192
15806
  direction: line2.direction
@@ -15250,7 +15864,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15250
15864
  length: ptLineSt.distanceTo(ptNewDoorSt),
15251
15865
  originalPoints: newOriginPts1.newOriginalPoints,
15252
15866
  doorAndBeamData: newDoorAndBeamData1,
15253
- id: randomUUID3(),
15867
+ id: randomUUID4(),
15254
15868
  rooftopPz: lineTmp.rooftopPz,
15255
15869
  isRebuild: false,
15256
15870
  direction: lineTmp.direction
@@ -15261,7 +15875,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15261
15875
  length: ptNewDoorSt.distanceTo(ptNewDoorEd),
15262
15876
  originalPoints: newOriginPts2.newOriginalPoints,
15263
15877
  doorAndBeamData: newDoorAndBeamData2,
15264
- id: randomUUID3(),
15878
+ id: randomUUID4(),
15265
15879
  rooftopPz: lineTmp.rooftopPz,
15266
15880
  isRebuild: false,
15267
15881
  direction: lineTmp.direction,
@@ -15280,7 +15894,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15280
15894
  length: ptNewDoorEd.distanceTo(ptLineEd),
15281
15895
  originalPoints: newOriginPts3.newOriginalPoints,
15282
15896
  doorAndBeamData: newDoorAndBeamData3,
15283
- id: randomUUID3(),
15897
+ id: randomUUID4(),
15284
15898
  rooftopPz: lineTmp.rooftopPz,
15285
15899
  isRebuild: false,
15286
15900
  direction: lineTmp.direction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.114",
3
+ "version": "1.0.115",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",