rm-graphical-computing-node 1.0.132 → 1.0.134

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 +49 -40
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3658,23 +3658,30 @@ var mergeLines = (lines) => {
3658
3658
  }
3659
3659
  return newLines;
3660
3660
  };
3661
- var pointInRectRegion = (point2, rect, epsilon3 = 1e-6) => {
3662
- if (rect.length !== 4)
3663
- return false;
3664
- const [p0, p1, p2, p3] = rect;
3665
- const ptBottom1 = p0;
3666
- const ptBottom2 = p0.z == p1.z ? p1 : p3;
3667
- let line2 = new THREE3.Line3(ptBottom1, ptBottom2);
3668
- let copyPoint = getPt3(point2);
3669
- copyPoint.z = ptBottom1.z;
3670
- const closestPoint = line2.closestPointToPoint(copyPoint, true, new THREE3.Vector3());
3671
- const distance2 = closestPoint.distanceTo(copyPoint);
3672
- if (distance2 > epsilon3)
3673
- return false;
3674
- const { minZ, maxZ } = getPointsMinAndMax(rect);
3675
- if (point2.z > minZ - epsilon3 && point2.z < maxZ + epsilon3)
3676
- return true;
3677
- return false;
3661
+ var pointInRectRegion = (point2, regions, epsilon3 = 1e-6) => {
3662
+ let isInside = false;
3663
+ for (let i = 0; i < regions.length; i++) {
3664
+ const rect = regions[i];
3665
+ if (rect.length !== 4)
3666
+ return false;
3667
+ const [p0, p1, p2, p3] = rect;
3668
+ const ptBottom1 = p0;
3669
+ const ptBottom2 = p1;
3670
+ let line2 = new THREE3.Line3(ptBottom1, ptBottom2);
3671
+ let copyPoint = getPt3(point2);
3672
+ copyPoint.z = ptBottom1.z;
3673
+ const closestPoint = line2.closestPointToPoint(copyPoint, true, new THREE3.Vector3());
3674
+ const distance2 = closestPoint.distanceTo(copyPoint);
3675
+ if (distance2 > epsilon3) {
3676
+ continue;
3677
+ }
3678
+ const { minZ, maxZ } = getPointsMinAndMax(rect);
3679
+ if (point2.z > minZ - epsilon3 && point2.z < maxZ + epsilon3) {
3680
+ isInside = true;
3681
+ break;
3682
+ }
3683
+ }
3684
+ return isInside;
3678
3685
  };
3679
3686
 
3680
3687
  // src/utils/updateLine.mjs
@@ -11931,8 +11938,8 @@ var checkNearObjects = (lines, objPoints) => {
11931
11938
  const rect = [];
11932
11939
  rect.push(getPt3(line2.start));
11933
11940
  rect.push(getPt3(line2.end));
11934
- rect.push(getPt3(new THREE8.Vector3(line2.end.x, line2.end.y, line2.rooftopPz)));
11935
- rect.push(getPt3(new THREE8.Vector3(line2.start.x, line2.start.y, line2.rooftopPz)));
11941
+ rect.push(getPt3(new THREE8.Vector3(line2.end.x, line2.end.y, line2.rooftopPz ? line2.rooftopPz : line2.end.z)));
11942
+ rect.push(getPt3(new THREE8.Vector3(line2.start.x, line2.start.y, line2.rooftopPz ? line2.rooftopPz : line2.start.z)));
11936
11943
  rectRegions.push(rect);
11937
11944
  }
11938
11945
  function hasNearbyPoint(p) {
@@ -11963,7 +11970,7 @@ var checkNearObjects = (lines, objPoints) => {
11963
11970
  }
11964
11971
  let __pcdPoints = [];
11965
11972
  for (const p of _pcdPoints) {
11966
- if (!pointInRectRegion(p, rectRegions, 0.1)) {
11973
+ if (!pointInRectRegion(p, rectRegions, 0.03)) {
11967
11974
  __pcdPoints.push(p);
11968
11975
  }
11969
11976
  }
@@ -15253,25 +15260,6 @@ var getWindowData = (lines, pcdData, lineReader) => {
15253
15260
  height += addHeight;
15254
15261
  }
15255
15262
  }
15256
- let isOverlap = false;
15257
- for (let m = 0; m < allDoorLines1.length; m++) {
15258
- let result = classifySegments(allDoorLines1[m].start, allDoorLines1[m].end, doorTmpSt, doorTmpEd);
15259
- if (result && result.type == "collinear_overlap" && result.maxPerpendicularDistance < 0.07) {
15260
- isOverlap = true;
15261
- }
15262
- }
15263
- if (isOverlap) {
15264
- if (findDoorDataIndex != -1) {
15265
- if (!beforePcdDoorisFindWindow) {
15266
- pcdData[windowDatas[findDoorDataIndex].index].isFindWindow = false;
15267
- windowDatas[findDoorDataIndex].isFind = false;
15268
- }
15269
- }
15270
- continue;
15271
- }
15272
- let afterDoorLen = doorTmpEd.distanceTo(doorTmpSt);
15273
- if (afterDoorLen < 0.4 && !isWindow || afterDoorLen < 0.3 && isWindow)
15274
- continue;
15275
15263
  const windowPcd = windowDatas[findDoorDataIndex];
15276
15264
  const windowPcdSt = windowPcd.windowStartPt.clone();
15277
15265
  const windowPcdEd = windowPcd.windowEndPt.clone();
@@ -15387,6 +15375,27 @@ var getWindowData = (lines, pcdData, lineReader) => {
15387
15375
  beamTmpEd = doorTmpEd.clone();
15388
15376
  beamTmpSt.z = beamTmpEd.z = windowPcd.maxZ;
15389
15377
  }
15378
+ let isOverlap = false;
15379
+ for (let m = 0; m < allDoorLines1.length; m++) {
15380
+ let result = classifySegments(allDoorLines1[m].start, allDoorLines1[m].end, doorTmpSt, doorTmpEd);
15381
+ console.log(result);
15382
+ if (result && result.type == "collinear_overlap" && result.maxPerpendicularDistance < 0.07) {
15383
+ isOverlap = true;
15384
+ }
15385
+ }
15386
+ console.log("isOverlap", isOverlap);
15387
+ if (isOverlap) {
15388
+ if (findDoorDataIndex != -1) {
15389
+ if (!beforePcdDoorisFindWindow) {
15390
+ pcdData[windowDatas[findDoorDataIndex].index].isFindWindow = false;
15391
+ windowDatas[findDoorDataIndex].isFind = false;
15392
+ }
15393
+ }
15394
+ continue;
15395
+ }
15396
+ let afterDoorLen = doorTmpEd.distanceTo(doorTmpSt);
15397
+ if (afterDoorLen < 0.4 && !isWindow || afterDoorLen < 0.3 && isWindow)
15398
+ continue;
15390
15399
  let doorType = "";
15391
15400
  let groundClearance = doorTmpSt.z - line2.start.z > 1e-4 ? doorTmpSt.z - line2.start.z : 0;
15392
15401
  windowHeight = beamTmpSt.z - doorTmpSt.z;
@@ -15411,7 +15420,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
15411
15420
  let inRectNum = 0;
15412
15421
  for (let b = 0; b < checkResultsNum; b++) {
15413
15422
  let pt = region.centerPts[b];
15414
- if (pointInRectRegion(pt, rectPts, 0.01))
15423
+ if (pointInRectRegion(pt, [rectPts], 0.01))
15415
15424
  inRectNum++;
15416
15425
  }
15417
15426
  let inRectPercentage = inRectNum / checkResultsNum;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",