qa: arc playground with fixed endpoint corner case

This commit is contained in:
Tomasz Wlostowski 2021-07-17 01:05:04 +02:00 committed by Roberto Fernandez Bautista
parent 2573ac19a5
commit 9c15ba9673
1 changed files with 21 additions and 0 deletions

View File

@ -158,6 +158,27 @@ bool collideArc2Arc( const SHAPE_ARC& a1, const SHAPE_ARC& a2, int clearance, SE
ptsB.push_back( a2.GetP0() );
ptsB.push_back( a2.GetP1() );
std::vector<VECTOR2I> nearestA, nearestB;
// this probably can be made with less points, but still...
CIRCLE circ1( a1.GetCenter(), a1.GetRadius() );
for( auto pB: ptsB )
{
auto nearest = circ1.NearestPoint( pB );
if( sliceContainsPoint( a1, nearest ) )
nearestA.push_back( nearest );
}
CIRCLE circ2( a2.GetCenter(), a2.GetRadius() );
for( auto pA: ptsA )
{
auto nearest = circ2.NearestPoint( pA );
if( sliceContainsPoint( a2, nearest ) )
nearestB.push_back( nearest );
}
ptsA.insert( ptsA.end(), nearestA.begin(), nearestA.end() );
ptsB.insert( ptsB.end(), nearestB.begin(), nearestB.end() );
double minDist = std::numeric_limits<double>::max();
bool minDistFound = false;