rm-graphical-computing-node 1.0.72 → 1.0.73
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 +107 -87
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11470,7 +11470,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
11470
11470
|
for (let i = 0; i < pcdData.length; i++) {
|
|
11471
11471
|
const window = pcdData[i];
|
|
11472
11472
|
window.isFindWindow = false;
|
|
11473
|
-
if (window.category == "window") {
|
|
11473
|
+
if (window.category == "window" && !window.isBayWindowObj) {
|
|
11474
11474
|
let boxPoints = [];
|
|
11475
11475
|
window.coordinatesByArea.coordinates.forEach((p) => {
|
|
11476
11476
|
boxPoints.push(new THREE10.Vector3(p.x, p.y, p.z));
|
|
@@ -11841,104 +11841,124 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
11841
11841
|
let afterDoorLen = doorTmpEd.distanceTo(doorTmpSt);
|
|
11842
11842
|
if (afterDoorLen < 0.4 && !isWindow || afterDoorLen < 0.3 && isWindow)
|
|
11843
11843
|
continue;
|
|
11844
|
-
const windowLine = new THREE10.Line3(doorTmpSt, doorTmpEd);
|
|
11845
11844
|
const windowPcd = windowDatas[findDoorDataIndex];
|
|
11846
11845
|
const windowPcdSt = windowPcd.windowStartPt.clone();
|
|
11847
11846
|
const windowPcdEd = windowPcd.windowEndPt.clone();
|
|
11848
|
-
const
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
let
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11847
|
+
const windowPcdLen = windowPcdSt.distanceTo(windowPcdEd);
|
|
11848
|
+
const windowPcdHeight = Math.abs(windowPcd.maxZ - windowPcd.minZ);
|
|
11849
|
+
let windowHeight = beamTmpSt.z - doorTmpSt.z;
|
|
11850
|
+
const windowLen = doorTmpSt.distanceTo(doorTmpEd);
|
|
11851
|
+
let changeWindowSize = false;
|
|
11852
|
+
let windowSizeThreshold = 0.5;
|
|
11853
|
+
if ((Math.abs(windowPcdLen - windowLen) < windowSizeThreshold || windowPcdLen > windowLen) && (Math.abs(windowPcdHeight - windowHeight) < windowSizeThreshold || windowPcdHeight > windowHeight)) {
|
|
11854
|
+
changeWindowSize = true;
|
|
11855
|
+
} else {
|
|
11856
|
+
let checkResultsNum = region.points.length / 4;
|
|
11857
|
+
let gridWidth = region.gridWidth;
|
|
11858
|
+
let gridHeight = region.gridHeight;
|
|
11859
|
+
let lenNum = Math.floor(windowLen / gridWidth);
|
|
11860
|
+
let heightNum = Math.floor(windowHeight / gridHeight);
|
|
11861
|
+
let totalCheckResultsNum = lenNum * heightNum;
|
|
11862
|
+
let checkResultsPercentage = checkResultsNum / totalCheckResultsNum;
|
|
11863
|
+
if (checkResultsPercentage < 0.8)
|
|
11864
|
+
changeWindowSize = true;
|
|
11864
11865
|
}
|
|
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;
|
|
11866
|
+
if (changeWindowSize) {
|
|
11867
|
+
const windowLine = new THREE10.Line3(doorTmpSt, doorTmpEd);
|
|
11868
|
+
let rectPts = windowPcd.rectPts.map((p) => new THREE10.Vector3(p.x, p.y, p.z));
|
|
11869
|
+
rectPts = setPointsSameZ(rectPts, doorTmpSt.z);
|
|
11870
|
+
let ptClose = new THREE10.Vector3();
|
|
11871
|
+
let vec2 = new THREE10.Vector3();
|
|
11872
|
+
if (rectPts.length == 5)
|
|
11873
|
+
rectPts.splice(4, 1);
|
|
11874
|
+
let shortLinePt1 = rectPts[0];
|
|
11875
|
+
let shortLinePt2 = rectPts[1];
|
|
11876
|
+
let shortLinePt3 = rectPts[2];
|
|
11877
|
+
let shortLinePt4 = rectPts[3];
|
|
11878
|
+
if (rectPts[0].distanceTo(rectPts[1]) > rectPts[1].distanceTo(rectPts[2])) {
|
|
11879
|
+
shortLinePt1 = rectPts[1];
|
|
11880
|
+
shortLinePt2 = rectPts[2];
|
|
11881
|
+
shortLinePt3 = rectPts[3];
|
|
11882
|
+
shortLinePt4 = rectPts[0];
|
|
11890
11883
|
}
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
let
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11884
|
+
let addShortLen = 0.2;
|
|
11885
|
+
let vecShort1 = new THREE10.Vector3().subVectors(shortLinePt2, shortLinePt1).normalize();
|
|
11886
|
+
let vecShort2 = new THREE10.Vector3().subVectors(shortLinePt4, shortLinePt3).normalize();
|
|
11887
|
+
shortLinePt1 = shortLinePt1.addScaledVector(vecShort1, -addShortLen);
|
|
11888
|
+
shortLinePt2 = shortLinePt2.addScaledVector(vecShort1, addShortLen);
|
|
11889
|
+
shortLinePt3 = shortLinePt3.addScaledVector(vecShort2, -addShortLen);
|
|
11890
|
+
shortLinePt4 = shortLinePt4.addScaledVector(vecShort2, addShortLen);
|
|
11891
|
+
let tmpVec = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
11892
|
+
let tmpDoorTmpSt = doorTmpSt.clone().addScaledVector(tmpVec, -addShortLen);
|
|
11893
|
+
let tmpDoorTmpEd = doorTmpEd.clone().addScaledVector(tmpVec, addShortLen);
|
|
11894
|
+
let intersect1 = segmentsIntersect2D(shortLinePt1, shortLinePt2, tmpDoorTmpSt, tmpDoorTmpEd);
|
|
11895
|
+
let intersect2 = segmentsIntersect2D(shortLinePt3, shortLinePt4, tmpDoorTmpSt, tmpDoorTmpEd);
|
|
11896
|
+
let distIntersect1 = 99999;
|
|
11897
|
+
let distIntersect2 = 99999;
|
|
11898
|
+
let near1St = false;
|
|
11899
|
+
let near2St = false;
|
|
11900
|
+
if (intersect1 != null) {
|
|
11901
|
+
let dist55 = intersect1.point.distanceTo(doorTmpSt);
|
|
11902
|
+
let dist66 = intersect1.point.distanceTo(doorTmpEd);
|
|
11903
|
+
if (dist55 < 0.1 || dist66 < 0.1) {
|
|
11904
|
+
if (dist55 < dist66) {
|
|
11905
|
+
near1St = true;
|
|
11906
|
+
distIntersect1 = dist55;
|
|
11907
|
+
} else
|
|
11908
|
+
distIntersect1 = dist66;
|
|
11909
|
+
}
|
|
11901
11910
|
}
|
|
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();
|
|
11911
|
+
if (intersect2 != null) {
|
|
11912
|
+
let dist55 = intersect2.point.distanceTo(doorTmpSt);
|
|
11913
|
+
let dist66 = intersect2.point.distanceTo(doorTmpEd);
|
|
11914
|
+
if (dist55 < 0.1 || dist66 < 0.1) {
|
|
11915
|
+
if (dist55 < dist66) {
|
|
11916
|
+
near2St = true;
|
|
11917
|
+
distIntersect2 = dist55;
|
|
11918
|
+
} else
|
|
11919
|
+
distIntersect2 = dist66;
|
|
11920
|
+
}
|
|
11923
11921
|
}
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11922
|
+
if (distIntersect1 == 99999 && distIntersect2 == 99999) {
|
|
11923
|
+
windowPcdSt.z = windowPcdEd.z = doorTmpSt.z;
|
|
11924
|
+
let dist11 = doorTmpSt.distanceTo(windowPcdSt);
|
|
11925
|
+
let dist22 = doorTmpSt.distanceTo(windowPcdEd);
|
|
11926
|
+
let dist33 = doorTmpEd.distanceTo(windowPcdSt);
|
|
11927
|
+
let dist44 = doorTmpEd.distanceTo(windowPcdEd);
|
|
11928
|
+
let minDist = Math.min(dist11, dist22, dist33, dist44);
|
|
11929
|
+
let wZ = doorTmpSt.z;
|
|
11930
|
+
if (dist11 == minDist) {
|
|
11931
|
+
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
11932
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
11933
|
+
} else if (dist22 == minDist) {
|
|
11934
|
+
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
11935
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize();
|
|
11936
|
+
} else if (dist33 == minDist) {
|
|
11937
|
+
ptClose = windowLine.closestPointToPoint(windowPcdSt, false, new THREE10.Vector3());
|
|
11938
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
11939
|
+
} else if (dist44 == minDist) {
|
|
11940
|
+
ptClose = windowLine.closestPointToPoint(windowPcdEd, false, new THREE10.Vector3());
|
|
11941
|
+
vec2 = new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
11942
|
+
}
|
|
11928
11943
|
} else {
|
|
11929
|
-
|
|
11930
|
-
|
|
11944
|
+
if (distIntersect1 < distIntersect2) {
|
|
11945
|
+
ptClose = intersect1.point.clone();
|
|
11946
|
+
vec2 = near1St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
11947
|
+
} else {
|
|
11948
|
+
ptClose = intersect2.point.clone();
|
|
11949
|
+
vec2 = near2St ? new THREE10.Vector3().subVectors(doorTmpEd, doorTmpSt).normalize() : new THREE10.Vector3().subVectors(doorTmpSt, doorTmpEd).normalize();
|
|
11950
|
+
}
|
|
11931
11951
|
}
|
|
11952
|
+
doorTmpSt = ptClose.clone();
|
|
11953
|
+
doorTmpEd = doorTmpSt.clone().addScaledVector(vec2, windowPcdLen);
|
|
11954
|
+
doorTmpSt.z = doorTmpEd.z = windowPcd.minZ;
|
|
11955
|
+
beamTmpSt = doorTmpSt.clone();
|
|
11956
|
+
beamTmpEd = doorTmpEd.clone();
|
|
11957
|
+
beamTmpSt.z = beamTmpEd.z = windowPcd.maxZ;
|
|
11932
11958
|
}
|
|
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
11959
|
let doorType = "";
|
|
11940
11960
|
let groundClearance = doorTmpSt.z - line2.start.z > 1e-4 ? doorTmpSt.z - line2.start.z : 0;
|
|
11941
|
-
|
|
11961
|
+
windowHeight = beamTmpSt.z - doorTmpSt.z;
|
|
11942
11962
|
let doorAndBeamDataObj = {
|
|
11943
11963
|
id,
|
|
11944
11964
|
windowTopSt: new THREE10.Vector3(doorTmpSt.x, doorTmpSt.y, doorTmpSt.z + windowHeight),
|