rm-graphical-computing-node 1.0.85 → 1.0.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +118 -3
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -12502,7 +12502,7 @@ var getWindowPcdData = (lines, pcdData) => {
12502
12502
  // src/geometry/door.mjs
12503
12503
  import * as THREE11 from "three";
12504
12504
  import { randomUUID as randomUUID2 } from "crypto";
12505
- var getDoorPcdData = (lines, pcdData) => {
12505
+ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
12506
12506
  if (!lines || !lines.length || !pcdData || !pcdData.length)
12507
12507
  return lines;
12508
12508
  const pcdToLineDist = 0.1;
@@ -12575,8 +12575,21 @@ var getDoorPcdData = (lines, pcdData) => {
12575
12575
  const line2 = tmpLines[maxIndex];
12576
12576
  let ptStart = getPt3(line2.start);
12577
12577
  let ptEnd = getPt3(line2.end);
12578
- let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, pcdToLineDist);
12579
- let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, pcdToLineDist);
12578
+ let vec1 = getVector3(ptStart, ptEnd);
12579
+ let vec2 = getVector3(ptShortSt1, ptShortEd1);
12580
+ let vec32 = getVector3(ptShortSt2, ptShortEd2);
12581
+ let tmpPtStart = ptStart.clone().addScaledVector(vec1, -pcdToLineDist);
12582
+ let tmpPtEnd = ptEnd.clone().addScaledVector(vec1, pcdToLineDist);
12583
+ let tmpPtShortSt1 = ptShortSt1.clone().addScaledVector(vec2, -pcdToLineDist);
12584
+ let tmpPtShortEd1 = ptShortEd1.clone().addScaledVector(vec2, pcdToLineDist);
12585
+ let tmpPtShortSt2 = ptShortSt2.clone().addScaledVector(vec32, -pcdToLineDist);
12586
+ let tmpPtShortEd2 = ptShortEd2.clone().addScaledVector(vec32, pcdToLineDist);
12587
+ let intersect1 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt1, tmpPtShortEd1, pcdToLineDist);
12588
+ let intersect2 = segmentsIntersect2D(tmpPtStart, tmpPtEnd, tmpPtShortSt2, tmpPtShortEd2, pcdToLineDist);
12589
+ console.log(intersect1, intersect2);
12590
+ let newDoorSt = null;
12591
+ let newDoorEd = null;
12592
+ let doorAddGroundClearance = 0;
12580
12593
  if (intersect1 != null && intersect2 != null) {
12581
12594
  if (line2.mergeIndexs) {
12582
12595
  let tmpIndex = [];
@@ -12610,6 +12623,7 @@ var getDoorPcdData = (lines, pcdData) => {
12610
12623
  }
12611
12624
  let groundClearance = minZ - line2.start.z;
12612
12625
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12626
+ doorAddGroundClearance = line2.start.z + groundClearance;
12613
12627
  let newLine1 = {
12614
12628
  start: ptStart,
12615
12629
  end: ptDoorSt,
@@ -12659,6 +12673,8 @@ var getDoorPcdData = (lines, pcdData) => {
12659
12673
  lines.push(newLine3);
12660
12674
  pcd.isFindDoor = true;
12661
12675
  line2.isRebuild = true;
12676
+ newDoorSt = newLine2.drawDoorData.start.clone();
12677
+ newDoorEd = newLine2.drawDoorData.end.clone();
12662
12678
  } else if (intersect1 == null && intersect2 == null) {
12663
12679
  ptShortSt1.z = ptShortEd1.z = ptShortSt2.z = ptShortEd2.z = line2.start.z;
12664
12680
  let shortLine1 = new THREE11.Line3(ptShortSt1, ptShortEd1);
@@ -12707,6 +12723,7 @@ var getDoorPcdData = (lines, pcdData) => {
12707
12723
  }
12708
12724
  let groundClearance = minZ - line2.start.z;
12709
12725
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12726
+ doorAddGroundClearance = line2.start.z + groundClearance;
12710
12727
  let newLine1 = {
12711
12728
  start: ptStart,
12712
12729
  end: ptDoorSt,
@@ -12756,6 +12773,104 @@ var getDoorPcdData = (lines, pcdData) => {
12756
12773
  lines.push(newLine3);
12757
12774
  pcd.isFindDoor = true;
12758
12775
  line2.isRebuild = true;
12776
+ newDoorSt = newLine2.drawDoorData.start.clone();
12777
+ newDoorEd = newLine2.drawDoorData.end.clone();
12778
+ }
12779
+ }
12780
+ if (newDoorSt != null && newDoorEd != null && needFindOtherDoor) {
12781
+ const newDoorLength = newDoorSt.distanceTo(newDoorEd);
12782
+ let isFind = false;
12783
+ for (let u4 = 0; u4 < lines.length; u4++) {
12784
+ const lineTmp = lines[u4];
12785
+ let ptLineSt = getPt3(lineTmp.start);
12786
+ let ptLineEd = getPt3(lineTmp.end);
12787
+ let line3 = new THREE11.Line3(ptLineSt, ptLineEd);
12788
+ if (!lineTmp || lineTmp.isRebuild || !lineTmp.doorAndBeamData || lineTmp.doorAndBeamData.length <= 0)
12789
+ continue;
12790
+ for (let w = 0; w < lineTmp.doorAndBeamData.length; w++) {
12791
+ const oldDoorData = lineTmp.doorAndBeamData[w];
12792
+ const doorStart = getPt3(oldDoorData.doorStart);
12793
+ const doorEnd = getPt3(oldDoorData.doorEnd);
12794
+ doorStart.z = doorEnd.z = newDoorSt.z;
12795
+ let classify = classifySegments(newDoorSt, newDoorEd, doorStart, doorEnd);
12796
+ if (classify && classify.type == "collinear_overlap" && classify.maxPerpendicularDistance < 0.3 && Math.abs(classify.overlap - newDoorLength) < 0.15) {
12797
+ let originDoorZ = newDoorSt.z;
12798
+ newDoorSt.z = newDoorEd.z = ptLineSt.z;
12799
+ let ptNewDoorSt = line3.closestPointToPoint(newDoorSt, false, new THREE11.Vector3());
12800
+ let ptNewDoorEd = line3.closestPointToPoint(newDoorEd, false, new THREE11.Vector3());
12801
+ if (ptLineSt.distanceTo(ptNewDoorSt) > ptLineSt.distanceTo(ptNewDoorEd))
12802
+ [ptNewDoorSt, ptNewDoorEd] = [ptNewDoorEd, ptNewDoorSt];
12803
+ const newOriginPts1 = getProjectedPointOnLine(ptLineSt, ptNewDoorSt, lineTmp.originalPoints);
12804
+ const newOriginPts2 = getProjectedPointOnLine(ptNewDoorSt, ptNewDoorEd, lineTmp.originalPoints);
12805
+ const newOriginPts3 = getProjectedPointOnLine(ptNewDoorEd, ptLineEd, lineTmp.originalPoints);
12806
+ const newDoorAndBeamData1 = [];
12807
+ const newDoorAndBeamData2 = [];
12808
+ const newDoorAndBeamData3 = [];
12809
+ if (lineTmp.doorAndBeamData) {
12810
+ for (let a = 0; a < lineTmp.doorAndBeamData.length; a++) {
12811
+ let doorStart2 = lineTmp.doorAndBeamData[a].doorStart;
12812
+ let doorEnd2 = lineTmp.doorAndBeamData[a].doorEnd;
12813
+ if (isPointOnLine2(ptLineSt, ptNewDoorSt, doorStart2, 1e-3, true) && isPointOnLine2(ptLineSt, ptNewDoorSt, doorEnd2, 1e-3, true))
12814
+ newDoorAndBeamData1.push(lineTmp.doorAndBeamData[a]);
12815
+ else if (isPointOnLine2(ptNewDoorEd, ptLineEd, doorStart2, 1e-3, true) && isPointOnLine2(ptNewDoorEd, ptLineEd, doorEnd2, 1e-3, true))
12816
+ newDoorAndBeamData3.push(lineTmp.doorAndBeamData[a]);
12817
+ }
12818
+ }
12819
+ let groundClearance = doorAddGroundClearance - lineTmp.start.z;
12820
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12821
+ let newLine1 = {
12822
+ start: ptLineSt,
12823
+ end: ptNewDoorSt,
12824
+ length: ptLineSt.distanceTo(ptNewDoorSt),
12825
+ originalPoints: newOriginPts1.newOriginalPoints,
12826
+ doorAndBeamData: newDoorAndBeamData1,
12827
+ id: randomUUID2(),
12828
+ rooftopPz: lineTmp.rooftopPz,
12829
+ isRebuild: false,
12830
+ direction: lineTmp.direction
12831
+ };
12832
+ let newLine2 = {
12833
+ start: ptNewDoorSt,
12834
+ end: ptNewDoorEd,
12835
+ length: ptNewDoorSt.distanceTo(ptNewDoorEd),
12836
+ originalPoints: newOriginPts2.newOriginalPoints,
12837
+ doorAndBeamData: newDoorAndBeamData2,
12838
+ id: randomUUID2(),
12839
+ rooftopPz: lineTmp.rooftopPz,
12840
+ isRebuild: false,
12841
+ direction: lineTmp.direction,
12842
+ drawDoorData: {
12843
+ start: new THREE11.Vector3(ptNewDoorSt.x, ptNewDoorSt.y, lineTmp.start.z),
12844
+ end: new THREE11.Vector3(ptNewDoorEd.x, ptNewDoorEd.y, lineTmp.start.z),
12845
+ n: new THREE11.Vector3(0, 0, 0),
12846
+ height,
12847
+ groundClearance
12848
+ },
12849
+ isDoor: true
12850
+ };
12851
+ let newLine3 = {
12852
+ start: ptNewDoorEd,
12853
+ end: ptLineEd,
12854
+ length: ptNewDoorEd.distanceTo(ptLineEd),
12855
+ originalPoints: newOriginPts3.newOriginalPoints,
12856
+ doorAndBeamData: newDoorAndBeamData3,
12857
+ id: randomUUID2(),
12858
+ rooftopPz: lineTmp.rooftopPz,
12859
+ isRebuild: false,
12860
+ direction: lineTmp.direction
12861
+ };
12862
+ if (newLine1.originalPoints.length > 0 && newLine1.length > 0.01)
12863
+ lines.push(newLine1);
12864
+ if (newLine2.originalPoints.length > 0 && newLine2.length > 0.01)
12865
+ lines.push(newLine2);
12866
+ if (newLine3.originalPoints.length > 0 && newLine3.length > 0.01)
12867
+ lines.push(newLine3);
12868
+ lineTmp.isRebuild = true;
12869
+ isFind = true;
12870
+ break;
12871
+ }
12872
+ }
12873
+ if (isFind) break;
12759
12874
  }
12760
12875
  }
12761
12876
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.85",
3
+ "version": "1.0.86",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",