rm-graphical-computing-node 1.0.105 → 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 +123 -83
  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,37 +14562,32 @@ 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;
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;
14595
14591
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14596
14592
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14597
14593
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14601,21 +14597,7 @@ var getWindowPcdData = (lines, pcdData) => {
14601
14597
  }
14602
14598
  if (!windowLocationIsTrue)
14603
14599
  continue;
14604
- line2.drawWindow.push(windowData);
14605
- line2.isWindow = true;
14606
- pcd.isWindowDoor = true;
14607
14600
  } 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
14601
  let ptWindowSt = null;
14620
14602
  let pcdMid = null;
14621
14603
  if (intersect1 != null) {
@@ -14632,19 +14614,14 @@ var getWindowPcdData = (lines, pcdData) => {
14632
14614
  let ptWindowEd = ptWindowSt.clone().addScaledVector(vec4, width);
14633
14615
  let groundClearance = minZ - line2.start.z;
14634
14616
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14635
- if (!line2.drawWindow)
14636
- line2.drawWindow = [];
14637
14617
  let p = getMid(ptWindowSt, ptWindowEd);
14638
14618
  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;
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;
14648
14625
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14649
14626
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14650
14627
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14654,9 +14631,6 @@ var getWindowPcdData = (lines, pcdData) => {
14654
14631
  }
14655
14632
  if (!windowLocationIsTrue)
14656
14633
  continue;
14657
- line2.drawWindow.push(windowData);
14658
- line2.isWindow = true;
14659
- pcd.isWindowDoor = true;
14660
14634
  } else {
14661
14635
  let shortLine1 = new THREE10.Line3(ptShortSt1, ptShortEd1);
14662
14636
  let shortLine2 = new THREE10.Line3(ptShortSt2, ptShortEd2);
@@ -14670,17 +14644,6 @@ var getWindowPcdData = (lines, pcdData) => {
14670
14644
  let dist4 = ptClose4.distanceTo(ptEnd);
14671
14645
  let nearDist = 0.1;
14672
14646
  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
14647
  let ptWindowSt = ptClose1.clone();
14685
14648
  let ptWindowEd = ptClose3.clone();
14686
14649
  if (dist2 < nearDist)
@@ -14690,19 +14653,14 @@ var getWindowPcdData = (lines, pcdData) => {
14690
14653
  ptWindowSt.z = ptWindowEd.z = minZ;
14691
14654
  let groundClearance = minZ - line2.start.z;
14692
14655
  groundClearance = groundClearance > 0.01 ? groundClearance : 0;
14693
- if (!line2.drawWindow)
14694
- line2.drawWindow = [];
14695
14656
  let p = getMid(ptWindowSt, ptWindowEd);
14696
14657
  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;
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;
14706
14664
  if ((line2.isPassageEntrance || line2.inPassageEntranceDoor) && line2.passageEntrance && line2.passageEntrance.length == 1) {
14707
14665
  const ret = checkWindowLocationIsTrue(windowData, line2.passageEntrance);
14708
14666
  windowLocationIsTrue = ret.windowLocationIsTrue;
@@ -14712,6 +14670,88 @@ var getWindowPcdData = (lines, pcdData) => {
14712
14670
  }
14713
14671
  if (!windowLocationIsTrue)
14714
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 {
14715
14755
  line2.drawWindow.push(windowData);
14716
14756
  line2.isWindow = true;
14717
14757
  pcd.isWindowDoor = true;
@@ -14729,7 +14769,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
14729
14769
  let passP = getPt3(passage.p);
14730
14770
  let distance2 = windowP.distanceTo(passP);
14731
14771
  if (distance2 < passage.width / 2) {
14732
- if (distance2 < 0.3 && Math.abs(windowData.width - passage.width) < 0.3) {
14772
+ if (distance2 < 0.3 && Math.abs(windowData.width - passage.width) < 0.3 || passage.width < windowData.width) {
14733
14773
  delDoorAndBemaData = true;
14734
14774
  break;
14735
14775
  } else {
@@ -14743,7 +14783,7 @@ function checkWindowLocationIsTrue(windowData, passageEntrance) {
14743
14783
 
14744
14784
  // src/geometry/door.mjs
14745
14785
  import * as THREE11 from "three";
14746
- import { randomUUID as randomUUID2 } from "crypto";
14786
+ import { randomUUID as randomUUID3 } from "crypto";
14747
14787
  var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14748
14788
  if (!lines || !lines.length || !pcdData || !pcdData.length)
14749
14789
  return lines;
@@ -14871,7 +14911,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14871
14911
  length: ptStart.distanceTo(ptDoorSt),
14872
14912
  originalPoints: newOriginPts1.newOriginalPoints,
14873
14913
  doorAndBeamData: newDoorAndBeamData1,
14874
- id: randomUUID2(),
14914
+ id: randomUUID3(),
14875
14915
  rooftopPz: line2.rooftopPz,
14876
14916
  isRebuild: false,
14877
14917
  direction: line2.direction
@@ -14882,7 +14922,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14882
14922
  length: ptDoorSt.distanceTo(ptDoorEd),
14883
14923
  originalPoints: newOriginPts2.newOriginalPoints,
14884
14924
  doorAndBeamData: newDoorAndBeamData2,
14885
- id: randomUUID2(),
14925
+ id: randomUUID3(),
14886
14926
  rooftopPz: line2.rooftopPz,
14887
14927
  isRebuild: false,
14888
14928
  direction: line2.direction,
@@ -14901,7 +14941,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14901
14941
  length: ptDoorEd.distanceTo(ptEnd),
14902
14942
  originalPoints: newOriginPts3.newOriginalPoints,
14903
14943
  doorAndBeamData: newDoorAndBeamData3,
14904
- id: randomUUID2(),
14944
+ id: randomUUID3(),
14905
14945
  rooftopPz: line2.rooftopPz,
14906
14946
  isRebuild: false,
14907
14947
  direction: line2.direction
@@ -14971,7 +15011,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14971
15011
  length: ptStart.distanceTo(ptDoorSt),
14972
15012
  originalPoints: newOriginPts1.newOriginalPoints,
14973
15013
  doorAndBeamData: newDoorAndBeamData1,
14974
- id: randomUUID2(),
15014
+ id: randomUUID3(),
14975
15015
  rooftopPz: line2.rooftopPz,
14976
15016
  isRebuild: false,
14977
15017
  direction: line2.direction
@@ -14982,7 +15022,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
14982
15022
  length: ptDoorSt.distanceTo(ptDoorEd),
14983
15023
  originalPoints: newOriginPts2.newOriginalPoints,
14984
15024
  doorAndBeamData: newDoorAndBeamData2,
14985
- id: randomUUID2(),
15025
+ id: randomUUID3(),
14986
15026
  rooftopPz: line2.rooftopPz,
14987
15027
  isRebuild: false,
14988
15028
  direction: line2.direction,
@@ -15001,7 +15041,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15001
15041
  length: ptDoorEd.distanceTo(ptEnd),
15002
15042
  originalPoints: newOriginPts3.newOriginalPoints,
15003
15043
  doorAndBeamData: newDoorAndBeamData3,
15004
- id: randomUUID2(),
15044
+ id: randomUUID3(),
15005
15045
  rooftopPz: line2.rooftopPz,
15006
15046
  isRebuild: false,
15007
15047
  direction: line2.direction
@@ -15065,7 +15105,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15065
15105
  length: ptLineSt.distanceTo(ptNewDoorSt),
15066
15106
  originalPoints: newOriginPts1.newOriginalPoints,
15067
15107
  doorAndBeamData: newDoorAndBeamData1,
15068
- id: randomUUID2(),
15108
+ id: randomUUID3(),
15069
15109
  rooftopPz: lineTmp.rooftopPz,
15070
15110
  isRebuild: false,
15071
15111
  direction: lineTmp.direction
@@ -15076,7 +15116,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15076
15116
  length: ptNewDoorSt.distanceTo(ptNewDoorEd),
15077
15117
  originalPoints: newOriginPts2.newOriginalPoints,
15078
15118
  doorAndBeamData: newDoorAndBeamData2,
15079
- id: randomUUID2(),
15119
+ id: randomUUID3(),
15080
15120
  rooftopPz: lineTmp.rooftopPz,
15081
15121
  isRebuild: false,
15082
15122
  direction: lineTmp.direction,
@@ -15095,7 +15135,7 @@ var getDoorPcdData = (lines, pcdData, needFindOtherDoor = true) => {
15095
15135
  length: ptNewDoorEd.distanceTo(ptLineEd),
15096
15136
  originalPoints: newOriginPts3.newOriginalPoints,
15097
15137
  doorAndBeamData: newDoorAndBeamData3,
15098
- id: randomUUID2(),
15138
+ id: randomUUID3(),
15099
15139
  rooftopPz: lineTmp.rooftopPz,
15100
15140
  isRebuild: false,
15101
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.105",
3
+ "version": "1.0.106",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",