!1122 修复:相交精度导致的走刀问题

pull/1122/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 966dc69c7c
commit f30df1b260

@ -250,7 +250,7 @@ exports[`超级复杂造型01 1`] = `"5230.46984"`;
exports[`超级复杂造型01 2`] = `"23338.03268"`; exports[`超级复杂造型01 2`] = `"23338.03268"`;
exports[`超级复杂造型01 3`] = `"11855.39980"`; exports[`超级复杂造型01 3`] = `"11855.39979"`;
exports[`超级复杂造型01 4`] = `"9.89484"`; exports[`超级复杂造型01 4`] = `"9.89484"`;

@ -148,3 +148,11 @@ test('直线和圆相切', () =>
let pts = cus[0].IntersectWith(cus[1], 0); let pts = cus[0].IntersectWith(cus[1], 0);
expect(pts).toMatchSnapshot(); expect(pts).toMatchSnapshot();
}); });
test("圆弧相交精度调整", () =>
{
let data = { "file": [2, "Arc", 8, 2, 134, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -30.303763742321802, 350.79539874943686, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -30.303763742321802, 350.79539874943686, 0, 1], 0, 2, 3.0000000000000084, 0, 1.686785963338877, false, "Arc", 8, 2, 135, false, 1, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.303763742321621, 213.47228144573236, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.303763742321621, 213.47228144573236, 0, 1], 0, 2, 141.25208333333353, 1.6629607907756918, 2.5287104082377034, false], "basePt": { "x": -129.84704567597646, "y": 294.72436477906575, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let cus = LoadEntityFromFileData(data) as Array<Curve>;
let pts = cus[0].IntersectWith(cus[1], 0);
expect(pts.length).toBe(2);
});

@ -88,7 +88,7 @@ exports[`圆求交错误导致的线丢失 1`] = `4148.6552754623435`;
exports[`圆求交错误导致的线丢失 2`] = `4425.280774659386`; exports[`圆求交错误导致的线丢失 2`] = `4425.280774659386`;
exports[`圆求交错误导致的线丢失 3`] = `4021.90031602838`; exports[`圆求交错误导致的线丢失 3`] = `4021.9003150863045`;
exports[`圆求交错误导致的线丢失 4`] = `4581.224228650713`; exports[`圆求交错误导致的线丢失 4`] = `4581.224228650713`;
@ -96,7 +96,7 @@ exports[`圆求交错误导致的线丢失 5`] = `3900.607880862771`;
exports[`圆求交错误导致的线丢失 6`] = `4757.468532252452`; exports[`圆求交错误导致的线丢失 6`] = `4757.468532252452`;
exports[`圆求交错误导致的线丢失 7`] = `3783.748626939053`; exports[`圆求交错误导致的线丢失 7`] = `3783.748625630569`;
exports[`圆求交错误导致的线丢失 8`] = `4972.0124797019525`; exports[`圆求交错误导致的线丢失 8`] = `4972.0124797019525`;
@ -200,11 +200,11 @@ exports[`精度过高导致直连失败 2`] = `"32040.01360"`;
exports[`精度过高导致直连失败 3`] = `1`; exports[`精度过高导致直连失败 3`] = `1`;
exports[`精度过高导致直连失败 4`] = `"32045.24858"`; exports[`精度过高导致直连失败 4`] = `"32045.24888"`;
exports[`精度过高导致连接失败 1`] = `1`; exports[`精度过高导致连接失败 1`] = `1`;
exports[`精度过高导致连接失败 2`] = `"75154.17850"`; exports[`精度过高导致连接失败 2`] = `"75154.17849"`;
exports[`精度过高导致连接失败 3`] = `1`; exports[`精度过高导致连接失败 3`] = `1`;

@ -10,6 +10,7 @@ import { CommandNames } from "../../Common/CommandNames";
//禁止触发反应的命令 //禁止触发反应的命令
const ForbidReactorCmd = new Set([ const ForbidReactorCmd = new Set([
CommandNames.DeleteHole, CommandNames.Hole, CommandNames.LookOverBoardInfos, CommandNames.DeleteHole, CommandNames.Hole, CommandNames.LookOverBoardInfos,
CommandNames.ChangeColorByMaterial, CommandNames.RestoreColor,
'PZ', 'ENT', 'BBS', 'PZ', 'ENT', 'BBS',
CommandNames.Show, CommandNames.HideSelect, CommandNames.HideUnSelect]); CommandNames.Show, CommandNames.HideSelect, CommandNames.HideUnSelect]);

@ -89,7 +89,7 @@ export function IntersectCircleAndCircle(cu1: Circle | Arc, cu2: Circle | Arc):
let pts: IntersectResult[] = []; let pts: IntersectResult[] = [];
let dist = center2.distanceTo(center1); let dist = center2.distanceTo(center1);
if (dist < Math.abs(radius1 - radius2) if (dist < Math.abs(radius1 - radius2) - 1e-3
|| dist > (radius1 + radius2 + 1e-3)) || dist > (radius1 + radius2 + 1e-3))
return pts; return pts;
if (equaln(dist, 0, 1e-6)) return pts; if (equaln(dist, 0, 1e-6)) return pts;

Loading…
Cancel
Save