From 9e73eed8138955841e6e48c69f8a18c9a8769b45 Mon Sep 17 00:00:00 2001 From: ChenX Date: Tue, 7 Nov 2023 17:20:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E7=BB=9F=E4=B8=80=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E9=81=BF=E5=85=8D=E6=9D=BF=E4=BB=B6=E9=80=A0=E5=9E=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Booloperate/__snapshots__/bool6.test.ts.snap | 2 ++ __test__/Booloperate/bool6.test.ts | 15 ++++++++++++++- .../ExtrudeEdgeGeometry2.ts | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/__test__/Booloperate/__snapshots__/bool6.test.ts.snap b/__test__/Booloperate/__snapshots__/bool6.test.ts.snap index 1639f3b05..612bc61ff 100644 --- a/__test__/Booloperate/__snapshots__/bool6.test.ts.snap +++ b/__test__/Booloperate/__snapshots__/bool6.test.ts.snap @@ -1,3 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`无法求到交集 1`] = `6966`; + +exports[`精度不一致导致的板件显示错误 1`] = `"84"`; diff --git a/__test__/Booloperate/bool6.test.ts b/__test__/Booloperate/bool6.test.ts index dd5a6cdb8..ef133c1de 100644 --- a/__test__/Booloperate/bool6.test.ts +++ b/__test__/Booloperate/bool6.test.ts @@ -1,5 +1,7 @@ +import { Board } from "../../src/DatabaseServices/Entity/Board"; import { BoolOpeartionType } from "../../src/GraphicsSystem/BoolOperateUtils"; -import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util"; +import { LoadEntityFromFileData, LoadRegionsFromFileData } from "../Utils/LoadEntity.util"; +import "../Utils/jest.util"; test('无法求到交集', () => { @@ -12,3 +14,14 @@ test('无法求到交集', () => expect(reg.Area).toMatchSnapshot(); }); + +test('精度不一致导致的板件显示错误', () => +{ + + let d = + { "file": [1, "Board", 10, 2, 100, 0, 1, 3, 71, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2663.0341099632205, -6829.664801153471, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2251.110228408969, -7614.664801153471, 15, 1], 0, 0, 1, 3, 699.9999999999995, 1158.0761184457501, 15, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, -1.6240976817373723e-16, 0, 0, 1.6240976817373723e-16, 1, 0, 0, 699.9999999999995, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -2931.1851045401936, -1380.525407665506, 735.0000000000001, 1], 0, 0, 1, 2, 4, [0, -699.9999999999995], 0, [1158.0761184457501, -699.9999999999995], 0, [1158.0761184457501, 0], 0, [0, 0], 0, true, 1, 3, 15, 1158.0761000000002, 2, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 15, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -2931.1851045401936, -1723.0254076655056, 735, 1], 0, 0, 1, 2, 4, [0, -15], 0, [1158.0761000000002, -15], 0, [1158.0761000000002, 0], 0, [0, 0], 0, true, 0, 3, 0, 0, 0, 0, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 2663.0341099632205, -6829.664801153471, 342.49999999999955, 1], 1.5, 0, 0, 0, 0, 0, 13, 2, "背板", "主卧", "下柜", "法国黄橡", "密度", "黄", 0, 0, "三合一", 2, 0, "0", "0", "0", "0", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0], "basePt": { "x": 2663.0341099632205, "y": -6844.664801153471, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }; + + let br = LoadEntityFromFileData(d)[0] as Board; + + expect(br.MeshGeometry.getAttribute("position").count).toMatchNumberSnapshot(0); +}); diff --git a/src/Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2.ts b/src/Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2.ts index 9a8cb31bb..446604047 100644 --- a/src/Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2.ts +++ b/src/Geometry/ExtrudeMeshGeomBuilder/ExtrudeEdgeGeometry2.ts @@ -1444,7 +1444,7 @@ function GetIntersection(cu1: Curve, cu2: Curve): IntersectResult[] m = new Map(); intCache.set(cu1, m); - let r = cu1.IntersectWith2(cu2, IntersectOption.ExtendNone); + let r = cu1.IntersectWith2(cu2, IntersectOption.ExtendNone, 1e-4); let cu1EndParam = cu1.EndParam; let cu2EndParam = cu2.EndParam;