rm-graphical-computing-node 1.0.111 → 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 +86 -2
- 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;
|
|
@@ -5603,6 +5625,7 @@ var expansionLine = (doorTmpSt, doorTmpEd, beamTmpSt, beamTmpEd, height, origina
|
|
|
5603
5625
|
downHeight = add;
|
|
5604
5626
|
}
|
|
5605
5627
|
}
|
|
5628
|
+
height += downHeight;
|
|
5606
5629
|
doorTmpSt.z -= downHeight;
|
|
5607
5630
|
doorTmpEd.z -= downHeight;
|
|
5608
5631
|
}
|
|
@@ -8993,7 +9016,7 @@ var drawStaircase = (pcdPointsArr, scene) => {
|
|
|
8993
9016
|
}
|
|
8994
9017
|
return pointCloudGroup;
|
|
8995
9018
|
};
|
|
8996
|
-
var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.1) => {
|
|
9019
|
+
var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.1) => {
|
|
8997
9020
|
if (allProjectionResults.length == 0) return [];
|
|
8998
9021
|
if (!averagePz2) averagePz2 = allProjectionResults[0].averagePz;
|
|
8999
9022
|
const pcdPointsArr = [];
|
|
@@ -9032,6 +9055,9 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9032
9055
|
allProjectionResults[i].points[u4].z
|
|
9033
9056
|
));
|
|
9034
9057
|
}
|
|
9058
|
+
if (wallLines && wallLines.length && wallVerifyType && wallVerifyType.length && wallVerifyType.includes(word)) {
|
|
9059
|
+
threePoints = checkNearObjects(wallLines, threePoints);
|
|
9060
|
+
}
|
|
9035
9061
|
let floorZ = -99999;
|
|
9036
9062
|
if (word === "floor") {
|
|
9037
9063
|
let mapSortPoint = /* @__PURE__ */ new Map();
|
|
@@ -9056,6 +9082,8 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9056
9082
|
threePoints = mostFrequentEntry[1].points.map((p) => new THREE8.Vector3(p.x, p.y, p.z));
|
|
9057
9083
|
floorZ = mostFrequentEntry[0];
|
|
9058
9084
|
}
|
|
9085
|
+
if (threePoints.length === 0)
|
|
9086
|
+
continue;
|
|
9059
9087
|
const centerData = getCenterAndPointHeight(threePoints);
|
|
9060
9088
|
const data = {
|
|
9061
9089
|
points: threePoints,
|
|
@@ -9130,6 +9158,8 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9130
9158
|
...array[j],
|
|
9131
9159
|
obb: array[j].obb.clone()
|
|
9132
9160
|
};
|
|
9161
|
+
if (cloneData.obb == null)
|
|
9162
|
+
continue;
|
|
9133
9163
|
let minJZ = 0;
|
|
9134
9164
|
let maxJZ = 0;
|
|
9135
9165
|
if (cloneData.type == "pipe") {
|
|
@@ -9198,7 +9228,9 @@ var getMergeMeaning = (allProjectionResults, averagePz2, pointCloudCluster = nul
|
|
|
9198
9228
|
cloneData.minz = centerData.minz;
|
|
9199
9229
|
cloneData.maxz = centerData.maxz;
|
|
9200
9230
|
cloneData.center = { x: centerData.x, y: centerData.y, z: centerData.z };
|
|
9201
|
-
|
|
9231
|
+
let newObb = getObb(cloneData.path, cloneData.center, cloneData.h, (cloneData.maxz + cloneData.minz) / 2);
|
|
9232
|
+
if (newObb != null)
|
|
9233
|
+
cloneData.obb = newObb;
|
|
9202
9234
|
cloneData.positionArr.push(...array[k].positionArr);
|
|
9203
9235
|
k = j;
|
|
9204
9236
|
}
|
|
@@ -11130,6 +11162,58 @@ function obbContainsPoint(obb, point2, epsilon3 = 1e-6) {
|
|
|
11130
11162
|
const z = v2.dot(zAxis);
|
|
11131
11163
|
return Math.abs(x) <= h.x + epsilon3 && Math.abs(y) <= h.y + epsilon3 && Math.abs(z) <= h.z + epsilon3;
|
|
11132
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
|
+
};
|
|
11133
11217
|
|
|
11134
11218
|
// src/utils/clusert.mjs
|
|
11135
11219
|
function alphaForTriangle(points, ia, ib, ic) {
|