rm-graphical-computing-node 1.0.43 → 1.0.45

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 +30 -46
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3782,7 +3782,6 @@ function getTrendLineEndpoints(points, options = {}) {
3782
3782
  }
3783
3783
 
3784
3784
  // src/geometry/beamLine.mjs
3785
- import { Line as Line2 } from "three";
3786
3785
  var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, onProgress = null) => {
3787
3786
  removeNoisePoints(lines, lineReader, lineEditor);
3788
3787
  if (lines.length <= 0 || runDataList.length <= 0)
@@ -3939,11 +3938,11 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
3939
3938
  let dist1 = door.doorStartPt.distanceTo(door.doorEndPt);
3940
3939
  let dist22 = newDoorSt.distanceTo(newDoorEd);
3941
3940
  let res = getParallelism(door.doorStartPt, door.doorEndPt, newDoorSt, newDoorEd);
3942
- if (Math.abs(dist22 - dist1) < 0.5 && res && res.angleDeg < 15) {
3941
+ if (Math.abs(dist22 - dist1) < 0.5 && res && res.angleDeg < 10) {
3943
3942
  door.doorStartPt = new THREE5.Vector3(lines[u4].start.x, lines[u4].start.y, 0);
3944
3943
  door.doorEndPt = new THREE5.Vector3(lines[u4].end.x, lines[u4].end.y, 0);
3945
3944
  break;
3946
- } else if (Math.abs(dist22 - dist1) > 1.3 && res && res.angleDeg < 15) {
3945
+ } else if (Math.abs(dist22 - dist1) > 1.3 && res && res.angleDeg < 10) {
3947
3946
  let restmp = classifySegments(door.doorStartPt, door.doorEndPt, newDoorSt, newDoorEd, { parallelAngleMax: THREE5.MathUtils.degToRad(15) });
3948
3947
  let dist11 = door.doorStartPt.distanceTo(newDoorSt);
3949
3948
  let dist12 = door.doorStartPt.distanceTo(newDoorEd);
@@ -4852,7 +4851,7 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
4852
4851
  let vecNegate = vec2.clone().negate();
4853
4852
  let ptCenterOther = ptCenter.clone().addScaledVector(vecNegate, dist3 + 0.1);
4854
4853
  let isInsert = segmentsIntersect2D(line3.start, line3.end, ptCenter, ptCenterOther);
4855
- let isTrue = !isDoor && !tmpDoorBeamData.isDoor && (length1 > length22 * 2 || length22 > length1 * 2);
4854
+ let isTrue = !isDoor && !tmpDoorBeamData.isDoor && (length1 > length22 * 2.5 || length22 > length1 * 2.5);
4856
4855
  if (dist3 < 0.4 && isInsert != null && !isTrue) {
4857
4856
  let isSameLine = false;
4858
4857
  for (let v2 = 0; v2 < line2.doorAndBeamData.length; v2++) {
@@ -11938,6 +11937,9 @@ function processData(wallSegments, objects, options) {
11938
11937
  return { segments: finalSegments, matches };
11939
11938
  }
11940
11939
 
11940
+ // src/wall-door-matcher/matcher.ts
11941
+ import * as THREE10 from "three";
11942
+
11941
11943
  // src/wall-door-matcher/utils.ts
11942
11944
  function dist2D2(a, b) {
11943
11945
  const dx = a.x - b.x;
@@ -12777,7 +12779,26 @@ function collectCandidates2(candidateSegments, doorLong, doorDirX, doorDirY, che
12777
12779
  for (const attempt of matchAttempts) {
12778
12780
  if (passingCandidates.length > 0) break;
12779
12781
  for (const seg of candidateSegments) {
12780
- const { start, end } = seg;
12782
+ const { start, end, isLine2, passageEntrance } = seg;
12783
+ if (isLine2)
12784
+ continue;
12785
+ if (passageEntrance) {
12786
+ const pt1 = new THREE10.Vector3(nline.start.x, nline.start.y, nline.start.z);
12787
+ const pt2 = new THREE10.Vector3(nline.end.x, nline.end.y, nline.end.z);
12788
+ let isOverLap = false;
12789
+ for (let v2 = 0; v2 < passageEntrance.length; v2++) {
12790
+ const data = passageEntrance[v2];
12791
+ const pt3 = new THREE10.Vector3(data.start.x, data.start.y, data.start.z);
12792
+ const pt4 = new THREE10.Vector3(data.end.x, data.end.y, data.end.z);
12793
+ let resultTmp = classifySegments(pt1, pt2, pt3, pt4);
12794
+ if (resultTmp.type == "collinear_overlap" && resultTmp.maxPerpendicularDistance < 0.1) {
12795
+ isOverLap = true;
12796
+ break;
12797
+ }
12798
+ }
12799
+ if (isOverLap)
12800
+ continue;
12801
+ }
12781
12802
  let validPoint = false;
12782
12803
  let minDist = Infinity;
12783
12804
  for (const pt of checkPoints) {
@@ -12924,8 +12945,6 @@ function mergeSourceData2(ws, srcIdxs, wallSegments) {
12924
12945
  if (boxData) ws.boxData = boxData;
12925
12946
  if (maxRooftopPz !== void 0) ws.rooftopPz = maxRooftopPz;
12926
12947
  }
12927
- function logDrawDoorSummary(mergedSegments) {
12928
- }
12929
12948
  function detectPerpendicularWalls2(match, mergedSegments, angleTol = 10, distTol = 0.2, perpDistTol = 0.2) {
12930
12949
  const results = [];
12931
12950
  if (!match.DrawDoor) return results;
@@ -13123,16 +13142,6 @@ function findDoorWalls(doorObjs, wallSegments, options, preMerged) {
13123
13142
  const checkPoints = getCheckPoints2(corners, centerX, centerY);
13124
13143
  debugScanDoor(door.name, candidateSegments, centerX, centerY, checkPoints, doorLong, doorDirX, doorDirY, opts);
13125
13144
  let passingCandidates = collectCandidates2(candidateSegments, actualDoorWidth, doorDirX, doorDirY, checkPoints, opts, door.name, verticalEdges, door.nline);
13126
- if (passingCandidates.length > 0) {
13127
- for (let ci = 0; ci < passingCandidates.length; ci++) {
13128
- const pc = passingCandidates[ci];
13129
- const seg = pc.seg;
13130
- const hasHinge = !!pc.hingeInfo?.hingePoint;
13131
- const isClosed = pc.hingeInfo?.isClosed;
13132
- const hDist = pc.hingeInfo?.hingeDist ?? -1;
13133
- const centerProj = pointToSegmentDist2(checkPoints[0].x, checkPoints[0].y, seg.start.x, seg.start.y, seg.end.x, seg.end.y);
13134
- }
13135
- }
13136
13145
  passingCandidates = rankCandidates2(passingCandidates, checkPoints, wallSegments, door.name);
13137
13146
  if (passingCandidates.length === 0) {
13138
13147
  for (const seg of candidateSegments) {
@@ -13221,9 +13230,6 @@ function findDoorWalls(doorObjs, wallSegments, options, preMerged) {
13221
13230
  };
13222
13231
  }
13223
13232
  }
13224
- if (door.name.includes("door_002")) {
13225
- window.__doorLog = true;
13226
- }
13227
13233
  ;
13228
13234
  pc.densityScore = densityScore.score;
13229
13235
  pc.densityOverlap = densityScore.bestOverlap;
@@ -13242,19 +13248,6 @@ function findDoorWalls(doorObjs, wallSegments, options, preMerged) {
13242
13248
  pc.densityScore = -1;
13243
13249
  }
13244
13250
  }
13245
- if (door.name.includes("door_002")) {
13246
- for (let pi = 0; pi < passingCandidates.length; pi++) {
13247
- const pc = passingCandidates[pi];
13248
- const s = pc.seg;
13249
- const segIdx = candidateSegments.findIndex(
13250
- (cs) => Math.abs(cs.start.x - s.start.x) < 1e-3 && Math.abs(cs.start.y - s.start.y) < 1e-3 && Math.abs(cs.end.x - s.end.x) < 1e-3 && Math.abs(cs.end.y - s.end.y) < 1e-3
13251
- );
13252
- const origIndices = segIdx >= 0 ? mergeSourceMap[segIdx] || [] : [];
13253
- for (const oi of origIndices) {
13254
- const orig = wallSegments[oi];
13255
- }
13256
- }
13257
- }
13258
13251
  passingCandidates.sort((a, b) => {
13259
13252
  const da2 = a.densityScore >= 0 ? a.densityScore : -Infinity;
13260
13253
  const db = b.densityScore >= 0 ? b.densityScore : -Infinity;
@@ -13271,14 +13264,6 @@ function findDoorWalls(doorObjs, wallSegments, options, preMerged) {
13271
13264
  if (ha !== hb) return hb - ha;
13272
13265
  return a.minDist - b.minDist;
13273
13266
  });
13274
- if (passingCandidates.length > 0) {
13275
- for (let ci = 0; ci < passingCandidates.length; ci++) {
13276
- const pc = passingCandidates[ci];
13277
- const s = pc.seg;
13278
- const ratio = pc.ratio || s.length / doorWidth;
13279
- const ratioDiff = Math.abs(ratio - 1);
13280
- }
13281
- }
13282
13267
  let bestSeg = null;
13283
13268
  let bestDist = Infinity;
13284
13269
  let bestRatio = 0;
@@ -13400,7 +13385,6 @@ function findDoorWalls(doorObjs, wallSegments, options, preMerged) {
13400
13385
  if (!srcIdxs || srcIdxs.length <= 1) continue;
13401
13386
  mergeSourceData2(ws, srcIdxs, wallSegments);
13402
13387
  }
13403
- logDrawDoorSummary(mergedSegments);
13404
13388
  return results;
13405
13389
  }
13406
13390
 
@@ -13922,10 +13906,10 @@ function normalizeAngles(lines) {
13922
13906
  hist[binIdx] += len;
13923
13907
  }
13924
13908
  const smooth = new Array(bins).fill(0);
13925
- const window2 = 5;
13909
+ const window = 5;
13926
13910
  for (let i = 0; i < bins; i++) {
13927
13911
  let sum2 = 0;
13928
- for (let j = -window2; j <= window2; j++) {
13912
+ for (let j = -window; j <= window; j++) {
13929
13913
  let idx = i + j;
13930
13914
  if (idx < 0) idx += bins;
13931
13915
  if (idx >= bins) idx -= bins;
@@ -16346,10 +16330,10 @@ function normalizeAngles2(lines) {
16346
16330
  hist[binIdx] += len;
16347
16331
  }
16348
16332
  const smooth = new Array(bins).fill(0);
16349
- const window2 = 5;
16333
+ const window = 5;
16350
16334
  for (let i = 0; i < bins; i++) {
16351
16335
  let sum2 = 0;
16352
- for (let j = -window2; j <= window2; j++) {
16336
+ for (let j = -window; j <= window; j++) {
16353
16337
  let idx = i + j;
16354
16338
  if (idx < 0) idx += bins;
16355
16339
  if (idx >= bins) idx -= bins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",