rm-graphical-computing-node 1.0.79 → 1.0.81

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 +107 -8
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -12556,8 +12556,8 @@ var getDoorPcdData = (lines, pcdData) => {
12556
12556
  const line2 = tmpLines[maxIndex];
12557
12557
  let ptStart = getPt3(line2.start);
12558
12558
  let ptEnd = getPt3(line2.end);
12559
- let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, 0.05);
12560
- let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, 0.05);
12559
+ let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, 0.3);
12560
+ let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, 0.3);
12561
12561
  if (intersect1 != null && intersect2 != null) {
12562
12562
  if (line2.mergeIndexs) {
12563
12563
  let tmpIndex = [];
@@ -12589,7 +12589,7 @@ var getDoorPcdData = (lines, pcdData) => {
12589
12589
  newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
12590
12590
  }
12591
12591
  }
12592
- let groundClearance = minZ - ptDoorSt.z;
12592
+ let groundClearance = minZ - line2.start.z;
12593
12593
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12594
12594
  let newLine1 = {
12595
12595
  start: ptStart,
@@ -12613,8 +12613,8 @@ var getDoorPcdData = (lines, pcdData) => {
12613
12613
  isRebuild: false,
12614
12614
  direction: line2.direction,
12615
12615
  drawDoorData: {
12616
- start: new THREE11.Vector3(ptDoorSt.x, ptDoorSt.y, minZ),
12617
- end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, minZ),
12616
+ start: new THREE11.Vector3(ptDoorSt.x, ptDoorSt.y, line2.start.z),
12617
+ end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, line2.start.z),
12618
12618
  n: new THREE11.Vector3(0, 0, 0),
12619
12619
  height,
12620
12620
  groundClearance
@@ -12632,14 +12632,113 @@ var getDoorPcdData = (lines, pcdData) => {
12632
12632
  isRebuild: false,
12633
12633
  direction: line2.direction
12634
12634
  };
12635
- if (newLine1.originalPoints.length > 0)
12635
+ if (newLine1.originalPoints.length > 0 && newLine1.length > 0.01)
12636
12636
  lines.push(newLine1);
12637
- if (newLine2.originalPoints.length > 0)
12637
+ if (newLine2.originalPoints.length > 0 && newLine2.length > 0.01)
12638
12638
  lines.push(newLine2);
12639
- if (newLine3.originalPoints.length > 0)
12639
+ if (newLine3.originalPoints.length > 0 && newLine3.length > 0.01)
12640
12640
  lines.push(newLine3);
12641
12641
  pcd.isFindDoor = true;
12642
12642
  line2.isRebuild = true;
12643
+ } else if (intersect1 == null && intersect2 == null) {
12644
+ ptShortSt1.z = ptShortEd1.z = ptShortSt2.z = ptShortEd2.z = line2.start.z;
12645
+ let shortLine1 = new THREE11.Line3(ptShortSt1, ptShortEd1);
12646
+ let shortLine2 = new THREE11.Line3(ptShortSt2, ptShortEd2);
12647
+ let ptClose1 = shortLine1.closestPointToPoint(ptStart, true, new THREE11.Vector3());
12648
+ let ptClose2 = shortLine1.closestPointToPoint(ptEnd, true, new THREE11.Vector3());
12649
+ let ptClose3 = shortLine2.closestPointToPoint(ptStart, true, new THREE11.Vector3());
12650
+ let ptClose4 = shortLine2.closestPointToPoint(ptEnd, true, new THREE11.Vector3());
12651
+ let dist1 = ptClose1.distanceTo(ptStart);
12652
+ let dist2 = ptClose2.distanceTo(ptEnd);
12653
+ let dist3 = ptClose3.distanceTo(ptStart);
12654
+ let dist4 = ptClose4.distanceTo(ptEnd);
12655
+ let nearDist = 0.1;
12656
+ console.log(dist1, dist2, dist3, dist4);
12657
+ if ((dist1 < nearDist || dist2 < nearDist) && (dist3 < nearDist || dist4 < nearDist)) {
12658
+ if (line2.mergeIndexs) {
12659
+ let tmpIndex = [];
12660
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
12661
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
12662
+ }
12663
+ for (let h = 0; h < lines.length; h++) {
12664
+ if (tmpIndex.includes(h))
12665
+ lines[h].isRebuild = true;
12666
+ }
12667
+ }
12668
+ let ptDoorSt = ptClose1.clone();
12669
+ let ptDoorEd = ptClose3.clone();
12670
+ if (dist2 < nearDist)
12671
+ ptDoorSt = ptClose2.clone();
12672
+ if (dist4 < nearDist)
12673
+ ptDoorEd = ptClose4.clone();
12674
+ const newOriginPts1 = getProjectedPointOnLine(ptStart, ptDoorSt, line2.originalPoints);
12675
+ const newOriginPts2 = getProjectedPointOnLine(ptDoorSt, ptDoorEd, line2.originalPoints);
12676
+ const newOriginPts3 = getProjectedPointOnLine(ptDoorEd, ptEnd, line2.originalPoints);
12677
+ const newDoorAndBeamData1 = [];
12678
+ const newDoorAndBeamData2 = [];
12679
+ const newDoorAndBeamData3 = [];
12680
+ if (line2.doorAndBeamData) {
12681
+ for (let a = 0; a < line2.doorAndBeamData.length; a++) {
12682
+ let doorStart = line2.doorAndBeamData[a].doorStart;
12683
+ let doorEnd = line2.doorAndBeamData[a].doorEnd;
12684
+ if (isPointOnLine2(ptStart, ptDoorSt, doorStart, 1e-3, true) && isPointOnLine2(ptStart, ptDoorSt, doorEnd, 1e-3, true))
12685
+ newDoorAndBeamData1.push(line2.doorAndBeamData[a]);
12686
+ else if (isPointOnLine2(ptDoorEd, ptEnd, doorStart, 1e-3, true) && isPointOnLine2(ptDoorEd, ptEnd, doorEnd, 1e-3, true))
12687
+ newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
12688
+ }
12689
+ }
12690
+ let groundClearance = minZ - line2.start.z;
12691
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12692
+ let newLine1 = {
12693
+ start: ptStart,
12694
+ end: ptDoorSt,
12695
+ length: ptStart.distanceTo(ptDoorSt),
12696
+ originalPoints: newOriginPts1.newOriginalPoints,
12697
+ doorAndBeamData: newDoorAndBeamData1,
12698
+ id: randomUUID2(),
12699
+ rooftopPz: line2.rooftopPz,
12700
+ isRebuild: false,
12701
+ direction: line2.direction
12702
+ };
12703
+ let newLine2 = {
12704
+ start: ptDoorSt,
12705
+ end: ptDoorEd,
12706
+ length: ptDoorSt.distanceTo(ptDoorEd),
12707
+ originalPoints: newOriginPts2.newOriginalPoints,
12708
+ doorAndBeamData: newDoorAndBeamData2,
12709
+ id: randomUUID2(),
12710
+ rooftopPz: line2.rooftopPz,
12711
+ isRebuild: false,
12712
+ direction: line2.direction,
12713
+ drawDoorData: {
12714
+ start: new THREE11.Vector3(ptDoorSt.x, ptDoorSt.y, line2.start.z),
12715
+ end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, line2.start.z),
12716
+ n: new THREE11.Vector3(0, 0, 0),
12717
+ height,
12718
+ groundClearance
12719
+ },
12720
+ isDoor: true
12721
+ };
12722
+ let newLine3 = {
12723
+ start: ptDoorEd,
12724
+ end: ptEnd,
12725
+ length: ptDoorEd.distanceTo(ptEnd),
12726
+ originalPoints: newOriginPts3.newOriginalPoints,
12727
+ doorAndBeamData: newDoorAndBeamData3,
12728
+ id: randomUUID2(),
12729
+ rooftopPz: line2.rooftopPz,
12730
+ isRebuild: false,
12731
+ direction: line2.direction
12732
+ };
12733
+ if (newLine1.originalPoints.length > 0 && newLine1.length > 0.01)
12734
+ lines.push(newLine1);
12735
+ if (newLine2.originalPoints.length > 0 && newLine2.length > 0.01)
12736
+ lines.push(newLine2);
12737
+ if (newLine3.originalPoints.length > 0 && newLine3.length > 0.01)
12738
+ lines.push(newLine3);
12739
+ pcd.isFindDoor = true;
12740
+ line2.isRebuild = true;
12741
+ }
12643
12742
  }
12644
12743
  }
12645
12744
  return lines;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",