修复:统一精度避免板件造型显示错误

pull/2465/MERGE
ChenX 11 months ago
parent a8dffc019d
commit 9e73eed813

@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`无法求到交集 1`] = `6966`; exports[`无法求到交集 1`] = `6966`;
exports[`精度不一致导致的板件显示错误 1`] = `"84"`;

@ -1,5 +1,7 @@
import { Board } from "../../src/DatabaseServices/Entity/Board";
import { BoolOpeartionType } from "../../src/GraphicsSystem/BoolOperateUtils"; import { BoolOpeartionType } from "../../src/GraphicsSystem/BoolOperateUtils";
import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util"; import { LoadEntityFromFileData, LoadRegionsFromFileData } from "../Utils/LoadEntity.util";
import "../Utils/jest.util";
test('无法求到交集', () => test('无法求到交集', () =>
{ {
@ -12,3 +14,14 @@ test('无法求到交集', () =>
expect(reg.Area).toMatchSnapshot(); 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);
});

@ -1444,7 +1444,7 @@ function GetIntersection(cu1: Curve, cu2: Curve): IntersectResult[]
m = new Map(); m = new Map();
intCache.set(cu1, m); 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 cu1EndParam = cu1.EndParam;
let cu2EndParam = cu2.EndParam; let cu2EndParam = cu2.EndParam;

Loading…
Cancel
Save