rm-graphical-computing-node 1.0.110 → 1.0.112
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 +94 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3649,6 +3649,24 @@ var mergeLines = (lines) => {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
return newLines;
|
|
3651
3651
|
};
|
|
3652
|
+
var pointInRectRegion = (point2, rect, epsilon3 = 1e-6) => {
|
|
3653
|
+
if (rect.length !== 4)
|
|
3654
|
+
return false;
|
|
3655
|
+
const [p0, p1, p2, p3] = rect;
|
|
3656
|
+
const ptBottom1 = p0;
|
|
3657
|
+
const ptBottom2 = p0.z == p1.z ? p1 : p3;
|
|
3658
|
+
let line2 = new THREE3.Line3(ptBottom1, ptBottom2);
|
|
3659
|
+
let copyPoint = getPt3(point2);
|
|
3660
|
+
copyPoint.z = ptBottom1.z;
|
|
3661
|
+
const closestPoint = line2.closestPointToPoint(copyPoint, true, new THREE3.Vector3());
|
|
3662
|
+
const distance2 = closestPoint.distanceTo(copyPoint);
|
|
3663
|
+
if (distance2 > epsilon3)
|
|
3664
|
+
return false;
|
|
3665
|
+
const { minZ, maxZ } = getPointsMinAndMax(rect);
|
|
3666
|
+
if (point2.z > minZ - epsilon3 && point2.z < maxZ + epsilon3)
|
|
3667
|
+
return true;
|
|
3668
|
+
return false;
|
|
3669
|
+
};
|
|
3652
3670
|
|
|
3653
3671
|
// src/utils/updateLine.mjs
|
|
3654
3672
|
import * as THREE4 from "three";
|
|
@@ -4705,7 +4723,11 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
4705
4723
|
}
|
|
4706
4724
|
}
|
|
4707
4725
|
if (addData) {
|
|
4726
|
+
if (id == 4 && index == 33)
|
|
4727
|
+
console.log("height11:", height);
|
|
4708
4728
|
const expansionData = expansionLine(doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, line2.originalPoints);
|
|
4729
|
+
if (id == 4 && index == 33)
|
|
4730
|
+
console.log("height22:", height);
|
|
4709
4731
|
if (expansionData) {
|
|
4710
4732
|
doorTmpSt = expansionData.pt1;
|
|
4711
4733
|
doorTmpEd = expansionData.pt2;
|
|
@@ -5036,6 +5058,14 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5036
5058
|
else if (doorAndBeamDataObj.isPullOutDoor)
|
|
5037
5059
|
tmpDoorBeamData.isPullOutDoor = true;
|
|
5038
5060
|
const hasCommon = pcbDoorIndexs.some((item) => tmpDoorBeamData.pcbDoorIndexs.includes(item));
|
|
5061
|
+
if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam" || doorAndBeamDataObj.type == "hole" && tmpDoorBeamData.type == "hole") {
|
|
5062
|
+
if (length22 > length1) {
|
|
5063
|
+
doorAndBeamDataObj.isExtend = true;
|
|
5064
|
+
}
|
|
5065
|
+
if (length1 > length22) {
|
|
5066
|
+
lines[doorBeamDataIndex[w2].linesIndex].isExtend = true;
|
|
5067
|
+
}
|
|
5068
|
+
}
|
|
5039
5069
|
let lineIsOnlyBeam1 = false;
|
|
5040
5070
|
let lineIsOnlyBeam2 = false;
|
|
5041
5071
|
if (doorAndBeamDataObj.type == "beam" && tmpDoorBeamData.type == "beam") {
|
|
@@ -5045,12 +5075,6 @@ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, on
|
|
|
5045
5075
|
lines[doorBeamDataIndex[w2].linesIndex].originalPoints = null;
|
|
5046
5076
|
lineIsOnlyBeam1 = length1 > length22;
|
|
5047
5077
|
lineIsOnlyBeam2 = length1 < length22;
|
|
5048
|
-
if (length22 > length1) {
|
|
5049
|
-
doorAndBeamDataObj.isExtend = true;
|
|
5050
|
-
}
|
|
5051
|
-
if (length1 > length22) {
|
|
5052
|
-
lines[doorBeamDataIndex[w2].linesIndex].isExtend = true;
|
|
5053
|
-
}
|
|
5054
5078
|
let lineTmp1 = new THREE5.Line3(tmpDoorBeamData.beamStart, tmpDoorBeamData.beamEnd);
|
|
5055
5079
|
let lineTmp2 = new THREE5.Line3(doorAndBeamDataObj.beamStart, doorAndBeamDataObj.beamEnd);
|
|
5056
5080
|
let ptClose12 = lineTmp1.closestPointToPoint(lineTmp2.start, true, new THREE5.Vector3());
|
|
@@ -5601,6 +5625,7 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
|
|
|
5601
5625
|
downHeight = add;
|
|
5602
5626
|
}
|
|
5603
5627
|
}
|
|
5628
|
+
height += downHeight;
|
|
5604
5629
|
doorTmpSt.z -= downHeight;
|
|
5605
5630
|
doorTmpEd.z -= downHeight;
|
|
5606
5631
|
}
|
|
@@ -8991,7 +9016,7 @@ var drawStaircase = (pcdPointsArr, scene) => {
|
|
|
8991
9016
|
}
|
|
8992
9017
|
return pointCloudGroup;
|
|
8993
9018
|
};
|
|
8994
|
-
var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.1) => {
|
|
9019
|
+
var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.1) => {
|
|
8995
9020
|
if (allProjectionResults.length == 0) return [];
|
|
8996
9021
|
if (!averagePz2) averagePz2 = allProjectionResults[0].averagePz;
|
|
8997
9022
|
const pcdPointsArr = [];
|
|
@@ -9030,6 +9055,9 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9030
9055
|
allProjectionResults[i].points[u4].z
|
|
9031
9056
|
));
|
|
9032
9057
|
}
|
|
9058
|
+
if (wallLines && wallLines.length && wallVerifyType && wallVerifyType.length && wallVerifyType.includes(word)) {
|
|
9059
|
+
threePoints = checkNearObjects(wallLines, threePoints);
|
|
9060
|
+
}
|
|
9033
9061
|
let floorZ = -99999;
|
|
9034
9062
|
if (word === "floor") {
|
|
9035
9063
|
let mapSortPoint = /* @__PURE__ */ new Map();
|
|
@@ -9054,6 +9082,8 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9054
9082
|
threePoints = mostFrequentEntry[1].points.map((p) => new THREE8.Vector3(p.x, p.y, p.z));
|
|
9055
9083
|
floorZ = mostFrequentEntry[0];
|
|
9056
9084
|
}
|
|
9085
|
+
if (threePoints.length === 0)
|
|
9086
|
+
continue;
|
|
9057
9087
|
const centerData = getCenterAndPointHeight(threePoints);
|
|
9058
9088
|
const data = {
|
|
9059
9089
|
points: threePoints,
|
|
@@ -9128,6 +9158,8 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9128
9158
|
...array[j],
|
|
9129
9159
|
obb: array[j].obb.clone()
|
|
9130
9160
|
};
|
|
9161
|
+
if (cloneData.obb == null)
|
|
9162
|
+
continue;
|
|
9131
9163
|
let minJZ = 0;
|
|
9132
9164
|
let maxJZ = 0;
|
|
9133
9165
|
if (cloneData.type == "pipe") {
|
|
@@ -9196,7 +9228,9 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9196
9228
|
cloneData.minz = centerData.minz;
|
|
9197
9229
|
cloneData.maxz = centerData.maxz;
|
|
9198
9230
|
cloneData.center = { x: centerData.x, y: centerData.y, z: centerData.z };
|
|
9199
|
-
|
|
9231
|
+
let newObb = getObb(cloneData.path, cloneData.center, cloneData.h, (cloneData.maxz + cloneData.minz) / 2);
|
|
9232
|
+
if (newObb != null)
|
|
9233
|
+
cloneData.obb = newObb;
|
|
9200
9234
|
cloneData.positionArr.push(...array[k].positionArr);
|
|
9201
9235
|
k = j;
|
|
9202
9236
|
}
|
|
@@ -11128,6 +11162,58 @@ function obbContainsPoint(obb, point2, epsilon3 = 1e-6) {
|
|
|
11128
11162
|
const z = v2.dot(zAxis);
|
|
11129
11163
|
return Math.abs(x) <= h.x + epsilon3 && Math.abs(y) <= h.y + epsilon3 && Math.abs(z) <= h.z + epsilon3;
|
|
11130
11164
|
}
|
|
11165
|
+
var checkNearObjects = (lines, objPoints) => {
|
|
11166
|
+
const CELL = 0.1;
|
|
11167
|
+
const grid = /* @__PURE__ */ new Map();
|
|
11168
|
+
const THRESHOLD_SQ = 0.03 * 0.03;
|
|
11169
|
+
const rectRegions = [];
|
|
11170
|
+
for (const line2 of lines) {
|
|
11171
|
+
for (const p2 of line2.originalPoints) {
|
|
11172
|
+
const key = `${Math.floor(p2.x / CELL)},${Math.floor(p2.y / CELL)},${Math.floor(p2.z / CELL)}`;
|
|
11173
|
+
if (!grid.has(key)) grid.set(key, []);
|
|
11174
|
+
grid.get(key).push(p2);
|
|
11175
|
+
}
|
|
11176
|
+
const rect = [];
|
|
11177
|
+
rect.push(getPt3(line2.start));
|
|
11178
|
+
rect.push(getPt3(line2.end));
|
|
11179
|
+
rect.push(getPt3(new THREE8.Vector3(line2.end.x, line2.end.y, line2.rooftopPz)));
|
|
11180
|
+
rect.push(getPt3(new THREE8.Vector3(line2.start.x, line2.start.y, line2.rooftopPz)));
|
|
11181
|
+
rectRegions.push(rect);
|
|
11182
|
+
}
|
|
11183
|
+
function hasNearbyPoint(p) {
|
|
11184
|
+
const cx = Math.floor(p.x / CELL);
|
|
11185
|
+
const cy = Math.floor(p.y / CELL);
|
|
11186
|
+
const cz = Math.floor(p.z / CELL);
|
|
11187
|
+
for (let dx = -1; dx <= 1; dx++) {
|
|
11188
|
+
for (let dy = -1; dy <= 1; dy++) {
|
|
11189
|
+
for (let dz = -1; dz <= 1; dz++) {
|
|
11190
|
+
const key = `${cx + dx},${cy + dy},${cz + dz}`;
|
|
11191
|
+
const points = grid.get(key);
|
|
11192
|
+
if (!points) continue;
|
|
11193
|
+
for (const p2 of points) {
|
|
11194
|
+
if (p.distanceToSquared(p2) < THRESHOLD_SQ) {
|
|
11195
|
+
return true;
|
|
11196
|
+
}
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
}
|
|
11200
|
+
}
|
|
11201
|
+
return false;
|
|
11202
|
+
}
|
|
11203
|
+
let _pcdPoints = [];
|
|
11204
|
+
for (const p of objPoints) {
|
|
11205
|
+
if (!hasNearbyPoint(p)) {
|
|
11206
|
+
_pcdPoints.push(p);
|
|
11207
|
+
}
|
|
11208
|
+
}
|
|
11209
|
+
let __pcdPoints = [];
|
|
11210
|
+
for (const p of _pcdPoints) {
|
|
11211
|
+
if (!pointInRectRegion(p, rectRegions, 0.1)) {
|
|
11212
|
+
__pcdPoints.push(p);
|
|
11213
|
+
}
|
|
11214
|
+
}
|
|
11215
|
+
return __pcdPoints;
|
|
11216
|
+
};
|
|
11131
11217
|
|
|
11132
11218
|
// src/utils/clusert.mjs
|
|
11133
11219
|
function alphaForTriangle(points, ia, ib, ic) {
|