Fix qa failure

This commit is contained in:
Seth Hillbrand 2024-05-21 16:25:44 -07:00
parent ee3533baeb
commit 819bdf4372
2 changed files with 10 additions and 2 deletions

View File

@ -444,7 +444,9 @@ bool SHAPE_ARC::Collide( const VECTOR2I& aP, int aClearance, int* aActual,
if( !dist ) if( !dist )
{ {
dist = radius - ( aP - center ).EuclideanNorm(); // Be sure to keep the sqrt of the squared distance instead of allowing a EuclideanNorm
// because this trucates the distance to an integer before subtracting
dist = KiROUND( radius - sqrt( ( aP - center ).SquaredEuclideanNorm() ) );
nearestPt = center + VECTOR2I( radius, 0 ); nearestPt = center + VECTOR2I( radius, 0 );
RotatePoint( nearestPt, center, angleToPt ); RotatePoint( nearestPt, center, angleToPt );
} }

View File

@ -597,12 +597,18 @@ static const std::vector<ARC_PT_COLLIDE_CASE> arc_pt_collide_cases = {
{ " -90deg, 0 cl, 90 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 71, 71 }, true, 0 }, { " -90deg, 0 cl, 90 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 71, 71 }, true, 0 },
{ " -90deg, 0 cl, 135 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 0, -100 }, false, -1 }, { " -90deg, 0 cl, 135 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 0, -100 }, false, -1 },
{ " -90deg, 0 cl, -45 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 0, 100 }, false, -1 }, { " -90deg, 0 cl, -45 deg ", { { 0, 0 }, { 71, 71 }, -90.0 }, 0, { 0, 100 }, false, -1 },
{ "issue 11358", { "issue 11358 collide",
{ { 119888000, 60452000 }, { 120904000, 60452000 }, 360.0 }, { { 119888000, 60452000 }, { 120904000, 60452000 }, 360.0 },
0, 0,
{ 120395500, 59571830 }, { 120395500, 59571830 },
true, true,
0 }, 0 },
{ "issue 11358 dist",
{ { 119888000, 60452000 }, { 120904000, 60452000 }, 360.0 },
100,
{ 118872050, 60452000 },
true,
50 },
}; };