rm-graphical-computing-node 1.0.105 → 1.0.107

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 +140 -83
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3526,6 +3526,12 @@ var setPointsSameZ = (points, z) => {
3526
3526
  points[i].z = z;
3527
3527
  return points;
3528
3528
  };
3529
+ function getObbLongSideDirection(obb, retNormalize = false) {
3530
+ const e = obb.rotation.elements;
3531
+ const h = obb.halfSize;
3532
+ const axis = h.x >= h.y ? new THREE3.Vector3(e[0], e[1], e[2]) : new THREE3.Vector3(e[3], e[4], e[5]);
3533
+ return retNormalize ? axis.normalize() : axis;
3534
+ }
3529
3535
  var getPt3 = (pt) => {
3530
3536
  return new THREE3.Vector3(pt.x, pt.y, pt.z);
3531
3537
  };
@@ -9106,6 +9112,8 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9106
9112
  pipeIsVerticalJ = false;
9107
9113
  }
9108
9114
  }
9115
+ let boxVecJ = null;
9116
+ boxVecJ = getObbLongSideDirection(cloneData.obb);
9109
9117
  for (let k = j + 1; k < array.length; k++) {
9110
9118
  if (array[k].obb == null || delData.has(k))
9111
9119
  continue;
@@ -9125,6 +9133,15 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
9125
9133
  if (cloneData.type == "pipe" && array[k].type == "pipe" && pipeIsVerticalJ != pipeIsVerticalK) {
9126
9134
  continue;
9127
9135
  }
9136
+ if (array[k].type == "door frame") {
9137
+ let boxVecK = getObbLongSideDirection(array[k].obb);
9138
+ if (boxVecJ.length() > 0.3 && boxVecK.length() > 0.3) {
9139
+ let isPPPP = isParallel(boxVecJ, boxVecK, 0.2);
9140
+ if (!isPPPP || !isPPPP.parallel) {
9141
+ continue;
9142
+ }
9143
+ }
9144
+ }
9128
9145
  let isMerge = false;
9129
9146
  if (cloneData.type == "pipe" && !pipeIsVerticalJ) {
9130
9147
  let f = calculateClosePointWithOBB(array[k].points, cloneData.obb);
@@ -13705,6 +13722,7 @@ var getOBB = (contour) => {
13705
13722
  // src/geometry/window.mjs
13706
13723
  import * as THREE10 from "three";
13707
13724
  import { mergeGeometries as mergeGeometries5 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
13725
+ import { randomUUID as randomUUID2 } from "crypto";
13708
13726
  import { retarget } from "three/examples/jsm/utils/SkeletonUtils.js";
13709
13727
  var getWindowData = (lines, pcdData, lineReader) => {
13710
13728
  if (lines.length <= 0 || !pcdData)
@@ -14561,37 +14579,32 @@ var getWindowPcdData = (lines, pcdData) => {
14561
14579
  tmpptShortEd2 = tmpptShortEd2.addScaledVector(vec2, 0.1);
14562
14580
  let intersect1 = segmentsIntersect2D(tmpptStart, tmpptEnd, tmpptShortSt1, tmpptShortEd1, pcdToLineDist);
14563
14581
  let intersect2 = segmentsIntersect2D(tmpptStart, tmpptEnd, tmpptShortSt2, tmpptShortEd2, pcdToLineDist);
14582
+ let windowLocationIsTrue = true;
14583
+ let windowData = {
14584
+ p: null,
14585
+ full: false,
14586
+ groundClearance: 0,
14587
+ height: 0,
14588
+ width: 0,
14589
+ obj_id: null
14590
+ };
14591
+ if (!line2.drawWindow)
14592
+ line2.drawWindow = [];
14564
14593
  if (intersect1 != null && intersect2 != null) {
14565
- if (line2.mergeIndexs) {
14566
- let tmpIndex = [];
14567
- for (let h = 0; h < line2.mergeIndexs.length; h++) {
14568
- tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14569
- }
14570
- for (let h = 0; h < lines.length; h++) {
14571
- if (tmpIndex.includes(h))
14572
- lines[h].isRebuild = true;
14573
- }
14574
- lines.push(line2);
14575
- }
14576
14594
  let ptWindowSt = getPt3(intersect1.point);
14577
14595
  let ptWindowEd = getPt3(intersect2.point);
14578
14596
  if (ptStart.distanceTo(ptWindowSt) > ptStart.distanceTo(ptWindowEd))
14579
14597
  [ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
14580
14598
  let groundClearance = minZ - line2.start.z;
14581
14599
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14582
- if (!line2.drawWindow)
14583
- line2.drawWindow = [];
14584
14600
  let p = getMid(ptWindowSt, ptWindowEd);
14585
14601
  p.z = line2.start.z;
14586
- let windowData = {
14587
- p,
14588
- full: false,
14589
- groundClearance,
14590
- height,
14591
- width: ptWindowSt.distanceTo(ptWindowEd),
14592
- obj_id: pcd.obj_id
14593
- };
14594
- let windowLocationIsTrue = true;
14602
+ windowData.p = p;
14603
+ windowData.full = false;
14604
+ windowData.groundClearance = groundClearance;
14605
+ windowData.height = height;
14606
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14607
+ windowData.obj_id = pcd.obj_id;
14595
14608
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14596
14609
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14597
14610
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14601,21 +14614,7 @@ var getWindowPcdData = (lines, pcdData) => {
14601
14614
  }
14602
14615
  if (!windowLocationIsTrue)
14603
14616
  continue;
14604
- line2.drawWindow.push(windowData);
14605
- line2.isWindow = true;
14606
- pcd.isWindowDoor = true;
14607
14617
  } else if (intersect1 != null || intersect2 != null) {
14608
- if (line2.mergeIndexs) {
14609
- let tmpIndex = [];
14610
- for (let h = 0; h < line2.mergeIndexs.length; h++) {
14611
- tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14612
- }
14613
- for (let h = 0; h < lines.length; h++) {
14614
- if (tmpIndex.includes(h))
14615
- lines[h].isRebuild = true;
14616
- }
14617
- lines.push(line2);
14618
- }
14619
14618
  let ptWindowSt = null;
14620
14619
  let pcdMid = null;
14621
14620
  if (intersect1 != null) {
@@ -14632,19 +14631,14 @@ var getWindowPcdData = (lines, pcdData) => {
14632
14631
  let ptWindowEd = ptWindowSt.clone().addScaledVector(vec4, width);
14633
14632
  let groundClearance = minZ - line2.start.z;
14634
14633
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14635
- if (!line2.drawWindow)
14636
- line2.drawWindow = [];
14637
14634
  let p = getMid(ptWindowSt, ptWindowEd);
14638
14635
  p.z = line2.start.z;
14639
- let windowData = {
14640
- p,
14641
- full: false,
14642
- groundClearance,
14643
- height,
14644
- width: ptWindowSt.distanceTo(ptWindowEd),
14645
- obj_id: pcd.obj_id
14646
- };
14647
- let windowLocationIsTrue = true;
14636
+ windowData.p = p;
14637
+ windowData.full = false;
14638
+ windowData.groundClearance = groundClearance;
14639
+ windowData.height = height;
14640
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14641
+ windowData.obj_id = pcd.obj_id;
14648
14642
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14649
14643
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14650
14644
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14654,9 +14648,6 @@ var getWindowPcdData = (lines, pcdData) => {
14654
14648
  }
14655
14649
  if (!windowLocationIsTrue)
14656
14650
  continue;
14657
- line2.drawWindow.push(windowData);
14658
- line2.isWindow = true;
14659
- pcd.isWindowDoor = true;
14660
14651
  } else {
14661
14652
  let shortLine1 = new THREE10.Line3(ptShortSt1, ptShortEd1);
14662
14653
  let shortLine2 = new THREE10.Line3(ptShortSt2, ptShortEd2);
@@ -14670,17 +14661,6 @@ var getWindowPcdData = (lines, pcdData) => {
14670
14661
  let dist4 = ptClose4.distanceTo(ptEnd);
14671
14662
  let nearDist = 0.1;
14672
14663
  if ((dist1 < nearDist || dist2 < nearDist) && (dist3 < nearDist || dist4 < nearDist)) {
14673
- if (line2.mergeIndexs) {
14674
- let tmpIndex = [];
14675
- for (let h = 0; h < line2.mergeIndexs.length; h++) {
14676
- tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14677
- }
14678
- for (let h = 0; h < lines.length; h++) {
14679
- if (tmpIndex.includes(h))
14680
- lines[h].isRebuild = true;
14681
- }
14682
- lines.push(line2);
14683
- }
14684
14664
  let ptWindowSt = ptClose1.clone();
14685
14665
  let ptWindowEd = ptClose3.clone();
14686
14666
  if (dist2 < nearDist)
@@ -14690,19 +14670,14 @@ var getWindowPcdData = (lines, pcdData) => {
14690
14670
  ptWindowSt.z = ptWindowEd.z = minZ;
14691
14671
  let groundClearance = minZ - line2.start.z;
14692
14672
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14693
- if (!line2.drawWindow)
14694
- line2.drawWindow = [];
14695
14673
  let p = getMid(ptWindowSt, ptWindowEd);
14696
14674
  p.z = line2.start.z;
14697
- let windowData = {
14698
- p,
14699
- full: false,
14700
- groundClearance,
14701
- height,
14702
- width: ptWindowSt.distanceTo(ptWindowEd),
14703
- obj_id: pcd.obj_id
14704
- };
14705
- let windowLocationIsTrue = true;
14675
+ windowData.p = p;
14676
+ windowData.full = false;
14677
+ windowData.groundClearance = groundClearance;
14678
+ windowData.height = height;
14679
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14680
+ windowData.obj_id = pcd.obj_id;
14706
14681
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14707
14682
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14708
14683
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14712,6 +14687,88 @@ var getWindowPcdData = (lines, pcdData) => {
14712
14687
  }
14713
14688
  if (!windowLocationIsTrue)
14714
14689
  continue;
14690
+ }
14691
+ }
14692
+ if (windowLocationIsTrue && windowData.p != null) {
14693
+ if (line2.mergeIndexs) {
14694
+ let tmpIndex = [];
14695
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
14696
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14697
+ }
14698
+ for (let h = 0; h < lines.length; h++) {
14699
+ if (tmpIndex.includes(h))
14700
+ lines[h].isRebuild = true;
14701
+ }
14702
+ lines.push(line2);
14703
+ }
14704
+ if (line2.doorAndBeamData && line2.doorAndBeamData.length > 0) {
14705
+ let tmpPtStart = getPt3(line2.start);
14706
+ let tmpPtEnd = getPt3(line2.end);
14707
+ let vec4 = getVector3(tmpPtStart, tmpPtEnd);
14708
+ let ptWindowSt = windowData.p.clone().addScaledVector(vec4, -windowData.width / 2);
14709
+ let ptWindowEd = windowData.p.clone().addScaledVector(vec4, windowData.width / 2);
14710
+ if (tmpPtStart.distanceTo(ptWindowSt) > tmpPtStart.distanceTo(ptWindowEd))
14711
+ [ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
14712
+ const newOriginPts1 = getProjectedPointOnLine(tmpPtStart, ptWindowSt, line2.originalPoints);
14713
+ const newOriginPts2 = getProjectedPointOnLine(ptWindowSt, ptWindowEd, line2.originalPoints);
14714
+ const newOriginPts3 = getProjectedPointOnLine(ptWindowEd, tmpPtEnd, line2.originalPoints);
14715
+ const newDoorAndBeamData1 = [];
14716
+ const newDoorAndBeamData2 = [];
14717
+ const newDoorAndBeamData3 = [];
14718
+ if (line2.doorAndBeamData) {
14719
+ for (let a = 0; a < line2.doorAndBeamData.length; a++) {
14720
+ let doorStart = line2.doorAndBeamData[a].doorStart;
14721
+ let doorEnd = line2.doorAndBeamData[a].doorEnd;
14722
+ if (isPointOnLine2(tmpPtStart, ptWindowSt, doorStart, 1e-3, true) && isPointOnLine2(tmpPtStart, ptWindowSt, doorEnd, 1e-3, true))
14723
+ newDoorAndBeamData1.push(line2.doorAndBeamData[a]);
14724
+ else if (isPointOnLine2(ptWindowEd, tmpPtEnd, doorStart, 1e-3, true) && isPointOnLine2(ptWindowEd, tmpPtEnd, doorEnd, 1e-3, true))
14725
+ newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
14726
+ }
14727
+ }
14728
+ let newLine1 = {
14729
+ start: tmpPtStart,
14730
+ end: ptWindowSt,
14731
+ length: tmpPtStart.distanceTo(ptWindowSt),
14732
+ originalPoints: newOriginPts1.newOriginalPoints,
14733
+ doorAndBeamData: newDoorAndBeamData1,
14734
+ id: randomUUID2(),
14735
+ rooftopPz: line2.rooftopPz,
14736
+ isRebuild: false,
14737
+ direction: line2.direction
14738
+ };
14739
+ let newLine2 = {
14740
+ start: ptWindowSt,
14741
+ end: ptWindowEd,
14742
+ length: ptWindowSt.distanceTo(ptWindowEd),
14743
+ originalPoints: newOriginPts2.newOriginalPoints,
14744
+ doorAndBeamData: newDoorAndBeamData2,
14745
+ id: randomUUID2(),
14746
+ rooftopPz: line2.rooftopPz,
14747
+ isRebuild: false,
14748
+ direction: line2.direction,
14749
+ drawWindow: [windowData],
14750
+ isWindow: true
14751
+ };
14752
+ let newLine3 = {
14753
+ start: ptWindowEd,
14754
+ end: tmpPtEnd,
14755
+ length: ptWindowEd.distanceTo(tmpPtEnd),
14756
+ originalPoints: newOriginPts3.newOriginalPoints,
14757
+ doorAndBeamData: newDoorAndBeamData3,
14758
+ id: randomUUID2(),
14759
+ rooftopPz: line2.rooftopPz,
14760
+ isRebuild: false,
14761
+ direction: line2.direction
14762
+ };
14763
+ if (newLine1.originalPoints.length > 10 && newLine1.length > 0.01)
14764
+ lines.push(newLine1);
14765
+ if (newLine2.originalPoints.length > 10 && newLine2.length > 0.01)
14766
+ lines.push(newLine2);
14767
+ if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
14768
+ lines.push(newLine3);
14769
+ pcd.isWindowDoor = true;
14770
+ line2.isRebuild = true;
14771
+ } else {
14715
14772
  line2.drawWindow.push(windowData);
14716
14773
  line2.isWindow = true;
14717
14774
  pcd.isWindowDoor = true;
@@ -14729,7 +14786,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
14729
14786
  let passP = getPt3(passage.p);
14730
14787
  let distance2 = windowP.distanceTo(passP);
14731
14788
  if (distance2 < passage.width / 2) {
14732
- if (distance2 < 0.3 && Math.abs(windowData.width - passage.width) < 0.3) {
14789
+ if (distance2 < 0.3 && Math.abs(windowData.width - passage.width) < 0.3 || passage.width < windowData.width) {
14733
14790
  delDoorAndBemaData = true;
14734
14791
  break;
14735
14792
  } else {
@@ -14743,7 +14800,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
14743
14800
 
14744
14801
  // src/geometry/door.mjs
14745
14802
  import * as THREE11 from "three";
14746
- import { randomUUID as randomUUID2 } from "crypto";
14803
+ import { randomUUID as randomUUID3 } from "crypto";
14747
14804
  var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14748
14805
  if (!lines || !lines.length || !pcdData || !pcdData.length)
14749
14806
  return lines;
@@ -14871,7 +14928,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14871
14928
  length: ptStart.distanceTo(ptDoorSt),
14872
14929
  originalPoints: newOriginPts1.newOriginalPoints,
14873
14930
  doorAndBeamData: newDoorAndBeamData1,
14874
- id: randomUUID2(),
14931
+ id: randomUUID3(),
14875
14932
  rooftopPz: line2.rooftopPz,
14876
14933
  isRebuild: false,
14877
14934
  direction: line2.direction
@@ -14882,7 +14939,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14882
14939
  length: ptDoorSt.distanceTo(ptDoorEd),
14883
14940
  originalPoints: newOriginPts2.newOriginalPoints,
14884
14941
  doorAndBeamData: newDoorAndBeamData2,
14885
- id: randomUUID2(),
14942
+ id: randomUUID3(),
14886
14943
  rooftopPz: line2.rooftopPz,
14887
14944
  isRebuild: false,
14888
14945
  direction: line2.direction,
@@ -14901,7 +14958,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14901
14958
  length: ptDoorEd.distanceTo(ptEnd),
14902
14959
  originalPoints: newOriginPts3.newOriginalPoints,
14903
14960
  doorAndBeamData: newDoorAndBeamData3,
14904
- id: randomUUID2(),
14961
+ id: randomUUID3(),
14905
14962
  rooftopPz: line2.rooftopPz,
14906
14963
  isRebuild: false,
14907
14964
  direction: line2.direction
@@ -14971,7 +15028,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14971
15028
  length: ptStart.distanceTo(ptDoorSt),
14972
15029
  originalPoints: newOriginPts1.newOriginalPoints,
14973
15030
  doorAndBeamData: newDoorAndBeamData1,
14974
- id: randomUUID2(),
15031
+ id: randomUUID3(),
14975
15032
  rooftopPz: line2.rooftopPz,
14976
15033
  isRebuild: false,
14977
15034
  direction: line2.direction
@@ -14982,7 +15039,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14982
15039
  length: ptDoorSt.distanceTo(ptDoorEd),
14983
15040
  originalPoints: newOriginPts2.newOriginalPoints,
14984
15041
  doorAndBeamData: newDoorAndBeamData2,
14985
- id: randomUUID2(),
15042
+ id: randomUUID3(),
14986
15043
  rooftopPz: line2.rooftopPz,
14987
15044
  isRebuild: false,
14988
15045
  direction: line2.direction,
@@ -15001,7 +15058,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15001
15058
  length: ptDoorEd.distanceTo(ptEnd),
15002
15059
  originalPoints: newOriginPts3.newOriginalPoints,
15003
15060
  doorAndBeamData: newDoorAndBeamData3,
15004
- id: randomUUID2(),
15061
+ id: randomUUID3(),
15005
15062
  rooftopPz: line2.rooftopPz,
15006
15063
  isRebuild: false,
15007
15064
  direction: line2.direction
@@ -15065,7 +15122,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15065
15122
  length: ptLineSt.distanceTo(ptNewDoorSt),
15066
15123
  originalPoints: newOriginPts1.newOriginalPoints,
15067
15124
  doorAndBeamData: newDoorAndBeamData1,
15068
- id: randomUUID2(),
15125
+ id: randomUUID3(),
15069
15126
  rooftopPz: lineTmp.rooftopPz,
15070
15127
  isRebuild: false,
15071
15128
  direction: lineTmp.direction
@@ -15076,7 +15133,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15076
15133
  length: ptNewDoorSt.distanceTo(ptNewDoorEd),
15077
15134
  originalPoints: newOriginPts2.newOriginalPoints,
15078
15135
  doorAndBeamData: newDoorAndBeamData2,
15079
- id: randomUUID2(),
15136
+ id: randomUUID3(),
15080
15137
  rooftopPz: lineTmp.rooftopPz,
15081
15138
  isRebuild: false,
15082
15139
  direction: lineTmp.direction,
@@ -15095,7 +15152,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15095
15152
  length: ptNewDoorEd.distanceTo(ptLineEd),
15096
15153
  originalPoints: newOriginPts3.newOriginalPoints,
15097
15154
  doorAndBeamData: newDoorAndBeamData3,
15098
- id: randomUUID2(),
15155
+ id: randomUUID3(),
15099
15156
  rooftopPz: lineTmp.rooftopPz,
15100
15157
  isRebuild: false,
15101
15158
  direction: lineTmp.direction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.105",
3
+ "version": "1.0.107",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",