!2766 优化:二维刀路切割建模产生多余线问题

pull/2749/MERGE
林三 4 months ago committed by ChenX
parent 3cf60c0974
commit 7e55354ee7

@ -24,3 +24,21 @@ test('二维刀路测试(常规)', async () =>
expect(br.MeshGeometry.getAttribute("position").count).toMatchNumberSnapshot(0);
expect(br.EdgeGeometry.getAttribute("position").count).toMatchNumberSnapshot(0);
});
test('二维刀路测试(常规) 2', async () =>
{
let brd = { "file": [1, "Board", 10, 2, 101, 0, 1, 3, 71, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 251.89454908675862, 0, 93.0690639268628, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 251.89454908675862, 0, 93.0690639268628, 1], 0, 0, 1, 3, 500, 600, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [600, 0], 0, [600, 500], 0, [0, 500], 0, true, 0, 3, 0, 0, 0, 0, 0, 20, 2, "背板", "", "", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 2, "Polyline", 10, 2, 0, 0, 0, 1, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 202.1760844748858, 195.10559360730602, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 202.1760844748858, 195.10559360730602, 0, 1], 0, 0, 1, 2, 4, [0, -57.8410388127854], 0, [54.38784246575338, -57.8410388127854], 0, [54.38784246575338, 0], 0, [0, 0], 0, true, 0, 1, 11, 0, "4810", 6, 0, "112", "11", "Polyline", 10, 2, 0, 0, 0, 1, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 2, [83.86235373858435, 370.2566887842466], -0.7061622410830409, [119.50199771689479, 188.48478524543378], 0, false, 0, 1, 11, 0, "4810", 6, 0, "112", "11", 0, null, 1, "4810", "Polyline", 10, 2, 0, 0, 0, 2, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -6, 55, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -3774.2918567833854, -3492.5110529734357, 0, 1], 0, 0, 1, 2, 10, [12, 0], 0, [0, 0], 0, [0, -38], -0.23606797749978972, [2.5, -48], 0, [2.5, -52], 0, [6, -55], 0, [9.5, -52], 0, [9.5, -48], -0.23606797749978972, [12, -38], 0, [12, 0], 0, false, 0, "", "", "", "", 0, false, 0, "", 0], "basePt": { "x": 251.89454908675862, "y": -18, "z": 93.0690639268628 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] };
let br = LoadBoardsFromFileData(brd)[0];
br.MeshGeometry;//预读取
await new Promise<void>((res, rej) =>
{
end((new Entity()).AsyncUpdated, function ()
{
res();
});
});
expect(br.EdgeGeometry.getAttribute("position").count).toMatchNumberSnapshot(0);
});

@ -3,3 +3,5 @@
exports[`二维刀路测试(常规) 1`] = `"591"`;
exports[`二维刀路测试(常规) 2`] = `"662"`;
exports[`二维刀路测试(常规) 2 1`] = `"1496"`;

@ -160,7 +160,7 @@ export class EdgesGeometry extends BufferGeometry
PolygonsOutline(polygons: PolygonRes[], coords: number[])
{
let pts: Vector3[] = [];
let ff = new FuzzyFactory();
let ff = new FuzzyFactory(3, 1e-7);
let record: { [key: string]: { p1: Vector3, p2: Vector3, count: number; }; } = {};
for (let polygon of polygons)

Loading…
Cancel
Save