build-dxf 0.1.156 → 0.1.157

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +8 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.156",
3
+ "version": "0.1.157",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -9711,7 +9711,7 @@ class DoubleWallFinder {
9711
9711
  * @returns
9712
9712
  */
9713
9713
  static find(lines, obstacle = [], esp = 0.4) {
9714
- lines = LineSegmentUtils.GroupBuilder(LineSegmentUtils.group(lines, (line) => WallHole.isBeam(line) ? "beam" : "lines")).handle("lines", (lines2) => {
9714
+ lines = LineSegmentUtils.GroupBuilder(LineSegmentUtils.group(lines, (_line) => "lines")).handle("lines", (lines2) => {
9715
9715
  const parallelAxis = lines2[0], verticalAxis = parallelAxis.clone().rotate(Math.PI * 0.5), [group1, group2] = LineSegmentUtils.groupByParallelToAxis(lines2, lines2[0], 5), newLines1 = this.group(group1, parallelAxis, verticalAxis, esp), newLines2 = this.group(group2, verticalAxis, parallelAxis, esp), appendLines = newLines1.concat(newLines2);
9716
9716
  lines2 = lines2.concat(appendLines);
9717
9717
  return lines2;
@@ -23000,13 +23000,14 @@ function findRooms(lines, trajectory2) {
23000
23000
  }
23001
23001
  function removeRoomSundries(lines, { trajectory: trajectory2 }) {
23002
23002
  if (trajectory2) {
23003
- const ls2 = [...findDiscretePointLine(lines)];
23004
- const rooms = findRooms(lines, trajectory2);
23005
- const removeLines = ls2.filter((line) => {
23003
+ const rooms = findRooms(lines, trajectory2), counterMap = new CounterMap();
23004
+ findDiscretePoint(lines).forEach((l) => counterMap.increment(l));
23005
+ const ls2 = counterMap.getByCount(2), removeLines = ls2.filter((line) => {
23006
23006
  const center = line.center;
23007
- return !!rooms.find((room) => room.ploy.pointWithin(center));
23008
- });
23009
- const set2 = new Set(removeLines);
23007
+ return !!rooms.find((room) => {
23008
+ return room.ploy.pointWithin(center) && !room.lines.find((l) => l == line);
23009
+ });
23010
+ }), set2 = new Set(removeLines);
23010
23011
  lines = lines.filter((line) => !set2.has(line));
23011
23012
  }
23012
23013
  return lines;