build-dxf 0.1.82 → 0.1.84
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 +80 -175
- package/src/utils/DxfSystem/utils/drawHandle/SceneAutoGenerat.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/CadPreProcessor/axisAlignCorr.d.ts +2 -2
- package/src/utils/DxfSystem/utils/lineHandle/DoubleWallHelper.d.ts +0 -1
- package/src/utils/DxfSystem/utils/tools/WallInsertObject.d.ts +2 -2
- package/src/utils/algorithmsStructures/LineSegment.d.ts +14 -2
- package/src/build copy.d.ts +0 -93
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -1454,6 +1454,14 @@ class LineSegment {
|
|
|
1454
1454
|
normal() {
|
|
1455
1455
|
return this.points[1].normal(this.points[0]);
|
|
1456
1456
|
}
|
|
1457
|
+
/**
|
|
1458
|
+
* @param line
|
|
1459
|
+
* @param t
|
|
1460
|
+
* @returns
|
|
1461
|
+
*/
|
|
1462
|
+
pointAt(t2) {
|
|
1463
|
+
return new Point(this.start.x + (this.end.x - this.start.x) * t2, this.start.y + (this.end.y - this.start.y) * t2);
|
|
1464
|
+
}
|
|
1457
1465
|
/** 膨胀为矩形
|
|
1458
1466
|
*
|
|
1459
1467
|
* @param width
|
|
@@ -2172,14 +2180,14 @@ class LineSegment {
|
|
|
2172
2180
|
* @param clippingLine
|
|
2173
2181
|
*/
|
|
2174
2182
|
static clippingByLine(target, clippingLine, callBack) {
|
|
2175
|
-
|
|
2176
|
-
const lines = this.clipping(target, [start, end].filter((i) => !!i), callBack);
|
|
2177
|
-
return lines.filter((line) => {
|
|
2178
|
-
const line0 = clippingLine.projectLineSegment(line);
|
|
2179
|
-
if (line0.length() / clippingLine.length() > 0.8) return false;
|
|
2180
|
-
return true;
|
|
2181
|
-
});
|
|
2183
|
+
return this.clippingByLines(target, [clippingLine], callBack);
|
|
2182
2184
|
}
|
|
2185
|
+
/** 通过线段组裁剪线段
|
|
2186
|
+
* @param target
|
|
2187
|
+
* @param clippingLines
|
|
2188
|
+
* @param callBack
|
|
2189
|
+
* @returns
|
|
2190
|
+
*/
|
|
2183
2191
|
static clippingByLines(target, clippingLines, callBack) {
|
|
2184
2192
|
const eps = 1e-6;
|
|
2185
2193
|
const intervals = clippingLines.map((line) => {
|
|
@@ -2192,15 +2200,38 @@ class LineSegment {
|
|
|
2192
2200
|
callBack?.(target.clone(), target);
|
|
2193
2201
|
return;
|
|
2194
2202
|
}
|
|
2203
|
+
const merged = [];
|
|
2195
2204
|
let cur = intervals[0];
|
|
2196
2205
|
for (let i = 1; i < intervals.length; i++) {
|
|
2197
2206
|
const next = intervals[i];
|
|
2198
2207
|
if (next[0] <= cur[1] + eps) {
|
|
2199
2208
|
cur[1] = Math.max(cur[1], next[1]);
|
|
2200
2209
|
} else {
|
|
2210
|
+
merged.push(cur);
|
|
2201
2211
|
cur = next;
|
|
2202
2212
|
}
|
|
2203
2213
|
}
|
|
2214
|
+
merged.push(cur);
|
|
2215
|
+
const newLines = [];
|
|
2216
|
+
let prev = 0;
|
|
2217
|
+
for (const [s, e] of merged) {
|
|
2218
|
+
if (s > prev + eps) {
|
|
2219
|
+
const newLine = new LineSegment(target.pointAt(prev), target.pointAt(s));
|
|
2220
|
+
if (newLine.length() > 1e-4) {
|
|
2221
|
+
newLines.push(newLine);
|
|
2222
|
+
callBack?.(newLine, target);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
prev = Math.max(prev, e);
|
|
2226
|
+
}
|
|
2227
|
+
if (prev < 1 - eps) {
|
|
2228
|
+
const newLine = new LineSegment(target.pointAt(prev), target.pointAt(1));
|
|
2229
|
+
if (newLine.length() > 1e-4) {
|
|
2230
|
+
newLines.push(newLine);
|
|
2231
|
+
callBack?.(newLine, target);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return newLines;
|
|
2204
2235
|
}
|
|
2205
2236
|
static constrainLine(line, base) {
|
|
2206
2237
|
const center = line.center, width = line.length();
|
|
@@ -3048,7 +3079,7 @@ class WallInsertObject {
|
|
|
3048
3079
|
if (key === "passageEntrance") {
|
|
3049
3080
|
if (type === "door") return 0.3;
|
|
3050
3081
|
}
|
|
3051
|
-
return 0;
|
|
3082
|
+
return 0.05;
|
|
3052
3083
|
}
|
|
3053
3084
|
getMinWidth(key, type) {
|
|
3054
3085
|
return WallInsertObject.getMinWidth(key, type);
|
|
@@ -6724,8 +6755,6 @@ class DoubleWallHelper {
|
|
|
6724
6755
|
quadtree
|
|
6725
6756
|
};
|
|
6726
6757
|
}
|
|
6727
|
-
static appendLine() {
|
|
6728
|
-
}
|
|
6729
6758
|
/** 补双线墙壁
|
|
6730
6759
|
* @param lines
|
|
6731
6760
|
* @param wallWidth
|
|
@@ -6740,7 +6769,7 @@ class DoubleWallHelper {
|
|
|
6740
6769
|
}
|
|
6741
6770
|
return true;
|
|
6742
6771
|
});
|
|
6743
|
-
let { resultList, quadtree } = this.findDoubleLine(lines, wallWidth),
|
|
6772
|
+
let { resultList, quadtree } = this.findDoubleLine(lines, wallWidth), removeLines = /* @__PURE__ */ new Set(), clipingMap = /* @__PURE__ */ new Map(), appendLines = [];
|
|
6744
6773
|
function addClipingMap(line, line1) {
|
|
6745
6774
|
if (!clipingMap.has(line)) clipingMap.set(line, []);
|
|
6746
6775
|
const startProj = line.projectPoint(line1.start);
|
|
@@ -6758,6 +6787,8 @@ class DoubleWallHelper {
|
|
|
6758
6787
|
}
|
|
6759
6788
|
const newLine1 = new LineSegment(project0.start.clone(), project1.start.clone());
|
|
6760
6789
|
const newLine2 = new LineSegment(project0.end.clone(), project1.end.clone());
|
|
6790
|
+
newLine1.userData.height = line0.userData.height;
|
|
6791
|
+
newLine2.userData.height = line1.userData.height;
|
|
6761
6792
|
appendLines.push(newLine1, newLine2);
|
|
6762
6793
|
addClipingMap(line0, project0);
|
|
6763
6794
|
addClipingMap(line1, project1);
|
|
@@ -6770,33 +6801,22 @@ class DoubleWallHelper {
|
|
|
6770
6801
|
quadtree.clear();
|
|
6771
6802
|
quadtree = new Quadtree(Box2.fromByLineSegment(...lines));
|
|
6772
6803
|
lines.forEach((line) => line.userData.isDoor || quadtree.insert(line));
|
|
6773
|
-
appendLines =
|
|
6774
|
-
appendLines
|
|
6775
|
-
const
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
return
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
list.forEach((line2) => {
|
|
6786
|
-
mergeLineUserData(newLine, line2);
|
|
6787
|
-
quadtree.remove(line2);
|
|
6788
|
-
removeLines.add(line2);
|
|
6789
|
-
});
|
|
6790
|
-
quadtree.insert(newLine);
|
|
6791
|
-
return newLine;
|
|
6804
|
+
appendLines = lineSegmentClipping(appendLines, 1e-9);
|
|
6805
|
+
appendLines.flatMap((line) => {
|
|
6806
|
+
const queryLines = quadtree.queryLineSegment(line).filter((item) => item.line.isParallelTo(line)).map((item) => item.line);
|
|
6807
|
+
if (queryLines.length) {
|
|
6808
|
+
const newLines = LineSegment.clippingByLines(line, queryLines);
|
|
6809
|
+
if (newLines) return newLines.forEach((line2) => {
|
|
6810
|
+
quadtree.insert(line2);
|
|
6811
|
+
lines.push(line2);
|
|
6812
|
+
});
|
|
6813
|
+
}
|
|
6814
|
+
quadtree.insert(line);
|
|
6815
|
+
lines.push(line);
|
|
6792
6816
|
});
|
|
6793
|
-
appendLines = appendLines.filter((line) => !removeLines.has(line));
|
|
6794
|
-
lines = lines.filter((line) => !removeLines.has(line));
|
|
6795
|
-
lines.push(...appendLines);
|
|
6796
6817
|
lines = lineSegmentClipping(lines, 1e-9);
|
|
6797
6818
|
quadtree.clear();
|
|
6798
6819
|
lines.push(...otherLines);
|
|
6799
|
-
Point.adsorb(lines.flatMap((line) => line.points), 1e-4);
|
|
6800
6820
|
return lines.filter((line) => line.length() > 1e-9);
|
|
6801
6821
|
}
|
|
6802
6822
|
/**
|
|
@@ -8277,67 +8297,6 @@ class DxfDataPlugin extends Pipeline {
|
|
|
8277
8297
|
DxfDataPlugin.initData(cad, this.lines);
|
|
8278
8298
|
}
|
|
8279
8299
|
}
|
|
8280
|
-
class LineQueryer {
|
|
8281
|
-
pointVirtualGrid;
|
|
8282
|
-
quadtree;
|
|
8283
|
-
constructor(lines) {
|
|
8284
|
-
this.pointVirtualGrid = createPointVirtualGrid(lines);
|
|
8285
|
-
this.quadtree = createQuadtree(lines);
|
|
8286
|
-
}
|
|
8287
|
-
update(lines) {
|
|
8288
|
-
this.clear();
|
|
8289
|
-
this.pointVirtualGrid = createPointVirtualGrid(lines);
|
|
8290
|
-
this.quadtree = createQuadtree(lines);
|
|
8291
|
-
}
|
|
8292
|
-
clear() {
|
|
8293
|
-
this.pointVirtualGrid.clear();
|
|
8294
|
-
this.quadtree.clear();
|
|
8295
|
-
}
|
|
8296
|
-
/**
|
|
8297
|
-
* @param point
|
|
8298
|
-
* @param radius
|
|
8299
|
-
* @param opt
|
|
8300
|
-
* @returns
|
|
8301
|
-
*/
|
|
8302
|
-
queryNearestPoint(point2, opt) {
|
|
8303
|
-
if (!point2) throw new Error("请传入查询点");
|
|
8304
|
-
const { resultIndex = 0, radius = 0.4, condition } = opt ?? {};
|
|
8305
|
-
const results = this.pointVirtualGrid.queryCircle(point2, radius).filter((item) => item.point !== point2).filter((item) => condition ? condition(item) : true);
|
|
8306
|
-
results.sort((a2, b4) => a2.point.distance(point2, true) - b4.point.distance(point2, true));
|
|
8307
|
-
if (results.length > resultIndex) return {
|
|
8308
|
-
point: results[resultIndex].point,
|
|
8309
|
-
line: results[resultIndex].userData
|
|
8310
|
-
};
|
|
8311
|
-
return null;
|
|
8312
|
-
}
|
|
8313
|
-
/**
|
|
8314
|
-
* @param point
|
|
8315
|
-
* @param radius
|
|
8316
|
-
* @param opt
|
|
8317
|
-
* @returns
|
|
8318
|
-
*/
|
|
8319
|
-
queryNearestLine(point2, opt) {
|
|
8320
|
-
if (!point2) throw new Error("请传入查询点");
|
|
8321
|
-
const { resultIndex = 0, radius = 0.4, condition } = opt ?? {};
|
|
8322
|
-
const results = this.quadtree.queryCircle(point2, radius).map((item) => {
|
|
8323
|
-
const projPoint = item.line.projectPoint(point2, false);
|
|
8324
|
-
if (projPoint && (!condition || condition(item, projPoint))) {
|
|
8325
|
-
if (projPoint) return {
|
|
8326
|
-
...item,
|
|
8327
|
-
distance: projPoint.distance(point2) ?? Infinity,
|
|
8328
|
-
projPoint
|
|
8329
|
-
};
|
|
8330
|
-
}
|
|
8331
|
-
return null;
|
|
8332
|
-
}).filter((i) => !!i);
|
|
8333
|
-
results.sort((a2, b4) => a2.distance - b4.distance);
|
|
8334
|
-
if (results.length > resultIndex) return {
|
|
8335
|
-
point: results[resultIndex].projPoint,
|
|
8336
|
-
line: results[resultIndex].line
|
|
8337
|
-
};
|
|
8338
|
-
return null;
|
|
8339
|
-
}
|
|
8340
|
-
}
|
|
8341
8300
|
function parallel(line, baseline) {
|
|
8342
8301
|
const currentAngle = Math.atan2(line.end.y - line.start.y, line.end.x - line.start.x);
|
|
8343
8302
|
const targetAngle = Math.atan2(baseline.end.y - baseline.start.y, baseline.end.x - baseline.start.x);
|
|
@@ -8508,66 +8467,6 @@ function preprocessing(lines) {
|
|
|
8508
8467
|
quadtree.clear();
|
|
8509
8468
|
return lines;
|
|
8510
8469
|
}
|
|
8511
|
-
function adsorption(lines, option) {
|
|
8512
|
-
const { snapThreshold: threshold = 0.2 } = option ?? {}, lineQueryer = new LineQueryer(lines), modifyManager = LineSegment.createModifyManager();
|
|
8513
|
-
function adsorptLine(point2, line) {
|
|
8514
|
-
const otherPoint = line.getAnotherPoint(point2);
|
|
8515
|
-
const direct = otherPoint.directionFrom(point2);
|
|
8516
|
-
const len = line.length();
|
|
8517
|
-
const result = lineQueryer.queryNearestLine(point2, {
|
|
8518
|
-
radius: threshold,
|
|
8519
|
-
condition: (node, projPoint) => {
|
|
8520
|
-
if (line !== node.line && node.line.isPerpendicularTo(line, 35)) {
|
|
8521
|
-
if (projPoint.distance(point2) < len) return true;
|
|
8522
|
-
const direct2 = projPoint.directionFrom(point2);
|
|
8523
|
-
return direct2.angleBetween(direct) > Math.PI * 0.5;
|
|
8524
|
-
}
|
|
8525
|
-
return false;
|
|
8526
|
-
}
|
|
8527
|
-
});
|
|
8528
|
-
if (result) return modifyManager.setPoint(line, point2, result.point.clone());
|
|
8529
|
-
}
|
|
8530
|
-
function adsorptPoint(point2, line) {
|
|
8531
|
-
const result = lineQueryer.queryNearestPoint(point2, {
|
|
8532
|
-
radius: threshold,
|
|
8533
|
-
condition(node) {
|
|
8534
|
-
const line2 = node.userData;
|
|
8535
|
-
return line2.isPerpendicularTo(line, 15);
|
|
8536
|
-
}
|
|
8537
|
-
});
|
|
8538
|
-
if (result) {
|
|
8539
|
-
const propPoint = result.line.projectPoint(point2, false);
|
|
8540
|
-
if (propPoint) {
|
|
8541
|
-
modifyManager.setPoint(line, point2, propPoint);
|
|
8542
|
-
modifyManager.setPoint(result.line, result.point, propPoint);
|
|
8543
|
-
}
|
|
8544
|
-
}
|
|
8545
|
-
}
|
|
8546
|
-
for (let i = 0; i < lines.length; i++) {
|
|
8547
|
-
const line = lines[i];
|
|
8548
|
-
line.points.map((point2) => {
|
|
8549
|
-
let results = lineQueryer.pointVirtualGrid.queryPoint(point2, true);
|
|
8550
|
-
if (results.length === 0 && lineQueryer.quadtree.queryCircle(point2, 1e-4).length < 2) adsorptLine(point2, line);
|
|
8551
|
-
});
|
|
8552
|
-
}
|
|
8553
|
-
modifyManager.modify();
|
|
8554
|
-
lines = lines.filter((line) => line.length() > 1e-9);
|
|
8555
|
-
const dpls = [...findDiscretePointLine2(lines)];
|
|
8556
|
-
lineQueryer.update(lines);
|
|
8557
|
-
for (let i = 0; i < dpls.length; i++) {
|
|
8558
|
-
const line = dpls[i];
|
|
8559
|
-
line.points.map((point2) => {
|
|
8560
|
-
let results = lineQueryer.pointVirtualGrid.queryPoint(point2, true);
|
|
8561
|
-
if (results.length === 0 && lineQueryer.quadtree.queryCircle(point2, 1e-4).length < 2) {
|
|
8562
|
-
adsorptPoint(point2, line);
|
|
8563
|
-
}
|
|
8564
|
-
});
|
|
8565
|
-
}
|
|
8566
|
-
modifyManager.modify();
|
|
8567
|
-
lineQueryer.clear();
|
|
8568
|
-
Point.adsorb(lines.flatMap((line) => line.points), 1e-4, "first");
|
|
8569
|
-
return lines;
|
|
8570
|
-
}
|
|
8571
8470
|
function removeShortLine(lines, len = 0.01) {
|
|
8572
8471
|
let defaultLines = [], doorLines = [];
|
|
8573
8472
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -8606,9 +8505,9 @@ function breakpointMerging(lines) {
|
|
|
8606
8505
|
function axisAlignCorr$1(lines, targettLine, option) {
|
|
8607
8506
|
lines = lines.map((line) => line.clone());
|
|
8608
8507
|
lines = breakpointMerging(lines);
|
|
8508
|
+
lines = lineSegmentClipping(lines, 1e-9);
|
|
8609
8509
|
lines = preprocessing(lines);
|
|
8610
8510
|
lines = AxisAlignCorr.start(lines, targettLine);
|
|
8611
|
-
lines = adsorption(lines, option);
|
|
8612
8511
|
lines = lineSegmentClipping(lines, 1e-9);
|
|
8613
8512
|
lines = removeShortLine(lines, 0.15);
|
|
8614
8513
|
let newLines = lines.filter((line) => !line.userData.isDoor);
|
|
@@ -8625,6 +8524,7 @@ function axisAlignCorr$1(lines, targettLine, option) {
|
|
|
8625
8524
|
newLines.push(...doorLines);
|
|
8626
8525
|
Point.adsorb(newLines.flatMap((line) => line.points), 1e-4);
|
|
8627
8526
|
lines = removeShortLine(lines, 0.05);
|
|
8527
|
+
lines = breakpointMerging(lines);
|
|
8628
8528
|
return newLines;
|
|
8629
8529
|
}
|
|
8630
8530
|
class BoundExt {
|
|
@@ -10166,8 +10066,8 @@ class Scenario {
|
|
|
10166
10066
|
new THREE.LineBasicMaterial({
|
|
10167
10067
|
color: 65280
|
|
10168
10068
|
});
|
|
10169
|
-
const MobileX = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, DEFAULT_WALL_HALF_WIDTH, true);
|
|
10170
|
-
const MobileY = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, DEFAULT_WALL_HALF_WIDTH, false);
|
|
10069
|
+
const MobileX = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, true);
|
|
10070
|
+
const MobileY = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, false);
|
|
10171
10071
|
let startingPoint = this.xinLine(MobileX, MobileY, data.start, 0);
|
|
10172
10072
|
let finishLine = this.xinLine(MobileX, MobileY, data.end, 1);
|
|
10173
10073
|
const grid = createPointVirtualGrid(this.lines);
|
|
@@ -10317,13 +10217,17 @@ class Scenario {
|
|
|
10317
10217
|
// 窗的处理
|
|
10318
10218
|
windowTreatment(dblWin, mesh, wallHeight) {
|
|
10319
10219
|
const doorList = dblWin;
|
|
10320
|
-
const MobileX = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, doorList.userData.wallWidth ? doorList.userData.wallWidth : 0.5, true);
|
|
10321
|
-
const MobileY = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, doorList.userData.wallWidth ? doorList.userData.wallWidth : 0.5, false);
|
|
10220
|
+
const MobileX = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, doorList.userData.wallWidth ? doorList.userData.wallWidth + 1e-3 : 0.5, true);
|
|
10221
|
+
const MobileY = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, doorList.userData.wallWidth ? doorList.userData.wallWidth + 1e-3 : 0.5, false);
|
|
10322
10222
|
let startingPoint = this.xinLine(MobileX, MobileY, doorList.start, wallHeight);
|
|
10323
10223
|
let finishLine = this.xinLine(MobileX, MobileY, doorList.end, wallHeight);
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10224
|
+
let x = MobileX > 0 ? 3e-3 : -3e-3;
|
|
10225
|
+
let y = MobileY > 0 ? 3e-3 : -3e-3;
|
|
10226
|
+
let startingPoint1 = this.xinLine1(y, x, startingPoint[0], startingPoint[1], 0, wallHeight);
|
|
10227
|
+
let finishLine1 = this.xinLine1(y, x, finishLine[0], finishLine[1], 1, wallHeight);
|
|
10228
|
+
startingPoint1.push(finishLine1[1]);
|
|
10229
|
+
startingPoint1.push(finishLine1[0]);
|
|
10230
|
+
return this.winHoleOpening(startingPoint1, mesh, dblWin.userData.groundClearance, dblWin.userData.height);
|
|
10327
10231
|
}
|
|
10328
10232
|
windowTreatment1(dblWin, mesh, wallHeight) {
|
|
10329
10233
|
const doorList = dblWin;
|
|
@@ -10339,8 +10243,8 @@ class Scenario {
|
|
|
10339
10243
|
TheHandlingOfTheDoor1(data) {
|
|
10340
10244
|
const wallHeightc = data.userData.height ? data.userData.height : this.wallHeight;
|
|
10341
10245
|
const doorList = data;
|
|
10342
|
-
const MobileX = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, DEFAULT_WALL_HALF_WIDTH, true);
|
|
10343
|
-
const MobileY = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, DEFAULT_WALL_HALF_WIDTH, false);
|
|
10246
|
+
const MobileX = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, true);
|
|
10247
|
+
const MobileY = this.angleToXAxisDegrees(doorList.start.x, doorList.start.y, doorList.end.x, doorList.end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, false);
|
|
10344
10248
|
let startingPoint = this.xinLine(MobileX, MobileY, doorList.start, doorList.userData.height ? doorList.userData.height : this.wallHeight);
|
|
10345
10249
|
let finishLine = this.xinLine(MobileX, MobileY, doorList.end, doorList.userData.height ? doorList.userData.height : this.wallHeight);
|
|
10346
10250
|
const quadtree = createQuadtree(this.lines);
|
|
@@ -10388,8 +10292,8 @@ class Scenario {
|
|
|
10388
10292
|
const dy = point2.y - point1.y;
|
|
10389
10293
|
const angleRad = Math.atan2(dy, dx);
|
|
10390
10294
|
const distance2 = point1.distanceTo(point2);
|
|
10391
|
-
const MobileX = this.angleToXAxisDegrees(doorList[i].start.x, doorList[i].start.y, doorList[i].end.x, doorList[i].end.y, DEFAULT_WALL_HALF_WIDTH, true);
|
|
10392
|
-
const MobileY = this.angleToXAxisDegrees(doorList[i].start.x, doorList[i].start.y, doorList[i].end.x, doorList[i].end.y, DEFAULT_WALL_HALF_WIDTH, false);
|
|
10295
|
+
const MobileX = this.angleToXAxisDegrees(doorList[i].start.x, doorList[i].start.y, doorList[i].end.x, doorList[i].end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, true);
|
|
10296
|
+
const MobileY = this.angleToXAxisDegrees(doorList[i].start.x, doorList[i].start.y, doorList[i].end.x, doorList[i].end.y, DEFAULT_WALL_HALF_WIDTH + 0.01, false);
|
|
10393
10297
|
let startingPoint = this.xinLine(MobileX, MobileY, doorList[i].start, doorList[i].userData.height ? doorList[i].userData.height : this.wallHeight);
|
|
10394
10298
|
let finishLine = this.xinLine(MobileX, MobileY, doorList[i].end, doorList[i].userData.height ? doorList[i].userData.height : this.wallHeight);
|
|
10395
10299
|
const quadtree = createQuadtree(this.lines);
|
|
@@ -10747,12 +10651,14 @@ class Scenario {
|
|
|
10747
10651
|
xinLine1(x, y, pointa, pointb, num, wallHeight) {
|
|
10748
10652
|
let point1;
|
|
10749
10653
|
let point2;
|
|
10654
|
+
let xx = x > 0 ? x + -1e-3 : 1e-3;
|
|
10655
|
+
let yy = y > 0 ? y + -1e-3 : 1e-3;
|
|
10750
10656
|
if (num === 0) {
|
|
10751
|
-
point1 = new THREE.Vector3(pointa.x -
|
|
10752
|
-
point2 = new THREE.Vector3(pointb.x -
|
|
10657
|
+
point1 = new THREE.Vector3(pointa.x - xx, pointa.y - yy, wallHeight);
|
|
10658
|
+
point2 = new THREE.Vector3(pointb.x - xx, pointb.y - yy, wallHeight);
|
|
10753
10659
|
} else {
|
|
10754
|
-
point1 = new THREE.Vector3(pointa.x +
|
|
10755
|
-
point2 = new THREE.Vector3(pointb.x +
|
|
10660
|
+
point1 = new THREE.Vector3(pointa.x + xx, pointa.y + yy, wallHeight);
|
|
10661
|
+
point2 = new THREE.Vector3(pointb.x + xx, pointb.y + yy, wallHeight);
|
|
10756
10662
|
}
|
|
10757
10663
|
return [point1, point2];
|
|
10758
10664
|
}
|
|
@@ -18678,10 +18584,11 @@ class SceneAutoGenerat {
|
|
|
18678
18584
|
return geometry;
|
|
18679
18585
|
}
|
|
18680
18586
|
getDoorAll(lines) {
|
|
18681
|
-
return lines.filter((line) => line.userData.isDoor ||
|
|
18587
|
+
return lines.filter((line) => line.userData.isDoor || line.userData.isPassageEntrance);
|
|
18682
18588
|
}
|
|
18683
18589
|
buildPlane(lines) {
|
|
18684
|
-
lines = lineSegmentClipping(lines, 0);
|
|
18590
|
+
lines = lineSegmentClipping(lines.map((line) => line.clone()), 0);
|
|
18591
|
+
Point.adsorb(lines.flatMap((line) => line.points), 1e-4);
|
|
18685
18592
|
LineSegment.groupByPath(lines).forEach((group, i) => {
|
|
18686
18593
|
const removeSet = findDiscretePointLine2(group, null, true);
|
|
18687
18594
|
let lines2 = group.filter((line) => !removeSet.has(line) && !line.userData.isBayWindow);
|
|
@@ -19144,9 +19051,7 @@ function doubleWallAlignment(lines) {
|
|
|
19144
19051
|
lines = [singleWall, newDoubleWalls].flat(10);
|
|
19145
19052
|
lines = LineSegmentUndirectedGraph.breakpointMerging(lines, mergeLineUserData);
|
|
19146
19053
|
lines = lineSegmentClipping(lines, 1e-9);
|
|
19147
|
-
TEST = true;
|
|
19148
19054
|
lines = buildDoubleWallGroup(lines);
|
|
19149
|
-
TEST = false;
|
|
19150
19055
|
lines.push(...doorLines);
|
|
19151
19056
|
WallInsertObject.recomputed(lines);
|
|
19152
19057
|
return lines;
|
|
@@ -12,7 +12,7 @@ export declare class SceneAutoGenerat {
|
|
|
12
12
|
constructor(lines: LineSegment[], itemList: any[], z: number, trajectory?: any);
|
|
13
13
|
init(): Promise<void>;
|
|
14
14
|
private createGeometryByLines;
|
|
15
|
-
getDoorAll(lines: LineSegment[]): LineSegment<
|
|
15
|
+
getDoorAll(lines: LineSegment<LineUserData>[]): LineSegment<LineUserData>[];
|
|
16
16
|
buildPlane(lines: LineSegment<LineUserData>[]): void;
|
|
17
17
|
wallGroup: Group | null;
|
|
18
18
|
/** 构建墙壁
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LineSegment } from '../../../../algorithmsStructures/LineSegment';
|
|
2
|
-
import { SetDataOption } from '../../../type';
|
|
2
|
+
import { LineUserData, SetDataOption } from '../../../type';
|
|
3
3
|
/** 轴对齐垂直纠正
|
|
4
4
|
* @param lines
|
|
5
5
|
* @param option
|
|
6
6
|
* @param verticalReferenceLine
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function axisAlignCorr(lines: LineSegment[], option: SetDataOption, verticalReferenceLine?: LineSegment): LineSegment<any>[];
|
|
9
|
+
export declare function axisAlignCorr(lines: LineSegment<LineUserData>[], option: SetDataOption, verticalReferenceLine?: LineSegment): LineSegment<any>[];
|
|
@@ -41,8 +41,8 @@ export declare class WallInsertObject {
|
|
|
41
41
|
* @param line
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
|
-
static getMinWidth(key: InsertObjectKey, type?: 'door'): 0 | 0.
|
|
45
|
-
getMinWidth(key: InsertObjectKey, type?: 'door'): 0 | 0.
|
|
44
|
+
static getMinWidth(key: InsertObjectKey, type?: 'door'): 0.3 | 0.05;
|
|
45
|
+
getMinWidth(key: InsertObjectKey, type?: 'door'): 0.3 | 0.05;
|
|
46
46
|
static clear(target: LineSegment, key: InsertObjectKey): void;
|
|
47
47
|
/**
|
|
48
48
|
* 重新计算
|
|
@@ -103,6 +103,12 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
103
103
|
* 获取发向量
|
|
104
104
|
*/
|
|
105
105
|
normal(): Point<Record<string, any>>;
|
|
106
|
+
/**
|
|
107
|
+
* @param line
|
|
108
|
+
* @param t
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
pointAt(t: number): Point<Record<string, any>>;
|
|
106
112
|
/** 膨胀为矩形
|
|
107
113
|
*
|
|
108
114
|
* @param width
|
|
@@ -295,8 +301,14 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
295
301
|
* @param target
|
|
296
302
|
* @param clippingLine
|
|
297
303
|
*/
|
|
298
|
-
static clippingByLine(target: LineSegment, clippingLine: LineSegment, callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[];
|
|
299
|
-
|
|
304
|
+
static clippingByLine(target: LineSegment, clippingLine: LineSegment, callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[] | undefined;
|
|
305
|
+
/** 通过线段组裁剪线段
|
|
306
|
+
* @param target
|
|
307
|
+
* @param clippingLines
|
|
308
|
+
* @param callBack
|
|
309
|
+
* @returns
|
|
310
|
+
*/
|
|
311
|
+
static clippingByLines(target: LineSegment, clippingLines: LineSegment[], callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[] | undefined;
|
|
300
312
|
static constrainLine(line: LineSegment, base: LineSegment): LineSegment<Record<string, any>>;
|
|
301
313
|
/** 创建线段修改管理器
|
|
302
314
|
* @returns
|
package/src/build copy.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { DxfSystem } from './utils/DxfSystem';
|
|
2
|
-
import { LineUserData, OriginalDataItem, SetDataOption } from './utils/DxfSystem/type';
|
|
3
|
-
import { WhiteModel } from './utils/DxfSystem/plugin/ModelDataPlugin/components/WhiteModel';
|
|
4
|
-
import { LineSegment } from './utils';
|
|
5
|
-
import * as THREE from "three";
|
|
6
|
-
export { Dxf } from './utils/DxfSystem/components/Dxf';
|
|
7
|
-
export * from './utils/DxfSystem/DxfSystem';
|
|
8
|
-
export * as ModelDataPlugin from './utils/DxfSystem/plugin/ModelDataPlugin';
|
|
9
|
-
export * as utils from './utils';
|
|
10
|
-
/** 快捷创建编辑器
|
|
11
|
-
* @param dom
|
|
12
|
-
* @param camera
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export declare function createEditor(dom: HTMLDivElement, camera?: THREE.Camera, orbitControls?: boolean, viewPermission?: 'admin'): Promise<{
|
|
16
|
-
dxfSystem: DxfSystem;
|
|
17
|
-
getFileAll: () => Promise<{
|
|
18
|
-
dxf: File;
|
|
19
|
-
obj: File;
|
|
20
|
-
glb: File;
|
|
21
|
-
gltf: File;
|
|
22
|
-
json: File;
|
|
23
|
-
jpg: File;
|
|
24
|
-
correctionDxf: File;
|
|
25
|
-
}>;
|
|
26
|
-
}>;
|
|
27
|
-
/**
|
|
28
|
-
* @param originData
|
|
29
|
-
* @param trajectory
|
|
30
|
-
* @deprecated 已废弃,请勿使用
|
|
31
|
-
*/
|
|
32
|
-
export declare function getModels(originData: OriginalDataItem[], trajectory: any, itemList: any): Promise<{
|
|
33
|
-
glb: File;
|
|
34
|
-
gltf: File;
|
|
35
|
-
}>;
|
|
36
|
-
type HandleJsonOption = {
|
|
37
|
-
/** json数据或路径 */
|
|
38
|
-
json: string | OriginalDataItem[];
|
|
39
|
-
trajectory?: string | Record<string, any>;
|
|
40
|
-
itemInfo?: string | Record<string, any>;
|
|
41
|
-
axisAlignCorr?: boolean;
|
|
42
|
-
axisAlignCorrOption?: SetDataOption;
|
|
43
|
-
doorFind?: boolean;
|
|
44
|
-
download?: {
|
|
45
|
-
json?: string;
|
|
46
|
-
dxf?: string;
|
|
47
|
-
image?: string;
|
|
48
|
-
correctionJson?: string;
|
|
49
|
-
correctionDxf?: string;
|
|
50
|
-
correctionImage?: string;
|
|
51
|
-
gltf?: string;
|
|
52
|
-
glb?: string;
|
|
53
|
-
obj?: string;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
/** 快捷构建需要的json文件
|
|
57
|
-
* @param opt
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
export declare function buildJson(opt: HandleJsonOption): Promise<{
|
|
61
|
-
dxfSystem: DxfSystem;
|
|
62
|
-
threeVJia: import('./utils').Component<{}> | null;
|
|
63
|
-
whiteModel: WhiteModel | null;
|
|
64
|
-
}>;
|
|
65
|
-
/** 获取所有文件数据
|
|
66
|
-
* @param dxfSystem
|
|
67
|
-
*/
|
|
68
|
-
export declare function getFileAll(dxfSystem?: DxfSystem): Promise<{
|
|
69
|
-
dxf: File;
|
|
70
|
-
obj: File;
|
|
71
|
-
glb: File;
|
|
72
|
-
gltf: File;
|
|
73
|
-
json: File;
|
|
74
|
-
jpg: File;
|
|
75
|
-
correctionDxf: File;
|
|
76
|
-
}>;
|
|
77
|
-
/** 获取全局DxfSystem
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
export declare function getGlobalDxfSystem(): DxfSystem | null;
|
|
81
|
-
/** 检测原始数据线段一侧是否属于环
|
|
82
|
-
* @param lineData
|
|
83
|
-
* @param startIndex
|
|
84
|
-
* @param direction
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
export declare function hasCircle(lineData: OriginalDataItem[], startIndex: number, direction: any): {
|
|
88
|
-
readonly originalIndices: number[];
|
|
89
|
-
readonly indices: number[];
|
|
90
|
-
circle: LineSegment<Record<string, any>>[];
|
|
91
|
-
originalLines: LineSegment<LineUserData>[];
|
|
92
|
-
lines: LineSegment<Record<string, any>>[];
|
|
93
|
-
} | null;
|