From 7e55354ee7f405cd76a582938df94814f84cc8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Wed, 22 May 2024 07:50:08 +0000 Subject: [PATCH] =?UTF-8?q?!2766=20=E4=BC=98=E5=8C=96:=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E5=88=80=E8=B7=AF=E5=88=87=E5=89=B2=E5=BB=BA=E6=A8=A1=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E5=A4=9A=E4=BD=99=E7=BA=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/Board/2dpath.test.ts | 18 ++++++++++++++++++ .../Board/__snapshots__/2dpath.test.ts.snap | 2 ++ src/Geometry/EdgeGeometry.ts | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/__test__/Board/2dpath.test.ts b/__test__/Board/2dpath.test.ts index 579c0cfae..6e5486d06 100644 --- a/__test__/Board/2dpath.test.ts +++ b/__test__/Board/2dpath.test.ts @@ -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((res, rej) => + { + end((new Entity()).AsyncUpdated, function () + { + res(); + }); + }); + + expect(br.EdgeGeometry.getAttribute("position").count).toMatchNumberSnapshot(0); +}); diff --git a/__test__/Board/__snapshots__/2dpath.test.ts.snap b/__test__/Board/__snapshots__/2dpath.test.ts.snap index 899b11a84..d3e5e0002 100644 --- a/__test__/Board/__snapshots__/2dpath.test.ts.snap +++ b/__test__/Board/__snapshots__/2dpath.test.ts.snap @@ -3,3 +3,5 @@ exports[`二维刀路测试(常规) 1`] = `"591"`; exports[`二维刀路测试(常规) 2`] = `"662"`; + +exports[`二维刀路测试(常规) 2 1`] = `"1496"`; diff --git a/src/Geometry/EdgeGeometry.ts b/src/Geometry/EdgeGeometry.ts index 2c9c11b9d..81bd54535 100644 --- a/src/Geometry/EdgeGeometry.ts +++ b/src/Geometry/EdgeGeometry.ts @@ -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)