修复精度过高导致的线框显示时可能多线

pull/471/head
ChenX 5 years ago
parent c3865978f0
commit 46a3856c1b

@ -14,3 +14,16 @@ test('EdgeGeometry生成', () =>
expect(line.geometry.attributes.position.count).toMatchSnapshot(); expect(line.geometry.attributes.position.count).toMatchSnapshot();
} }
}); });
test('EdgeGeometry生成2', () =>
{
let d = { "file": [1, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 3652.4820542036323, 5394.829497889616, 0, 1], 0, 0, 2, 577.5, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 200, 0, 1], 0, 0, 2, 4, [0, -200], 0, [600, -200], 0, [600, 377.49999999999994], 0, [0, 377.5], 0, true, 1, 2, 9, 577.5, 10.759448803828036, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [577.5, 0], 0, [577.5, 9], 0, [0, 9], 0, true, 0, 3, 0, 0, 0, [0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 3652.4820542036323, 5974.829497889616, 0, 1], 3, 0, 0, 0, 5, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3652.4820542036323, 5394.829497889616, 200, 1], 1, "立板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0], "basePt": { "x": 3652.4820542036323, "y": 5394.829497889616, "z": 0 } }
let brs = LoadBoardsFromFileData(d);
for (let br of brs)
{
let line = br.GetDrawObjectFromRenderType(RenderType.Wireframe) as Line;
//@ts-ignore
expect(line.geometry.attributes.position.count).toMatchSnapshot();
}
});

@ -2,6 +2,8 @@
exports[`EdgeGeometry生成 1`] = `432`; exports[`EdgeGeometry生成 1`] = `432`;
exports[`EdgeGeometry生成 2`] = `864`; exports[`EdgeGeometry生成 2`] = `860`;
exports[`EdgeGeometry生成 3`] = `146`; exports[`EdgeGeometry生成 3`] = `146`;
exports[`EdgeGeometry生成2 1`] = `110`;

@ -245,7 +245,7 @@ class FuzzPoint
private map: { [key: string]: Vector3D } = {}; private map: { [key: string]: Vector3D } = {};
GetVector(v: Vector3D) GetVector(v: Vector3D)
{ {
let key = `${ToFixed(v.x, 3)},${ToFixed(v.y, 3)},${ToFixed(v.z, 3)}`; let key = `${ToFixed(v.x, 2)},${ToFixed(v.y, 2)},${ToFixed(v.z, 2)}`;
if (key in this.map) return this.map[key]; if (key in this.map) return this.map[key];
else this.map[key] = v; else this.map[key] = v;
return v; return v;

Loading…
Cancel
Save