rm-graphical-computing-node 1.0.72 → 1.0.74
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.
- package/dist/index.mjs +630 -100
- 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
|
-
|
|
3225
|
-
new THREE3.
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
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";
|
|
@@ -11470,7 +11598,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
11470
11598
|
for (let i = 0; i < pcdData.length; i++) {
|
|
11471
11599
|
const window = pcdData[i];
|
|
11472
11600
|
window.isFindWindow = false;
|
|
11473
|
-
if (window.category == "window") {
|
|
11601
|
+
if (window.category == "window" && !window.isBayWindowObj) {
|
|
11474
11602
|
let boxPoints = [];
|
|
11475
11603
|
window.coordinatesByArea.coordinates.forEach((p) => {
|
|
11476
11604
|
boxPoints.push(new THREE10.Vector3(p.x, p.y, p.z));
|
|
@@ -11841,104 +11969,124 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
11841
11969
|
let afterDoorLen = doorTmpEd.distanceTo(doorTmpSt);
|
|
11842
11970
|
if (afterDoorLen < 0.4 && !isWindow || afterDoorLen < 0.3 && isWindow)
|
|
11843
11971
|
continue;
|
|
11844
|
-
const windowLine = new THREE10.Line3(doorTmpSt, doorTmpEd);
|
|
11845
11972
|
const windowPcd = windowDatas[findDoorDataIndex];
|
|
11846
11973
|
const windowPcdSt = windowPcd.windowStartPt.clone();
|
|
11847
11974
|
const windowPcdEd = windowPcd.windowEndPt.clone();
|
|
11848
|
-
const
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
let
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11975
|
+
const windowPcdLen = windowPcdSt.distanceTo(windowPcdEd);
|
|
11976
|
+
const windowPcdHeight = Math.abs(windowPcd.maxZ - windowPcd.minZ);
|
|
11977
|
+
let windowHeight = beamTmpSt.z - doorTmpSt.z;
|
|
11978
|
+
const windowLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
11979
|
+
let changeWindowSize = false;
|
|
11980
|
+
let windowSizeThreshold = 0.5;
|
|
11981
|
+
if ((Math.abs(windowPcdLen - windowLen) < windowSizeThreshold || windowPcdLen > windowLen) && (Math.abs(windowPcdHeight - windowHeight) < windowSizeThreshold || windowPcdHeight > windowHeight)) {
|
|
11982
|
+
changeWindowSize = true;
|
|
11983
|
+
} else {
|
|
11984
|
+
let checkResultsNum = region.points.length / 4;
|
|
11985
|
+
let gridWidth = region.gridWidth;
|
|
11986
|
+
let gridHeight = region.gridHeight;
|
|
11987
|
+
let lenNum = Math.floor(windowLen / gridWidth);
|
|
11988
|
+
let heightNum = Math.floor(windowHeight / gridHeight);
|
|
11989
|
+
let totalCheckResultsNum = lenNum * heightNum;
|
|
11990
|
+
let checkResultsPercentage = checkResultsNum / totalCheckResultsNum;
|
|
11991
|
+
if (checkResultsPercentage < 0.8)
|
|
11992
|
+
changeWindowSize = true;
|
|
11864
11993
|
}
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
let dist55 = intersect1.point.distanceTo(doorTmpSt);
|
|
11883
|
-
let dist66 = intersect1.point.distanceTo(doorTmpEd);
|
|
11884
|
-
if (dist55 < 0.1 || dist66 < 0.1) {
|
|
11885
|
-
if (dist55 < dist66) {
|
|
11886
|
-
near1St = true;
|
|
11887
|
-
distIntersect1 = dist55;
|
|
11888
|
-
} else
|
|
11889
|
-
distIntersect1 = dist66;
|
|
11994
|
+
if (changeWindowSize) {
|
|
11995
|
+
const windowLine = new THREE10.Line3(doorTmpSt, doorTmpEd);
|
|
11996
|
+
let rectPts = windowPcd.rectPts.map((p) => new THREE10.Vector3(p.x, p.y, p.z));
|
|
11997
|
+
rectPts = setPointsSameZ(rectPts, doorTmpSt.z);
|
|
11998
|
+
let ptClose = new THREE10.Vector3();
|
|
11999
|
+
let vec2 = new THREE10.Vector3();
|
|
12000
|
+
if (rectPts.length == 5)
|
|
12001
|
+
rectPts.splice(4, 1);
|
|
12002
|
+
let shortLinePt1 = rectPts[0];
|
|
12003
|
+
let shortLinePt2 = rectPts[1];
|
|
12004
|
+
let shortLinePt3 = rectPts[2];
|
|
12005
|
+
let shortLinePt4 = rectPts[3];
|
|
12006
|
+
if (rectPts[0].distanceTo(rectPts[1]) > rectPts[1].distanceTo(rectPts[2])) {
|
|
12007
|
+
shortLinePt1 = rectPts[1];
|
|
12008
|
+
shortLinePt2 = rectPts[2];
|
|
12009
|
+
shortLinePt3 = rectPts[3];
|
|
12010
|
+
shortLinePt4 = rectPts[0];
|
|
11890
12011
|
}
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
let
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
12012
|
+
let addShortLen = 0.2;
|
|
12013
|
+
let vecShort1 = new THREE10.Vector3().subVectors(shortLinePt2, shortLinePt1).normalize();
|
|
12014
|
+
let vecShort2 = new THREE10.Vector3().subVectors(shortLinePt4, shortLinePt3).normalize();
|
|
12015
|
+
shortLinePt1 = shortLinePt1.addScaledVector(vecShort1, -addShortLen);
|
|
12016
|
+
shortLinePt2 = shortLinePt2.addScaledVector(vecShort1, addShortLen);
|
|
12017
|
+
shortLinePt3 = shortLinePt3.addScaledVector(vecShort2, -addShortLen);
|
|
12018
|
+
shortLinePt4 = shortLinePt4.addScaledVector(vecShort2, addShortLen);
|
|
12019
|
+
let tmpVec = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
12020
|
+
let tmpDoorTmpSt = doorTmpSt.clone().addScaledVector(tmpVec, -addShortLen);
|
|
12021
|
+
let tmpDoorTmpEd = doorTmpEd.clone().addScaledVector(tmpVec, addShortLen);
|
|
12022
|
+
let intersect1 = segmentsIntersect2D(shortLinePt1, shortLinePt2, tmpDoorTmpSt, tmpDoorTmpEd);
|
|
12023
|
+
let intersect2 = segmentsIntersect2D(shortLinePt3, shortLinePt4, tmpDoorTmpSt, tmpDoorTmpEd);
|
|
12024
|
+
let distIntersect1 = 99999;
|
|
12025
|
+
let distIntersect2 = 99999;
|
|
12026
|
+
let near1St = false;
|
|
12027
|
+
let near2St = false;
|
|
12028
|
+
if (intersect1 != null) {
|
|
12029
|
+
let dist55 = intersect1.point.distanceTo(doorTmpSt);
|
|
12030
|
+
let dist66 = intersect1.point.distanceTo(doorTmpEd);
|
|
12031
|
+
if (dist55 < 0.1 || dist66 < 0.1) {
|
|
12032
|
+
if (dist55 < dist66) {
|
|
12033
|
+
near1St = true;
|
|
12034
|
+
distIntersect1 = dist55;
|
|
12035
|
+
} else
|
|
12036
|
+
distIntersect1 = dist66;
|
|
12037
|
+
}
|
|
11901
12038
|
}
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
11913
|
-
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
11914
|
-
} else if (dist22 == minDist) {
|
|
11915
|
-
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
11916
|
-
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
11917
|
-
} else if (dist33 == minDist) {
|
|
11918
|
-
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
11919
|
-
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
11920
|
-
} else if (dist44 == minDist) {
|
|
11921
|
-
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
11922
|
-
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
12039
|
+
if (intersect2 != null) {
|
|
12040
|
+
let dist55 = intersect2.point.distanceTo(doorTmpSt);
|
|
12041
|
+
let dist66 = intersect2.point.distanceTo(doorTmpEd);
|
|
12042
|
+
if (dist55 < 0.1 || dist66 < 0.1) {
|
|
12043
|
+
if (dist55 < dist66) {
|
|
12044
|
+
near2St = true;
|
|
12045
|
+
distIntersect2 = dist55;
|
|
12046
|
+
} else
|
|
12047
|
+
distIntersect2 = dist66;
|
|
12048
|
+
}
|
|
11923
12049
|
}
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
12050
|
+
if (distIntersect1 == 99999 && distIntersect2 == 99999) {
|
|
12051
|
+
windowPcdSt.z = windowPcdEd.z = doorTmpSt.z;
|
|
12052
|
+
let dist11 = doorTmpSt.distanceTo(windowPcdSt);
|
|
12053
|
+
let dist22 = doorTmpSt.distanceTo(windowPcdEd);
|
|
12054
|
+
let dist33 = doorTmpEd.distanceTo(windowPcdSt);
|
|
12055
|
+
let dist44 = doorTmpEd.distanceTo(windowPcdEd);
|
|
12056
|
+
let minDist = Math.min(dist11, dist22, dist33, dist44);
|
|
12057
|
+
let wZ = doorTmpSt.z;
|
|
12058
|
+
if (dist11 == minDist) {
|
|
12059
|
+
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
12060
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
12061
|
+
} else if (dist22 == minDist) {
|
|
12062
|
+
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
12063
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
12064
|
+
} else if (dist33 == minDist) {
|
|
12065
|
+
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
12066
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
12067
|
+
} else if (dist44 == minDist) {
|
|
12068
|
+
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
12069
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
12070
|
+
}
|
|
11928
12071
|
} else {
|
|
11929
|
-
|
|
11930
|
-
|
|
12072
|
+
if (distIntersect1 < distIntersect2) {
|
|
12073
|
+
ptClose = intersect1.point.clone();
|
|
12074
|
+
vec2 = near1St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
12075
|
+
} else {
|
|
12076
|
+
ptClose = intersect2.point.clone();
|
|
12077
|
+
vec2 = near2St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
12078
|
+
}
|
|
11931
12079
|
}
|
|
12080
|
+
doorTmpSt = ptClose.clone();
|
|
12081
|
+
doorTmpEd = doorTmpSt.clone().addScaledVector(vec2, windowPcdLen);
|
|
12082
|
+
doorTmpSt.z = doorTmpEd.z = windowPcd.minZ;
|
|
12083
|
+
beamTmpSt = doorTmpSt.clone();
|
|
12084
|
+
beamTmpEd = doorTmpEd.clone();
|
|
12085
|
+
beamTmpSt.z = beamTmpEd.z = windowPcd.maxZ;
|
|
11932
12086
|
}
|
|
11933
|
-
doorTmpSt = ptClose.clone();
|
|
11934
|
-
doorTmpEd = doorTmpSt.clone().addScaledVector(vec2, windowLen);
|
|
11935
|
-
doorTmpSt.z = doorTmpEd.z = windowPcd.minZ;
|
|
11936
|
-
beamTmpSt = doorTmpSt.clone();
|
|
11937
|
-
beamTmpEd = doorTmpEd.clone();
|
|
11938
|
-
beamTmpSt.z = beamTmpEd.z = windowPcd.maxZ;
|
|
11939
12087
|
let doorType = "";
|
|
11940
12088
|
let groundClearance = doorTmpSt.z - line2.start.z > 1e-4 ? doorTmpSt.z - line2.start.z : 0;
|
|
11941
|
-
|
|
12089
|
+
windowHeight = beamTmpSt.z - doorTmpSt.z;
|
|
11942
12090
|
let doorAndBeamDataObj = {
|
|
11943
12091
|
id,
|
|
11944
12092
|
windowTopSt: new THREE10.Vector3(doorTmpSt.x, doorTmpSt.y, doorTmpSt.z + windowHeight),
|
|
@@ -12084,6 +12232,386 @@ var checkWindowAndDoorIsTrue = async (lines, runDataList, collectDataPath, point
|
|
|
12084
12232
|
}
|
|
12085
12233
|
return lines;
|
|
12086
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 ptMid = getMid(ptStart2, ptEnd2);
|
|
12283
|
+
let ptClose = tmpLine3.closestPointToPoint(ptMid, true, new THREE10.Vector3());
|
|
12284
|
+
if (ptClose.distanceTo(ptMid) < pcdToLineDist) {
|
|
12285
|
+
eligibilityLines.push(line3);
|
|
12286
|
+
eligibilityLinesIndexs.push(j);
|
|
12287
|
+
} else {
|
|
12288
|
+
tmpLine3 = new THREE10.Line3(ptStart2, ptEnd2);
|
|
12289
|
+
ptMid = getMid(ptMid1, ptMid2);
|
|
12290
|
+
ptClose = tmpLine3.closestPointToPoint(ptMid, true, new THREE10.Vector3());
|
|
12291
|
+
if (ptClose.distanceTo(ptMid) < pcdToLineDist) {
|
|
12292
|
+
eligibilityLines.push(line3);
|
|
12293
|
+
eligibilityLinesIndexs.push(j);
|
|
12294
|
+
}
|
|
12295
|
+
}
|
|
12296
|
+
}
|
|
12297
|
+
}
|
|
12298
|
+
let newLines = mergeLines(eligibilityLines);
|
|
12299
|
+
let tmpLines = [];
|
|
12300
|
+
if (newLines && newLines.length) {
|
|
12301
|
+
for (let k = 0; k < newLines.length; k++) {
|
|
12302
|
+
let mergeIndexs = newLines[k].mergeIndexs;
|
|
12303
|
+
for (let c = 0; c < eligibilityLines.length; c++) {
|
|
12304
|
+
if (mergeIndexs.includes(c))
|
|
12305
|
+
continue;
|
|
12306
|
+
tmpLines.push(eligibilityLines[c]);
|
|
12307
|
+
}
|
|
12308
|
+
}
|
|
12309
|
+
tmpLines.push(...newLines);
|
|
12310
|
+
} else
|
|
12311
|
+
tmpLines = [...eligibilityLines];
|
|
12312
|
+
let maxLen = -1;
|
|
12313
|
+
let maxIndex = -1;
|
|
12314
|
+
for (let t = 0; t < tmpLines.length; t++) {
|
|
12315
|
+
if (tmpLines[t].length > maxLen) {
|
|
12316
|
+
maxLen = tmpLines[t].length;
|
|
12317
|
+
maxIndex = t;
|
|
12318
|
+
}
|
|
12319
|
+
}
|
|
12320
|
+
if (maxIndex == -1)
|
|
12321
|
+
continue;
|
|
12322
|
+
const line2 = tmpLines[maxIndex];
|
|
12323
|
+
let ptStart = getPt3(line2.start);
|
|
12324
|
+
let ptEnd = getPt3(line2.end);
|
|
12325
|
+
ptStart.z = ptEnd.z = ptShortEd1.z;
|
|
12326
|
+
let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, pcdToLineDist);
|
|
12327
|
+
let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, pcdToLineDist);
|
|
12328
|
+
if (intersect1 != null && intersect2 != null) {
|
|
12329
|
+
if (line2.mergeIndexs) {
|
|
12330
|
+
let tmpIndex = [];
|
|
12331
|
+
for (let h = 0; h < line2.mergeIndexs.length; h++) {
|
|
12332
|
+
tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
|
|
12333
|
+
}
|
|
12334
|
+
for (let h = 0; h < lines.length; h++) {
|
|
12335
|
+
if (tmpIndex.includes(h))
|
|
12336
|
+
lines[h].isRebuild = true;
|
|
12337
|
+
}
|
|
12338
|
+
lines.push(line2);
|
|
12339
|
+
}
|
|
12340
|
+
let ptWindowSt = getPt3(intersect1.point);
|
|
12341
|
+
let ptWindowEd = getPt3(intersect2.point);
|
|
12342
|
+
if (ptStart.distanceTo(ptWindowSt) > ptStart.distanceTo(ptWindowEd))
|
|
12343
|
+
[ptWindowSt, ptWindowEd] = [ptWindowEd, ptWindowSt];
|
|
12344
|
+
let groundClearance = minZ - ptWindowSt.z;
|
|
12345
|
+
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12346
|
+
if (!line2.drawWindow)
|
|
12347
|
+
line2.drawWindow = [];
|
|
12348
|
+
let p = getMid(ptWindowSt, ptWindowEd);
|
|
12349
|
+
p.z = minZ;
|
|
12350
|
+
line2.drawWindow.push({
|
|
12351
|
+
p,
|
|
12352
|
+
full: false,
|
|
12353
|
+
groundClearance,
|
|
12354
|
+
height,
|
|
12355
|
+
width: ptWindowSt.distanceTo(ptWindowEd)
|
|
12356
|
+
});
|
|
12357
|
+
line2.isWindow = true;
|
|
12358
|
+
pcd.isWindowDoor = true;
|
|
12359
|
+
} else if (intersect1 != null || intersect2 != null) {
|
|
12360
|
+
if (line2.mergeIndexs) {
|
|
12361
|
+
let tmpIndex = [];
|
|
12362
|
+
for (let h = 0; h < line2.mergeIndexs.length; h++) {
|
|
12363
|
+
tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
|
|
12364
|
+
}
|
|
12365
|
+
for (let h = 0; h < lines.length; h++) {
|
|
12366
|
+
if (tmpIndex.includes(h))
|
|
12367
|
+
lines[h].isRebuild = true;
|
|
12368
|
+
}
|
|
12369
|
+
lines.push(line2);
|
|
12370
|
+
}
|
|
12371
|
+
let ptWindowSt = null;
|
|
12372
|
+
let pcdMid = null;
|
|
12373
|
+
if (intersect1 != null) {
|
|
12374
|
+
ptWindowSt = getPt3(intersect1.point);
|
|
12375
|
+
pcdMid = ptMid2.clone();
|
|
12376
|
+
} else {
|
|
12377
|
+
ptWindowSt = getPt3(intersect2.point);
|
|
12378
|
+
pcdMid = ptMid1.clone();
|
|
12379
|
+
}
|
|
12380
|
+
let line3 = new THREE10.Line3(ptStart, ptEnd);
|
|
12381
|
+
let ptClose = line3.closestPointToPoint(pcdMid, false, new THREE10.Vector3());
|
|
12382
|
+
let vec2 = getVector3(ptWindowSt, ptClose);
|
|
12383
|
+
let width = ptMid1.distanceTo(ptMid2);
|
|
12384
|
+
let ptWindowEd = ptWindowSt.clone().addScaledVector(vec2, width);
|
|
12385
|
+
let groundClearance = minZ - ptWindowSt.z;
|
|
12386
|
+
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12387
|
+
if (!line2.drawWindow)
|
|
12388
|
+
line2.drawWindow = [];
|
|
12389
|
+
let p = getMid(ptWindowSt, ptWindowEd);
|
|
12390
|
+
p.z = minZ;
|
|
12391
|
+
line2.drawWindow.push({
|
|
12392
|
+
p,
|
|
12393
|
+
full: false,
|
|
12394
|
+
groundClearance,
|
|
12395
|
+
height,
|
|
12396
|
+
width: ptWindowSt.distanceTo(ptWindowEd)
|
|
12397
|
+
});
|
|
12398
|
+
line2.isWindow = true;
|
|
12399
|
+
pcd.isWindowDoor = true;
|
|
12400
|
+
} else {
|
|
12401
|
+
let shortLine1 = new THREE10.Line3(ptShortSt1, ptShortEd1);
|
|
12402
|
+
let shortLine2 = new THREE10.Line3(ptShortSt2, ptShortEd2);
|
|
12403
|
+
let ptClose1 = shortLine1.closestPointToPoint(ptStart, true, new THREE10.Vector3());
|
|
12404
|
+
let ptClose2 = shortLine1.closestPointToPoint(ptEnd, true, new THREE10.Vector3());
|
|
12405
|
+
let ptClose3 = shortLine2.closestPointToPoint(ptStart, true, new THREE10.Vector3());
|
|
12406
|
+
let ptClose4 = shortLine2.closestPointToPoint(ptEnd, true, new THREE10.Vector3());
|
|
12407
|
+
let dist1 = ptClose1.distanceTo(ptStart);
|
|
12408
|
+
let dist2 = ptClose2.distanceTo(ptEnd);
|
|
12409
|
+
let dist3 = ptClose3.distanceTo(ptStart);
|
|
12410
|
+
let dist4 = ptClose4.distanceTo(ptEnd);
|
|
12411
|
+
let nearDist = 0.1;
|
|
12412
|
+
if ((dist1 < nearDist || dist2 < nearDist) && (dist3 < nearDist || dist4 < nearDist)) {
|
|
12413
|
+
if (line2.mergeIndexs) {
|
|
12414
|
+
let tmpIndex = [];
|
|
12415
|
+
for (let h = 0; h < line2.mergeIndexs.length; h++) {
|
|
12416
|
+
tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
|
|
12417
|
+
}
|
|
12418
|
+
for (let h = 0; h < lines.length; h++) {
|
|
12419
|
+
if (tmpIndex.includes(h))
|
|
12420
|
+
lines[h].isRebuild = true;
|
|
12421
|
+
}
|
|
12422
|
+
lines.push(line2);
|
|
12423
|
+
}
|
|
12424
|
+
let ptWindowSt = ptClose1.clone();
|
|
12425
|
+
let ptWindowEd = ptClose3.clone();
|
|
12426
|
+
if (dist2 < nearDist)
|
|
12427
|
+
ptWindowSt = ptClose2.clone();
|
|
12428
|
+
if (dist4 < nearDist)
|
|
12429
|
+
ptWindowEd = ptClose4.clone();
|
|
12430
|
+
ptWindowSt.z = ptWindowEd.z = minZ;
|
|
12431
|
+
let groundClearance = minZ - ptWindowSt.z;
|
|
12432
|
+
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12433
|
+
if (!line2.drawWindow)
|
|
12434
|
+
line2.drawWindow = [];
|
|
12435
|
+
let p = getMid(ptWindowSt, ptWindowEd);
|
|
12436
|
+
p.z = minZ;
|
|
12437
|
+
line2.drawWindow.push({
|
|
12438
|
+
p,
|
|
12439
|
+
full: false,
|
|
12440
|
+
groundClearance,
|
|
12441
|
+
height,
|
|
12442
|
+
width: ptWindowSt.distanceTo(ptWindowEd)
|
|
12443
|
+
});
|
|
12444
|
+
line2.isWindow = true;
|
|
12445
|
+
pcd.isWindowDoor = true;
|
|
12446
|
+
}
|
|
12447
|
+
}
|
|
12448
|
+
}
|
|
12449
|
+
return lines;
|
|
12450
|
+
};
|
|
12451
|
+
|
|
12452
|
+
// src/geometry/door.mjs
|
|
12453
|
+
import * as THREE11 from "three";
|
|
12454
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
12455
|
+
var getDoorPcdData = (lines, pcdData) => {
|
|
12456
|
+
if (!lines || !lines.length || !pcdData || !pcdData.length)
|
|
12457
|
+
return lines;
|
|
12458
|
+
for (let i = 0; i < pcdData.length; i++) {
|
|
12459
|
+
const pcd = pcdData[i];
|
|
12460
|
+
if (pcd.category != "door" || pcd.isFindBeam)
|
|
12461
|
+
continue;
|
|
12462
|
+
let ptArray = pcd.coordinatesByArea.coordinates;
|
|
12463
|
+
let minZ = pcd.coordinatesByArea.heightData.minZ;
|
|
12464
|
+
let maxZ = pcd.coordinatesByArea.heightData.maxZ;
|
|
12465
|
+
let height = maxZ - minZ;
|
|
12466
|
+
let ptLongSt1 = getPt3(ptArray[0]);
|
|
12467
|
+
let ptLongEd1 = getPt3(ptArray[1]);
|
|
12468
|
+
let ptLongSt2 = getPt3(ptArray[2]);
|
|
12469
|
+
let ptLongEd2 = getPt3(ptArray[3]);
|
|
12470
|
+
let ptShortSt1 = getPt3(ptArray[1]);
|
|
12471
|
+
let ptShortEd1 = getPt3(ptArray[2]);
|
|
12472
|
+
let ptShortSt2 = getPt3(ptArray[3]);
|
|
12473
|
+
let ptShortEd2 = getPt3(ptArray[0]);
|
|
12474
|
+
if (ptLongSt1.distanceTo(ptLongEd1) < ptLongSt1.distanceTo(ptLongEd2)) {
|
|
12475
|
+
ptLongSt1 = getPt3(ptArray[1]);
|
|
12476
|
+
ptLongEd1 = getPt3(ptArray[2]);
|
|
12477
|
+
ptLongSt2 = getPt3(ptArray[3]);
|
|
12478
|
+
ptLongEd2 = getPt3(ptArray[0]);
|
|
12479
|
+
ptShortSt1 = getPt3(ptArray[0]);
|
|
12480
|
+
ptShortEd1 = getPt3(ptArray[1]);
|
|
12481
|
+
ptShortSt2 = getPt3(ptArray[2]);
|
|
12482
|
+
ptShortEd2 = getPt3(ptArray[3]);
|
|
12483
|
+
}
|
|
12484
|
+
let ptMid1 = getMid(ptShortSt1, ptShortEd1);
|
|
12485
|
+
let ptMid2 = getMid(ptShortSt2, ptShortEd2);
|
|
12486
|
+
let shortLen = ptShortSt1.distanceTo(ptShortEd1);
|
|
12487
|
+
let eligibilityLines = [];
|
|
12488
|
+
let eligibilityLinesIndexs = [];
|
|
12489
|
+
for (let j = 0; j < lines.length; j++) {
|
|
12490
|
+
const line3 = lines[j];
|
|
12491
|
+
let ptStart2 = getPt3(line3.start);
|
|
12492
|
+
let ptEnd2 = getPt3(line3.end);
|
|
12493
|
+
ptStart2.z = ptEnd2.z = ptMid1.z;
|
|
12494
|
+
let classify = classifySegments(ptMid1, ptMid2, ptStart2, ptEnd2);
|
|
12495
|
+
if (classify.type == "collinear_overlap" && classify.maxPerpendicularDistance < 0.3) {
|
|
12496
|
+
eligibilityLines.push(line3);
|
|
12497
|
+
eligibilityLinesIndexs.push(j);
|
|
12498
|
+
}
|
|
12499
|
+
}
|
|
12500
|
+
let newLines = mergeLines(eligibilityLines);
|
|
12501
|
+
let tmpLines = [];
|
|
12502
|
+
if (newLines && newLines.length) {
|
|
12503
|
+
for (let k = 0; k < newLines.length; k++) {
|
|
12504
|
+
let mergeIndexs = newLines[k].mergeIndexs;
|
|
12505
|
+
for (let c = 0; c < eligibilityLines.length; c++) {
|
|
12506
|
+
if (mergeIndexs.includes(c))
|
|
12507
|
+
continue;
|
|
12508
|
+
tmpLines.push(eligibilityLines[c]);
|
|
12509
|
+
}
|
|
12510
|
+
}
|
|
12511
|
+
tmpLines.push(...newLines);
|
|
12512
|
+
} else
|
|
12513
|
+
tmpLines = [...eligibilityLines];
|
|
12514
|
+
let maxLen = -1;
|
|
12515
|
+
let maxIndex = -1;
|
|
12516
|
+
for (let t = 0; t < tmpLines.length; t++) {
|
|
12517
|
+
if (tmpLines[t].length > maxLen) {
|
|
12518
|
+
maxLen = tmpLines[t].length;
|
|
12519
|
+
maxIndex = t;
|
|
12520
|
+
}
|
|
12521
|
+
}
|
|
12522
|
+
if (maxIndex == -1)
|
|
12523
|
+
continue;
|
|
12524
|
+
const line2 = tmpLines[maxIndex];
|
|
12525
|
+
let ptStart = getPt3(line2.start);
|
|
12526
|
+
let ptEnd = getPt3(line2.end);
|
|
12527
|
+
let intersect1 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt1, ptShortEd1, 0.05);
|
|
12528
|
+
let intersect2 = segmentsIntersect2D(ptStart, ptEnd, ptShortSt2, ptShortEd2, 0.05);
|
|
12529
|
+
if (intersect1 != null && intersect2 != null) {
|
|
12530
|
+
if (line2.mergeIndexs) {
|
|
12531
|
+
let tmpIndex = [];
|
|
12532
|
+
for (let h = 0; h < line2.mergeIndexs.length; h++) {
|
|
12533
|
+
tmpIndex.push(eligibilityLinesIndexs[line2.mergeIndexs[h]]);
|
|
12534
|
+
}
|
|
12535
|
+
for (let h = 0; h < lines.length; h++) {
|
|
12536
|
+
if (tmpIndex.includes(h))
|
|
12537
|
+
lines[h].isRebuild = true;
|
|
12538
|
+
}
|
|
12539
|
+
}
|
|
12540
|
+
let ptDoorSt = getPt3(intersect1.point);
|
|
12541
|
+
let ptDoorEd = getPt3(intersect2.point);
|
|
12542
|
+
if (ptStart.distanceTo(ptDoorSt) > ptStart.distanceTo(ptDoorEd))
|
|
12543
|
+
[ptDoorSt, ptDoorEd] = [ptDoorEd, ptDoorSt];
|
|
12544
|
+
const newOriginPts1 = getProjectedPointOnLine(ptStart, ptDoorSt, line2.originalPoints);
|
|
12545
|
+
const newOriginPts2 = getProjectedPointOnLine(ptDoorSt, ptDoorEd, line2.originalPoints);
|
|
12546
|
+
const newOriginPts3 = getProjectedPointOnLine(ptDoorEd, ptEnd, line2.originalPoints);
|
|
12547
|
+
const newDoorAndBeamData1 = [];
|
|
12548
|
+
const newDoorAndBeamData2 = [];
|
|
12549
|
+
const newDoorAndBeamData3 = [];
|
|
12550
|
+
if (line2.doorAndBeamData) {
|
|
12551
|
+
for (let a = 0; a < line2.doorAndBeamData.length; a++) {
|
|
12552
|
+
let doorStart = line2.doorAndBeamData[a].doorStart;
|
|
12553
|
+
let doorEnd = line2.doorAndBeamData[a].doorEnd;
|
|
12554
|
+
if (isPointOnLine2(ptStart, ptDoorSt, doorStart, 1e-3, true) && isPointOnLine2(ptStart, ptDoorSt, doorEnd, 1e-3, true))
|
|
12555
|
+
newDoorAndBeamData1.push(line2.doorAndBeamData[a]);
|
|
12556
|
+
else if (isPointOnLine2(ptDoorEd, ptEnd, doorStart, 1e-3, true) && isPointOnLine2(ptDoorEd, ptEnd, doorEnd, 1e-3, true))
|
|
12557
|
+
newDoorAndBeamData3.push(line2.doorAndBeamData[a]);
|
|
12558
|
+
}
|
|
12559
|
+
}
|
|
12560
|
+
let groundClearance = minZ - ptDoorSt.z;
|
|
12561
|
+
groundClearance = groundClearance > 0.01 ? groundClearance : 0;
|
|
12562
|
+
let newLine1 = {
|
|
12563
|
+
start: ptStart,
|
|
12564
|
+
end: ptDoorSt,
|
|
12565
|
+
length: ptStart.distanceTo(ptDoorSt),
|
|
12566
|
+
originalPoints: newOriginPts1.newOriginalPoints,
|
|
12567
|
+
doorAndBeamData: newDoorAndBeamData1,
|
|
12568
|
+
id: randomUUID2(),
|
|
12569
|
+
rooftopPz: line2.rooftopPz,
|
|
12570
|
+
isRebuild: false,
|
|
12571
|
+
direction: line2.direction
|
|
12572
|
+
};
|
|
12573
|
+
let newLine2 = {
|
|
12574
|
+
start: ptDoorSt,
|
|
12575
|
+
end: ptDoorEd,
|
|
12576
|
+
length: ptDoorSt.distanceTo(ptDoorEd),
|
|
12577
|
+
originalPoints: newOriginPts2.newOriginalPoints,
|
|
12578
|
+
doorAndBeamData: newDoorAndBeamData2,
|
|
12579
|
+
id: randomUUID2(),
|
|
12580
|
+
rooftopPz: line2.rooftopPz,
|
|
12581
|
+
isRebuild: false,
|
|
12582
|
+
direction: line2.direction,
|
|
12583
|
+
drawDoorData: {
|
|
12584
|
+
start: new THREE11.Vector3(ptDoorSt.x, ptDoorSt.y, minZ),
|
|
12585
|
+
end: new THREE11.Vector3(ptDoorEd.x, ptDoorEd.y, minZ),
|
|
12586
|
+
n: new THREE11.Vector3(0, 0, 0),
|
|
12587
|
+
height,
|
|
12588
|
+
groundClearance
|
|
12589
|
+
},
|
|
12590
|
+
isDoor: true
|
|
12591
|
+
};
|
|
12592
|
+
let newLine3 = {
|
|
12593
|
+
start: ptDoorEd,
|
|
12594
|
+
end: ptEnd,
|
|
12595
|
+
length: ptDoorEd.distanceTo(ptEnd),
|
|
12596
|
+
originalPoints: newOriginPts3.newOriginalPoints,
|
|
12597
|
+
doorAndBeamData: newDoorAndBeamData3,
|
|
12598
|
+
id: randomUUID2(),
|
|
12599
|
+
rooftopPz: line2.rooftopPz,
|
|
12600
|
+
isRebuild: false,
|
|
12601
|
+
direction: line2.direction
|
|
12602
|
+
};
|
|
12603
|
+
if (newLine1.originalPoints.length > 0)
|
|
12604
|
+
lines.push(newLine1);
|
|
12605
|
+
if (newLine2.originalPoints.length > 0)
|
|
12606
|
+
lines.push(newLine2);
|
|
12607
|
+
if (newLine3.originalPoints.length > 0)
|
|
12608
|
+
lines.push(newLine3);
|
|
12609
|
+
pcd.isFindDoor = true;
|
|
12610
|
+
line2.isRebuild = true;
|
|
12611
|
+
}
|
|
12612
|
+
}
|
|
12613
|
+
return lines;
|
|
12614
|
+
};
|
|
12087
12615
|
|
|
12088
12616
|
// src/wall-window-matcher/utils.ts
|
|
12089
12617
|
function dist2D(a, b) {
|
|
@@ -13196,7 +13724,7 @@ function processData(wallSegments, objects, options) {
|
|
|
13196
13724
|
}
|
|
13197
13725
|
|
|
13198
13726
|
// src/wall-door-matcher/matcher.ts
|
|
13199
|
-
import * as
|
|
13727
|
+
import * as THREE12 from "three";
|
|
13200
13728
|
|
|
13201
13729
|
// src/wall-door-matcher/utils.ts
|
|
13202
13730
|
function dist2D2(a, b) {
|
|
@@ -14041,13 +14569,13 @@ function collectCandidates2(candidateSegments, doorLong, doorDirX, doorDirY, che
|
|
|
14041
14569
|
if (isLine2)
|
|
14042
14570
|
continue;
|
|
14043
14571
|
if (passageEntrance) {
|
|
14044
|
-
const pt1 = new
|
|
14045
|
-
const pt2 = new
|
|
14572
|
+
const pt1 = new THREE12.Vector3(nline.start.x, nline.start.y, nline.start.z);
|
|
14573
|
+
const pt2 = new THREE12.Vector3(nline.end.x, nline.end.y, nline.end.z);
|
|
14046
14574
|
let isOverLap = false;
|
|
14047
14575
|
for (let v2 = 0; v2 < passageEntrance.length; v2++) {
|
|
14048
14576
|
const data = passageEntrance[v2];
|
|
14049
|
-
const pt3 = new
|
|
14050
|
-
const pt4 = new
|
|
14577
|
+
const pt3 = new THREE12.Vector3(data.start.x, data.start.y, data.start.z);
|
|
14578
|
+
const pt4 = new THREE12.Vector3(data.end.x, data.end.y, data.end.z);
|
|
14051
14579
|
let resultTmp = classifySegments(pt1, pt2, pt3, pt4);
|
|
14052
14580
|
if (resultTmp.type == "collinear_overlap" && resultTmp.maxPerpendicularDistance < 0.1) {
|
|
14053
14581
|
isOverLap = true;
|
|
@@ -18287,6 +18815,7 @@ export {
|
|
|
18287
18815
|
findWindowWalls,
|
|
18288
18816
|
getBeamLine,
|
|
18289
18817
|
getColLine,
|
|
18818
|
+
getDoorPcdData,
|
|
18290
18819
|
getLineCheckResults,
|
|
18291
18820
|
getMatcherAPI,
|
|
18292
18821
|
getMergeFloorMeaning,
|
|
@@ -18296,6 +18825,7 @@ export {
|
|
|
18296
18825
|
getSlabData,
|
|
18297
18826
|
getStaircase,
|
|
18298
18827
|
getWindowData,
|
|
18828
|
+
getWindowPcdData,
|
|
18299
18829
|
isRawLineNearArc,
|
|
18300
18830
|
logArcRawSegments,
|
|
18301
18831
|
matchWalls,
|