rm-graphical-computing-node 1.0.170 → 1.0.172
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 +85 -17
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14128,7 +14128,7 @@ var drawStaircase = (pcdPointsArr, scene) => {
|
|
|
14128
14128
|
}
|
|
14129
14129
|
return pointCloudGroup;
|
|
14130
14130
|
};
|
|
14131
|
-
var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.
|
|
14131
|
+
var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averagePz2, pointCloudCluster = null, tolerancePointCloudCluster = 0.2, wallLinesDelPs = 0.2) => {
|
|
14132
14132
|
if (allProjectionResults.length == 0) return [];
|
|
14133
14133
|
if (!averagePz2) averagePz2 = allProjectionResults[0].averagePz;
|
|
14134
14134
|
const pcdPointsArr = [];
|
|
@@ -14136,6 +14136,7 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
14136
14136
|
const CELL = 0.1;
|
|
14137
14137
|
const grid = /* @__PURE__ */ new Map();
|
|
14138
14138
|
const rectRegions = [];
|
|
14139
|
+
let isTrueType = ["floor", "Staircase", "window", "metal framing of interior glass partitions", "door", "balcony railing"];
|
|
14139
14140
|
if (wallLines) {
|
|
14140
14141
|
for (const line2 of wallLines) {
|
|
14141
14142
|
for (const p2 of line2.originalPoints) {
|
|
@@ -14180,12 +14181,14 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
14180
14181
|
let threePoints = [];
|
|
14181
14182
|
let threePointsStr = [];
|
|
14182
14183
|
for (let u4 = 0; u4 < allProjectionResults[i].points.length; u4++) {
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14184
|
+
if (allProjectionResults[i].points[u4].z > averagePz2 && allProjectionResults[i].points[u4].z - averagePz2 > 0.1 || isTrueType.includes(word)) {
|
|
14185
|
+
threePoints.push(new THREE8.Vector3(
|
|
14186
|
+
allProjectionResults[i].points[u4].x,
|
|
14187
|
+
allProjectionResults[i].points[u4].y,
|
|
14188
|
+
allProjectionResults[i].points[u4].z
|
|
14189
|
+
));
|
|
14190
|
+
threePointsStr.push(`${allProjectionResults[i].points[u4].x},${allProjectionResults[i].points[u4].y},${allProjectionResults[i].points[u4].z}`);
|
|
14191
|
+
}
|
|
14189
14192
|
}
|
|
14190
14193
|
if (wallLines) {
|
|
14191
14194
|
if (wallVerifyType.type1 && wallVerifyType.type1.length && wallVerifyType.type1.includes(word)) {
|
|
@@ -14293,6 +14296,72 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
14293
14296
|
}
|
|
14294
14297
|
}
|
|
14295
14298
|
}
|
|
14299
|
+
if (pointCloudCluster != null) {
|
|
14300
|
+
for (let i = 0; i < pcdPointsArr.length; i++) {
|
|
14301
|
+
let type = pcdPointsArr[i].type;
|
|
14302
|
+
if (type != "window") continue;
|
|
14303
|
+
let array = pcdPointsArr[i].array;
|
|
14304
|
+
let delArray = /* @__PURE__ */ new Set();
|
|
14305
|
+
let newArray = [];
|
|
14306
|
+
for (let j = 0; j < array.length; j++) {
|
|
14307
|
+
if (delArray.has(j)) continue;
|
|
14308
|
+
let points = array[j].points;
|
|
14309
|
+
let obj_id = array[j].obj_id;
|
|
14310
|
+
let type2 = array[j].type;
|
|
14311
|
+
let averagePz3 = array[j].averagePz;
|
|
14312
|
+
let positionArr = array[j].positionArr;
|
|
14313
|
+
let isStaircaseBalconyRailing = array[j].isStaircaseBalconyRailing;
|
|
14314
|
+
if (points.length < 50)
|
|
14315
|
+
continue;
|
|
14316
|
+
let clusterResult = pointCloudCluster([points], {
|
|
14317
|
+
tolerance: tolerancePointCloudCluster,
|
|
14318
|
+
minClusterSize: 20,
|
|
14319
|
+
maxClusterSize: 1e7,
|
|
14320
|
+
threadCount: 1
|
|
14321
|
+
});
|
|
14322
|
+
let beforeLength = newArray.length;
|
|
14323
|
+
if (clusterResult.length > 0 && clusterResult[0].length > 1) {
|
|
14324
|
+
let add = 1;
|
|
14325
|
+
for (const cluster of clusterResult[0]) {
|
|
14326
|
+
if (cluster.length < 50) continue;
|
|
14327
|
+
const newOriginalPoints = cluster.map((i2) => points[i2]);
|
|
14328
|
+
const centerData = getCenterAndPointHeight(newOriginalPoints);
|
|
14329
|
+
let pathPoints = newOriginalPoints.map((p) => [p.x, p.y]);
|
|
14330
|
+
const data = {
|
|
14331
|
+
points: newOriginalPoints,
|
|
14332
|
+
path: computeContour(pathPoints),
|
|
14333
|
+
h: centerData.h,
|
|
14334
|
+
minz: centerData.minz,
|
|
14335
|
+
maxz: centerData.maxz,
|
|
14336
|
+
center: { x: centerData.x, y: centerData.y, z: centerData.z },
|
|
14337
|
+
type: type2,
|
|
14338
|
+
averagePz: averagePz3,
|
|
14339
|
+
obb: null,
|
|
14340
|
+
obj_id: obj_id + `_${add}`,
|
|
14341
|
+
positionArr,
|
|
14342
|
+
isStaircaseBalconyRailing,
|
|
14343
|
+
mapPosition: array[j]?.mapPosition
|
|
14344
|
+
};
|
|
14345
|
+
data.obb = getObb(data.path, data.center, data.h, (data.maxz + data.minz) / 2);
|
|
14346
|
+
if (data.obb == null) continue;
|
|
14347
|
+
newArray.push(data);
|
|
14348
|
+
add++;
|
|
14349
|
+
}
|
|
14350
|
+
}
|
|
14351
|
+
if (newArray.length != beforeLength) {
|
|
14352
|
+
delArray.add(j);
|
|
14353
|
+
}
|
|
14354
|
+
}
|
|
14355
|
+
if (delArray.size > 0) {
|
|
14356
|
+
for (let j = 0; j < array.length; j++) {
|
|
14357
|
+
if (!delArray.has(j)) {
|
|
14358
|
+
newArray.push(array[j]);
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
pcdPointsArr[i].array = newArray;
|
|
14362
|
+
}
|
|
14363
|
+
}
|
|
14364
|
+
}
|
|
14296
14365
|
function appendPcdObj(targetType, sourceType) {
|
|
14297
14366
|
const targetData = pcdPointsArr.find((item) => item.type == targetType);
|
|
14298
14367
|
const sourceData = pcdPointsArr.find((item) => item.type == sourceType);
|
|
@@ -14453,9 +14522,8 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
14453
14522
|
delData.add(k);
|
|
14454
14523
|
let threePoints = [];
|
|
14455
14524
|
let threePointsStr = [];
|
|
14456
|
-
let isTrueType = cloneData.type == "floor" || cloneData.type == "Staircase" || cloneData.type == "window" || cloneData.type == "metal framing of interior glass partitions" || cloneData.type == "door" || cloneData.type == "balcony railing";
|
|
14457
14525
|
for (let m = 0; m < array[k].points.length; m++) {
|
|
14458
|
-
if (array[k].points[m].z > averagePz2 && array[k].points[m].z - averagePz2 > 0.1 || isTrueType) {
|
|
14526
|
+
if (array[k].points[m].z > averagePz2 && array[k].points[m].z - averagePz2 > 0.1 || isTrueType.includes(cloneData.type)) {
|
|
14459
14527
|
cloneData.points.push(array[k].points[m]);
|
|
14460
14528
|
threePoints.push(array[k].points[m]);
|
|
14461
14529
|
threePointsStr.push(`${array[k].points[m].x},${array[k].points[m].y},${array[k].points[m].z}`);
|
|
@@ -14682,7 +14750,7 @@ var getMergeMeaning = (allProjectionResults, wallLines, wallVerifyType, averageP
|
|
|
14682
14750
|
for (let k = 0; k < newnewData.length; k++) {
|
|
14683
14751
|
if (newnewData[k].obb == null || delData.has(k) || j == k)
|
|
14684
14752
|
continue;
|
|
14685
|
-
let tol = 0.
|
|
14753
|
+
let tol = 0.35;
|
|
14686
14754
|
let boxVecK = getObbLongSideDirection(newnewData[k].obb);
|
|
14687
14755
|
let obbPointsClone = getOBBPoints(cloneData.obb);
|
|
14688
14756
|
let polygonK = newnewData[k].path.map((point2) => new THREE8.Vector3(point2[0], point2[1], 0));
|
|
@@ -17998,6 +18066,8 @@ var getWindowData = (lines, pcdData, lineReader) => {
|
|
|
17998
18066
|
let beamEd = new THREE10.Vector3(tmpRegion.facePoints[1].x, tmpRegion.facePoints[1].y, 0);
|
|
17999
18067
|
let bIsTrue = true;
|
|
18000
18068
|
let bIsSoTall = Math.abs(tmpRegion.facePoints[2].z - windowDatas[n].maxZ) > 0.2;
|
|
18069
|
+
if (windowDatas[n].maxZ < doorTmpSt.z || Math.abs(windowDatas[n].maxZ - doorTmpSt.z) < 0.3)
|
|
18070
|
+
continue;
|
|
18001
18071
|
if (bIsTrue) {
|
|
18002
18072
|
let result = classifySegments(doorSt.clone(), doorEd.clone(), beamSt.clone(), beamEd.clone(), {
|
|
18003
18073
|
collinearAngleMax: THREE10.MathUtils.degToRad(10),
|
|
@@ -18924,12 +18994,12 @@ var getWindowPcdData = (lines, pcdData) => {
|
|
|
18924
18994
|
lines.push(newLine2);
|
|
18925
18995
|
if (newLine3.originalPoints.length > 10 && newLine3.length > 0.01)
|
|
18926
18996
|
lines.push(newLine3);
|
|
18927
|
-
pcd.
|
|
18997
|
+
pcd.isPcdFindWindow = true;
|
|
18928
18998
|
line2.isRebuild = true;
|
|
18929
18999
|
} else {
|
|
18930
19000
|
line2.drawWindow.push(windowData);
|
|
18931
19001
|
line2.isWindow = true;
|
|
18932
|
-
pcd.
|
|
19002
|
+
pcd.isPcdFindWindow = true;
|
|
18933
19003
|
}
|
|
18934
19004
|
}
|
|
18935
19005
|
}
|
|
@@ -20581,9 +20651,7 @@ var getArcWallLine = (lines) => {
|
|
|
20581
20651
|
const arcGroups = detectArcSegmentGroups(lines, {
|
|
20582
20652
|
minSegments: 3
|
|
20583
20653
|
});
|
|
20584
|
-
console.log(arcGroups);
|
|
20585
20654
|
const arc = [];
|
|
20586
|
-
const pathArc = [];
|
|
20587
20655
|
let delIndex = [];
|
|
20588
20656
|
for (let i = 0; i < arcGroups.length; i++) {
|
|
20589
20657
|
if (delIndex.includes(i))
|
|
@@ -20650,7 +20718,6 @@ var getArcWallLine = (lines) => {
|
|
|
20650
20718
|
if (!delIndex.includes(i))
|
|
20651
20719
|
mergeIndexs.push(arcGroups[i]);
|
|
20652
20720
|
}
|
|
20653
|
-
console.log(mergeIndexs);
|
|
20654
20721
|
for (let i = 0; i < mergeIndexs.length; i++) {
|
|
20655
20722
|
const acceptedArcSegments = mergeIndexs[i].segmentIndices;
|
|
20656
20723
|
let pts = [];
|
|
@@ -20673,7 +20740,6 @@ var getArcWallLine = (lines) => {
|
|
|
20673
20740
|
161
|
|
20674
20741
|
);
|
|
20675
20742
|
const threeData = curve.map((p) => new THREE12.Vector3(p.x, p.y, 0));
|
|
20676
|
-
pathArc.push(threeData);
|
|
20677
20743
|
const points2D = threeData.map(
|
|
20678
20744
|
(p) => new THREE12.Vector2(p.x, p.y)
|
|
20679
20745
|
);
|
|
@@ -20696,7 +20762,9 @@ var getArcWallLine = (lines) => {
|
|
|
20696
20762
|
controlPointStart: { x: P1.x, y: P1.y, z: floorZ },
|
|
20697
20763
|
controlPointEnd: { x: P2.x, y: P2.y, z: floorZ }
|
|
20698
20764
|
},
|
|
20699
|
-
rooftopPz
|
|
20765
|
+
rooftopPz,
|
|
20766
|
+
originalPoints: pts,
|
|
20767
|
+
path: threeData
|
|
20700
20768
|
});
|
|
20701
20769
|
}
|
|
20702
20770
|
}
|