build-dxf 0.1.146 → 0.1.147
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/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -3675,6 +3675,18 @@ class LineSegmentUtils {
|
|
|
3675
3675
|
}
|
|
3676
3676
|
return lines;
|
|
3677
3677
|
}
|
|
3678
|
+
/** 线段合法性检测 */
|
|
3679
|
+
static legitimacy(line) {
|
|
3680
|
+
const values = [
|
|
3681
|
+
line.start.x,
|
|
3682
|
+
line.start.y,
|
|
3683
|
+
line.end.x,
|
|
3684
|
+
line.end.y
|
|
3685
|
+
];
|
|
3686
|
+
return values.every(
|
|
3687
|
+
(v2) => typeof v2 === "number" && !Number.isNaN(v2)
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3678
3690
|
/**保留四位小数位数
|
|
3679
3691
|
* @param points
|
|
3680
3692
|
*/
|
|
@@ -8519,13 +8531,14 @@ class PCSparseOctree {
|
|
|
8519
8531
|
}
|
|
8520
8532
|
}
|
|
8521
8533
|
const box3$1 = new THREE.Box3();
|
|
8522
|
-
|
|
8523
|
-
|
|
8534
|
+
const temp = new Vector3();
|
|
8535
|
+
function projectPointToSegment(point2, start, _end, dir) {
|
|
8524
8536
|
const len2 = dir.lengthSq();
|
|
8525
8537
|
if (len2 < 1e-12) {
|
|
8526
8538
|
return 0;
|
|
8527
8539
|
}
|
|
8528
|
-
|
|
8540
|
+
temp.copy(point2);
|
|
8541
|
+
let t2 = temp.sub(start).dot(dir) / len2;
|
|
8529
8542
|
t2 = Math.max(0, Math.min(1, t2));
|
|
8530
8543
|
return t2;
|
|
8531
8544
|
}
|
|
@@ -8570,7 +8583,7 @@ class CheckPointCloudContinuity {
|
|
|
8570
8583
|
* @param points
|
|
8571
8584
|
*/
|
|
8572
8585
|
static checkByProjectionContinuity(points, opt) {
|
|
8573
|
-
let { ratio = 0.6, axisLine } = opt ?? {};
|
|
8586
|
+
let { ratio = 0.6, gridSize = 0.02, axisLine } = opt ?? {};
|
|
8574
8587
|
if (!axisLine) {
|
|
8575
8588
|
const rectangle = new Polygon(
|
|
8576
8589
|
points.map((p2) => new Point(p2.x, p2.y))
|
|
@@ -8584,17 +8597,17 @@ class CheckPointCloudContinuity {
|
|
|
8584
8597
|
start.set(xline.start.x, xline.start.y, 0);
|
|
8585
8598
|
end.set(xline.end.x, xline.end.y, 0);
|
|
8586
8599
|
const xts = this.projectPoint(points, start, end);
|
|
8587
|
-
if (!this.continuity(xts, xline.length, ratio)) return false;
|
|
8600
|
+
if (!this.continuity(xts, xline.length, gridSize, ratio)) return false;
|
|
8588
8601
|
const yline2 = xline.clone().rotate(Math.PI * 0.5);
|
|
8589
8602
|
start.set(yline2.start.x, yline2.start.y, 0);
|
|
8590
8603
|
end.set(yline2.end.x, yline2.end.y, 0);
|
|
8591
8604
|
const yts = this.projectPoint(points, start, end);
|
|
8592
|
-
if (!this.continuity(yts, yline2.length, ratio)) return false;
|
|
8605
|
+
if (!this.continuity(yts, yline2.length, gridSize, ratio)) return false;
|
|
8593
8606
|
const center = xline.center.clone();
|
|
8594
8607
|
start.set(center.x, center.y, 10);
|
|
8595
8608
|
end.set(center.x, center.y, -10);
|
|
8596
8609
|
const zts = this.projectPoint(points, start, end);
|
|
8597
|
-
if (!this.continuity(zts, 20, ratio)) return false;
|
|
8610
|
+
if (!this.continuity(zts, 20, gridSize, ratio)) return false;
|
|
8598
8611
|
return true;
|
|
8599
8612
|
}
|
|
8600
8613
|
/** 通过区域投影面积占比检测
|
|
@@ -8619,7 +8632,7 @@ class CheckPointCloudContinuity {
|
|
|
8619
8632
|
const dir = xline.direction(), angle = Math.atan2(dir.y, dir.x), center = xline.center, cos = Math.cos(-angle), sin = Math.sin(-angle), voxelizationPoints = [], xMap = new CounterMap(), yMap = new CounterMap(), occupied = /* @__PURE__ */ new Set();
|
|
8620
8633
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
8621
8634
|
points.forEach((p2) => {
|
|
8622
|
-
const dx = p2.x - center.x, dy = p2.y - center.y, x = Math.floor((dx * cos - dy * sin) / gridSize), y = Math.floor(p2.z / gridSize), key = BigInt(x) << 32n
|
|
8635
|
+
const dx = p2.x - center.x, dy = p2.y - center.y, x = Math.floor((dx * cos - dy * sin) / gridSize), y = Math.floor(p2.z / gridSize), key = BigInt(x) << 32n | BigInt(y) & 0xffffffffn;
|
|
8623
8636
|
if (occupied.has(key)) return;
|
|
8624
8637
|
occupied.add(key);
|
|
8625
8638
|
xMap.increment(x, 1);
|
|
@@ -8646,10 +8659,11 @@ class CheckPointCloudContinuity {
|
|
|
8646
8659
|
*/
|
|
8647
8660
|
static projectPoint(points, start, end) {
|
|
8648
8661
|
const point2 = new Vector3();
|
|
8662
|
+
const dir = end.clone().sub(start);
|
|
8649
8663
|
return points.map((p2) => {
|
|
8650
8664
|
point2.copy(p2);
|
|
8651
|
-
return projectPointToSegment(point2, start, end);
|
|
8652
|
-
})
|
|
8665
|
+
return projectPointToSegment(point2, start, end, dir);
|
|
8666
|
+
});
|
|
8653
8667
|
}
|
|
8654
8668
|
}
|
|
8655
8669
|
const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -10956,25 +10970,29 @@ function splitIntersectedLine(lines, minLen = 1e-9, opt) {
|
|
|
10956
10970
|
lines = LineSegmentUtils.splitIntersections(lines, {
|
|
10957
10971
|
obstacle,
|
|
10958
10972
|
onSplit: (line, newLines) => {
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
}
|
|
10966
|
-
if (balconyRailing && line.userData.isBalconyRailing) {
|
|
10967
|
-
const len = line.length;
|
|
10968
|
-
newLines.forEach((line2) => {
|
|
10969
|
-
if (line2.length / len < balconyRailing.filteringRatio) {
|
|
10970
|
-
if (opt?.balconyRailing?.behavior === "discard") removeSet.add(line2);
|
|
10971
|
-
else delete line2.userData.isBalconyRailing;
|
|
10973
|
+
try {
|
|
10974
|
+
WallHole.splitHole(line, newLines);
|
|
10975
|
+
if (line.userData.isBayWindow) {
|
|
10976
|
+
newLines.sort((a2, b4) => b4.length - a2.length);
|
|
10977
|
+
for (let i = 1; i < newLines.length; i++) {
|
|
10978
|
+
newLines[i].userData.isBayWindow = false;
|
|
10972
10979
|
}
|
|
10973
|
-
}
|
|
10980
|
+
}
|
|
10981
|
+
if (balconyRailing && line.userData.isBalconyRailing) {
|
|
10982
|
+
const len = line.length;
|
|
10983
|
+
newLines.forEach((line2) => {
|
|
10984
|
+
if (line2.length / len < balconyRailing.filteringRatio) {
|
|
10985
|
+
if (opt?.balconyRailing?.behavior === "discard") removeSet.add(line2);
|
|
10986
|
+
else delete line2.userData.isBalconyRailing;
|
|
10987
|
+
}
|
|
10988
|
+
});
|
|
10989
|
+
}
|
|
10990
|
+
} catch (error) {
|
|
10991
|
+
console.error(error.message);
|
|
10974
10992
|
}
|
|
10975
10993
|
}
|
|
10976
10994
|
});
|
|
10977
|
-
lines = lines.filter((line) => line.length >= minLen && !removeSet.has(line));
|
|
10995
|
+
lines = lines.filter((line) => line.length >= minLen && !removeSet.has(line) && LineSegmentUtils.legitimacy(line));
|
|
10978
10996
|
return dedup ? LineSegmentUtils.deduplicate(lines, 3) : lines;
|
|
10979
10997
|
}
|
|
10980
10998
|
function mergeChainsLine(lines, callBack, removeLines, newLines) {
|
package/src/index3.js
CHANGED
|
@@ -11917,7 +11917,9 @@ class Command extends Component {
|
|
|
11917
11917
|
" justify-center items-center bg-[rgba(0,0,0,0.5)]": !isMobileRef.value
|
|
11918
11918
|
},
|
|
11919
11919
|
"onClick": (e) => e.stopPropagation(),
|
|
11920
|
-
"onPointerdown": (e) => e.stopPropagation()
|
|
11920
|
+
"onPointerdown": (e) => e.stopPropagation(),
|
|
11921
|
+
"onPointerup": (e) => e.stopPropagation(),
|
|
11922
|
+
"onMousedown": (e) => e.stopPropagation()
|
|
11921
11923
|
}, [isMobileRef.value && createVNode("div", {
|
|
11922
11924
|
"class": "flex-1 pointer-events-none"
|
|
11923
11925
|
}, null), createVNode("div", {
|
|
@@ -14878,6 +14880,8 @@ function createPage$2(el, editWidth, editHeight, editGroundClearance) {
|
|
|
14878
14880
|
return createVNode("div", {
|
|
14879
14881
|
"class": " z-20 absolute left-0 top-[50%] translate-y-[-50%] flex flex-col p-[10px] gap-[16px]",
|
|
14880
14882
|
"onClick": (e) => e.stopPropagation(),
|
|
14883
|
+
"onMousedown": (e) => e.stopPropagation(),
|
|
14884
|
+
"onPointerup": (e) => e.stopPropagation(),
|
|
14881
14885
|
"onPointerdown": (e) => e.stopPropagation()
|
|
14882
14886
|
}, [editWidth && createVNode(_sfc_main$5, {
|
|
14883
14887
|
"iconSize": "28px",
|
|
@@ -18181,6 +18185,7 @@ function createPage(el) {
|
|
|
18181
18185
|
return createVNode("div", {
|
|
18182
18186
|
"class": " z-20 absolute left-0 top-[50%] translate-y-[-50%] flex flex-col p-[10px] gap-[16px]",
|
|
18183
18187
|
"onClick": (e) => e.stopPropagation(),
|
|
18188
|
+
"onMousedown": (e) => e.stopPropagation(),
|
|
18184
18189
|
"onPointerdown": (e) => e.stopPropagation()
|
|
18185
18190
|
}, [createVNode(_sfc_main$4, {
|
|
18186
18191
|
"icon": "tdesign:rotate-locked-filled",
|