rm-graphical-computing-node 1.0.40 → 1.0.41
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 +62 -63
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3447,6 +3447,65 @@ function pointToSegmentDistance(p, a, b) {
|
|
|
3447
3447
|
p.y - y
|
|
3448
3448
|
);
|
|
3449
3449
|
}
|
|
3450
|
+
var voxelDownsample2DForContour = (points, cellSize) => {
|
|
3451
|
+
if (!points || points.length === 0) return [];
|
|
3452
|
+
const map = /* @__PURE__ */ new Map();
|
|
3453
|
+
for (let i = 0; i < points.length; i++) {
|
|
3454
|
+
const p = points[i];
|
|
3455
|
+
const x = p[0];
|
|
3456
|
+
const y = p[1];
|
|
3457
|
+
const gx = Math.floor(x / cellSize);
|
|
3458
|
+
const gy = Math.floor(y / cellSize);
|
|
3459
|
+
const key = `${gx}_${gy}`;
|
|
3460
|
+
let cell = map.get(key);
|
|
3461
|
+
if (!cell) {
|
|
3462
|
+
const cx = (gx + 0.5) * cellSize;
|
|
3463
|
+
const cy = (gy + 0.5) * cellSize;
|
|
3464
|
+
const dx2 = x - cx;
|
|
3465
|
+
const dy2 = y - cy;
|
|
3466
|
+
cell = {
|
|
3467
|
+
minX: p,
|
|
3468
|
+
maxX: p,
|
|
3469
|
+
minY: p,
|
|
3470
|
+
maxY: p,
|
|
3471
|
+
center: p,
|
|
3472
|
+
centerDist2: dx2 * dx2 + dy2 * dy2,
|
|
3473
|
+
cx,
|
|
3474
|
+
cy
|
|
3475
|
+
};
|
|
3476
|
+
map.set(key, cell);
|
|
3477
|
+
continue;
|
|
3478
|
+
}
|
|
3479
|
+
if (x < cell.minX[0]) cell.minX = p;
|
|
3480
|
+
if (x > cell.maxX[0]) cell.maxX = p;
|
|
3481
|
+
if (y < cell.minY[1]) cell.minY = p;
|
|
3482
|
+
if (y > cell.maxY[1]) cell.maxY = p;
|
|
3483
|
+
const dx = x - cell.cx;
|
|
3484
|
+
const dy = y - cell.cy;
|
|
3485
|
+
const dist22 = dx * dx + dy * dy;
|
|
3486
|
+
if (dist22 < cell.centerDist2) {
|
|
3487
|
+
cell.center = p;
|
|
3488
|
+
cell.centerDist2 = dist22;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3492
|
+
const result = [];
|
|
3493
|
+
function addPoint(p) {
|
|
3494
|
+
const key = `${p[0]}_${p[1]}`;
|
|
3495
|
+
if (!seen.has(key)) {
|
|
3496
|
+
seen.add(key);
|
|
3497
|
+
result.push(p);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
for (const cell of map.values()) {
|
|
3501
|
+
addPoint(cell.minX);
|
|
3502
|
+
addPoint(cell.maxX);
|
|
3503
|
+
addPoint(cell.minY);
|
|
3504
|
+
addPoint(cell.maxY);
|
|
3505
|
+
addPoint(cell.center);
|
|
3506
|
+
}
|
|
3507
|
+
return result;
|
|
3508
|
+
};
|
|
3450
3509
|
|
|
3451
3510
|
// src/utils/updateLine.mjs
|
|
3452
3511
|
import * as THREE4 from "three";
|
|
@@ -10547,65 +10606,6 @@ function obbContainsPoint(obb, point2, epsilon3 = 1e-6) {
|
|
|
10547
10606
|
const z = v2.dot(zAxis);
|
|
10548
10607
|
return Math.abs(x) <= h.x + epsilon3 && Math.abs(y) <= h.y + epsilon3 && Math.abs(z) <= h.z + epsilon3;
|
|
10549
10608
|
}
|
|
10550
|
-
function voxelDownsample2DForContour(points, cellSize) {
|
|
10551
|
-
if (!points || points.length === 0) return [];
|
|
10552
|
-
const map = /* @__PURE__ */ new Map();
|
|
10553
|
-
for (let i = 0; i < points.length; i++) {
|
|
10554
|
-
const p = points[i];
|
|
10555
|
-
const x = p[0];
|
|
10556
|
-
const y = p[1];
|
|
10557
|
-
const gx = Math.floor(x / cellSize);
|
|
10558
|
-
const gy = Math.floor(y / cellSize);
|
|
10559
|
-
const key = `${gx}_${gy}`;
|
|
10560
|
-
let cell = map.get(key);
|
|
10561
|
-
if (!cell) {
|
|
10562
|
-
const cx = (gx + 0.5) * cellSize;
|
|
10563
|
-
const cy = (gy + 0.5) * cellSize;
|
|
10564
|
-
const dx2 = x - cx;
|
|
10565
|
-
const dy2 = y - cy;
|
|
10566
|
-
cell = {
|
|
10567
|
-
minX: p,
|
|
10568
|
-
maxX: p,
|
|
10569
|
-
minY: p,
|
|
10570
|
-
maxY: p,
|
|
10571
|
-
center: p,
|
|
10572
|
-
centerDist2: dx2 * dx2 + dy2 * dy2,
|
|
10573
|
-
cx,
|
|
10574
|
-
cy
|
|
10575
|
-
};
|
|
10576
|
-
map.set(key, cell);
|
|
10577
|
-
continue;
|
|
10578
|
-
}
|
|
10579
|
-
if (x < cell.minX[0]) cell.minX = p;
|
|
10580
|
-
if (x > cell.maxX[0]) cell.maxX = p;
|
|
10581
|
-
if (y < cell.minY[1]) cell.minY = p;
|
|
10582
|
-
if (y > cell.maxY[1]) cell.maxY = p;
|
|
10583
|
-
const dx = x - cell.cx;
|
|
10584
|
-
const dy = y - cell.cy;
|
|
10585
|
-
const dist22 = dx * dx + dy * dy;
|
|
10586
|
-
if (dist22 < cell.centerDist2) {
|
|
10587
|
-
cell.center = p;
|
|
10588
|
-
cell.centerDist2 = dist22;
|
|
10589
|
-
}
|
|
10590
|
-
}
|
|
10591
|
-
const seen = /* @__PURE__ */ new Set();
|
|
10592
|
-
const result = [];
|
|
10593
|
-
function addPoint(p) {
|
|
10594
|
-
const key = `${p[0]}_${p[1]}`;
|
|
10595
|
-
if (!seen.has(key)) {
|
|
10596
|
-
seen.add(key);
|
|
10597
|
-
result.push(p);
|
|
10598
|
-
}
|
|
10599
|
-
}
|
|
10600
|
-
for (const cell of map.values()) {
|
|
10601
|
-
addPoint(cell.minX);
|
|
10602
|
-
addPoint(cell.maxX);
|
|
10603
|
-
addPoint(cell.minY);
|
|
10604
|
-
addPoint(cell.maxY);
|
|
10605
|
-
addPoint(cell.center);
|
|
10606
|
-
}
|
|
10607
|
-
return result;
|
|
10608
|
-
}
|
|
10609
10609
|
|
|
10610
10610
|
// src/utils/clusert.mjs
|
|
10611
10611
|
function alphaForTriangle(points, ia, ib, ic) {
|
|
@@ -10775,10 +10775,9 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
|
|
|
10775
10775
|
if (isIntersect) {
|
|
10776
10776
|
for (let b = 0; b < slabData2.points.length; b++)
|
|
10777
10777
|
slabData1.points.push(slabData2.points[b]);
|
|
10778
|
-
let
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
let path3 = computeContour(pathPoints);
|
|
10778
|
+
let tmpPoints = slabData1.points.map((p) => [p.x, p.y]);
|
|
10779
|
+
tmpPoints = voxelDownsample2DForContour(tmpPoints, 0.1);
|
|
10780
|
+
let path3 = computeContour(tmpPoints);
|
|
10782
10781
|
slabData1.contour = path3;
|
|
10783
10782
|
delIndex.add(k);
|
|
10784
10783
|
k = -1;
|