rm-graphical-computing-node 1.0.104 → 1.0.106

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 +149 -91
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -13705,6 +13705,7 @@ var getOBB = (contour) => {
13705
13705
  // src/geometry/window.mjs
13706
13706
  import * as THREE10 from "three";
13707
13707
  import { mergeGeometries as mergeGeometries5 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
13708
+ import { randomUUID as randomUUID2 } from "crypto";
13708
13709
  import { retarget } from "three/examples/jsm/utils/SkeletonUtils.js";
13709
13710
  var getWindowData = (lines, pcdData, lineReader) => {
13710
13711
  if (lines.length <= 0 || !pcdData)
@@ -14561,57 +14562,42 @@ var getWindowPcdData = (lines, pcdData) => {
14561
14562
  tmpptShortEd2 = tmpptShortEd2.addScaledVector(vec2, 0.1);
14562
14563
  let intersect1 = segmentsIntersect2D(tmpptStart, tmpptEnd, tmpptShortSt1, tmpptShortEd1, pcdToLineDist);
14563
14564
  let intersect2 = segmentsIntersect2D(tmpptStart, tmpptEnd, tmpptShortSt2, tmpptShortEd2, pcdToLineDist);
14565
+ let windowLocationIsTrue = true;
14566
+ let windowData = {
14567
+ p: null,
14568
+ full: false,
14569
+ groundClearance: 0,
14570
+ height: 0,
14571
+ width: 0,
14572
+ obj_id: null
14573
+ };
14574
+ if (!line2.drawWindow)
14575
+ line2.drawWindow = [];
14564
14576
  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
14577
  let ptWindowSt = getPt3(intersect1.point);
14577
14578
  let ptWindowEd = getPt3(intersect2.point);
14578
14579
  if (ptStart.distanceTo(ptWindowSt) > ptStart.distanceTo(ptWindowEd))
14579
14580
  [ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
14580
14581
  let groundClearance = minZ - line2.start.z;
14581
14582
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14582
- if (!line2.drawWindow)
14583
- line2.drawWindow = [];
14584
14583
  let p = getMid(ptWindowSt, ptWindowEd);
14585
14584
  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;
14595
- if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length) {
14596
- windowLocationIsTrue = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14585
+ windowData.p = p;
14586
+ windowData.full = false;
14587
+ windowData.groundClearance = groundClearance;
14588
+ windowData.height = height;
14589
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14590
+ windowData.obj_id = pcd.obj_id;
14591
+ if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14592
+ const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14593
+ windowLocationIsTrue = ret.windowLocationIsTrue;
14594
+ if (ret.delDoorAndBemaData) {
14595
+ line2.doorAndBeamData = [];
14596
+ }
14597
14597
  }
14598
14598
  if (!windowLocationIsTrue)
14599
14599
  continue;
14600
- line2.drawWindow.push(windowData);
14601
- line2.isWindow = true;
14602
- pcd.isWindowDoor = true;
14603
14600
  } else if (intersect1 != null || intersect2 != null) {
14604
- if (line2.mergeIndexs) {
14605
- let tmpIndex = [];
14606
- for (let h = 0; h < line2.mergeIndexs.length; h++) {
14607
- tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14608
- }
14609
- for (let h = 0; h < lines.length; h++) {
14610
- if (tmpIndex.includes(h))
14611
- lines[h].isRebuild = true;
14612
- }
14613
- lines.push(line2);
14614
- }
14615
14601
  let ptWindowSt = null;
14616
14602
  let pcdMid = null;
14617
14603
  if (intersect1 != null) {
@@ -14628,27 +14614,23 @@ var getWindowPcdData = (lines, pcdData) => {
14628
14614
  let ptWindowEd = ptWindowSt.clone().addScaledVector(vec4, width);
14629
14615
  let groundClearance = minZ - line2.start.z;
14630
14616
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14631
- if (!line2.drawWindow)
14632
- line2.drawWindow = [];
14633
14617
  let p = getMid(ptWindowSt, ptWindowEd);
14634
14618
  p.z = line2.start.z;
14635
- let windowData = {
14636
- p,
14637
- full: false,
14638
- groundClearance,
14639
- height,
14640
- width: ptWindowSt.distanceTo(ptWindowEd),
14641
- obj_id: pcd.obj_id
14642
- };
14643
- let windowLocationIsTrue = true;
14644
- if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length) {
14645
- windowLocationIsTrue = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14619
+ windowData.p = p;
14620
+ windowData.full = false;
14621
+ windowData.groundClearance = groundClearance;
14622
+ windowData.height = height;
14623
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14624
+ windowData.obj_id = pcd.obj_id;
14625
+ if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14626
+ const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14627
+ windowLocationIsTrue = ret.windowLocationIsTrue;
14628
+ if (ret.delDoorAndBemaData) {
14629
+ line2.doorAndBeamData = [];
14630
+ }
14646
14631
  }
14647
14632
  if (!windowLocationIsTrue)
14648
14633
  continue;
14649
- line2.drawWindow.push(windowData);
14650
- line2.isWindow = true;
14651
- pcd.isWindowDoor = true;
14652
14634
  } else {
14653
14635
  let shortLine1 = new THREE10.Line3(ptShortSt1, ptShortEd1);
14654
14636
  let shortLine2 = new THREE10.Line3(ptShortSt2, ptShortEd2);
@@ -14662,17 +14644,6 @@ var getWindowPcdData = (lines, pcdData) => {
14662
14644
  let dist4 = ptClose4.distanceTo(ptEnd);
14663
14645
  let nearDist = 0.1;
14664
14646
  if ((dist1 < nearDist || dist2 < nearDist) && (dist3 < nearDist || dist4 < nearDist)) {
14665
- if (line2.mergeIndexs) {
14666
- let tmpIndex = [];
14667
- for (let h = 0; h < line2.mergeIndexs.length; h++) {
14668
- tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14669
- }
14670
- for (let h = 0; h < lines.length; h++) {
14671
- if (tmpIndex.includes(h))
14672
- lines[h].isRebuild = true;
14673
- }
14674
- lines.push(line2);
14675
- }
14676
14647
  let ptWindowSt = ptClose1.clone();
14677
14648
  let ptWindowEd = ptClose3.clone();
14678
14649
  if (dist2 < nearDist)
@@ -14682,24 +14653,105 @@ var getWindowPcdData = (lines, pcdData) => {
14682
14653
  ptWindowSt.z = ptWindowEd.z = minZ;
14683
14654
  let groundClearance = minZ - line2.start.z;
14684
14655
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14685
- if (!line2.drawWindow)
14686
- line2.drawWindow = [];
14687
14656
  let p = getMid(ptWindowSt, ptWindowEd);
14688
14657
  p.z = line2.start.z;
14689
- let windowData = {
14690
- p,
14691
- full: false,
14692
- groundClearance,
14693
- height,
14694
- width: ptWindowSt.distanceTo(ptWindowEd),
14695
- obj_id: pcd.obj_id
14696
- };
14697
- let windowLocationIsTrue = true;
14698
- if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length) {
14699
- windowLocationIsTrue = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14658
+ windowData.p = p;
14659
+ windowData.full = false;
14660
+ windowData.groundClearance = groundClearance;
14661
+ windowData.height = height;
14662
+ windowData.width = ptWindowSt.distanceTo(ptWindowEd);
14663
+ windowData.obj_id = pcd.obj_id;
14664
+ if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14665
+ const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14666
+ windowLocationIsTrue = ret.windowLocationIsTrue;
14667
+ if (ret.delDoorAndBemaData) {
14668
+ line2.doorAndBeamData = [];
14669
+ }
14700
14670
  }
14701
14671
  if (!windowLocationIsTrue)
14702
14672
  continue;
14673
+ }
14674
+ }
14675
+ if (windowLocationIsTrue && windowData.p != null) {
14676
+ if (line2.mergeIndexs) {
14677
+ let tmpIndex = [];
14678
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
14679
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
14680
+ }
14681
+ for (let h = 0; h < lines.length; h++) {
14682
+ if (tmpIndex.includes(h))
14683
+ lines[h].isRebuild = true;
14684
+ }
14685
+ lines.push(line2);
14686
+ }
14687
+ if (line2.doorAndBeamData && line2.doorAndBeamData.length > 0) {
14688
+ let tmpPtStart = getPt3(line2.start);
14689
+ let tmpPtEnd = getPt3(line2.end);
14690
+ let vec4 = getVector3(tmpPtStart, tmpPtEnd);
14691
+ let ptWindowSt = windowData.p.clone().addScaledVector(vec4, -windowData.width / 2);
14692
+ let ptWindowEd = windowData.p.clone().addScaledVector(vec4, windowData.width / 2);
14693
+ if (tmpPtStart.distanceTo(ptWindowSt) > tmpPtStart.distanceTo(ptWindowEd))
14694
+ [ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
14695
+ const newOriginPts1 = getProjectedPointOnLine(tmpPtStart, ptWindowSt, line2.originalPoints);
14696
+ const newOriginPts2 = getProjectedPointOnLine(ptWindowSt, ptWindowEd, line2.originalPoints);
14697
+ const newOriginPts3 = getProjectedPointOnLine(ptWindowEd, tmpPtEnd, line2.originalPoints);
14698
+ const newDoorAndBeamData1 = [];
14699
+ const newDoorAndBeamData2 = [];
14700
+ const newDoorAndBeamData3 = [];
14701
+ if (line2.doorAndBeamData) {
14702
+ for (let a = 0; a < line2.doorAndBeamData.length; a++) {
14703
+ let doorStart = line2.doorAndBeamData[a].doorStart;
14704
+ let doorEnd = line2.doorAndBeamData[a].doorEnd;
14705
+ if (isPointOnLine2(tmpPtStart, ptWindowSt, doorStart, 1e-3, true) && isPointOnLine2(tmpPtStart, ptWindowSt, doorEnd, 1e-3, true))
14706
+ newDoorAndBeamData1.push(line2.doorAndBeamData[a]);
14707
+ else if (isPointOnLine2(ptWindowEd, tmpPtEnd, doorStart, 1e-3, true) && isPointOnLine2(ptWindowEd, tmpPtEnd, doorEnd, 1e-3, true))
14708
+ newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
14709
+ }
14710
+ }
14711
+ let newLine1 = {
14712
+ start: tmpPtStart,
14713
+ end: ptWindowSt,
14714
+ length: tmpPtStart.distanceTo(ptWindowSt),
14715
+ originalPoints: newOriginPts1.newOriginalPoints,
14716
+ doorAndBeamData: newDoorAndBeamData1,
14717
+ id: randomUUID2(),
14718
+ rooftopPz: line2.rooftopPz,
14719
+ isRebuild: false,
14720
+ direction: line2.direction
14721
+ };
14722
+ let newLine2 = {
14723
+ start: ptWindowSt,
14724
+ end: ptWindowEd,
14725
+ length: ptWindowSt.distanceTo(ptWindowEd),
14726
+ originalPoints: newOriginPts2.newOriginalPoints,
14727
+ doorAndBeamData: newDoorAndBeamData2,
14728
+ id: randomUUID2(),
14729
+ rooftopPz: line2.rooftopPz,
14730
+ isRebuild: false,
14731
+ direction: line2.direction,
14732
+ drawWindow: [windowData],
14733
+ isWindow: true
14734
+ };
14735
+ let newLine3 = {
14736
+ start: ptWindowEd,
14737
+ end: tmpPtEnd,
14738
+ length: ptWindowEd.distanceTo(tmpPtEnd),
14739
+ originalPoints: newOriginPts3.newOriginalPoints,
14740
+ doorAndBeamData: newDoorAndBeamData3,
14741
+ id: randomUUID2(),
14742
+ rooftopPz: line2.rooftopPz,
14743
+ isRebuild: false,
14744
+ direction: line2.direction
14745
+ };
14746
+ if (newLine1.originalPoints.length > 10 && newLine1.length > 0.01)
14747
+ lines.push(newLine1);
14748
+ if (newLine2.originalPoints.length > 10 && newLine2.length > 0.01)
14749
+ lines.push(newLine2);
14750
+ if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
14751
+ lines.push(newLine3);
14752
+ pcd.isWindowDoor = true;
14753
+ line2.isRebuild = true;
14754
+ } else {
14703
14755
  line2.drawWindow.push(windowData);
14704
14756
  line2.isWindow = true;
14705
14757
  pcd.isWindowDoor = true;
@@ -14711,21 +14763,27 @@ var getWindowPcdData = (lines, pcdData) => {
14711
14763
  function checkWindowLocationIsTrue(windowData, passageEntrance) {
14712
14764
  let windowP = getPt3(windowData.p);
14713
14765
  let windowLocationIsTrue = true;
14766
+ let delDoorAndBemaData = false;
14714
14767
  for (let i = 0; i < passageEntrance.length; i++) {
14715
14768
  const passage = passageEntrance[i];
14716
14769
  let passP = getPt3(passage.p);
14717
14770
  let distance2 = windowP.distanceTo(passP);
14718
14771
  if (distance2 < passage.width / 2) {
14719
- windowLocationIsTrue = false;
14720
- break;
14772
+ if (distance2 < 0.3 && Math.abs(windowData.width - passage.width) < 0.3 || passage.width < windowData.width) {
14773
+ delDoorAndBemaData = true;
14774
+ break;
14775
+ } else {
14776
+ windowLocationIsTrue = false;
14777
+ break;
14778
+ }
14721
14779
  }
14722
14780
  }
14723
- return windowLocationIsTrue;
14781
+ return { windowLocationIsTrue, delDoorAndBemaData };
14724
14782
  }
14725
14783
 
14726
14784
  // src/geometry/door.mjs
14727
14785
  import * as THREE11 from "three";
14728
- import { randomUUID as randomUUID2 } from "crypto";
14786
+ import { randomUUID as randomUUID3 } from "crypto";
14729
14787
  var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14730
14788
  if (!lines || !lines.length || !pcdData || !pcdData.length)
14731
14789
  return lines;
@@ -14853,7 +14911,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14853
14911
  length: ptStart.distanceTo(ptDoorSt),
14854
14912
  originalPoints: newOriginPts1.newOriginalPoints,
14855
14913
  doorAndBeamData: newDoorAndBeamData1,
14856
- id: randomUUID2(),
14914
+ id: randomUUID3(),
14857
14915
  rooftopPz: line2.rooftopPz,
14858
14916
  isRebuild: false,
14859
14917
  direction: line2.direction
@@ -14864,7 +14922,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14864
14922
  length: ptDoorSt.distanceTo(ptDoorEd),
14865
14923
  originalPoints: newOriginPts2.newOriginalPoints,
14866
14924
  doorAndBeamData: newDoorAndBeamData2,
14867
- id: randomUUID2(),
14925
+ id: randomUUID3(),
14868
14926
  rooftopPz: line2.rooftopPz,
14869
14927
  isRebuild: false,
14870
14928
  direction: line2.direction,
@@ -14883,7 +14941,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14883
14941
  length: ptDoorEd.distanceTo(ptEnd),
14884
14942
  originalPoints: newOriginPts3.newOriginalPoints,
14885
14943
  doorAndBeamData: newDoorAndBeamData3,
14886
- id: randomUUID2(),
14944
+ id: randomUUID3(),
14887
14945
  rooftopPz: line2.rooftopPz,
14888
14946
  isRebuild: false,
14889
14947
  direction: line2.direction
@@ -14953,7 +15011,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14953
15011
  length: ptStart.distanceTo(ptDoorSt),
14954
15012
  originalPoints: newOriginPts1.newOriginalPoints,
14955
15013
  doorAndBeamData: newDoorAndBeamData1,
14956
- id: randomUUID2(),
15014
+ id: randomUUID3(),
14957
15015
  rooftopPz: line2.rooftopPz,
14958
15016
  isRebuild: false,
14959
15017
  direction: line2.direction
@@ -14964,7 +15022,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14964
15022
  length: ptDoorSt.distanceTo(ptDoorEd),
14965
15023
  originalPoints: newOriginPts2.newOriginalPoints,
14966
15024
  doorAndBeamData: newDoorAndBeamData2,
14967
- id: randomUUID2(),
15025
+ id: randomUUID3(),
14968
15026
  rooftopPz: line2.rooftopPz,
14969
15027
  isRebuild: false,
14970
15028
  direction: line2.direction,
@@ -14983,7 +15041,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14983
15041
  length: ptDoorEd.distanceTo(ptEnd),
14984
15042
  originalPoints: newOriginPts3.newOriginalPoints,
14985
15043
  doorAndBeamData: newDoorAndBeamData3,
14986
- id: randomUUID2(),
15044
+ id: randomUUID3(),
14987
15045
  rooftopPz: line2.rooftopPz,
14988
15046
  isRebuild: false,
14989
15047
  direction: line2.direction
@@ -15047,7 +15105,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15047
15105
  length: ptLineSt.distanceTo(ptNewDoorSt),
15048
15106
  originalPoints: newOriginPts1.newOriginalPoints,
15049
15107
  doorAndBeamData: newDoorAndBeamData1,
15050
- id: randomUUID2(),
15108
+ id: randomUUID3(),
15051
15109
  rooftopPz: lineTmp.rooftopPz,
15052
15110
  isRebuild: false,
15053
15111
  direction: lineTmp.direction
@@ -15058,7 +15116,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15058
15116
  length: ptNewDoorSt.distanceTo(ptNewDoorEd),
15059
15117
  originalPoints: newOriginPts2.newOriginalPoints,
15060
15118
  doorAndBeamData: newDoorAndBeamData2,
15061
- id: randomUUID2(),
15119
+ id: randomUUID3(),
15062
15120
  rooftopPz: lineTmp.rooftopPz,
15063
15121
  isRebuild: false,
15064
15122
  direction: lineTmp.direction,
@@ -15077,7 +15135,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15077
15135
  length: ptNewDoorEd.distanceTo(ptLineEd),
15078
15136
  originalPoints: newOriginPts3.newOriginalPoints,
15079
15137
  doorAndBeamData: newDoorAndBeamData3,
15080
- id: randomUUID2(),
15138
+ id: randomUUID3(),
15081
15139
  rooftopPz: lineTmp.rooftopPz,
15082
15140
  isRebuild: false,
15083
15141
  direction: lineTmp.direction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.104",
3
+ "version": "1.0.106",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",