rm-graphical-computing-node 1.0.131 → 1.0.133
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 +43 -29
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3529,11 +3529,17 @@ var setPointsSameZ = (points, z) => {
|
|
|
3529
3529
|
points[i].z = z;
|
|
3530
3530
|
return points;
|
|
3531
3531
|
};
|
|
3532
|
-
function getObbLongSideDirection(obb
|
|
3532
|
+
function getObbLongSideDirection(obb) {
|
|
3533
3533
|
const e = obb.rotation.elements;
|
|
3534
3534
|
const h = obb.halfSize;
|
|
3535
|
-
const
|
|
3536
|
-
|
|
3535
|
+
const isXLong = h.x >= h.y;
|
|
3536
|
+
const direction = isXLong ? new THREE3.Vector3(e[0], e[1], e[2]) : new THREE3.Vector3(e[3], e[4], e[5]);
|
|
3537
|
+
return {
|
|
3538
|
+
direction: direction.normalize(),
|
|
3539
|
+
// 长边单位方向向量
|
|
3540
|
+
length: Math.max(h.x, h.y) * 2
|
|
3541
|
+
// 长边实际长度
|
|
3542
|
+
};
|
|
3537
3543
|
}
|
|
3538
3544
|
var getPt3 = (pt) => {
|
|
3539
3545
|
return new THREE3.Vector3(pt.x, pt.y, pt.z);
|
|
@@ -3652,23 +3658,30 @@ var mergeLines = (lines) => {
|
|
|
3652
3658
|
}
|
|
3653
3659
|
return newLines;
|
|
3654
3660
|
};
|
|
3655
|
-
var pointInRectRegion = (point2,
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3661
|
+
var pointInRectRegion = (point2, regions, epsilon3 = 1e-6) => {
|
|
3662
|
+
let isInside = false;
|
|
3663
|
+
for (let i = 0; i < regions.length; i++) {
|
|
3664
|
+
const rect = regions[i];
|
|
3665
|
+
if (rect.length !== 4)
|
|
3666
|
+
return false;
|
|
3667
|
+
const [p0, p1, p2, p3] = rect;
|
|
3668
|
+
const ptBottom1 = p0;
|
|
3669
|
+
const ptBottom2 = p1;
|
|
3670
|
+
let line2 = new THREE3.Line3(ptBottom1, ptBottom2);
|
|
3671
|
+
let copyPoint = getPt3(point2);
|
|
3672
|
+
copyPoint.z = ptBottom1.z;
|
|
3673
|
+
const closestPoint = line2.closestPointToPoint(copyPoint, true, new THREE3.Vector3());
|
|
3674
|
+
const distance2 = closestPoint.distanceTo(copyPoint);
|
|
3675
|
+
if (distance2 > epsilon3) {
|
|
3676
|
+
continue;
|
|
3677
|
+
}
|
|
3678
|
+
const { minZ, maxZ } = getPointsMinAndMax(rect);
|
|
3679
|
+
if (point2.z > minZ - epsilon3 && point2.z < maxZ + epsilon3) {
|
|
3680
|
+
isInside = true;
|
|
3681
|
+
break;
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
return isInside;
|
|
3672
3685
|
};
|
|
3673
3686
|
|
|
3674
3687
|
// src/utils/updateLine.mjs
|
|
@@ -9776,8 +9789,8 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
9776
9789
|
let tol = 0.5;
|
|
9777
9790
|
let f = calculateClosePointWithOBB(sourceItem.points, targetItem.obb);
|
|
9778
9791
|
let boxVecJ = getObbLongSideDirection(targetItem.obb);
|
|
9779
|
-
if (boxVecJ.length
|
|
9780
|
-
let isPPPP = isParallel(boxVecJ, boxVecK, tol);
|
|
9792
|
+
if (boxVecJ.length > 0.3 && boxVecK.length > 0.3 || f > 0.3) {
|
|
9793
|
+
let isPPPP = isParallel(boxVecJ.direction, boxVecK.direction, tol);
|
|
9781
9794
|
if (!isPPPP || !isPPPP.parallel) {
|
|
9782
9795
|
continue;
|
|
9783
9796
|
}
|
|
@@ -9869,9 +9882,9 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
9869
9882
|
let tol = array[k].type == "door frame" ? 0.5 : 0.5;
|
|
9870
9883
|
let boxVecK = getObbLongSideDirection(array[k].obb);
|
|
9871
9884
|
let f = calculateClosePointWithOBB(array[k].points, cloneData.obb, 1);
|
|
9872
|
-
if (boxVecJ.length
|
|
9873
|
-
let isPPPP = isParallel(boxVecJ, boxVecK, tol);
|
|
9874
|
-
if ((!isPPPP || !isPPPP.parallel) && f < 0.
|
|
9885
|
+
if (boxVecJ.length > 0.3 && boxVecK.length > 0.3 || f > 0.3) {
|
|
9886
|
+
let isPPPP = isParallel(boxVecJ.direction, boxVecK.direction, tol);
|
|
9887
|
+
if ((!isPPPP || !isPPPP.parallel) && f < 0.65) {
|
|
9875
9888
|
continue;
|
|
9876
9889
|
}
|
|
9877
9890
|
}
|
|
@@ -9918,6 +9931,7 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
9918
9931
|
if (newObb != null)
|
|
9919
9932
|
cloneData.obb = newObb;
|
|
9920
9933
|
cloneData.positionArr.push(...array[k].positionArr);
|
|
9934
|
+
boxVecJ = getObbLongSideDirection(cloneData.obb);
|
|
9921
9935
|
k = j;
|
|
9922
9936
|
}
|
|
9923
9937
|
}
|
|
@@ -11924,8 +11938,8 @@ var checkNearObjects = (lines, objPoints) => {
|
|
|
11924
11938
|
const rect = [];
|
|
11925
11939
|
rect.push(getPt3(line2.start));
|
|
11926
11940
|
rect.push(getPt3(line2.end));
|
|
11927
|
-
rect.push(getPt3(new THREE8.Vector3(line2.end.x, line2.end.y, line2.rooftopPz)));
|
|
11928
|
-
rect.push(getPt3(new THREE8.Vector3(line2.start.x, line2.start.y, line2.rooftopPz)));
|
|
11941
|
+
rect.push(getPt3(new THREE8.Vector3(line2.end.x, line2.end.y, line2.rooftopPz ? line2.rooftopPz : line2.end.z)));
|
|
11942
|
+
rect.push(getPt3(new THREE8.Vector3(line2.start.x, line2.start.y, line2.rooftopPz ? line2.rooftopPz : line2.start.z)));
|
|
11929
11943
|
rectRegions.push(rect);
|
|
11930
11944
|
}
|
|
11931
11945
|
function hasNearbyPoint(p) {
|
|
@@ -11956,7 +11970,7 @@ var checkNearObjects = (lines, objPoints) => {
|
|
|
11956
11970
|
}
|
|
11957
11971
|
let __pcdPoints = [];
|
|
11958
11972
|
for (const p of _pcdPoints) {
|
|
11959
|
-
if (!pointInRectRegion(p, rectRegions, 0.
|
|
11973
|
+
if (!pointInRectRegion(p, rectRegions, 0.03)) {
|
|
11960
11974
|
__pcdPoints.push(p);
|
|
11961
11975
|
}
|
|
11962
11976
|
}
|
|
@@ -15404,7 +15418,7 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
15404
15418
|
let inRectNum = 0;
|
|
15405
15419
|
for (let b = 0; b < checkResultsNum; b++) {
|
|
15406
15420
|
let pt = region.centerPts[b];
|
|
15407
|
-
if (pointInRectRegion(pt, rectPts, 0.01))
|
|
15421
|
+
if (pointInRectRegion(pt, [rectPts], 0.01))
|
|
15408
15422
|
inRectNum++;
|
|
15409
15423
|
}
|
|
15410
15424
|
let inRectPercentage = inRectNum / checkResultsNum;
|