build-dxf 0.1.94 → 0.1.95
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 +1 -1
- package/src/build.js +225 -64
- package/src/index.css +8 -4
- package/src/index3.js +5 -5
- package/src/utils/DxfSystem/components/Dxf.d.ts +3 -3
- package/src/utils/DxfSystem/components/ThreeVJia.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CFComponent.d.ts +2 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ClippingLine.d.ts +2 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawDoorLine.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawLine.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DrawWindow.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ManualDistance.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag/modifyDoor.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag/modifyLine.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag/modifyWindow.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PropertiesPanel.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/RayDistance.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/SelectAll.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorr.d.ts +2 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrContinue.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +4 -4
- package/src/utils/DxfSystem/plugin/Editor/pages/PropertiesPanel.vue.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/ModelDataRender.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +2 -2
- package/src/utils/DxfSystem/type.d.ts +4 -4
- package/src/utils/DxfSystem/utils/drawHandle/BayWindowHelper.d.ts +2 -2
- package/src/utils/DxfSystem/utils/drawHandle/CAD.d.ts +3 -3
- package/src/utils/DxfSystem/utils/drawHandle/SceneAutoGenerat.d.ts +1 -1
- package/src/utils/DxfSystem/utils/drawHandle/getWinDrawData.d.ts +3 -3
- package/src/utils/DxfSystem/utils/drawHelper.d.ts +2 -2
- package/src/utils/DxfSystem/utils/lineHandle/BoundExt.d.ts +3 -3
- package/src/utils/DxfSystem/utils/lineHandle/DoorFind.d.ts +5 -5
- package/src/utils/DxfSystem/utils/lineHandle/DoubleWallHelper.d.ts +2 -2
- package/src/utils/DxfSystem/utils/lineHandle/HeightQuery.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/LineGroupType.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/buildGroup/buildBayWindowGroup.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/buildGroup/buildDoubleWallGroup.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/clippingLineUserData.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/findDiscrete.d.ts +5 -5
- package/src/utils/DxfSystem/utils/lineHandle/findVerticalReference.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/lineSegmentClipping.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/mergeLineUserData.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/axisAlignCorr/index.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/axisAlignCorr/linesSmoothing.d.ts +3 -3
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/axisAlignCorr/removeQuad.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/boundExt.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/doorSpaceHandle.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/doubleWallAlignment.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/index.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/init.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/removeShortDoubleWall.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/DxfPreProcessor/wallHeightHandle.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/WallGroupManager.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/WallInsertObject.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/WallInsertObjectDrawData.d.ts +5 -5
- package/src/utils/DxfSystem/utils/tools/clippingDoubleWall.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/findRooms.d.ts +3 -3
- package/src/utils/DxfSystem/utils/tools/index.d.ts +4 -4
- package/src/utils/DxfSystem/utils/tools/lineDataToThreeVJiaJson.d.ts +2 -2
- package/src/utils/DxfSystem/utils/tools/mergeChains.d.ts +1 -1
- package/src/utils/DxfSystem/utils/tools/removeDangline.d.ts +1 -1
- package/src/utils/algorithms/AlignToParallelSegments.d.ts +23 -0
- package/src/utils/{algorithmsStructures → algorithms}/LineQueryer.d.ts +2 -2
- package/src/utils/{algorithmsStructures → algorithms}/LineSegment.d.ts +1 -1
- package/src/utils/{algorithmsStructures → algorithms}/LineSegmentUtils.d.ts +5 -1
- package/src/utils/{algorithmsStructures → algorithms}/MiniCircles.d.ts +2 -2
- package/src/utils/{algorithmsStructures → algorithms}/Point.d.ts +7 -0
- package/src/utils/{algorithmsStructures/PointVirtualGrid.d.ts → algorithms/PointSpatialHash.d.ts} +9 -8
- package/src/utils/index.d.ts +17 -17
- package/src/utils/modelScenario/bayWindow.d.ts +1 -1
- package/src/utils/modelScenario/scenario.d.ts +2 -2
- package/src/utils/threeObject3D/ExtrudeMesh.d.ts +1 -1
- package/src/utils/algorithmsStructures/AlignToParallelSegments.d.ts +0 -8
- /package/src/utils/{algorithmsStructures → algorithms}/AxisAlignCorr.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Box2.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/ConvexHullGraham.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Debouncing.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/LineIndexGenerator.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Map.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/MaxiCircles.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/OBB.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/PCSparseOctree.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Pipeline.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/PointUtils.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Polygon.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Quadtree.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/Rectangle.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/UndirectedGraph.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/UnionFindSet.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/ccw.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/mergeUShapedPath.d.ts +0 -0
- /package/src/utils/{algorithmsStructures → algorithms}/stepElimination.d.ts +0 -0
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -604,8 +604,8 @@ class LineSegment {
|
|
|
604
604
|
* @param t
|
|
605
605
|
* @returns
|
|
606
606
|
*/
|
|
607
|
-
pointAt(t2) {
|
|
608
|
-
return
|
|
607
|
+
pointAt(t2, point2 = new Point()) {
|
|
608
|
+
return point2.set(this.start.x + (this.end.x - this.start.x) * t2, this.start.y + (this.end.y - this.start.y) * t2);
|
|
609
609
|
}
|
|
610
610
|
/** 膨胀为矩形
|
|
611
611
|
*
|
|
@@ -1099,6 +1099,16 @@ class Point {
|
|
|
1099
1099
|
this.y += point2.y;
|
|
1100
1100
|
return this;
|
|
1101
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* 加法
|
|
1104
|
+
* @description 将当前点的坐标加上指定点的坐标
|
|
1105
|
+
* @param point
|
|
1106
|
+
* @returns
|
|
1107
|
+
*/
|
|
1108
|
+
addScalar(value) {
|
|
1109
|
+
this.x += value;
|
|
1110
|
+
this.y += value;
|
|
1111
|
+
}
|
|
1102
1112
|
parseInt() {
|
|
1103
1113
|
this.x = ~~this.x;
|
|
1104
1114
|
this.y = ~~this.y;
|
|
@@ -1666,7 +1676,7 @@ class PvgList extends Array {
|
|
|
1666
1676
|
return this.map((item) => item.point);
|
|
1667
1677
|
}
|
|
1668
1678
|
}
|
|
1669
|
-
class
|
|
1679
|
+
class PointSpatialHash {
|
|
1670
1680
|
map = /* @__PURE__ */ new Map();
|
|
1671
1681
|
gridSize;
|
|
1672
1682
|
id;
|
|
@@ -1701,7 +1711,7 @@ class PointVirtualGrid {
|
|
|
1701
1711
|
return this;
|
|
1702
1712
|
}
|
|
1703
1713
|
if (point2.currentData[this.id]) this.remove(point2);
|
|
1704
|
-
const id = this.
|
|
1714
|
+
const id = this.getGridIdByPoint(point2);
|
|
1705
1715
|
if (!this.map.has(id)) this.map.set(id, /* @__PURE__ */ new Set());
|
|
1706
1716
|
const set2 = this.map.get(id);
|
|
1707
1717
|
const target = { point: point2, userData };
|
|
@@ -1745,7 +1755,7 @@ class PointVirtualGrid {
|
|
|
1745
1755
|
update(point2) {
|
|
1746
1756
|
const { target, set: set2 } = point2.currentData[this.id];
|
|
1747
1757
|
if (!target) return false;
|
|
1748
|
-
const id = this.
|
|
1758
|
+
const id = this.getGridIdByPoint(point2);
|
|
1749
1759
|
let newSet = this.map.get(id);
|
|
1750
1760
|
if (newSet === set2) return false;
|
|
1751
1761
|
set2.delete(target);
|
|
@@ -1766,8 +1776,11 @@ class PointVirtualGrid {
|
|
|
1766
1776
|
* @param point
|
|
1767
1777
|
* @returns
|
|
1768
1778
|
*/
|
|
1769
|
-
|
|
1779
|
+
getGridIdByPoint(point2) {
|
|
1770
1780
|
const i = Math.ceil(point2.x / this.gridSize), j = Math.ceil(point2.y / this.gridSize);
|
|
1781
|
+
return this.getGridId(i, j);
|
|
1782
|
+
}
|
|
1783
|
+
getGridId(i, j) {
|
|
1771
1784
|
return `${i}.${j}`;
|
|
1772
1785
|
}
|
|
1773
1786
|
/**
|
|
@@ -1782,15 +1795,6 @@ class PointVirtualGrid {
|
|
|
1782
1795
|
}
|
|
1783
1796
|
this.map.clear();
|
|
1784
1797
|
}
|
|
1785
|
-
/**
|
|
1786
|
-
*
|
|
1787
|
-
* @param gridId
|
|
1788
|
-
* @returns
|
|
1789
|
-
*/
|
|
1790
|
-
decodeGridId(gridId) {
|
|
1791
|
-
const [i, j] = gridId.split(".").map(Number);
|
|
1792
|
-
return new Point(i, j);
|
|
1793
|
-
}
|
|
1794
1798
|
/**
|
|
1795
1799
|
* 查询与矩形相交的点
|
|
1796
1800
|
* @param rectangle 矩形
|
|
@@ -1822,7 +1826,7 @@ class PointVirtualGrid {
|
|
|
1822
1826
|
const minI = Math.ceil(box2.minX / this.gridSize), maxI = Math.ceil(box2.maxX / this.gridSize), minJ = Math.ceil(box2.minY / this.gridSize), maxJ = Math.ceil(box2.maxY / this.gridSize), list = new PvgList();
|
|
1823
1827
|
for (let i = minI; i <= maxI; i++) {
|
|
1824
1828
|
for (let j = minJ; j <= maxJ; j++) {
|
|
1825
|
-
const id =
|
|
1829
|
+
const id = this.getGridId(i, j);
|
|
1826
1830
|
if (!this.map.has(id)) continue;
|
|
1827
1831
|
const set2 = this.map.get(id);
|
|
1828
1832
|
set2?.forEach((item) => {
|
|
@@ -1842,7 +1846,7 @@ class PointVirtualGrid {
|
|
|
1842
1846
|
const minI = Math.ceil(box2.minX / this.gridSize), maxI = Math.ceil(box2.maxX / this.gridSize), minJ = Math.ceil(box2.minY / this.gridSize), maxJ = Math.ceil(box2.maxY / this.gridSize), list = [];
|
|
1843
1847
|
for (let i = minI; i <= maxI; i++) {
|
|
1844
1848
|
for (let j = minJ; j <= maxJ; j++) {
|
|
1845
|
-
const id =
|
|
1849
|
+
const id = this.getGridId(i, j);
|
|
1846
1850
|
if (!this.map.has(id)) continue;
|
|
1847
1851
|
const set2 = this.map.get(id);
|
|
1848
1852
|
set2?.forEach((item) => {
|
|
@@ -1862,7 +1866,7 @@ class PointVirtualGrid {
|
|
|
1862
1866
|
if (point2.currentData[this.id]) {
|
|
1863
1867
|
set2 = point2.currentData[this.id]?.set;
|
|
1864
1868
|
} else {
|
|
1865
|
-
const id = this.
|
|
1869
|
+
const id = this.getGridIdByPoint(point2);
|
|
1866
1870
|
if (this.map.has(id)) set2 = this.map.get(id);
|
|
1867
1871
|
}
|
|
1868
1872
|
set2?.forEach((item) => {
|
|
@@ -1922,6 +1926,15 @@ class PointVirtualGrid {
|
|
|
1922
1926
|
if (list.size === 1) return [...list][0];
|
|
1923
1927
|
}
|
|
1924
1928
|
}
|
|
1929
|
+
/** 通过线段快速创建
|
|
1930
|
+
* @param lines
|
|
1931
|
+
* @returns
|
|
1932
|
+
*/
|
|
1933
|
+
static fromByLines(lines) {
|
|
1934
|
+
const psh = new PointSpatialHash();
|
|
1935
|
+
lines.forEach((line) => psh.insert(line.start, line).insert(line.end, line));
|
|
1936
|
+
return psh;
|
|
1937
|
+
}
|
|
1925
1938
|
}
|
|
1926
1939
|
class Quadtree {
|
|
1927
1940
|
bounds;
|
|
@@ -2795,7 +2808,7 @@ class CounterMap extends MapEnhance {
|
|
|
2795
2808
|
function findDiscretePointLine(lines, grid0, lineSet, deep = true) {
|
|
2796
2809
|
lineSet = lineSet ?? /* @__PURE__ */ new Set();
|
|
2797
2810
|
const is2 = grid0 ? true : false;
|
|
2798
|
-
const grid = grid0 ||
|
|
2811
|
+
const grid = grid0 || createPointSpatialHash(lines);
|
|
2799
2812
|
function handle(line) {
|
|
2800
2813
|
if (!(line instanceof LineSegment)) return;
|
|
2801
2814
|
if (lineSet?.has(line)) return;
|
|
@@ -2867,7 +2880,7 @@ function findDiscretePoint(lines) {
|
|
|
2867
2880
|
}
|
|
2868
2881
|
function findDiscretePoint2(lines) {
|
|
2869
2882
|
const pointMap = new MapEnhance();
|
|
2870
|
-
const pvg =
|
|
2883
|
+
const pvg = createPointSpatialHash(lines);
|
|
2871
2884
|
lines.forEach((line) => {
|
|
2872
2885
|
const qr2 = Math.min(1e-3, line.length() * 9e-3);
|
|
2873
2886
|
line.points.forEach((p2) => {
|
|
@@ -2907,7 +2920,7 @@ class PointUtils {
|
|
|
2907
2920
|
* @returns
|
|
2908
2921
|
*/
|
|
2909
2922
|
static adsorb(points, tolerance = 1e-4, mode = "average") {
|
|
2910
|
-
const grid = new
|
|
2923
|
+
const grid = new PointSpatialHash();
|
|
2911
2924
|
points.forEach((p2) => grid.insert(p2));
|
|
2912
2925
|
const visited = /* @__PURE__ */ new Set();
|
|
2913
2926
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -2980,7 +2993,7 @@ class LineSegmentUtils {
|
|
|
2980
2993
|
* @param lines
|
|
2981
2994
|
*/
|
|
2982
2995
|
static maxLengthLineIndex(lines, excludeCallBack) {
|
|
2983
|
-
let maxLength =
|
|
2996
|
+
let maxLength = -Infinity, maxIndex = -1;
|
|
2984
2997
|
for (let i = 0; i < lines.length; i++) {
|
|
2985
2998
|
if (excludeCallBack && excludeCallBack(lines[i])) continue;
|
|
2986
2999
|
const length = lines[i].length();
|
|
@@ -2991,11 +3004,27 @@ class LineSegmentUtils {
|
|
|
2991
3004
|
}
|
|
2992
3005
|
return maxIndex;
|
|
2993
3006
|
}
|
|
3007
|
+
/** 获取线段组的中心
|
|
3008
|
+
* @param lines
|
|
3009
|
+
*/
|
|
3010
|
+
static getLinesCenter(lines) {
|
|
3011
|
+
let totalWeight = 0;
|
|
3012
|
+
let x = 0;
|
|
3013
|
+
let y = 0;
|
|
3014
|
+
for (const line of lines) {
|
|
3015
|
+
const len = line.length();
|
|
3016
|
+
const center = line.center;
|
|
3017
|
+
x += center.x * len;
|
|
3018
|
+
y += center.y * len;
|
|
3019
|
+
totalWeight += len;
|
|
3020
|
+
}
|
|
3021
|
+
return new Point(x / totalWeight, y / totalWeight);
|
|
3022
|
+
}
|
|
2994
3023
|
/** 通过在同一路径上且平行的线段分组
|
|
2995
3024
|
* @param lines
|
|
2996
3025
|
*/
|
|
2997
3026
|
static groupByPathAndParallel(lines) {
|
|
2998
|
-
const pointVirtualGrid = new
|
|
3027
|
+
const pointVirtualGrid = new PointSpatialHash(), quadtree = new Quadtree(Box2.fromByLineSegment(...lines));
|
|
2999
3028
|
lines.forEach((line) => {
|
|
3000
3029
|
line.points.forEach((p2) => pointVirtualGrid.insert(p2, line));
|
|
3001
3030
|
quadtree.insert(line);
|
|
@@ -3047,7 +3076,7 @@ class LineSegmentUtils {
|
|
|
3047
3076
|
* @returns
|
|
3048
3077
|
*/
|
|
3049
3078
|
static groupByPath(lines) {
|
|
3050
|
-
const pointVirtualGrid = new
|
|
3079
|
+
const pointVirtualGrid = new PointSpatialHash();
|
|
3051
3080
|
lines.forEach((line) => line.points.forEach((p2) => pointVirtualGrid.insert(p2, line)));
|
|
3052
3081
|
function dfs(point2, group, visted2) {
|
|
3053
3082
|
const list = pointVirtualGrid.queryPoint(point2, true);
|
|
@@ -3093,7 +3122,7 @@ class LineSegmentUtils {
|
|
|
3093
3122
|
*/
|
|
3094
3123
|
static groupByLeafPath(lines) {
|
|
3095
3124
|
PointUtils.adsorb(lines.flatMap((line) => line.points));
|
|
3096
|
-
const grid = new
|
|
3125
|
+
const grid = new PointSpatialHash(), visited = /* @__PURE__ */ new Set();
|
|
3097
3126
|
lines.forEach((line) => line.points.forEach((p2) => grid.insert(p2, line)));
|
|
3098
3127
|
function dfs(point2, path, maxPath = []) {
|
|
3099
3128
|
const list = grid.queryPoint(point2, true);
|
|
@@ -3178,7 +3207,7 @@ class LineSegmentUtils {
|
|
|
3178
3207
|
lines.forEach((line) => line.currentData.fittedLine = fittedLine);
|
|
3179
3208
|
return fittedLine;
|
|
3180
3209
|
}
|
|
3181
|
-
/**
|
|
3210
|
+
/** 传入的线段全部投影为一条线段
|
|
3182
3211
|
* @param lines 请确保共线
|
|
3183
3212
|
* @returns
|
|
3184
3213
|
*/
|
|
@@ -5579,7 +5608,7 @@ class Polygon extends Array {
|
|
|
5579
5608
|
* @returns
|
|
5580
5609
|
*/
|
|
5581
5610
|
static fromByLines(lines) {
|
|
5582
|
-
const grid = new
|
|
5611
|
+
const grid = new PointSpatialHash(), points = /* @__PURE__ */ new Set();
|
|
5583
5612
|
lines.forEach((line) => line.points.forEach((p2) => grid.insert(p2, line)));
|
|
5584
5613
|
const start = lines[0].start;
|
|
5585
5614
|
let current = start;
|
|
@@ -5606,7 +5635,7 @@ class Polygon extends Array {
|
|
|
5606
5635
|
lines = LineSegmentUtils.groupByLeafPath(lines).sort((a2, b4) => b4.length - a2.length)[0];
|
|
5607
5636
|
}
|
|
5608
5637
|
if (lines.length === 1) return new Polygon(lines[0].points.map((p2) => p2.clone()));
|
|
5609
|
-
const grid = new
|
|
5638
|
+
const grid = new PointSpatialHash(), points = /* @__PURE__ */ new Set();
|
|
5610
5639
|
lines.forEach((line) => line.points.forEach((p2) => grid.insert(p2, line)));
|
|
5611
5640
|
let start = lines[0].isSameEndpointAsEnd(lines[1]) ? lines[0].end : lines[0].start;
|
|
5612
5641
|
let current = start;
|
|
@@ -6148,7 +6177,7 @@ class MiniCircles {
|
|
|
6148
6177
|
let { A, B, exitPoint = A, grid, path = /* @__PURE__ */ new Set() } = opt;
|
|
6149
6178
|
if (Array.isArray(grid)) {
|
|
6150
6179
|
const lines = grid;
|
|
6151
|
-
grid = new
|
|
6180
|
+
grid = new PointSpatialHash();
|
|
6152
6181
|
for (let i = 0; i < lines.length; i++) grid.insert(lines[i].start, lines[i]).insert(lines[i].end, lines[i]);
|
|
6153
6182
|
}
|
|
6154
6183
|
while (true) {
|
|
@@ -6188,7 +6217,7 @@ class MiniCircles {
|
|
|
6188
6217
|
* @param ringEdges
|
|
6189
6218
|
*/
|
|
6190
6219
|
miniCircle(lines, option) {
|
|
6191
|
-
const { side = 2, circleEdges = this.findCycleEntryEdges(lines) } = option ?? {}, grid =
|
|
6220
|
+
const { side = 2, circleEdges = this.findCycleEntryEdges(lines) } = option ?? {}, grid = createPointSpatialHash(lines), findSetMap = new ArrayMap();
|
|
6192
6221
|
const getBaseCircle = (line) => {
|
|
6193
6222
|
const circles = [];
|
|
6194
6223
|
line.points.forEach((point2) => {
|
|
@@ -6733,7 +6762,7 @@ function buildBayWindowGroup(lines, clear = true) {
|
|
|
6733
6762
|
LineGroupType.removeByType(line, "bayWindow");
|
|
6734
6763
|
}
|
|
6735
6764
|
});
|
|
6736
|
-
const grid =
|
|
6765
|
+
const grid = createPointSpatialHash(lines);
|
|
6737
6766
|
removeSet.clear();
|
|
6738
6767
|
bayWindowLines.forEach((bayWindowLine) => {
|
|
6739
6768
|
let { circles } = maxiCircles$1.miniCircle(lines_, { circleEdges: [bayWindowLine] });
|
|
@@ -6827,7 +6856,7 @@ function buildDoubleWallGroup_(lines_, clearInternalLine = false) {
|
|
|
6827
6856
|
let { internalEdges, circles } = maxiCircles.maxiCircles(queryLines, (circles2) => circles2.filter(isPolyHasTrajectoryPoint));
|
|
6828
6857
|
const { circles: finalCircles } = maxiCircles.mergeCircles([...circlesList, ...circles], internalEdges);
|
|
6829
6858
|
lines_.forEach((line) => LineGroupType.removeByTypes(line, ["doubleWall", "wall"]));
|
|
6830
|
-
const grid = new
|
|
6859
|
+
const grid = new PointSpatialHash(), finalCirclesSet = new Set(finalCircles.flat(2));
|
|
6831
6860
|
otherLines.forEach((line) => !finalCirclesSet.has(line) && grid.insert(line.center, line));
|
|
6832
6861
|
finalCircles.forEach((group) => {
|
|
6833
6862
|
const id2 = uuid();
|
|
@@ -7236,7 +7265,7 @@ class WallInsertObjectDrawData {
|
|
|
7236
7265
|
* @returns
|
|
7237
7266
|
*/
|
|
7238
7267
|
static handleHoleDrawData(doubleWallGroup, wall, lines = []) {
|
|
7239
|
-
const grid = new
|
|
7268
|
+
const grid = new PointSpatialHash();
|
|
7240
7269
|
lines.forEach((line) => line.points.forEach((p2) => grid.insert(p2, line)));
|
|
7241
7270
|
const holes = new ArrayMap();
|
|
7242
7271
|
const newLines = [];
|
|
@@ -7684,8 +7713,8 @@ function lineDataToThreeVJiaJson(lineSegments, angle = 0, updateGroup = true) {
|
|
|
7684
7713
|
}
|
|
7685
7714
|
};
|
|
7686
7715
|
}
|
|
7687
|
-
function
|
|
7688
|
-
const grid = new
|
|
7716
|
+
function createPointSpatialHash(lines) {
|
|
7717
|
+
const grid = new PointSpatialHash();
|
|
7689
7718
|
for (const seg of lines) {
|
|
7690
7719
|
grid.insert(seg.start, seg);
|
|
7691
7720
|
grid.insert(seg.end, seg);
|
|
@@ -7782,7 +7811,7 @@ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
7782
7811
|
__proto__: null,
|
|
7783
7812
|
ThreeVJiaJson,
|
|
7784
7813
|
WallGroupManager,
|
|
7785
|
-
|
|
7814
|
+
createPointSpatialHash,
|
|
7786
7815
|
createQuadtree,
|
|
7787
7816
|
getLineIndexByCenter,
|
|
7788
7817
|
lineDataToOriginalData,
|
|
@@ -8550,7 +8579,7 @@ class BoundExt {
|
|
|
8550
8579
|
let exteriorLines = findLines.filter((line) => line.userData.expandDirect).filter((line) => !line.userData.isBalconyRailing).filter((line) => !LineGroupType.hasType(line, "bayWindow"));
|
|
8551
8580
|
lines = lines.filter((line) => !exteriorLines.includes(line));
|
|
8552
8581
|
lines.push(...exteriorLines);
|
|
8553
|
-
const grid =
|
|
8582
|
+
const grid = createPointSpatialHash(lines), quadtree = createQuadtree(lines), arrayMap = new ArrayMap(), pointMap = /* @__PURE__ */ new Map();
|
|
8554
8583
|
let appendLines = [];
|
|
8555
8584
|
exteriorLines.forEach((line) => {
|
|
8556
8585
|
const mode = line.userData.expandDirect, direction = mode === "left" ? line.getRightDirection() : line.getLeftDirection();
|
|
@@ -8773,7 +8802,7 @@ class BayWindow {
|
|
|
8773
8802
|
// 飘窗处理
|
|
8774
8803
|
overhangTreatment(data, singleLine) {
|
|
8775
8804
|
this.singleLine = singleLine;
|
|
8776
|
-
const grid =
|
|
8805
|
+
const grid = createPointSpatialHash(Scenario.Instance.lines);
|
|
8777
8806
|
for (const i in data) {
|
|
8778
8807
|
this.bayWindowGroup = new THREE.Group();
|
|
8779
8808
|
this.dottedLinePoints.push(data[i].dottedLine);
|
|
@@ -8911,7 +8940,7 @@ class BayWindow {
|
|
|
8911
8940
|
let startingPoint;
|
|
8912
8941
|
let finishLine;
|
|
8913
8942
|
if (statuc) {
|
|
8914
|
-
const dottedGrid =
|
|
8943
|
+
const dottedGrid = createPointSpatialHash(this.singleLine);
|
|
8915
8944
|
const a2 = new Point(data.start.x, data.start.y);
|
|
8916
8945
|
const b4 = new Point(data.end.x, data.end.y);
|
|
8917
8946
|
if (dottedGrid.queryCircle(a2, 1e-4).length > 0 || dottedGrid.queryCircle(b4, 1e-4).length > 0) {
|
|
@@ -8942,7 +8971,7 @@ class BayWindow {
|
|
|
8942
8971
|
startingPoint = this.xinLine(MobileX, MobileY, data.start, data.direction);
|
|
8943
8972
|
finishLine = this.xinLine(MobileX, MobileY, data.end, data.direction);
|
|
8944
8973
|
}
|
|
8945
|
-
const grid =
|
|
8974
|
+
const grid = createPointSpatialHash(Scenario.Instance.lines);
|
|
8946
8975
|
const isDouble = grid.queryCircle(Point.from(data.start), 1e-3).some((item2) => LineGroupType.hasType(item2.userData, "doubleWall") || item2.userData?.userData.isDoor);
|
|
8947
8976
|
const isDouble1 = grid.queryCircle(Point.from(data.end), 1e-3).some((item2) => LineGroupType.hasType(item2.userData, "doubleWall") || item2.userData?.userData.isDoor);
|
|
8948
8977
|
let startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 0, wallHeightc);
|
|
@@ -9838,7 +9867,7 @@ class Scenario {
|
|
|
9838
9867
|
});
|
|
9839
9868
|
BayWindow.Instance?.overhangTreatment(bayWinList, singleLineWall);
|
|
9840
9869
|
this.TheHandlingOfTheDoor(menList);
|
|
9841
|
-
this.singleLineWallValue =
|
|
9870
|
+
this.singleLineWallValue = createPointSpatialHash(singleLineWall);
|
|
9842
9871
|
this.overallTreatmentOfSingleLineWalls(singleLineWall);
|
|
9843
9872
|
for (const g in groups) {
|
|
9844
9873
|
let wallHeight = 0;
|
|
@@ -10027,7 +10056,7 @@ class Scenario {
|
|
|
10027
10056
|
const MobileY = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, false);
|
|
10028
10057
|
let startingPoint = this.xinLine(MobileX, MobileY, data.start, 0);
|
|
10029
10058
|
let finishLine = this.xinLine(MobileX, MobileY, data.end, 1);
|
|
10030
|
-
const grid =
|
|
10059
|
+
const grid = createPointSpatialHash(this.lines);
|
|
10031
10060
|
const isDouble = grid.queryCircle(Point.from(data.start), 1e-3).some((item) => LineGroupType.hasType(item.userData, "doubleWall") || item.userData?.userData.isDoor);
|
|
10032
10061
|
const isDouble1 = grid.queryCircle(Point.from(data.end), 1e-3).some((item) => LineGroupType.hasType(item.userData, "doubleWall") || item.userData?.userData.isDoor);
|
|
10033
10062
|
let startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 0, wallHeightc);
|
|
@@ -10753,7 +10782,7 @@ class Scenario {
|
|
|
10753
10782
|
for (const o in balconyLins) {
|
|
10754
10783
|
this.installBalconys(balconyLins[o], o);
|
|
10755
10784
|
}
|
|
10756
|
-
const grid =
|
|
10785
|
+
const grid = createPointSpatialHash(this.lines);
|
|
10757
10786
|
let listS = this.correctionSorting(data);
|
|
10758
10787
|
for (const i in listS) {
|
|
10759
10788
|
if (Number(i) % 2 === 0 && Number(i) !== listS.length - 1) {
|
|
@@ -18702,7 +18731,7 @@ class DoorFind {
|
|
|
18702
18731
|
this.lines = lines;
|
|
18703
18732
|
const doors = lines.filter((line) => line.userData.isDoor), noDoorLines = lines.filter((line) => !line.userData.isDoor);
|
|
18704
18733
|
const openDoors = doors.filter((line) => !line.userData.doorDirectConnection), closeDoors = doors.filter((line) => line.userData.doorDirectConnection);
|
|
18705
|
-
this.grid =
|
|
18734
|
+
this.grid = createPointSpatialHash(noDoorLines);
|
|
18706
18735
|
this.quadtree = createQuadtree([...noDoorLines, ...closeDoors]);
|
|
18707
18736
|
openDoors.forEach((l) => l.userData.doorDirectConnection = true);
|
|
18708
18737
|
closeDoors.forEach((line) => this.findCloseDoors(line));
|
|
@@ -18712,7 +18741,7 @@ class DoorFind {
|
|
|
18712
18741
|
* 查找兄弟门(双开门)
|
|
18713
18742
|
*/
|
|
18714
18743
|
findBrotherDoor(lines) {
|
|
18715
|
-
const grid =
|
|
18744
|
+
const grid = createPointSpatialHash(lines);
|
|
18716
18745
|
const doorLines = [];
|
|
18717
18746
|
findDiscretePointLine2(lines).forEach((line) => line.userData.isDoor && doorLines.push(line));
|
|
18718
18747
|
const searchedList = [];
|
|
@@ -18743,7 +18772,7 @@ class DoorFind {
|
|
|
18743
18772
|
item.line = list[0]?.userData;
|
|
18744
18773
|
item.linePoint = list[0]?.point;
|
|
18745
18774
|
});
|
|
18746
|
-
const doorGrid = new
|
|
18775
|
+
const doorGrid = new PointSpatialHash(), minAngle = Math.PI / 180 * 170;
|
|
18747
18776
|
searchedList.forEach((item, index2) => item.line && doorGrid.insert(item.point, index2));
|
|
18748
18777
|
const removeLines = [];
|
|
18749
18778
|
searchedList.forEach((item) => {
|
|
@@ -18966,7 +18995,7 @@ class AxisAlignCorr {
|
|
|
18966
18995
|
this.lines = lines;
|
|
18967
18996
|
this.baseline = baseline;
|
|
18968
18997
|
this.excludeLines = excludeLines ?? [];
|
|
18969
|
-
this.grid =
|
|
18998
|
+
this.grid = createPointSpatialHash(lines);
|
|
18970
18999
|
}
|
|
18971
19000
|
visited = /* @__PURE__ */ new Set();
|
|
18972
19001
|
newLines = [];
|
|
@@ -19057,12 +19086,12 @@ class LineQueryer {
|
|
|
19057
19086
|
pointVirtualGrid;
|
|
19058
19087
|
quadtree;
|
|
19059
19088
|
constructor(lines) {
|
|
19060
|
-
this.pointVirtualGrid =
|
|
19089
|
+
this.pointVirtualGrid = createPointSpatialHash(lines);
|
|
19061
19090
|
this.quadtree = createQuadtree(lines);
|
|
19062
19091
|
}
|
|
19063
19092
|
update(lines) {
|
|
19064
19093
|
this.clear();
|
|
19065
|
-
this.pointVirtualGrid =
|
|
19094
|
+
this.pointVirtualGrid = createPointSpatialHash(lines);
|
|
19066
19095
|
this.quadtree = createQuadtree(lines);
|
|
19067
19096
|
}
|
|
19068
19097
|
clear() {
|
|
@@ -19115,7 +19144,7 @@ class LineQueryer {
|
|
|
19115
19144
|
}
|
|
19116
19145
|
}
|
|
19117
19146
|
function removeDangline(lines, len = 0.01, consecutive = false) {
|
|
19118
|
-
const grid =
|
|
19147
|
+
const grid = createPointSpatialHash(lines);
|
|
19119
19148
|
let defaultLines = [];
|
|
19120
19149
|
const doorLines = [];
|
|
19121
19150
|
const removeLineSet = /* @__PURE__ */ new Set();
|
|
@@ -19148,6 +19177,128 @@ function removeDangline(lines, len = 0.01, consecutive = false) {
|
|
|
19148
19177
|
WallInsertObject.recomputed(defaultLines);
|
|
19149
19178
|
return [...defaultLines, ...doorLines];
|
|
19150
19179
|
}
|
|
19180
|
+
const DELETE_SYMBOL = /* @__PURE__ */ Symbol("DELETE_SYMBOL");
|
|
19181
|
+
const INTERSECT_COUNT = /* @__PURE__ */ Symbol("INTERSECT_COUNT");
|
|
19182
|
+
function fitting(lines) {
|
|
19183
|
+
const index2 = LineSegmentUtils.maxLengthLineIndex(lines);
|
|
19184
|
+
if (index2 === -1) throw Error("未找到最长线段");
|
|
19185
|
+
const maxLine = lines[index2], center = LineSegmentUtils.getLinesCenter(lines), direct = maxLine.direction(), start = center.clone().add(direct.clone().multiplyScalar(-1)), end = center.clone().add(direct.clone().multiplyScalar(1));
|
|
19186
|
+
return new LineSegment(start, end);
|
|
19187
|
+
}
|
|
19188
|
+
function layoutDesign(lines, axis) {
|
|
19189
|
+
const blocks = lines.map((line, index2) => {
|
|
19190
|
+
const sv = axis.projectPointValue(line.start), ev = axis.projectPointValue(line.end), range = sv < ev ? [sv, ev] : [ev, sv];
|
|
19191
|
+
return { range, index: index2, rangeSize: range[1] - range[0] };
|
|
19192
|
+
});
|
|
19193
|
+
blocks.sort((a2, b4) => {
|
|
19194
|
+
if (Math.abs(a2.range[0] - b4.range[0]) < 1e-4) return b4.rangeSize - a2.rangeSize;
|
|
19195
|
+
return a2.range[0] - b4.range[0];
|
|
19196
|
+
});
|
|
19197
|
+
const newLines = [];
|
|
19198
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
19199
|
+
const block = blocks[i], line = lines[block.index], ranges = [];
|
|
19200
|
+
let start = block.range[0];
|
|
19201
|
+
for (let j = i + 1; j < blocks.length; j++) {
|
|
19202
|
+
const nextBlock = blocks[j], nextLine = lines[nextBlock.index];
|
|
19203
|
+
const overlap = Math.min(block.range[1], nextBlock.range[1]) - Math.max(block.range[0], nextBlock.range[0]);
|
|
19204
|
+
if (overlap < 0) break;
|
|
19205
|
+
else if (!(overlap >= nextBlock.rangeSize && nextLine?.currentData[INTERSECT_COUNT] === 0) && nextBlock.range[0] > start) {
|
|
19206
|
+
ranges.push([start, nextBlock.range[0]]);
|
|
19207
|
+
}
|
|
19208
|
+
start = Math.max(start, nextBlock.range[1]);
|
|
19209
|
+
}
|
|
19210
|
+
if (start < block.range[1]) ranges.push([start, block.range[1]]);
|
|
19211
|
+
for (let j = 0; j < ranges.length; j++) {
|
|
19212
|
+
const range = ranges[j], start2 = axis.pointAt(range[0]), end = axis.pointAt(range[1]);
|
|
19213
|
+
if (j === 0) line.set(start2, end);
|
|
19214
|
+
else {
|
|
19215
|
+
let newLine = line.clone();
|
|
19216
|
+
newLine.set(start2, end);
|
|
19217
|
+
newLines.push(newLine);
|
|
19218
|
+
}
|
|
19219
|
+
}
|
|
19220
|
+
if (ranges.length === 0) line.currentData[DELETE_SYMBOL] = true;
|
|
19221
|
+
}
|
|
19222
|
+
lines.push(...newLines);
|
|
19223
|
+
return lines;
|
|
19224
|
+
}
|
|
19225
|
+
class AlignToParallelSegments {
|
|
19226
|
+
/** 通过平行轴和垂直轴分组
|
|
19227
|
+
* @param verticalLines
|
|
19228
|
+
* @param parallelAxis 平行轴
|
|
19229
|
+
* @param verticalAxis 垂直轴
|
|
19230
|
+
* @param esp 垂直投影值分组距离
|
|
19231
|
+
* @param gap 平行轴投影区间间隙
|
|
19232
|
+
*/
|
|
19233
|
+
static group(lines, parallelAxis, verticalAxis, esp = 0.05, gap = 0.01) {
|
|
19234
|
+
const vls = lines.map((line) => [
|
|
19235
|
+
verticalAxis.projectPointValue(line.start),
|
|
19236
|
+
line,
|
|
19237
|
+
[parallelAxis.projectPointValue(line.start), parallelAxis.projectPointValue(line.end)].sort((a2, b4) => a2 - b4)
|
|
19238
|
+
]).sort((a2, b4) => a2[0] - b4[0]), unionFindSet = new UnionFindSet(vls.length);
|
|
19239
|
+
for (let i = 0; i < vls.length; i++) {
|
|
19240
|
+
const [ipv, _iline, [istart, iend]] = vls[i];
|
|
19241
|
+
for (let j = i + 1; j < vls.length; j++) {
|
|
19242
|
+
const [jpv, _jline, [jstart, jend]] = vls[j];
|
|
19243
|
+
if (jpv - ipv > esp) break;
|
|
19244
|
+
const overlap = Math.min(iend, jend) - Math.max(istart, jstart);
|
|
19245
|
+
if (overlap > -gap) unionFindSet.union(i, j);
|
|
19246
|
+
}
|
|
19247
|
+
}
|
|
19248
|
+
const groups = unionFindSet.getAllSets().map((v2) => v2.map((v22) => vls[v22][1]));
|
|
19249
|
+
return groups;
|
|
19250
|
+
}
|
|
19251
|
+
/** 拟合并对齐线段
|
|
19252
|
+
* @param groups
|
|
19253
|
+
* @param verticalLines
|
|
19254
|
+
*/
|
|
19255
|
+
static fittingAlignment(groups, verticalLines) {
|
|
19256
|
+
const grid = PointSpatialHash.fromByLines(verticalLines);
|
|
19257
|
+
for (let i = 0; i < groups.length; i++) {
|
|
19258
|
+
const group = groups[i];
|
|
19259
|
+
if (group.length <= 1) continue;
|
|
19260
|
+
const axisLine = fitting(group);
|
|
19261
|
+
for (let j = 0; j < group.length; j++) {
|
|
19262
|
+
const line = group[j];
|
|
19263
|
+
let intersectCount = 0;
|
|
19264
|
+
line.points.forEach((p2) => {
|
|
19265
|
+
const intersectPoints = grid.queryCircle(p2, 1e-4).map((result) => result.point);
|
|
19266
|
+
axisLine.pointAt(axisLine.projectPointValue(p2), p2);
|
|
19267
|
+
intersectPoints.forEach((point2) => point2.copy(p2));
|
|
19268
|
+
intersectCount += intersectPoints.length;
|
|
19269
|
+
});
|
|
19270
|
+
line.currentData[INTERSECT_COUNT] = intersectCount;
|
|
19271
|
+
}
|
|
19272
|
+
layoutDesign(group, axisLine);
|
|
19273
|
+
}
|
|
19274
|
+
return groups.flat().filter((line) => {
|
|
19275
|
+
delete line.currentData[INTERSECT_COUNT];
|
|
19276
|
+
if (line.length() < 1e-9) return false;
|
|
19277
|
+
if (line.currentData[DELETE_SYMBOL]) {
|
|
19278
|
+
delete line.currentData[DELETE_SYMBOL];
|
|
19279
|
+
return false;
|
|
19280
|
+
}
|
|
19281
|
+
return true;
|
|
19282
|
+
});
|
|
19283
|
+
}
|
|
19284
|
+
/** 对齐到平行线段, 请在垂直纠正(AxisAlignCorr)后使用
|
|
19285
|
+
* @param lines
|
|
19286
|
+
* @returns
|
|
19287
|
+
*/
|
|
19288
|
+
static align(lines, esp = 0.05, gap = 0.01) {
|
|
19289
|
+
const axisLine = lines[0], axisLineV = axisLine.clone().rotate(Math.PI * 0.5, axisLine.center);
|
|
19290
|
+
let [pllLines, verticalLines] = LineSegmentUtils.groupByParallelToAxis(lines, axisLine);
|
|
19291
|
+
const groups = this.group(pllLines, axisLine, axisLineV, esp, gap);
|
|
19292
|
+
pllLines = this.fittingAlignment(groups, verticalLines);
|
|
19293
|
+
verticalLines = verticalLines.filter((line) => line.length() > 1e-9);
|
|
19294
|
+
const groups2 = this.group(verticalLines, axisLineV, axisLine, esp, gap);
|
|
19295
|
+
verticalLines = this.fittingAlignment(groups2, pllLines);
|
|
19296
|
+
return [
|
|
19297
|
+
...pllLines,
|
|
19298
|
+
...verticalLines
|
|
19299
|
+
];
|
|
19300
|
+
}
|
|
19301
|
+
}
|
|
19151
19302
|
function getNextPoint(point2, line, next, width) {
|
|
19152
19303
|
if (next.length === 0) {
|
|
19153
19304
|
const direct = point2.directionFrom(line.getAnotherPoint(point2));
|
|
@@ -19158,7 +19309,7 @@ function getNextPoint(point2, line, next, width) {
|
|
|
19158
19309
|
return p2;
|
|
19159
19310
|
}
|
|
19160
19311
|
function stepElimination(lineSegments, findMinWidth = 0.1, onMerge) {
|
|
19161
|
-
const grid =
|
|
19312
|
+
const grid = createPointSpatialHash(lineSegments);
|
|
19162
19313
|
function getIntersInfo(line, point2) {
|
|
19163
19314
|
const intersList = grid.queryCircle(point2, 1e-4).filter((item) => item.point !== point2);
|
|
19164
19315
|
if (intersList.length == 0) return;
|
|
@@ -19268,12 +19419,20 @@ function stepEliminationMerge(target, _, source, oldLine) {
|
|
|
19268
19419
|
WallInsertObject.recomputed([target]);
|
|
19269
19420
|
}
|
|
19270
19421
|
function linesSmoothing(lines, _) {
|
|
19422
|
+
const other = [];
|
|
19423
|
+
lines = lines.filter((line) => {
|
|
19424
|
+
if (line.userData.isBayWindow) {
|
|
19425
|
+
other.push(line);
|
|
19426
|
+
return false;
|
|
19427
|
+
}
|
|
19428
|
+
return true;
|
|
19429
|
+
});
|
|
19271
19430
|
repetitiveTask(2, () => lines = stepElimination(lines, 0.1, stepEliminationMerge));
|
|
19272
19431
|
WallInsertObject.recomputed(lines);
|
|
19273
|
-
return lines;
|
|
19432
|
+
return [...lines, ...other];
|
|
19274
19433
|
}
|
|
19275
19434
|
function shortDistanceLink(lines, radius = 0.1) {
|
|
19276
|
-
const dpSet = findDiscretePoint(lines.filter((line) => !line.userData.isDoor)), pointVirtualGrid =
|
|
19435
|
+
const dpSet = findDiscretePoint(lines.filter((line) => !line.userData.isDoor)), pointVirtualGrid = createPointSpatialHash(dpSet.map((v2) => v2)), appendLines = [], visited = /* @__PURE__ */ new Set();
|
|
19277
19436
|
const getWeight2 = (target, point2, line) => {
|
|
19278
19437
|
if (target.weight) return target.weight;
|
|
19279
19438
|
const targetLine = target.userData, targetPoint = target.point;
|
|
@@ -19300,7 +19459,7 @@ function shortDistanceLink(lines, radius = 0.1) {
|
|
|
19300
19459
|
return [...lines, ...appendLines];
|
|
19301
19460
|
}
|
|
19302
19461
|
function linkByWindow(lines, radius = 0.1) {
|
|
19303
|
-
const pvg =
|
|
19462
|
+
const pvg = createPointSpatialHash(lines);
|
|
19304
19463
|
lines.forEach((line) => {
|
|
19305
19464
|
line.points.forEach((p2) => {
|
|
19306
19465
|
if (pvg.queryCircle(p2, 1e-3, true).length !== 0) return;
|
|
@@ -19319,7 +19478,7 @@ function linkByWindow(lines, radius = 0.1) {
|
|
|
19319
19478
|
return lines;
|
|
19320
19479
|
}
|
|
19321
19480
|
function preprocessing(lines) {
|
|
19322
|
-
const pointVirtualGrid = new
|
|
19481
|
+
const pointVirtualGrid = new PointSpatialHash(), quadtree = new Quadtree(Box2.fromByLineSegment(...lines)), doors = [];
|
|
19323
19482
|
lines.forEach((line) => {
|
|
19324
19483
|
if (line.userData.isDoor) doors.push(line);
|
|
19325
19484
|
else {
|
|
@@ -19388,12 +19547,14 @@ function correction(lines, targettLine, option) {
|
|
|
19388
19547
|
lines = lineSegmentClipping(lines, 1e-9);
|
|
19389
19548
|
lines = preprocessing(lines);
|
|
19390
19549
|
lines = AxisAlignCorr.start(lines, targettLine);
|
|
19550
|
+
lines = lineSegmentClipping(lines, 1e-9);
|
|
19551
|
+
lines = AlignToParallelSegments.align(lines);
|
|
19552
|
+
new WallInsertObject(lines).recomputed().merge();
|
|
19391
19553
|
lines = adsorption(lines, option);
|
|
19392
19554
|
lines = lineSegmentClipping(lines, 1e-9);
|
|
19393
19555
|
lines = removeDangline(lines, 0.1, false);
|
|
19394
|
-
lines = linesSmoothing(lines);
|
|
19395
19556
|
let newLines = lines.filter((line) => !line.userData.isDoor && !line.userData.isBalconyRailing);
|
|
19396
|
-
let
|
|
19557
|
+
let otherLines = lines.filter((line) => line.userData.isDoor || line.userData.isBalconyRailing);
|
|
19397
19558
|
newLines = buildBayWindowGroup(newLines, false);
|
|
19398
19559
|
const { wallGroup = true } = option ?? {};
|
|
19399
19560
|
if (wallGroup) {
|
|
@@ -19402,9 +19563,9 @@ function correction(lines, targettLine, option) {
|
|
|
19402
19563
|
newLines = buildBayWindowGroup(newLines, false);
|
|
19403
19564
|
}
|
|
19404
19565
|
new WallInsertObject(newLines).recomputed().merge();
|
|
19405
|
-
newLines.push(...doorLines);
|
|
19406
19566
|
newLines = removeDangline(newLines, 0.15, true);
|
|
19407
19567
|
newLines = linesSmoothing(newLines);
|
|
19568
|
+
newLines.push(...otherLines);
|
|
19408
19569
|
return newLines.filter((line) => line.length() > 1e-9);
|
|
19409
19570
|
}
|
|
19410
19571
|
function axisAlignCorr(lines, option, verticalReferenceLine) {
|
|
@@ -19436,7 +19597,7 @@ function boundExt(lines, { trajectory: trajectory2, onBoundExt }) {
|
|
|
19436
19597
|
return lines;
|
|
19437
19598
|
}
|
|
19438
19599
|
function doubleWallAlignment(lines) {
|
|
19439
|
-
const singleWall = lines.filter((line) => !LineGroupType.hasType(line, "doubleWall") && !line.userData.isDoor), doorLines = lines.filter((line) => line.userData.isDoor), grid =
|
|
19600
|
+
const singleWall = lines.filter((line) => !LineGroupType.hasType(line, "doubleWall") && !line.userData.isDoor), doorLines = lines.filter((line) => line.userData.isDoor), grid = createPointSpatialHash(singleWall.filter((line) => !line.userData.isDoor)), allGrid = createPointSpatialHash(lines), doubleWalls = LineGroupType.getGroupsByType(lines, "doubleWall"), offset = -DEFAULT_WALL_WIDTH * 0.5, tree = createQuadtree(doubleWalls.flat());
|
|
19440
19601
|
const newDoubleWalls = doubleWalls.flatMap((doubleWall) => {
|
|
19441
19602
|
const poly = Polygon.fromByLines2(doubleWall);
|
|
19442
19603
|
Polygon.ensureCCW(poly);
|
|
@@ -19510,7 +19671,7 @@ function doubleWallAlignment(lines) {
|
|
|
19510
19671
|
lines = lineSegmentClipping(lines);
|
|
19511
19672
|
lines.push(...doorLines);
|
|
19512
19673
|
WallInsertObject.recomputed(lines);
|
|
19513
|
-
return lines;
|
|
19674
|
+
return lines.filter((line) => line.length() > 1e-4);
|
|
19514
19675
|
}
|
|
19515
19676
|
const point = new Point();
|
|
19516
19677
|
class HeightQuery {
|
|
@@ -19570,7 +19731,7 @@ function wallHeightHandle(lineSegments, option) {
|
|
|
19570
19731
|
return lineSegments;
|
|
19571
19732
|
}
|
|
19572
19733
|
function doorSpaceHandle(lineSegments) {
|
|
19573
|
-
const noDoorLines = lineSegments.filter((line) => !line.userData.isDoor), quadtree = createQuadtree(noDoorLines), pvg =
|
|
19734
|
+
const noDoorLines = lineSegments.filter((line) => !line.userData.isDoor), quadtree = createQuadtree(noDoorLines), pvg = createPointSpatialHash(noDoorLines), doors = lineSegments.filter((line) => {
|
|
19574
19735
|
if (!line.userData.isDoor) return false;
|
|
19575
19736
|
let startCount = pvg.queryPoint(line.start, true).length;
|
|
19576
19737
|
let endCount = pvg.queryPoint(line.end, true).length;
|
|
@@ -19600,7 +19761,7 @@ function doorSpaceHandle(lineSegments) {
|
|
|
19600
19761
|
return lineSegments;
|
|
19601
19762
|
}
|
|
19602
19763
|
function removeShortDoubleWall(lineSegments) {
|
|
19603
|
-
const doubleWalls = LineGroupType.getGroupsByType(lineSegments, "doubleWall"), freePointLines = [...findDiscretePointLine2(lineSegments)].filter((line) => line.length() < 0.3), grid =
|
|
19764
|
+
const doubleWalls = LineGroupType.getGroupsByType(lineSegments, "doubleWall"), freePointLines = [...findDiscretePointLine2(lineSegments)].filter((line) => line.length() < 0.3), grid = createPointSpatialHash(doubleWalls.flat(4)), lines = freePointLines.filter((line) => grid.queryPoint(line.start).length > 0 || grid.queryPoint(line.end).length > 0), removeSet = new Set(lines);
|
|
19604
19765
|
return lineSegments.filter((line) => !removeSet.has(line));
|
|
19605
19766
|
}
|
|
19606
19767
|
const PRE_PROCESSOR = {
|
|
@@ -22135,8 +22296,8 @@ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22135
22296
|
OBB: OBB2,
|
|
22136
22297
|
PCSparseOctree,
|
|
22137
22298
|
Point,
|
|
22299
|
+
PointSpatialHash,
|
|
22138
22300
|
PointUtils,
|
|
22139
|
-
PointVirtualGrid,
|
|
22140
22301
|
Polygon,
|
|
22141
22302
|
PvgList,
|
|
22142
22303
|
Quadtree,
|
|
@@ -22459,7 +22620,7 @@ export {
|
|
|
22459
22620
|
HeightQuery as H,
|
|
22460
22621
|
LineDashed as L,
|
|
22461
22622
|
MiniCircles as M,
|
|
22462
|
-
|
|
22623
|
+
PointSpatialHash as P,
|
|
22463
22624
|
Quadtree as Q,
|
|
22464
22625
|
SelectLocalFile as S,
|
|
22465
22626
|
ThreeVJia as T,
|