Fix fishy logic in SHAPE_LINE_CHAIN::Collide().
This commit is contained in:
parent
06b199fd41
commit
78bec3f1ba
|
@ -655,13 +655,16 @@ bool SHAPE_LINE_CHAIN::Collide( const SEG& aSeg, int aClearance, int* aActual,
|
|||
return true;
|
||||
}
|
||||
|
||||
int dist = 0;
|
||||
int closest_dist = sqrt( closest_dist_sq );
|
||||
int closest_dist = std::numeric_limits<int>::max();
|
||||
|
||||
if( closest_dist_sq < VECTOR2I ::ECOORD_MAX )
|
||||
closest_dist = sqrt( closest_dist_sq );
|
||||
|
||||
// Collide arc segments
|
||||
for( size_t i = 0; i < ArcCount(); i++ )
|
||||
{
|
||||
const SHAPE_ARC& arc = Arc( i );
|
||||
int dist = 0;
|
||||
|
||||
// The arcs in the chain should have zero width
|
||||
wxASSERT_MSG( arc.GetWidth() == 0, wxT( "Invalid arc width - should be zero" ) );
|
||||
|
@ -673,9 +676,7 @@ bool SHAPE_LINE_CHAIN::Collide( const SEG& aSeg, int aClearance, int* aActual,
|
|||
return true;
|
||||
|
||||
if( dist < closest_dist )
|
||||
{
|
||||
closest_dist = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue