rm-graphical-computing-node 1.0.73 → 1.0.75

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 +531 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2610,6 +2610,7 @@ var PointsUtils = class {
2610
2610
  };
2611
2611
 
2612
2612
  // src/utils/utils.mjs
2613
+ import { randomUUID } from "crypto";
2613
2614
  var addLine = (pt1, pt2, scene) => {
2614
2615
  let lineMaterial = new THREE3.LineBasicMaterial({ color: "#0011ff" });
2615
2616
  let pts = [];
@@ -3220,14 +3221,24 @@ var isPointOnLine = (line2, point2, tolerance = 1e-6) => {
3220
3221
  line2.closestPointToPoint(point2, true, closestPoint);
3221
3222
  return closestPoint.distanceTo(point2) < tolerance;
3222
3223
  };
3223
- var isPointOnLine2 = (lineStart, lineEnd, point2, tolerance = 1e-6) => {
3224
- const line2 = new THREE3.Line3(
3225
- new THREE3.Vector3(lineStart.x, lineStart.y, lineStart.z),
3226
- new THREE3.Vector3(lineEnd.x, lineEnd.y, lineEnd.z)
3227
- );
3228
- const closestPoint = new THREE3.Vector3();
3229
- line2.closestPointToPoint(new THREE3.Vector3(point2.x, point2.y, point2.z), true, closestPoint);
3230
- return closestPoint.distanceTo(new THREE3.Vector3(point2.x, point2.y, point2.z)) < tolerance;
3224
+ var isPointOnLine2 = (lineStart, lineEnd, point2, tolerance = 1e-6, setZZero = false) => {
3225
+ if (setZZero) {
3226
+ const line2 = new THREE3.Line3(
3227
+ new THREE3.Vector3(lineStart.x, lineStart.y, 0),
3228
+ new THREE3.Vector3(lineEnd.x, lineEnd.y, 0)
3229
+ );
3230
+ const closestPoint = new THREE3.Vector3();
3231
+ line2.closestPointToPoint(new THREE3.Vector3(point2.x, point2.y, 0), true, closestPoint);
3232
+ return closestPoint.distanceTo(new THREE3.Vector3(point2.x, point2.y, 0)) < tolerance;
3233
+ } else {
3234
+ const line2 = new THREE3.Line3(
3235
+ new THREE3.Vector3(lineStart.x, lineStart.y, lineStart.z),
3236
+ new THREE3.Vector3(lineEnd.x, lineEnd.y, lineEnd.z)
3237
+ );
3238
+ const closestPoint = new THREE3.Vector3();
3239
+ line2.closestPointToPoint(new THREE3.Vector3(point2.x, point2.y, point2.z), true, closestPoint);
3240
+ return closestPoint.distanceTo(new THREE3.Vector3(point2.x, point2.y, point2.z)) < tolerance;
3241
+ }
3231
3242
  };
3232
3243
  var getFarthestPoints = (points) => {
3233
3244
  let maxDist = 0;
@@ -3511,6 +3522,123 @@ var setPointsSameZ = (points, z) => {
3511
3522
  points[i].z = z;
3512
3523
  return points;
3513
3524
  };
3525
+ var getPt3 = (pt) => {
3526
+ return new THREE3.Vector3(pt.x, pt.y, pt.z);
3527
+ };
3528
+ var getVector3 = (pt1, pt2, isNormalize = true) => {
3529
+ if (isNormalize)
3530
+ return new THREE3.Vector3().subVectors(pt2, pt1).normalize();
3531
+ return new THREE3.Vector3().subVectors(pt2, pt1);
3532
+ };
3533
+ var mergeLines = (lines) => {
3534
+ let allMergeIndex = [];
3535
+ let newLines = [];
3536
+ for (let i = 0; i < lines.length; i++) {
3537
+ let line1 = lines[i];
3538
+ if (allMergeIndex.includes(i) || line1.isDoor)
3539
+ continue;
3540
+ let start1 = getPt3(line1.start);
3541
+ let end1 = getPt3(line1.end);
3542
+ let mergeIndexs = [];
3543
+ for (let j = 0; j < lines.length; j++) {
3544
+ let line2 = lines[j];
3545
+ if (i == j || mergeIndexs.includes(j) || allMergeIndex.includes(j) || line2.isDoor)
3546
+ continue;
3547
+ let start2 = getPt3(line2.start);
3548
+ let end2 = getPt3(line2.end);
3549
+ let isP = classifySegments(start1, end1, start2, end2);
3550
+ if (!isP || isP.type != "collinear_gap")
3551
+ continue;
3552
+ let isEq1 = ptIsEqual(start1, start2);
3553
+ let isEq2 = ptIsEqual(start1, end2);
3554
+ let isEq3 = ptIsEqual(end1, start2);
3555
+ let isEq4 = ptIsEqual(end1, end2);
3556
+ if (isEq1) {
3557
+ start1 = end1.clone();
3558
+ end1 = end2.clone();
3559
+ } else if (isEq2) {
3560
+ start1 = end1.clone();
3561
+ end1 = start2.clone();
3562
+ } else if (isEq3) {
3563
+ end1 = end2.clone();
3564
+ } else if (isEq4) {
3565
+ end1 = start2.clone();
3566
+ } else continue;
3567
+ mergeIndexs.push(j);
3568
+ j = -1;
3569
+ }
3570
+ if (!mergeIndexs.length)
3571
+ continue;
3572
+ let newOriginalPoints = line1.originalPoints;
3573
+ let newDoorAndBeamDatas = [];
3574
+ if (line1.doorAndBeamData)
3575
+ newDoorAndBeamDatas = line1.doorAndBeamData;
3576
+ let newWindowData = [];
3577
+ if (line1.windowData)
3578
+ newWindowData = line1.windowData;
3579
+ let newRooftopPz = line1.rooftopPz;
3580
+ let newIsPassageEntrance = false;
3581
+ if (line1.isPassageEntrance)
3582
+ newIsPassageEntrance = line1.isPassageEntrance;
3583
+ let newInPassageEntranceDoor = false;
3584
+ if (line1.inPassageEntranceDoor)
3585
+ newInPassageEntranceDoor = line1.inPassageEntranceDoor;
3586
+ let newPassageEntrance = [];
3587
+ if (line1.passageEntrance)
3588
+ newPassageEntrance = line1.passageEntrance;
3589
+ let newDrawWindow = [];
3590
+ if (line1.drawWindow)
3591
+ newDrawWindow = line1.drawWindow;
3592
+ let newIsHoleWindow = false;
3593
+ if (line1.isHoleWindow)
3594
+ newIsHoleWindow = line1.isHoleWindow;
3595
+ for (let t = 0; t < mergeIndexs.length; t++) {
3596
+ let line3 = lines[mergeIndexs[t]];
3597
+ for (let e = 0; e < line3.originalPoints.length; e++)
3598
+ newOriginalPoints.push(line3.originalPoints[e]);
3599
+ if (line3.doorAndBeamData)
3600
+ newDoorAndBeamDatas.push(...line3.doorAndBeamData);
3601
+ if (line3.windowData)
3602
+ newWindowData.push(...line3.windowData);
3603
+ newRooftopPz = newRooftopPz < line3.rooftopPz ? line3.rooftopPz : newRooftopPz;
3604
+ if (line3.isPassageEntrance)
3605
+ newIsPassageEntrance = line3.isPassageEntrance;
3606
+ if (line3.inPassageEntranceDoor)
3607
+ newInPassageEntranceDoor = line3.inPassageEntranceDoor;
3608
+ if (line3.passageEntrance)
3609
+ newPassageEntrance.push(...line3.passageEntrance);
3610
+ if (line3.drawWindow)
3611
+ newDrawWindow.push(...line3.drawWindow);
3612
+ if (line3.isHoleWindow)
3613
+ newIsHoleWindow = line3.isHoleWindow;
3614
+ }
3615
+ if (mergeIndexs.length)
3616
+ mergeIndexs.push(i);
3617
+ let newLine = {
3618
+ start: start1,
3619
+ end: end1,
3620
+ length: start1.distanceTo(end1),
3621
+ originalPoints: newOriginalPoints,
3622
+ isRebuild: false,
3623
+ doorAndBeamData: newDoorAndBeamDatas,
3624
+ windowData: newWindowData,
3625
+ rooftopPz: newRooftopPz,
3626
+ id: randomUUID(),
3627
+ direction: line1.direction,
3628
+ // isDoor: newIsDoor,
3629
+ // drawDoorData: newDrawDoorData,
3630
+ isPassageEntrance: newIsPassageEntrance,
3631
+ inPassageEntranceDoor: newInPassageEntranceDoor,
3632
+ passageEntrance: newPassageEntrance,
3633
+ drawWindow: newDrawWindow,
3634
+ isHoleWindow: newIsHoleWindow,
3635
+ mergeIndexs
3636
+ };
3637
+ newLines.push(newLine);
3638
+ allMergeIndex.push(...mergeIndexs);
3639
+ }
3640
+ return newLines;
3641
+ };
3514
3642
 
3515
3643
  // src/utils/updateLine.mjs
3516
3644
  import * as THREE4 from "three";
@@ -12104,6 +12232,394 @@ var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, point
12104
12232
  }
12105
12233
  return lines;
12106
12234
  };
12235
+ var getWindowPcdData = (lines, pcdData) => {
12236
+ if (!lines || !lines.length || !pcdData || !pcdData.length)
12237
+ return lines;
12238
+ for (let i = 0; i < lines.length; i++) {
12239
+ if (lines[i].drawWindow && lines[i].drawWindow.length)
12240
+ lines[i].drawWindow.length = 0;
12241
+ }
12242
+ const pcdToLineDist = 0.3;
12243
+ for (let i = 0; i < pcdData.length; i++) {
12244
+ const pcd = pcdData[i];
12245
+ if (pcd.category != "window" || pcd.isBayWindowObj || pcd.isFindWindow)
12246
+ continue;
12247
+ let ptArray = pcd.coordinatesByArea.coordinates;
12248
+ let minZ = pcd.coordinatesByArea.heightData.minZ;
12249
+ let maxZ = pcd.coordinatesByArea.heightData.maxZ;
12250
+ let height = maxZ - minZ;
12251
+ let ptLongSt1 = getPt3(ptArray[0]);
12252
+ let ptLongEd1 = getPt3(ptArray[1]);
12253
+ let ptLongSt2 = getPt3(ptArray[2]);
12254
+ let ptLongEd2 = getPt3(ptArray[3]);
12255
+ let ptShortSt1 = getPt3(ptArray[1]);
12256
+ let ptShortEd1 = getPt3(ptArray[2]);
12257
+ let ptShortSt2 = getPt3(ptArray[3]);
12258
+ let ptShortEd2 = getPt3(ptArray[0]);
12259
+ if (ptLongSt1.distanceTo(ptLongEd1) < ptLongSt1.distanceTo(ptLongEd2)) {
12260
+ ptLongSt1 = getPt3(ptArray[1]);
12261
+ ptLongEd1 = getPt3(ptArray[2]);
12262
+ ptLongSt2 = getPt3(ptArray[3]);
12263
+ ptLongEd2 = getPt3(ptArray[0]);
12264
+ ptShortSt1 = getPt3(ptArray[0]);
12265
+ ptShortEd1 = getPt3(ptArray[1]);
12266
+ ptShortSt2 = getPt3(ptArray[2]);
12267
+ ptShortEd2 = getPt3(ptArray[3]);
12268
+ }
12269
+ let ptMid1 = getMid(ptShortSt1, ptShortEd1);
12270
+ let ptMid2 = getMid(ptShortSt2, ptShortEd2);
12271
+ let shortLen = ptShortSt1.distanceTo(ptShortEd1);
12272
+ let eligibilityLines = [];
12273
+ let eligibilityLinesIndexs = [];
12274
+ for (let j = 0; j < lines.length; j++) {
12275
+ const line3 = lines[j];
12276
+ let ptStart2 = getPt3(line3.start);
12277
+ let ptEnd2 = getPt3(line3.end);
12278
+ ptStart2.z = ptEnd2.z = ptMid1.z;
12279
+ let isp = getParallelism(ptMid1, ptMid2, ptStart2, ptEnd2);
12280
+ if (isp && isp.angleDeg < 25) {
12281
+ let tmpLine3 = new THREE10.Line3(ptMid1, ptMid2);
12282
+ let tmpLine4 = new THREE10.Line3(ptLongSt1, ptLongEd1);
12283
+ let tmpLine5 = new THREE10.Line3(ptLongSt2, ptLongEd2);
12284
+ let ptMid = getMid(ptStart2, ptEnd2);
12285
+ let ptClose3 = tmpLine3.closestPointToPoint(ptMid, true, new THREE10.Vector3());
12286
+ let ptClose4 = tmpLine4.closestPointToPoint(ptMid, true, new THREE10.Vector3());
12287
+ let ptClose5 = tmpLine5.closestPointToPoint(ptMid, true, new THREE10.Vector3());
12288
+ if (ptClose3.distanceTo(ptMid) < pcdToLineDist || ptClose4.distanceTo(ptMid) < pcdToLineDist || ptClose5.distanceTo(ptMid) < pcdToLineDist) {
12289
+ eligibilityLines.push(line3);
12290
+ eligibilityLinesIndexs.push(j);
12291
+ } else {
12292
+ tmpLine3 = new THREE10.Line3(ptStart2, ptEnd2);
12293
+ let ptMid3 = getMid(ptMid1, ptMid2);
12294
+ let ptMid4 = getMid(ptLongSt1, ptLongEd1);
12295
+ let ptMid5 = getMid(ptLongSt2, ptLongEd2);
12296
+ ptClose3 = tmpLine3.closestPointToPoint(ptMid3, true, new THREE10.Vector3());
12297
+ ptClose4 = tmpLine3.closestPointToPoint(ptMid4, true, new THREE10.Vector3());
12298
+ ptClose5 = tmpLine3.closestPointToPoint(ptMid5, true, new THREE10.Vector3());
12299
+ if (ptClose3.distanceTo(ptMid3) < pcdToLineDist || ptClose4.distanceTo(ptMid4) < pcdToLineDist || ptClose5.distanceTo(ptMid5) < pcdToLineDist) {
12300
+ eligibilityLines.push(line3);
12301
+ eligibilityLinesIndexs.push(j);
12302
+ }
12303
+ }
12304
+ }
12305
+ }
12306
+ let newLines = mergeLines(eligibilityLines);
12307
+ let tmpLines = [];
12308
+ if (newLines && newLines.length) {
12309
+ for (let k = 0; k < newLines.length; k++) {
12310
+ let mergeIndexs = newLines[k].mergeIndexs;
12311
+ for (let c = 0; c < eligibilityLines.length; c++) {
12312
+ if (mergeIndexs.includes(c))
12313
+ continue;
12314
+ tmpLines.push(eligibilityLines[c]);
12315
+ }
12316
+ }
12317
+ tmpLines.push(...newLines);
12318
+ } else
12319
+ tmpLines = [...eligibilityLines];
12320
+ let maxLen = -1;
12321
+ let maxIndex = -1;
12322
+ for (let t = 0; t < tmpLines.length; t++) {
12323
+ if (tmpLines[t].length > maxLen) {
12324
+ maxLen = tmpLines[t].length;
12325
+ maxIndex = t;
12326
+ }
12327
+ }
12328
+ if (maxIndex == -1)
12329
+ continue;
12330
+ const line2 = tmpLines[maxIndex];
12331
+ let ptStart = getPt3(line2.start);
12332
+ let ptEnd = getPt3(line2.end);
12333
+ ptStart.z = ptEnd.z = ptShortEd1.z;
12334
+ let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, pcdToLineDist);
12335
+ let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, pcdToLineDist);
12336
+ if (intersect1 != null && intersect2 != null) {
12337
+ if (line2.mergeIndexs) {
12338
+ let tmpIndex = [];
12339
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
12340
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
12341
+ }
12342
+ for (let h = 0; h < lines.length; h++) {
12343
+ if (tmpIndex.includes(h))
12344
+ lines[h].isRebuild = true;
12345
+ }
12346
+ lines.push(line2);
12347
+ }
12348
+ let ptWindowSt = getPt3(intersect1.point);
12349
+ let ptWindowEd = getPt3(intersect2.point);
12350
+ if (ptStart.distanceTo(ptWindowSt) > ptStart.distanceTo(ptWindowEd))
12351
+ [ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
12352
+ let groundClearance = minZ - ptWindowSt.z;
12353
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12354
+ if (!line2.drawWindow)
12355
+ line2.drawWindow = [];
12356
+ let p = getMid(ptWindowSt, ptWindowEd);
12357
+ p.z = minZ;
12358
+ line2.drawWindow.push({
12359
+ p,
12360
+ full: false,
12361
+ groundClearance,
12362
+ height,
12363
+ width: ptWindowSt.distanceTo(ptWindowEd)
12364
+ });
12365
+ line2.isWindow = true;
12366
+ pcd.isWindowDoor = true;
12367
+ } else if (intersect1 != null || intersect2 != null) {
12368
+ if (line2.mergeIndexs) {
12369
+ let tmpIndex = [];
12370
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
12371
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
12372
+ }
12373
+ for (let h = 0; h < lines.length; h++) {
12374
+ if (tmpIndex.includes(h))
12375
+ lines[h].isRebuild = true;
12376
+ }
12377
+ lines.push(line2);
12378
+ }
12379
+ let ptWindowSt = null;
12380
+ let pcdMid = null;
12381
+ if (intersect1 != null) {
12382
+ ptWindowSt = getPt3(intersect1.point);
12383
+ pcdMid = ptMid2.clone();
12384
+ } else {
12385
+ ptWindowSt = getPt3(intersect2.point);
12386
+ pcdMid = ptMid1.clone();
12387
+ }
12388
+ let line3 = new THREE10.Line3(ptStart, ptEnd);
12389
+ let ptClose = line3.closestPointToPoint(pcdMid, false, new THREE10.Vector3());
12390
+ let vec2 = getVector3(ptWindowSt, ptClose);
12391
+ let width = ptMid1.distanceTo(ptMid2);
12392
+ let ptWindowEd = ptWindowSt.clone().addScaledVector(vec2, width);
12393
+ let groundClearance = minZ - ptWindowSt.z;
12394
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12395
+ if (!line2.drawWindow)
12396
+ line2.drawWindow = [];
12397
+ let p = getMid(ptWindowSt, ptWindowEd);
12398
+ p.z = minZ;
12399
+ line2.drawWindow.push({
12400
+ p,
12401
+ full: false,
12402
+ groundClearance,
12403
+ height,
12404
+ width: ptWindowSt.distanceTo(ptWindowEd)
12405
+ });
12406
+ line2.isWindow = true;
12407
+ pcd.isWindowDoor = true;
12408
+ } else {
12409
+ let shortLine1 = new THREE10.Line3(ptShortSt1, ptShortEd1);
12410
+ let shortLine2 = new THREE10.Line3(ptShortSt2, ptShortEd2);
12411
+ let ptClose1 = shortLine1.closestPointToPoint(ptStart, true, new THREE10.Vector3());
12412
+ let ptClose2 = shortLine1.closestPointToPoint(ptEnd, true, new THREE10.Vector3());
12413
+ let ptClose3 = shortLine2.closestPointToPoint(ptStart, true, new THREE10.Vector3());
12414
+ let ptClose4 = shortLine2.closestPointToPoint(ptEnd, true, new THREE10.Vector3());
12415
+ let dist1 = ptClose1.distanceTo(ptStart);
12416
+ let dist2 = ptClose2.distanceTo(ptEnd);
12417
+ let dist3 = ptClose3.distanceTo(ptStart);
12418
+ let dist4 = ptClose4.distanceTo(ptEnd);
12419
+ let nearDist = 0.1;
12420
+ if ((dist1 < nearDist || dist2 < nearDist) && (dist3 < nearDist || dist4 < nearDist)) {
12421
+ if (line2.mergeIndexs) {
12422
+ let tmpIndex = [];
12423
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
12424
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
12425
+ }
12426
+ for (let h = 0; h < lines.length; h++) {
12427
+ if (tmpIndex.includes(h))
12428
+ lines[h].isRebuild = true;
12429
+ }
12430
+ lines.push(line2);
12431
+ }
12432
+ let ptWindowSt = ptClose1.clone();
12433
+ let ptWindowEd = ptClose3.clone();
12434
+ if (dist2 < nearDist)
12435
+ ptWindowSt = ptClose2.clone();
12436
+ if (dist4 < nearDist)
12437
+ ptWindowEd = ptClose4.clone();
12438
+ ptWindowSt.z = ptWindowEd.z = minZ;
12439
+ let groundClearance = minZ - ptWindowSt.z;
12440
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12441
+ if (!line2.drawWindow)
12442
+ line2.drawWindow = [];
12443
+ let p = getMid(ptWindowSt, ptWindowEd);
12444
+ p.z = minZ;
12445
+ line2.drawWindow.push({
12446
+ p,
12447
+ full: false,
12448
+ groundClearance,
12449
+ height,
12450
+ width: ptWindowSt.distanceTo(ptWindowEd)
12451
+ });
12452
+ line2.isWindow = true;
12453
+ pcd.isWindowDoor = true;
12454
+ }
12455
+ }
12456
+ }
12457
+ return lines;
12458
+ };
12459
+
12460
+ // src/geometry/door.mjs
12461
+ import * as THREE11 from "three";
12462
+ import { randomUUID as randomUUID2 } from "crypto";
12463
+ var getDoorPcdData = (lines, pcdData) => {
12464
+ if (!lines || !lines.length || !pcdData || !pcdData.length)
12465
+ return lines;
12466
+ for (let i = 0; i < pcdData.length; i++) {
12467
+ const pcd = pcdData[i];
12468
+ if (pcd.category != "door" || pcd.isFindBeam)
12469
+ continue;
12470
+ let ptArray = pcd.coordinatesByArea.coordinates;
12471
+ let minZ = pcd.coordinatesByArea.heightData.minZ;
12472
+ let maxZ = pcd.coordinatesByArea.heightData.maxZ;
12473
+ let height = maxZ - minZ;
12474
+ let ptLongSt1 = getPt3(ptArray[0]);
12475
+ let ptLongEd1 = getPt3(ptArray[1]);
12476
+ let ptLongSt2 = getPt3(ptArray[2]);
12477
+ let ptLongEd2 = getPt3(ptArray[3]);
12478
+ let ptShortSt1 = getPt3(ptArray[1]);
12479
+ let ptShortEd1 = getPt3(ptArray[2]);
12480
+ let ptShortSt2 = getPt3(ptArray[3]);
12481
+ let ptShortEd2 = getPt3(ptArray[0]);
12482
+ if (ptLongSt1.distanceTo(ptLongEd1) < ptLongSt1.distanceTo(ptLongEd2)) {
12483
+ ptLongSt1 = getPt3(ptArray[1]);
12484
+ ptLongEd1 = getPt3(ptArray[2]);
12485
+ ptLongSt2 = getPt3(ptArray[3]);
12486
+ ptLongEd2 = getPt3(ptArray[0]);
12487
+ ptShortSt1 = getPt3(ptArray[0]);
12488
+ ptShortEd1 = getPt3(ptArray[1]);
12489
+ ptShortSt2 = getPt3(ptArray[2]);
12490
+ ptShortEd2 = getPt3(ptArray[3]);
12491
+ }
12492
+ let ptMid1 = getMid(ptShortSt1, ptShortEd1);
12493
+ let ptMid2 = getMid(ptShortSt2, ptShortEd2);
12494
+ let shortLen = ptShortSt1.distanceTo(ptShortEd1);
12495
+ let eligibilityLines = [];
12496
+ let eligibilityLinesIndexs = [];
12497
+ for (let j = 0; j < lines.length; j++) {
12498
+ const line3 = lines[j];
12499
+ let ptStart2 = getPt3(line3.start);
12500
+ let ptEnd2 = getPt3(line3.end);
12501
+ ptStart2.z = ptEnd2.z = ptMid1.z;
12502
+ let classify = classifySegments(ptMid1, ptMid2, ptStart2, ptEnd2);
12503
+ if (classify.type == "collinear_overlap" && classify.maxPerpendicularDistance < 0.3) {
12504
+ eligibilityLines.push(line3);
12505
+ eligibilityLinesIndexs.push(j);
12506
+ }
12507
+ }
12508
+ let newLines = mergeLines(eligibilityLines);
12509
+ let tmpLines = [];
12510
+ if (newLines && newLines.length) {
12511
+ for (let k = 0; k < newLines.length; k++) {
12512
+ let mergeIndexs = newLines[k].mergeIndexs;
12513
+ for (let c = 0; c < eligibilityLines.length; c++) {
12514
+ if (mergeIndexs.includes(c))
12515
+ continue;
12516
+ tmpLines.push(eligibilityLines[c]);
12517
+ }
12518
+ }
12519
+ tmpLines.push(...newLines);
12520
+ } else
12521
+ tmpLines = [...eligibilityLines];
12522
+ let maxLen = -1;
12523
+ let maxIndex = -1;
12524
+ for (let t = 0; t < tmpLines.length; t++) {
12525
+ if (tmpLines[t].length > maxLen) {
12526
+ maxLen = tmpLines[t].length;
12527
+ maxIndex = t;
12528
+ }
12529
+ }
12530
+ if (maxIndex == -1)
12531
+ continue;
12532
+ const line2 = tmpLines[maxIndex];
12533
+ let ptStart = getPt3(line2.start);
12534
+ let ptEnd = getPt3(line2.end);
12535
+ let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, 0.05);
12536
+ let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, 0.05);
12537
+ if (intersect1 != null && intersect2 != null) {
12538
+ if (line2.mergeIndexs) {
12539
+ let tmpIndex = [];
12540
+ for (let h = 0; h < line2.mergeIndexs.length; h++) {
12541
+ tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
12542
+ }
12543
+ for (let h = 0; h < lines.length; h++) {
12544
+ if (tmpIndex.includes(h))
12545
+ lines[h].isRebuild = true;
12546
+ }
12547
+ }
12548
+ let ptDoorSt = getPt3(intersect1.point);
12549
+ let ptDoorEd = getPt3(intersect2.point);
12550
+ if (ptStart.distanceTo(ptDoorSt) > ptStart.distanceTo(ptDoorEd))
12551
+ [ptDoorSt, ptDoorEd] = [ptDoorEd, ptDoorSt];
12552
+ const newOriginPts1 = getProjectedPointOnLine(ptStart, ptDoorSt, line2.originalPoints);
12553
+ const newOriginPts2 = getProjectedPointOnLine(ptDoorSt, ptDoorEd, line2.originalPoints);
12554
+ const newOriginPts3 = getProjectedPointOnLine(ptDoorEd, ptEnd, line2.originalPoints);
12555
+ const newDoorAndBeamData1 = [];
12556
+ const newDoorAndBeamData2 = [];
12557
+ const newDoorAndBeamData3 = [];
12558
+ if (line2.doorAndBeamData) {
12559
+ for (let a = 0; a < line2.doorAndBeamData.length; a++) {
12560
+ let doorStart = line2.doorAndBeamData[a].doorStart;
12561
+ let doorEnd = line2.doorAndBeamData[a].doorEnd;
12562
+ if (isPointOnLine2(ptStart, ptDoorSt, doorStart, 1e-3, true) && isPointOnLine2(ptStart, ptDoorSt, doorEnd, 1e-3, true))
12563
+ newDoorAndBeamData1.push(line2.doorAndBeamData[a]);
12564
+ else if (isPointOnLine2(ptDoorEd, ptEnd, doorStart, 1e-3, true) && isPointOnLine2(ptDoorEd, ptEnd, doorEnd, 1e-3, true))
12565
+ newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
12566
+ }
12567
+ }
12568
+ let groundClearance = minZ - ptDoorSt.z;
12569
+ groundClearance = groundClearance > 0.01 ? groundClearance : 0;
12570
+ let newLine1 = {
12571
+ start: ptStart,
12572
+ end: ptDoorSt,
12573
+ length: ptStart.distanceTo(ptDoorSt),
12574
+ originalPoints: newOriginPts1.newOriginalPoints,
12575
+ doorAndBeamData: newDoorAndBeamData1,
12576
+ id: randomUUID2(),
12577
+ rooftopPz: line2.rooftopPz,
12578
+ isRebuild: false,
12579
+ direction: line2.direction
12580
+ };
12581
+ let newLine2 = {
12582
+ start: ptDoorSt,
12583
+ end: ptDoorEd,
12584
+ length: ptDoorSt.distanceTo(ptDoorEd),
12585
+ originalPoints: newOriginPts2.newOriginalPoints,
12586
+ doorAndBeamData: newDoorAndBeamData2,
12587
+ id: randomUUID2(),
12588
+ rooftopPz: line2.rooftopPz,
12589
+ isRebuild: false,
12590
+ direction: line2.direction,
12591
+ drawDoorData: {
12592
+ start: new THREE11.Vector3(ptDoorSt.x, ptDoorSt.y, minZ),
12593
+ end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, minZ),
12594
+ n: new THREE11.Vector3(0, 0, 0),
12595
+ height,
12596
+ groundClearance
12597
+ },
12598
+ isDoor: true
12599
+ };
12600
+ let newLine3 = {
12601
+ start: ptDoorEd,
12602
+ end: ptEnd,
12603
+ length: ptDoorEd.distanceTo(ptEnd),
12604
+ originalPoints: newOriginPts3.newOriginalPoints,
12605
+ doorAndBeamData: newDoorAndBeamData3,
12606
+ id: randomUUID2(),
12607
+ rooftopPz: line2.rooftopPz,
12608
+ isRebuild: false,
12609
+ direction: line2.direction
12610
+ };
12611
+ if (newLine1.originalPoints.length > 0)
12612
+ lines.push(newLine1);
12613
+ if (newLine2.originalPoints.length > 0)
12614
+ lines.push(newLine2);
12615
+ if (newLine3.originalPoints.length > 0)
12616
+ lines.push(newLine3);
12617
+ pcd.isFindDoor = true;
12618
+ line2.isRebuild = true;
12619
+ }
12620
+ }
12621
+ return lines;
12622
+ };
12107
12623
 
12108
12624
  // src/wall-window-matcher/utils.ts
12109
12625
  function dist2D(a, b) {
@@ -13216,7 +13732,7 @@ function processData(wallSegments, objects, options) {
13216
13732
  }
13217
13733
 
13218
13734
  // src/wall-door-matcher/matcher.ts
13219
- import * as THREE11 from "three";
13735
+ import * as THREE12 from "three";
13220
13736
 
13221
13737
  // src/wall-door-matcher/utils.ts
13222
13738
  function dist2D2(a, b) {
@@ -14061,13 +14577,13 @@ function collectCandidates2(candidateSegments, doorLong, doorDirX, doorDirY, che
14061
14577
  if (isLine2)
14062
14578
  continue;
14063
14579
  if (passageEntrance) {
14064
- const pt1 = new THREE11.Vector3(nline.start.x, nline.start.y, nline.start.z);
14065
- const pt2 = new THREE11.Vector3(nline.end.x, nline.end.y, nline.end.z);
14580
+ const pt1 = new THREE12.Vector3(nline.start.x, nline.start.y, nline.start.z);
14581
+ const pt2 = new THREE12.Vector3(nline.end.x, nline.end.y, nline.end.z);
14066
14582
  let isOverLap = false;
14067
14583
  for (let v2 = 0; v2 < passageEntrance.length; v2++) {
14068
14584
  const data = passageEntrance[v2];
14069
- const pt3 = new THREE11.Vector3(data.start.x, data.start.y, data.start.z);
14070
- const pt4 = new THREE11.Vector3(data.end.x, data.end.y, data.end.z);
14585
+ const pt3 = new THREE12.Vector3(data.start.x, data.start.y, data.start.z);
14586
+ const pt4 = new THREE12.Vector3(data.end.x, data.end.y, data.end.z);
14071
14587
  let resultTmp = classifySegments(pt1, pt2, pt3, pt4);
14072
14588
  if (resultTmp.type == "collinear_overlap" && resultTmp.maxPerpendicularDistance < 0.1) {
14073
14589
  isOverLap = true;
@@ -18307,6 +18823,7 @@ export {
18307
18823
  findWindowWalls,
18308
18824
  getBeamLine,
18309
18825
  getColLine,
18826
+ getDoorPcdData,
18310
18827
  getLineCheckResults,
18311
18828
  getMatcherAPI,
18312
18829
  getMergeFloorMeaning,
@@ -18316,6 +18833,7 @@ export {
18316
18833
  getSlabData,
18317
18834
  getStaircase,
18318
18835
  getWindowData,
18836
+ getWindowPcdData,
18319
18837
  isRawLineNearArc,
18320
18838
  logArcRawSegments,
18321
18839
  matchWalls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rm-graphical-computing-node",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "description": "墙体/梁线/点云语义计算库(依赖 Python 与 three.js)",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",