rm-graphical-computing-node 1.0.52 → 1.0.54

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 +95 -25
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3506,6 +3506,11 @@ var voxelDownsample2DForContour = (points, cellSize) => {
3506
3506
  }
3507
3507
  return result;
3508
3508
  };
3509
+ var setPointsSameZ = (points, z) => {
3510
+ for (let i = 0; i < points.length; i++)
3511
+ points[i].z = z;
3512
+ return points;
3513
+ };
3509
3514
 
3510
3515
  // src/utils/updateLine.mjs
3511
3516
  import * as THREE4 from "three";
@@ -4614,7 +4619,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4614
4619
  let line3TmpDoor = new THREE5.Line3(doorTmpSt.clone(), doorTmpEd.clone());
4615
4620
  let nearWallDist = -1;
4616
4621
  for (let x = 0; x < lines.length; x++) {
4617
- if (lines[x].length < 0.5 || x == index) continue;
4622
+ if (lines[x].length < 0.5 || x == index || lines[x].isLine2) continue;
4618
4623
  let startPt2 = new THREE5.Vector3(lines[x].start.x, lines[x].start.y, lines[x].start.z);
4619
4624
  let endPt2 = new THREE5.Vector3(lines[x].end.x, lines[x].end.y, lines[x].end.z);
4620
4625
  let result = classifySegments(startPt2, endPt2, doorTmpSt, doorTmpEd);
@@ -10971,7 +10976,8 @@ var getObliqueSlabData = (lines, runDataList, pointCloudCluster = null) => {
10971
10976
  // points: newPoints[x],
10972
10977
  contour: path3,
10973
10978
  minZ,
10974
- maxZ
10979
+ maxZ,
10980
+ averagePz: minZ
10975
10981
  // normal: lines[i][0],
10976
10982
  // area: area
10977
10983
  });
@@ -10997,6 +11003,7 @@ function getPathZ(path3, points) {
10997
11003
  // src/geometry/window.mjs
10998
11004
  import * as THREE10 from "three";
10999
11005
  import { mergeGeometries as mergeGeometries5 } from "three/examples/jsm/utils/BufferGeometryUtils.js";
11006
+ import { retarget } from "three/examples/jsm/utils/SkeletonUtils.js";
11000
11007
  var getWindowData = (lines, pcdData, lineReader) => {
11001
11008
  if (lines.length <= 0 || !pcdData)
11002
11009
  return lines;
@@ -11122,7 +11129,8 @@ var getWindowData = (lines, pcdData, lineReader) => {
11122
11129
  isFind: false,
11123
11130
  inWall: false,
11124
11131
  //是否在墙内
11125
- name: window.name
11132
+ name: window.name,
11133
+ rectPts: window.coordinatesByArea.coordinates
11126
11134
  });
11127
11135
  }
11128
11136
  }
@@ -11346,7 +11354,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
11346
11354
  let beamStExtended = beamSt.clone().addScaledVector(vec2, nExtend);
11347
11355
  let beamEdExtended = beamEd.clone().addScaledVector(vec2.clone().negate(), nExtend);
11348
11356
  let isPPP = getParallelism(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
11349
- if (isPPP.isParallel)
11357
+ if (isPPP.isParallel || isPPP.angleDeg > 45)
11350
11358
  continue;
11351
11359
  let insertPt = segmentsIntersect2D(doorStExtended, doorEdExtended, beamStExtended, beamEdExtended);
11352
11360
  let bIsTrue = true;
@@ -11466,32 +11474,94 @@ var getWindowData = (lines, pcdData, lineReader) => {
11466
11474
  let afterDoorLen = doorTmpEd.distanceTo(doorTmpSt);
11467
11475
  if (afterDoorLen < 0.4 && !isWindow || afterDoorLen < 0.3 && isWindow)
11468
11476
  continue;
11469
- const windowLine = new THREE10.Line3(new THREE10.Vector3(doorTmpSt.x, doorTmpSt.y, 0), new THREE10.Vector3(doorTmpEd.x, doorTmpEd.y, 0));
11477
+ const windowLine = new THREE10.Line3(doorTmpSt, doorTmpEd);
11470
11478
  const windowPcd = windowDatas[findDoorDataIndex];
11471
11479
  const windowPcdSt = windowPcd.windowStartPt.clone();
11472
11480
  const windowPcdEd = windowPcd.windowEndPt.clone();
11473
- windowPcdSt.z = windowPcdEd.z = doorTmpSt.z;
11474
- let dist11 = doorTmpSt.distanceTo(windowPcdSt);
11475
- let dist22 = doorTmpSt.distanceTo(windowPcdEd);
11476
- let dist33 = doorTmpEd.distanceTo(windowPcdSt);
11477
- let dist44 = doorTmpEd.distanceTo(windowPcdEd);
11478
- let minDist = Math.min(dist11, dist22, dist33, dist44);
11479
- let windowLen = windowPcdSt.distanceTo(windowPcdEd);
11480
- let wZ = doorTmpSt.z;
11481
+ const windowLen = windowPcdSt.distanceTo(windowPcdEd);
11482
+ let rectPts = windowPcd.rectPts.map((p) => new THREE10.Vector3(p.x, p.y, p.z));
11483
+ rectPts = setPointsSameZ(rectPts, doorTmpSt.z);
11481
11484
  let ptClose = new THREE10.Vector3();
11482
11485
  let vec2 = new THREE10.Vector3();
11483
- if (dist11 == minDist) {
11484
- ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
11485
- vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
11486
- } else if (dist22 == minDist) {
11487
- ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
11488
- vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
11489
- } else if (dist33 == minDist) {
11490
- ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
11491
- vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11492
- } else if (dist44 == minDist) {
11493
- ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
11494
- vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11486
+ if (rectPts.length == 5)
11487
+ rectPts.splice(4, 1);
11488
+ let shortLinePt1 = rectPts[0];
11489
+ let shortLinePt2 = rectPts[1];
11490
+ let shortLinePt3 = rectPts[2];
11491
+ let shortLinePt4 = rectPts[3];
11492
+ if (rectPts[0].distanceTo(rectPts[1]) > rectPts[1].distanceTo(rectPts[2])) {
11493
+ shortLinePt1 = rectPts[1];
11494
+ shortLinePt2 = rectPts[2];
11495
+ shortLinePt3 = rectPts[3];
11496
+ shortLinePt4 = rectPts[0];
11497
+ }
11498
+ let addShortLen = 0.2;
11499
+ let vecShort1 = new THREE10.Vector3().subVectors(shortLinePt2, shortLinePt1).normalize();
11500
+ let vecShort2 = new THREE10.Vector3().subVectors(shortLinePt4, shortLinePt3).normalize();
11501
+ shortLinePt1 = shortLinePt1.addScaledVector(vecShort1, -addShortLen);
11502
+ shortLinePt2 = shortLinePt2.addScaledVector(vecShort1, addShortLen);
11503
+ shortLinePt3 = shortLinePt3.addScaledVector(vecShort2, -addShortLen);
11504
+ shortLinePt4 = shortLinePt4.addScaledVector(vecShort2, addShortLen);
11505
+ let tmpVec = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
11506
+ let tmpDoorTmpSt = doorTmpSt.clone().addScaledVector(tmpVec, -addShortLen);
11507
+ let tmpDoorTmpEd = doorTmpEd.clone().addScaledVector(tmpVec, addShortLen);
11508
+ let intersect1 = segmentsIntersect2D(shortLinePt1, shortLinePt2, tmpDoorTmpSt, tmpDoorTmpEd);
11509
+ let intersect2 = segmentsIntersect2D(shortLinePt3, shortLinePt4, tmpDoorTmpSt, tmpDoorTmpEd);
11510
+ let distIntersect1 = 99999;
11511
+ let distIntersect2 = 99999;
11512
+ let near1St = false;
11513
+ let near2St = false;
11514
+ if (intersect1 != null) {
11515
+ let dist55 = intersect1.point.distanceTo(doorTmpSt);
11516
+ let dist66 = intersect1.point.distanceTo(doorTmpEd);
11517
+ if (dist55 < 0.1 || dist66 < 0.1) {
11518
+ if (dist55 < dist66) {
11519
+ near1St = true;
11520
+ distIntersect1 = dist55;
11521
+ } else
11522
+ distIntersect1 = dist66;
11523
+ }
11524
+ }
11525
+ if (intersect2 != null) {
11526
+ let dist55 = intersect2.point.distanceTo(doorTmpSt);
11527
+ let dist66 = intersect2.point.distanceTo(doorTmpEd);
11528
+ if (dist55 < 0.1 || dist66 < 0.1) {
11529
+ if (dist55 < dist66) {
11530
+ near2St = true;
11531
+ distIntersect2 = dist55;
11532
+ } else
11533
+ distIntersect2 = dist66;
11534
+ }
11535
+ }
11536
+ if (distIntersect1 == 99999 && distIntersect2 == 99999) {
11537
+ windowPcdSt.z = windowPcdEd.z = doorTmpSt.z;
11538
+ let dist11 = doorTmpSt.distanceTo(windowPcdSt);
11539
+ let dist22 = doorTmpSt.distanceTo(windowPcdEd);
11540
+ let dist33 = doorTmpEd.distanceTo(windowPcdSt);
11541
+ let dist44 = doorTmpEd.distanceTo(windowPcdEd);
11542
+ let minDist = Math.min(dist11, dist22, dist33, dist44);
11543
+ let wZ = doorTmpSt.z;
11544
+ if (dist11 == minDist) {
11545
+ ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
11546
+ vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
11547
+ } else if (dist22 == minDist) {
11548
+ ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
11549
+ vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
11550
+ } else if (dist33 == minDist) {
11551
+ ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
11552
+ vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11553
+ } else if (dist44 == minDist) {
11554
+ ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
11555
+ vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11556
+ }
11557
+ } else {
11558
+ if (distIntersect1 < distIntersect2) {
11559
+ ptClose = intersect1.point.clone();
11560
+ vec2 = near1St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11561
+ } else {
11562
+ ptClose = intersect2.point.clone();
11563
+ vec2 = near2St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
11564
+ }
11495
11565
  }
11496
11566
  doorTmpSt = ptClose.clone();
11497
11567
  doorTmpEd = doorTmpSt.clone().addScaledVector(vec2, windowLen);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",