!1869 户型:支持非Z0平面,优化多种墙体厚度情况,修复圆弧墙删除重复

pull/1871/head
ChenX 3 years ago
parent 5d76303aac
commit c1c0e90435

@ -53,16 +53,18 @@
"${workspaceFolder}/node_modules/**/*.js"
]
},
//ref:https://gist.github.com/cecilemuller/2963155d0f249c1544289b78a1cdd695?permalink_comment_id=4101212#gistcomment-4101212
{
"name": "运行 当前TS文件",
"type": "node",
"request": "launch",
"args": [
"${file}"
"${relativeFile}"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
"ts-node/register/transpile-only",
],
"cwd": "${workspaceFolder}",
"protocol": "inspector",
@ -77,8 +79,9 @@
"${file}"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
"ts-node/register/transpile-only"
],
"cwd": "${workspaceFolder}",
"protocol": "inspector",

@ -40,4 +40,5 @@
}
}
],
"commentTranslate.hover.enabled": false,
}

@ -6,6 +6,7 @@ import { RoomWallParse } from "../../src/DatabaseServices/Room/ParseService/Room
import "../Utils/jest.util";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
test('重叠墙分析丢失墙体', () =>
{
let d =
@ -91,7 +92,6 @@ test('测试重叠墙裁剪共面墙', () =>
{ "file": [9, "RoomWallLine", 1, 1, 8, 2, 102, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 7582.936440680016, 4072.8217140340644, 0, 11404.772886843615, 4072.8217140340644, 0, "RoomWallLine", 1, 1, 8, 2, 104, false, 1, 3, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 344.67866612827356, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 344.67866612827356, 0, 1], 0, 120, 8317.832194362007, 2405.5987617151795, 0, 8948.8726815918, 3591.519677371171, 0, "RoomWallLine", 1, 1, 8, 2, 105, false, 1, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 344.67866612827356, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 344.67866612827356, 0, 1], 0, 120, 8948.8726815918, 3591.519677371171, 0, 10363.27377365858, 1720.1582324828173, 0, "RoomWallLine", 1, 1, 8, 2, 120, false, 1, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -768.0628669331354, 38.73618487825024, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -768.0628669331354, 38.73618487825024, 0, 1], 0, 120, 7712.618614009485, 5843.207171574814, 0, 6464.123975442953, 5843.207171574814, 0, "RoomWallLine", 1, 1, 8, 2, 121, false, 1, 3, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 33.27857761626092, 1189.278029150868, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 33.27857761626092, 1189.278029150868, 0, 1], 0, 120, 5662.782530893557, 4692.665327302197, 0, 5662.782530893557, 4315.6736278761255, 0, "RoomWallLine", 1, 1, 8, 2, 122, false, 1, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -768.0628669331354, 38.73618487825024, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -768.0628669331354, 38.73618487825024, 0, 1], 0, 120, 6464.123975442953, 5963.207171574814, 0, 7536.78656169138, 5963.207171574814, 0, "RoomWallLine", 1, 1, 8, 2, 123, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 33.27857761626092, 1189.278029150868, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 33.27857761626092, 1189.278029150868, 0, 1], 0, 120, 5662.782530893557, 4812.665327302197, 0, 5662.782530893557, 5140.162418546004, 0, "RoomWallLine", 1, 1, 8, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1013.3654121365089, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1013.3654121365089, 0, 0, 1], 0, 120, 8556.896201417756, 6120.087165973126, 0, 11068.716186983665, 6120.087165973126, 0, "RoomWallLine", 1, 1, 8, 2, 125, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1013.3654121365089, 120, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1013.3654121365089, 120, 0, 1], 0, 360, 11068.716186983665, 6120.087165973126, 0, 8556.896201417756, 6120.087165973126, 0], "basePt": { "x": 5636.061108509818, "y": 2028.6590400585872, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallLine>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -101,7 +101,6 @@ test('月牙', () =>
{ "file": [2, "RoomWallArc", 1, 8, 2, 100, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4496.077612614482, -741.9233039201708, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1620.5085099927596, 2464.3397133082917, 0, 1], 0, 120, 2, 1756.2993543878508, 2.8629180296730343, 5.25597253402777, false, "RoomWallArc", 1, 8, 2, 106, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5234.303124908539, -226.36979470591615, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5234.303124908539, -226.36979470591615, 0, 1], 0, 120, 2, 2426.985013452408, 4.347491344276138, 3.1549543991895943, true], "basePt": { "x": 2747.5401166365295, "y": -2549.6124485068253, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -111,7 +110,6 @@ test('双圆弧', () =>
{ "file": [2, "RoomWallArc", 1, 8, 2, 112, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4660.422705930473, -1880.3542100014474, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1784.8536033087516, 1325.9088072270151, 0, 1], 0, 120, 2, 1883.3093734998954, 4.864938171508393, 4.013217893950692, true, "RoomWallLine", 1, 1, 8, 2, 113, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 3448.3559093243402, -3321.793864262949, 0, 4946.607028421562, -3741.792559738791, 0], "basePt": { "x": 3409.7409432351606, "y": -3823.6618271889474, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -122,7 +120,6 @@ test('直线与圆弧', () =>
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -143,7 +140,6 @@ test('直线圆弧2', () =>
{ "file": [2, "RoomWallArc", 1, 8, 2, 102, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2875.5691026217214, -3206.2630172284626, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 2, 1427.019691385767, 1.5707963267948963, 5.12541940334308, true, "RoomWallLine", 1, 1, 8, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 3448.3559093243402, -4513.28270861423, 0, 7698.725050158591, -4513.28270861423, 0], "basePt": { "x": 2875.569102621722, "y": -4573.28270861423, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -167,7 +163,6 @@ test('圆弧变大', () =>
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -178,7 +173,6 @@ test('圆弧与直线延伸连接错误', () =>
let walls = LoadEntityFromFileData<RoomWallArc>(d);
new RoomWallParse(true, undefined, false).Do(walls);
TestWallCurveParse(walls);
});
@ -201,3 +195,28 @@ test('因为面域分析导致的墙类型不对', () =>
w.LidCurves.forEach(TestCurveType);
}
});
test('墙厚度导致的破面', () =>
{
let d =
{ "file": [5, "RoomWallLine", 1, 1, 8, 2, 182, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 11267.149565616683, 3556.463141871858, 0, 6209.54639995897, 1648.7027338926612, 0, "RoomWallLine", 1, 1, 8, 2, 226, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 13215.079750883982, 2493.2410833026615, 0, 4095.0486089909755, 2493.2410833026615, 0, "RoomWallLine", 1, 1, 8, 2, 348, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 6209.54639995897, 1648.7027338926612, 0, 13215.079750883982, 2493.2410833026615, 0, "RoomWallLine", 1, 1, 8, 2, 350, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 19704.739930166426, 2493.2410833026615, 0, 14776.045214490798, 1417.472659820908, 0, "RoomWallLine", 1, 1, 8, 2, 351, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 14776.045214490798, 1417.472659820908, 0, 14890.795870036949, -473.79760778945183, 0], "basePt": { "x": 4095.0486089909755, "y": -477.4313566665644, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallBase>(d);
TestWallCurveParse(walls);
//
let d2 =
{ "file": [3, "RoomWallLine", 1, 1, 8, 2, 182, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 6727.498057253742, 3560.1172669223483, 0, 6209.54639995897, 1648.7027338926612, 0, "RoomWallLine", 1, 1, 8, 2, 226, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 13215.079750883982, 2493.2410833026615, 0, 4095.0486089909755, 2493.2410833026615, 0, "RoomWallLine", 1, 1, 8, 2, 348, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 6209.54639995897, 1648.7027338926612, 0, 13215.079750883982, 2493.2410833026615, 0], "basePt": { "x": 4095.0486089909755, "y": 1589.1340295891598, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
walls = LoadEntityFromFileData<RoomWallBase>(d2);
TestWallCurveParse(walls);
});
test('TODO:应该适当的延伸,应该合理的判断', () =>
{
let d =
{ "file": [4, "RoomWallLine", 1, 1, 8, 2, 100, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -4214.193942419408, -1440.0043542405433, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -4214.193942419408, -1440.0043542405433, 0, 1], 0, 240, 7967.554880617505, 3146.8334229914917, 0, 6209.54639995897, 1648.7027338926612, 0, "RoomWallLine", 1, 1, 8, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -4214.193942419408, -1440.0043542405433, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -4214.193942419408, -1440.0043542405433, 0, 1], 0, 120, 6209.54639995897, 1648.7027338926612, 0, 4161.649025909495, 2005.5816431119943, 0, "RoomWallLine", 1, 1, 8, 2, 102, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -3647.4661029658027, -2776.6553702892907, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -3647.4661029658027, -2776.6553702892907, 0, 1], 0, 240, 4095.0486089909755, 2493.2410833026615, 0, 6075.834594752296, 1322.2148703338619, 0, "RoomWallLine", 1, 1, 8, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -3647.4661029658027, -2776.6553702892907, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -3647.4661029658027, -2776.6553702892907, 0, 1], 0, 120, 6075.834594752296, 1322.2148703338619, 0, 7901.571915130223, 1858.040227258869, 0], "basePt": { "x": -62.84563758389231, "y": -1557.7388499328842, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let walls = LoadEntityFromFileData<RoomWallBase>(d);
TestWallCurveParse(walls);
});

@ -1,5 +1,101 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TODO:应该适当的延伸,应该合理的判断 1`] = `
Array [
-1741.576246932827,
-1484.12755208,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 2`] = `
Array [
-1774.4407143842418,
-1512.1338261176606,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 3`] = `
Array [
-155.66614222457792,
182.66924252571152,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 4`] = `
Array [
-2152.463399961451,
375.10121358953484,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 5`] = `
Array [
-1943.3313481374992,
338.6566048491314,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 6`] = `
Array [
-20.60144214795946,
-118.21835974764781,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 7`] = `
Array [
2006.6088105074173,
-1186.2924784250126,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 8`] = `
Array [
1954.9631610152228,
-1155.7599475125862,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 9`] = `
Array [
-122.13846064094832,
-206.59669995491095,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 10`] = `
Array [
1721.9488451640773,
505.36506225093467,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 11`] = `
Array [
1929.5257955917768,
566.28565159908,
0,
]
`;
exports[`TODO:应该适当的延伸,应该合理的判断 12`] = `
Array [
-33.7928402945563,
115.14357969433922,
0,
]
`;
exports[`共线墙盖子方向正确性 1`] = `
Array [
0,
@ -82,7 +178,7 @@ Array [
exports[`双圆弧 3`] = `
Array [
1961.16055900844,
1961.1605590084405,
-549.7642323795053,
0,
]
@ -90,7 +186,7 @@ Array [
exports[`双圆弧 4`] = `
Array [
802.0985560028485,
802.098556002848,
-224.849054254164,
0,
]
@ -278,8 +374,8 @@ Array [
exports[`圆弧合集 11`] = `
Array [
338.4395624138842,
-921.2970180023038,
338.439562413884,
-921.297018002304,
0,
]
`;
@ -310,8 +406,8 @@ Array [
exports[`圆弧合集 15`] = `
Array [
-838.0308338264758,
848.6832679602094,
-838.0308338264754,
848.6832679602089,
0,
]
`;
@ -327,7 +423,7 @@ Array [
exports[`圆弧合集 17`] = `
Array [
854.5988200686626,
-1.897590573715441e-13,
-3.795181147430882e-13,
0,
]
`;
@ -358,16 +454,16 @@ Array [
exports[`圆弧合集 21`] = `
Array [
-3318.2841006345834,
3513.288895098543,
-3318.28410063458,
3513.288895098546,
0,
]
`;
exports[`圆弧合集 22`] = `
Array [
-3198.2392210147773,
3461.220234624574,
-3198.2392210147755,
3461.220234624575,
0,
]
`;
@ -500,31 +596,327 @@ Array [
]
`;
exports[`墙厚度导致的破面 1`] = `
Array [
-2361.953972758025,
-890.9442135148124,
0,
]
`;
exports[`墙厚度导致的破面 2`] = `
Array [
-1684.688061863174,
-635.4751606534576,
0,
]
`;
exports[`墙厚度导致的破面 3`] = `
Array [
-2957.266447223081,
-1115.4999036235808,
0,
]
`;
exports[`墙厚度导致的破面 4`] = `
Array [
-1782.208520920668,
-672.2605043556164,
0,
]
`;
exports[`墙厚度导致的破面 5`] = `
Array [
-84.70384902573642,
224.55569010876843,
0,
]
`;
exports[`墙厚度导致的破面 6`] = `
Array [
42.35192451286821,
-112.27784505438444,
0,
]
`;
exports[`墙厚度导致的破面 7`] = `
Array [
-3586.6444178901857,
0,
0,
]
`;
exports[`墙厚度导致的破面 8`] = `
Array [
-3854.3543873757935,
0,
0,
]
`;
exports[`墙厚度导致的破面 9`] = `
Array [
-4267.5322335124565,
0,
0,
]
`;
exports[`墙厚度导致的破面 10`] = `
Array [
-4172.482584889758,
0,
0,
]
`;
exports[`墙厚度导致的破面 11`] = `
Array [
0,
-120,
0,
]
`;
exports[`墙厚度导致的破面 12`] = `
Array [
0,
60,
0,
]
`;
exports[`墙厚度导致的破面 13`] = `
Array [
5271.33247975336,
635.4751606534574,
0,
]
`;
exports[`墙厚度导致的破面 14`] = `
Array [
7005.533350925012,
844.5383494100004,
0,
]
`;
exports[`墙厚度导致的破面 15`] = `
Array [
7.181188453314462,
-59.56870430350136,
0,
]
`;
exports[`墙厚度导致的破面 16`] = `
Array [
-7.181188453314462,
59.56870430350136,
0,
]
`;
exports[`墙厚度导致的破面 17`] = `
Array [
-4887.604657869804,
-1066.7998447288523,
0,
]
`;
exports[`墙厚度导致的破面 18`] = `
Array [
-4969.784773481455,
-1084.7370022346554,
0,
]
`;
exports[`墙厚度导致的破面 19`] = `
Array [
-51.179028089740314,
234.47965174784258,
0,
]
`;
exports[`墙厚度导致的破面 20`] = `
Array [
107.96094818936035,
-1779.3652716122278,
0,
]
`;
exports[`墙厚度导致的破面 21`] = `
Array [
121.54036290294243,
-2003.175263608493,
0,
]
`;
exports[`墙厚度导致的破面 22`] = `
Array [
119.77972898780718,
7.267497754225133,
0,
]
`;
exports[`墙厚度导致的破面 23`] = `
Array [
-264.3367064331633,
-975.4906952677293,
0,
]
`;
exports[`墙厚度导致的破面 24`] = `
Array [
-191.4647361284733,
-706.5687966133517,
0,
]
`;
exports[`墙厚度导致的破面 25`] = `
Array [
-281.3462723080602,
-1038.2616719716443,
0,
]
`;
exports[`墙厚度导致的破面 26`] = `
Array [
-233.720833266696,
-862.5079022066495,
0,
]
`;
exports[`墙厚度导致的破面 27`] = `
Array [
-231.64586006150967,
62.77097670391504,
0,
]
`;
exports[`墙厚度导致的破面 28`] = `
Array [
-5669.596840122989,
0,
0,
]
`;
exports[`墙厚度导致的破面 29`] = `
Array [
-2202.7628626973756,
0,
0,
]
`;
exports[`墙厚度导致的破面 30`] = `
Array [
-6636.095470032647,
0,
0,
]
`;
exports[`墙厚度导致的破面 31`] = `
Array [
-2235.280245923952,
0,
0,
]
`;
exports[`墙厚度导致的破面 32`] = `
Array [
0,
-120,
0,
]
`;
exports[`墙厚度导致的破面 33`] = `
Array [
0,
60,
0,
]
`;
exports[`墙厚度导致的破面 34`] = `
Array [
5861.0615762514635,
706.5687966133514,
0,
]
`;
exports[`墙厚度导致的破面 35`] = `
Array [
7158.170300915642,
862.9391979031479,
0,
]
`;
exports[`墙厚度导致的破面 36`] = `
Array [
-7.181188453314462,
59.56870430350136,
0,
]
`;
exports[`大圆弧月牙 1`] = `
Array [
1692.4169251634871,
-114.70157416882662,
-7.359776358470561,
-1696.283388289997,
0,
]
`;
exports[`大圆弧月牙 2`] = `
Array [
-850.3049723506203,
-1604.9687843523732,
1692.4169251634876,
-114.7015741688221,
0,
]
`;
exports[`大圆弧月牙 3`] = `
Array [
1799.6110045595046,
245.64929679942895,
-850.3049723506203,
-1604.9687843523732,
0,
]
`;
exports[`大圆弧月牙 4`] = `
Array [
1799.6110045595042,
245.64929679943376,
0,
]
`;
exports[`大圆弧月牙 5`] = `
Array [
-62.064759470104036,
102.70328929454081,
@ -532,7 +924,7 @@ Array [
]
`;
exports[`大圆弧月牙 5`] = `
exports[`大圆弧月牙 6`] = `
Array [
2452.5207229477573,
412.59733475712767,
@ -540,7 +932,15 @@ Array [
]
`;
exports[`大圆弧月牙 6`] = `
exports[`大圆弧月牙 7`] = `
Array [
-2110.6348714729015,
1315.4143440222335,
0,
]
`;
exports[`大圆弧月牙 8`] = `
Array [
2334.1836661654233,
392.6890201098577,
@ -548,7 +948,7 @@ Array [
]
`;
exports[`大圆弧月牙 7`] = `
exports[`大圆弧月牙 9`] = `
Array [
-2207.970434377741,
852.9270864628846,
@ -556,7 +956,7 @@ Array [
]
`;
exports[`大圆弧月牙 8`] = `
exports[`大圆弧月牙 10`] = `
Array [
19.908314647269435,
-118.337056782334,
@ -566,13 +966,21 @@ Array [
exports[`月牙 1`] = `
Array [
1692.4169251634871,
-114.70157416882662,
-7.359776358470561,
-1696.283388289997,
0,
]
`;
exports[`月牙 2`] = `
Array [
1692.4169251634871,
-114.70157416882812,
0,
]
`;
exports[`月牙 3`] = `
Array [
-850.3049723506203,
-1604.9687843523732,
@ -580,7 +988,7 @@ Array [
]
`;
exports[`月牙 3`] = `
exports[`月牙 4`] = `
Array [
-62.064759470104036,
102.70328929454081,
@ -588,7 +996,15 @@ Array [
]
`;
exports[`月牙 4`] = `
exports[`月牙 5`] = `
Array [
-2110.6348714729015,
1315.4143440222335,
0,
]
`;
exports[`月牙 6`] = `
Array [
-2207.970434377741,
852.9270864628846,
@ -606,16 +1022,16 @@ Array [
exports[`测试盖子方向正确性 2`] = `
Array [
17.920136678846802,
29.939165672541776,
17.920136678847257,
29.93916567254263,
0,
]
`;
exports[`测试盖子方向正确性 3`] = `
Array [
19.28439029517517,
-41.62318724932243,
19.284390295175626,
-41.62318724932322,
0,
]
`;
@ -630,16 +1046,16 @@ Array [
exports[`测试盖子方向正确性 5`] = `
Array [
17.920136678846802,
29.939165672541776,
17.920136678847257,
29.93916567254263,
0,
]
`;
exports[`测试盖子方向正确性 6`] = `
Array [
19.28439029517517,
-41.62318724932243,
19.284390295175626,
-41.62318724932322,
0,
]
`;
@ -687,7 +1103,7 @@ Array [
exports[`测试重叠墙裁剪共面墙 6`] = `
Array [
656.815119681436,
1234.359449056492,
1234.3594490564924,
0,
]
`;
@ -878,16 +1294,16 @@ Array [
exports[`直线与圆弧 1`] = `
Array [
1729.705839052831,
-484.8814639276743,
1729.7058390528305,
-484.8814639276738,
0,
]
`;
exports[`直线与圆弧 2`] = `
Array [
1228.2620544368037,
-344.31374953804425,
1228.2620544368035,
-344.3137495380443,
0,
]
`;

@ -125,6 +125,9 @@
"three": "^0.122.0",
"xaop": "^1.3.3"
},
"resolutions": {
"acorn": "8.7.0"
},
"jest": {
"transform": {
"^.+\\.(js|ts|tsx)$": "ts-jest",

@ -2,7 +2,6 @@ import { Intent } from "@blueprintjs/core";
import { Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { equalv3, isPerpendicularityTo, ZAxis, ZAxisN } from "../../Geometry/GeUtils";
import { equaln } from "../../Nest/Common/Util";
import { AppToaster } from "../../UI/Components/Toaster";
import { ViewChange } from "../ViewChange";
@ -34,10 +33,8 @@ export async function FixDrawWallDir(): Promise<boolean>
await new ViewChange(ZAxisN, true).exec();
return true;
}
let ucsMtx = app.Editor.UCSMatrix;
if (!equalv3(new Vector3().setFromMatrixColumn(ucsMtx, 2), ZAxis, 1e-3))
{
@ -54,10 +51,5 @@ export async function FixDrawWallDir(): Promise<boolean>
app.Editor.SetUCSLookAt(new Vector3(0, 0, -1));
}
else if (!equaln(ucsMtx.elements[14], 0))
{
ucsMtx.elements[14] = 0;
app.Editor.UCSMatrix = ucsMtx;
}
return true;
}

@ -8,3 +8,15 @@ export function EntityUpdateWrap(ent: Entity, exec: Function)
ent.DeferUpdate();
ent.AutoUpdate = bak;
}
export function EntitysUpdateWrap(ens: Entity[], exec: Function)
{
let baks = ens.map(e => e.AutoUpdate);
exec();
for (let i = 0; i < ens.length; i++)
{
let en = ens[i];
en.DeferUpdate();
en.AutoUpdate = baks[i];
}
}

@ -95,12 +95,17 @@ export class RoomWallArc extends RoomWallBase
GetGripPoints(): Array<Vector3>
{
return [
let pts = [
this.StartPoint,
this.GetPointAtParam(0.5),
this.EndPoint,
this.Center.clone(),
];
let count = pts.length;
for (let i = 0; i < count; i++)
pts.push(pts[i].clone().setZ(pts[i].z + 2700));
return pts;
}
MoveGripPoints(indexList: Array<number>, vec: Vector3)
{

@ -155,7 +155,10 @@ export class RoomWallLine extends RoomWallBase
let ep = this.EndPoint;
let pts = [sp, midPoint(sp, ep), ep];
for (let i = 0; i < 3; i++)
pts.push(pts[i].clone().setZ(2700));
{
let p = pts[i].clone();
pts.push(p.setZ(p.z + 2700));
}
return pts;
}
@ -439,7 +442,12 @@ export class RoomWallLine extends RoomWallBase
if (this.Region)
{
let bakZ = this.Region.OCSNoClone.elements[14];
this.Region.OCSNoClone.elements[14] = this._Matrix.elements[14];
let pts = this.Region.MatrixAlignTo2(this.OCSNoClone).pts;
this.Region.OCSNoClone.elements[14] = bakZ;
let faces = ShapeUtils.triangulateShape(pts, []);
//top

@ -20,7 +20,7 @@ export class RegionReplacement
let box = flat.BoundingBox;
this.fb.add(box.min.x, box.min.y, box.max.x, box.max.y);
this.contours.push([flat.Contour.Clone(), flat.HoleDatas.map(h => UpdateTempPolyline(h).Clone())]);
this.contours.push([flat.Contour.Clone().ApplyMatrix(flat.OCSNoClone), flat.HoleDatas.map(h => UpdateTempPolyline(h).Clone().ApplyMatrix(flat.OCSNoClone))]);
});
this.fb.finish();
}

@ -6,7 +6,7 @@ import { RoomWallParse } from "./RoomWallParse";
export class RoomParse
{
walls: RoomWallBase[];
constructor(private _ExtendsWalls, private _UpdateDb: Database, private _IsCacheWallNodePoints: boolean)
constructor(private _ExtendsWalls: boolean, private _UpdateDb: Database, private _IsCacheWallNodePoints: boolean)
{
this.walls = GetAllWalls();
}

@ -1,5 +1,5 @@
import { Vector3 } from "three";
import { arrayRemoveDuplicateBySort } from "../../../Common/ArrayExt";
import { EntitysUpdateWrap } from "../../../Common/EntityUpdateWrap";
import { Status } from "../../../Common/Status";
import { Route } from "../../../Geometry/CurveMap";
import { RegionParse } from "../../../Geometry/RegionParse";
@ -34,12 +34,21 @@ import { RegionReplacement } from "./RegionReplacement";
*/
export class RoomRegionParse
{
rr: RegionReplacement;//区域替换工具
reped: Set<RoomRegion>;//已经替换的区域
oldregs: RoomRegion[];//旧的区域
/**
* @param _UpdateDb db,
*/
constructor(private _UpdateDb: Database)
{
if (this._UpdateDb)
{
this.oldregs = this._UpdateDb.ModelSpace.Entitys.filter(e => !e.IsErase && e instanceof RoomRegion) as RoomRegion[];
this.rr = new RegionReplacement(this.oldregs);
this.reped = new Set<RoomRegion>();
}
}
Do(walls: RoomWallBase[])
@ -125,50 +134,53 @@ export class RoomRegionParse
ContourTreeNode.ParseContourTree(cons);
//解析 天花板区域 内空区域
let rr: RegionReplacement;
let reped: Set<RoomRegion>;
let oldregs: RoomRegion[];
if (this._UpdateDb)
{
oldregs = this._UpdateDb.ModelSpace.Entitys.filter(e => !e.IsErase && e instanceof RoomRegion) as RoomRegion[];
rr = new RegionReplacement(oldregs);
reped = new Set<RoomRegion>();
}
for (let con of cons)
{
let routes = map.get(con.contour.Curve as Polyline);
if (con.contour.Curve.ColorIndex === 2)//天花板区域(或者柱子)
{
if (con.Depth !== 0 || con.area < 1e6)//柱子
for (let r of routes) r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Pillar;
for (let r of routes)
r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Pillar;
else
for (let r of routes) r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Outside;
for (let r of routes)
r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Outside;
//未来我们需要返回这个轮廓,以便在ue中可以绘制真正的屋顶
}
else if (con.contour.Curve.ColorIndex === 1)//内空区域
{
for (let r of routes) r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Inside;
for (let r of routes)
r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Inside;
if (this._UpdateDb)
if (this._UpdateDb && con.contour.Area > 3e5)
{
//组合外圈和网洞 画出来 就行了
let floor = new RoomFlatFloor(con.contour.Curve as Polyline, con.children.map(c => c.contour.Curve as Polyline));
let top = new RoomFlatTop(con.contour.Curve as Polyline, con.children.map(c => c.contour.Curve as Polyline));
top.Position = new Vector3(0, 0, 2700);
let floor = new RoomFlatFloor();
let top = new RoomFlatTop();
floor.OCS = con.contour.Curve.OCSNoClone;//设置坐标系 以便我们正常的应用轮廓
top.OCS = con.contour.Curve.OCSNoClone;
floor.Contour = con.contour.Curve as Polyline;
top.Contour = con.contour.Curve as Polyline;
floor.Holes = con.children.map(c => c.contour.Curve as Polyline);
top.Holes = con.children.map(c => c.contour.Curve as Polyline);
top.Move({ x: 0, y: 0, z: 2700 });//等轮廓设置完在移动 否则设置失败
let conPts = Polyline2Points(floor.Contour, false, 0)[1];
let holePts = floor.HoleDatas.map(h => Polyline2Points(UpdateTempPolyline(h), false, 0)[1]);
let pos = ParseRegionTextPos(conPts, holePts);
let oldR = rr.GetReplaceOldReg(pos);
pos.applyMatrix4(floor.OCSNoClone);
let oldR = this.rr.GetReplaceOldReg(pos);
let name = "";
if (oldR)
{
if (reped.has(oldR)) //新增
if (this.reped.has(oldR)) //新增
{
//继承信息
if (oldR.TextString)//继承名称
@ -181,14 +193,22 @@ export class RoomRegionParse
floor = oldR.Floor.Object as RoomFlatFloor;
top = oldR.Top.Object as RoomFlatTop;
EntitysUpdateWrap([floor, top, oldR], () =>
{
top.WriteAllObjectRecord();//因为修改了ocs 所以我们先记录下原始数据
top.OCS = con.contour.Curve.OCSNoClone;
floor.WriteAllObjectRecord();
floor.OCS = con.contour.Curve.OCSNoClone;
floor.UpdateContourHoles(con.contour.Curve as Polyline, con.children.map(c => c.contour.Curve as Polyline));
top.Position = new Vector3;
top.UpdateContourHoles(con.contour.Curve as Polyline, con.children.map(c => c.contour.Curve as Polyline));
top.Position = new Vector3(0, 0, 2700);
top.Move({ x: 0, y: 0, z: 2700 });//等轮廓设置完在移动 否则设置失败
oldR.Position = pos;
oldR.Area = floor.Area;
});
reped.add(oldR);
this.reped.add(oldR);
continue;
}
}
@ -205,22 +225,25 @@ export class RoomRegionParse
for (let [orgArc, arcs] of parse.ExpLineMap)
orgArc[CURVE_FACE_TYPE_KEY] = arcs[0][CURVE_FACE_TYPE_KEY];
for (let wall of walls)
{
wall.LeftCurves && arrayRemoveDuplicateBySort(wall.LeftCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
wall.RightCurves && arrayRemoveDuplicateBySort(wall.RightCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
wall.Update();
}
}
End()
{
if (this._UpdateDb)
{
for (let r of oldregs)
if (!reped.has(r))
for (let r of this.oldregs)
if (!this.reped.has(r))
{
r.Erase();
r.Floor?.Object.Erase();
r.Top?.Object.Erase();
}
}
for (let wall of walls)
{
wall.LeftCurves && arrayRemoveDuplicateBySort(wall.LeftCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
wall.RightCurves && arrayRemoveDuplicateBySort(wall.RightCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
wall.Update();
}
}
}

@ -1,7 +1,7 @@
import Flatbush from 'flatbush';
import { Box3, Vector3 } from "three";
import { arrayPushArray } from '../../../Common/ArrayExt';
import { CurveMap, Route, Vertice } from "../../../Geometry/CurveMap";
import { CurveMap, Vertice } from "../../../Geometry/CurveMap";
import { AsVector2, equalv3, midPoint, SelectNearP } from "../../../Geometry/GeUtils";
import { CalcRouteAngle, RegionParse } from "../../../Geometry/RegionParse";
import { IntersectOption } from "../../../GraphicsSystem/IntersectWith";
@ -60,6 +60,97 @@ export class RoomWallParse
* @param changeWalls ( )
*/
Do(walls: RoomWallBase[], changeWalls: RoomWallBase[] = undefined)
{
let regionPrase = new RoomRegionParse(this._UpdateDb);
const GroupWalls = (walls: RoomWallBase[], fn: (wall: RoomWallBase) => number) =>
{
let map = new Map<number, RoomWallBase[]>();
for (let w of walls)
{
let value = fn(w);
let arr = map.get(value);
if (!arr)
{
arr = [];
map.set(value, arr);
}
arr.push(w);
}
return map;
};
//按Z轴区分
let zgroupMap = GroupWalls(walls, w => Math.round(w.OCSNoClone.elements[14] * 100));
for (let [, walls] of zgroupMap)
{
// 不需要了
// let tmap = GroupWalls(walls, w => Math.round(w.Thickness * 100));
// if (tmap.size > 1 && false)//有不同厚度的墙
// {
// let orgWalls = walls.concat();
// let map = new Map<RoomWallBase, RoomWallBase[]>();
// let minThickness = Infinity;
// for (let [t] of tmap) minThickness = Math.min(t, minThickness);
// for (let [t, ws] of tmap)
// {
// if (t === minThickness) continue;
// for (let w of ws)
// {
// let o = (t - minThickness) / 200;
// let left = w.GetOffsetCurves(o)[0] as unknown as RoomWallBase;
// let right = w.GetOffsetCurves(-o)[0] as unknown as RoomWallBase;
// left.Thickness = minThickness / 100;
// right.Thickness = minThickness / 100;
// walls.push(left, right);
// map.set(w, [left, right]);
// }
// }
// this.PraseWallsFromSameFloor(walls, changeWalls);
// //天下大一统
// for (let [w, ws] of map)
// {
// for (let ww of ws)
// {
// arrayPushArray(w.LeftCurves, ww.LeftCurves);
// arrayPushArray(w.RightCurves, ww.RightCurves);
// arrayPushArray(w.LidCurves, ww.LidCurves);
// }
// const RemoveDup = (curves: Curve[]) =>
// {
// curves.sort((c1, c2) =>
// {
// return ComparePoint("xyz")(c1.StartPoint, c2.StartPoint);
// });
// arrayRemoveDuplicateBySort(curves, (c1, c2) => { return c1.Join(c2) === Status.True; });
// };
// RemoveDup(w.LeftCurves);
// RemoveDup(w.RightCurves);
// RemoveDup(w.LidCurves);
// }
// regionPrase.Do(orgWalls);
// }
// else
// {
this.PraseWallsFromSameFloor(walls, changeWalls);
regionPrase.Do(walls);
// }
}
regionPrase.End();
}
PraseWallsFromSameFloor(walls: RoomWallBase[], changeWalls: RoomWallBase[] = undefined)
{
if (this._IsCacheWallNodePoints) RoomWallParse._CacheWallNodePoints = [];
@ -96,6 +187,9 @@ export class RoomWallParse
wall.EndPoint = cu.EndPoint;
}
let orgCurveLeftMap = new Map<Curve, Curve>();
let orgCurveRightMap = new Map<Curve, Curve>();
//{打断后的曲线}指向{新生成曲线}
let curveLeftCurveMap: Map<Curve, Curve> = new Map;
let curveRightCurveMap: Map<Curve, Curve> = new Map;
@ -186,7 +280,7 @@ export class RoomWallParse
let iPam = preCurve.IntersectWith2(nowCurve, IntersectOption.ExtendBoth);
let iPts = iPam.map(p => p.pt);
let tPts = iPts.filter(p => preCurve.PtOnCurve3(p) && nowCurve.PtOnCurve3(p));
let tPts = iPam.filter(p => preCurve.ParamOnCurve(p.thisParam) && nowCurve.ParamOnCurve(p.argParam)).map(p => p.pt);
let code = EntityEncode2(preCurve, nowCurve);
let tp: Vector3;
@ -209,9 +303,9 @@ export class RoomWallParse
if (iPts.length > 0)
{
//fuck 没有括号导致的错误
//尖角时才延伸,否则补盖
let isExtend = (preR.isReverse ? iPam[0].thisParam > 1 : iPam[0].thisParam < 0)
&& (nowR.isReverse ? iPam[0].argParam > 1 : iPam[0].argParam < 0);
//尖角时才延伸,否则补盖 (延伸或者在线上)
let isExtend = (preR.isReverse ? iPam[0].thisParam > 0 : iPam[0].thisParam < 1)
&& (nowR.isReverse ? iPam[0].argParam > 0 : iPam[0].argParam < 1);
let distSq = iPts[0].distanceToSquared(v.position);
if (isExtend && distSq < 500 * 500)//尖角
@ -390,44 +484,45 @@ export class RoomWallParse
}
}
//移除过小房间的内墙(空间过小 或者 没有空间)
let regionData = new RegionParse2(undefined);
const RemoveSmallSpaceInteriorWall = (routes: Route[]) =>
{
let polyline = Polyline.Combine(routes.map(r => r.curve), 1e-3);
let space = polyline.GetOffsetCurves(-120)[0];
//现在已经不再需要移除小房间了
// //移除过小房间的内墙(空间过小 或者 没有空间)
// let regionData = new RegionParse2(undefined);
// const RemoveSmallSpaceInteriorWall = (routes: Route[]) =>
// {
// let polyline = Polyline.Combine(routes.map(r => r.curve), 1e-3);
// let space = polyline.GetOffsetCurves(-120)[0];
if (!space || space.Area < 1e4)//0.1平米
{
for (let r of routes)
{
let cu: Curve;
//因为是逆时针 所以我们删除右边的线
if (r.isReverse)
{
cu = curveLeftCurveMap.get(r.curve);
curveLeftCurveMap.delete(r.curve);
}
else
{
cu = curveRightCurveMap.get(r.curve);
curveRightCurveMap.delete(r.curve);
}
// if (!space || space.Area < 1e4)//0.1平米
// {
// for (let r of routes)
// {
// let cu: Curve;
// //因为是逆时针 所以我们删除右边的线
// if (r.isReverse)
// {
// cu = curveLeftCurveMap.get(r.curve);
// curveLeftCurveMap.delete(r.curve);
// }
// else
// {
// cu = curveRightCurveMap.get(r.curve);
// curveRightCurveMap.delete(r.curve);
// }
//还要删除补的盖子
if (cu)
{
curveStarLeftHalfLidCurveMap.delete(cu);
curveEndLeftHalfLidCurveMap.delete(cu);
// //还要删除补的盖子
// if (cu)
// {
// curveStarLeftHalfLidCurveMap.delete(cu);
// curveEndLeftHalfLidCurveMap.delete(cu);
curveStartLidCurveMap.delete(cu);
curveEndLidCurveMap.delete(cu);
}
}
}
};
regionData.RegionsInternal.forEach(RemoveSmallSpaceInteriorWall);
regionData.RegionsOutline.forEach(RemoveSmallSpaceInteriorWall);
// curveStartLidCurveMap.delete(cu);
// curveEndLidCurveMap.delete(cu);
// }
// }
// }
// };
// regionData.RegionsInternal.forEach(RemoveSmallSpaceInteriorWall);
// regionData.RegionsOutline.forEach(RemoveSmallSpaceInteriorWall);
}
//构建裁剪面
@ -443,8 +538,8 @@ export class RoomWallParse
let splitCurves = breakData._Curve2SplitCurveMap.get(orgCurve);
let orgWall = curveWallMap.get(orgCurve);
let leftStartParam = 0, leftEndParam = 1,
rightStartParam = 0, rightEndParam = 1;
let leftStartParam = 1, leftEndParam = 0,
rightStartParam = 1, rightEndParam = 0;
if (!splitCurves)
{
//左右线
@ -545,6 +640,9 @@ export class RoomWallParse
trimContours.push(contour);
orgWall.Region = pl;
orgCurveLeftMap.set(orgCurve, new Line(p1, p2));
orgCurveRightMap.set(orgCurve, new Line(p3, p4));
}
else
{
@ -589,6 +687,9 @@ export class RoomWallParse
}
trimContours.push(contour);
orgWall.Region = contour.Curve as Polyline;
orgCurveLeftMap.set(orgCurve, leftCurve);
orgCurveRightMap.set(orgCurve, rightCurve);
}
}
@ -636,7 +737,7 @@ export class RoomWallParse
this.fb.search(trim._Box.min.x - 1e-2, trim._Box.min.y - 1e-2, trim._Box.max.x + 1e-2, trim._Box.max.y + 1e-2, (id =>
{
if (id !== index)
// if (id !== index) //裁剪的好处是有些细的盖子将会消失
trim.TrimBy(trimContours[id], this.boxs[id]);
return false;
}));
@ -645,17 +746,15 @@ export class RoomWallParse
return curves as (Arc | Line)[];
};
for (let [splitCurve, offsetCurve] of curveLeftCurveMap)
for (let [orgCurve, offsetCurve] of orgCurveLeftMap)
{
let orgCurve = breakData._SplitCurve2OrgCurveMap.get(splitCurve);
let orgWall = curveWallMap.get(orgCurve);
arrayPushArray(orgWall.LeftCurves, Trim(splitCurve, offsetCurve, orgCurve[ROOM_WALL_INDEX_KEY], CurveType.Left));
arrayPushArray(orgWall.LeftCurves, Trim(orgCurve, offsetCurve, orgCurve[ROOM_WALL_INDEX_KEY], CurveType.Left));
}
for (let [splitCurve, offsetCurve] of curveRightCurveMap)
for (let [orgCurve, offsetCurve] of orgCurveRightMap)
{
let orgCurve = breakData._SplitCurve2OrgCurveMap.get(splitCurve);
let orgWall = curveWallMap.get(orgCurve);
arrayPushArray(orgWall.RightCurves, Trim(splitCurve, offsetCurve, orgCurve[ROOM_WALL_INDEX_KEY], CurveType.Right));
arrayPushArray(orgWall.RightCurves, Trim(orgCurve, offsetCurve, orgCurve[ROOM_WALL_INDEX_KEY], CurveType.Right));
}
for (let [splitCurve, offsetCurve] of curveStartLidCurveMap)
@ -697,15 +796,13 @@ export class RoomWallParse
arrayPushArray(orgWall.LidCurves, Trim(splitCurve, offsetCurve, orgCurve[ROOM_WALL_INDEX_KEY], CurveType.EndLid));
}
//区域分析需要破裂的圆弧,这里暂时不合并墙
//区域分析需要破裂的圆弧,这里暂时不合并墙(在room region parse中合并)
// for (let wall of walls)
// {
// wall.LeftCurves && arrayRemoveDuplicateBySort(wall.LeftCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
// wall.RightCurves && arrayRemoveDuplicateBySort(wall.RightCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
// }
new RoomRegionParse(this._UpdateDb).Do(walls);
SHOW_PERF && console.timeEnd("wall parse2");
}

@ -1,6 +1,7 @@
import Flatbush from 'flatbush';
import { Box3 } from "three";
import { arraySortByNumber } from '../../../Common/ArrayExt';
import { equaln } from '../../../Geometry/GeUtils';
import { Arc } from '../../Entity/Arc';
import { Line } from "../../Entity/Line";
import { RoomWallArc } from '../Entity/Wall/RoomWallArc';
@ -56,9 +57,11 @@ export class RoomWallRemoveDuplicate
{
let orgWall = walls[id];
if (type !== orgWall.constructor.name) continue;
let orgAxis = orgAxisCurve[id];
if (type === "RoomWallArc" && !equaln((orgAxis as Arc).Radius, (axis as Arc).Radius, 1e-2))
continue;
let [par1, isclose1] = getParam1.GetParamAtPoint2(orgAxis.StartPoint);
if (!isclose1) continue;
let [par2, isclose2] = getParam1.GetParamAtPoint2(orgAxis.EndPoint);

@ -2,7 +2,7 @@
"compilerOptions": {
"sourceMap": true,
"module": "CommonJS",
"target": "ES2019",
"target": "ES2021",
"noLib": false,
"moduleResolution": "node",
"skipLibCheck": true,

Loading…
Cancel
Save