diff --git a/__test__/Booloperate/__snapshots__/bool3.test.ts.snap b/__test__/Booloperate/__snapshots__/bool3.test.ts.snap index 8fee0db28..6c3c1013a 100644 --- a/__test__/Booloperate/__snapshots__/bool3.test.ts.snap +++ b/__test__/Booloperate/__snapshots__/bool3.test.ts.snap @@ -2,4 +2,4 @@ exports[`布尔_误差共线_误差交点 1`] = `739590.0297771678`; -exports[`布尔_误差共线_误差交点 2`] = `739582.7655079779`; +exports[`布尔_误差共线_误差交点 2`] = `739582.752529773`; diff --git a/__test__/Booloperate/bool3.test.ts b/__test__/Booloperate/bool3.test.ts index 16b36e36a..7467df37a 100644 --- a/__test__/Booloperate/bool3.test.ts +++ b/__test__/Booloperate/bool3.test.ts @@ -12,7 +12,8 @@ test('布尔_误差共线_误差交点', () => expect(regs[0].Area).toMatchSnapshot(); //弧形情况 - d = [2, "Region", 3, 2, 156, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 141.87083942583706, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 141.87083942583706, 0, 1], 2, 4, [600, 0], 0, [600, 1241.380049628613], 0, [0, 1241.380049628613], 0, [0, 0], 0, true, 0, "Region", 3, 2, 155, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 1374.2508890544507, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 1374.2508890544507, 0, 1], 2, 4, [0, 0], 0, [582, 0], 0.26581272283978424, [582, 8.999955254199449], 0, [0, 8.999955254199449], 0, true, 0]; + d = + [2, "Region", 3, 2, 156, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 141.87083942583706, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 141.87083942583706, 0, 1], 2, 4, [600, 0], 0, [600, 1241.380049628613], 0, [0, 1241.380049628613], 0, [0, 0], 0, true, 0, "Region", 3, 2, 155, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 1374.2508890544507, 0, 1], 1, 1, 1, 1, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3051.4141274641142, 1374.2508890544507, 0, 1], 2, 4, [0, 0], 0, [582, 0], 0.26581272283978424, [582, 8.999955254199449], 0, [0, 8.999955254199449], 0, true, 0]; regs = LoadRegionsFromFileData(d); regs[0].BooleanOper(regs[1], BoolOpeartionType.Subtract); expect(regs[0].Area).toMatchSnapshot(); diff --git a/src/DatabaseServices/Entity/Arc.ts b/src/DatabaseServices/Entity/Arc.ts index fb0e6ce1f..092652342 100644 --- a/src/DatabaseServices/Entity/Arc.ts +++ b/src/DatabaseServices/Entity/Arc.ts @@ -448,7 +448,7 @@ export class Arc extends Curve return this; } - IntersectWith2(curve: Curve, intType: IntersectOption, tolerance = 1e-6) + IntersectWith2(curve: Curve, intType: IntersectOption, tolerance = 1e-4) { if (curve instanceof Arc) { diff --git a/src/GraphicsSystem/IntersectWith.ts b/src/GraphicsSystem/IntersectWith.ts index e4cd7ce4a..0318dc399 100644 --- a/src/GraphicsSystem/IntersectWith.ts +++ b/src/GraphicsSystem/IntersectWith.ts @@ -230,7 +230,7 @@ export function IntersectLineAndCircle(line: Line, circle: Circle, extType: Inte export function IntersectLineAndArc(line: Line, arc: Arc, extType: IntersectOption, tolerance = 1e-6) { let ptArr = IntersectLineAndCircleOrArc(line, arc); - return CheckPointOnCurve(ptArr, line, arc, extType); + return CheckPointOnCurve(ptArr, line, arc, extType, tolerance); } //直线和直线 export function IntersectLAndLFor2D(p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3, tolerance = 1e-6): Vector3 @@ -430,7 +430,7 @@ export function IntersectPolylineAndCurve(pl: Polyline, cu: Curve, extType: Inte pt: r.pt, thisParam: pl.GetParamAtPoint(r.pt), argParam: cu.GetParamAtPoint(r.pt), - } + }; })); } } @@ -503,7 +503,7 @@ export function IntersectLineAndEllipseFor2D(l: Line, el: Ellipse) pt, thisParam: l.GetParamAtPoint(pt), argParam: el.GetParamAtPoint(pt) - } + }; }); } export function IntersectEllipseAndCircleOrArc(el: Ellipse, cir: Circle | Arc, type: IntersectOption) @@ -557,12 +557,12 @@ export function IntersectEllipseAndCircleOrArc(el: Ellipse, cir: Circle | Arc, t let ro = new Matrix4().makeRotationZ(el.Rotation); let res = pts.map(p => { - let pt = p.applyMatrix4(ro).applyMatrix4(el.OCS) + let pt = p.applyMatrix4(ro).applyMatrix4(el.OCS); return { pt, thisParam: el.GetParamAtPoint(pt), argParam: cir.GetParamAtPoint(pt) - } + }; }); return CheckPointOnCurve(res, el, cir, type); }