Fix zero failure in SEG::PointCloserThan().

Fixes: lp:1843329
* https://bugs.launchpad.net/kicad/+bug/1843329
This commit is contained in:
Jeff Young 2019-09-09 23:16:29 +01:00
parent 18a76d3a87
commit 2278f40051
1 changed files with 2 additions and 2 deletions

View File

@ -40,9 +40,9 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
SEG::ecoord t = d.Dot( aP - A ); SEG::ecoord t = d.Dot( aP - A );
if( t <= 0 || !l_squared ) if( t <= 0 || !l_squared )
return ( aP - A ).SquaredEuclideanNorm() < dist_sq; return ( aP - A ).SquaredEuclideanNorm() <= dist_sq;
else if( t >= l_squared ) else if( t >= l_squared )
return ( aP - B ).SquaredEuclideanNorm() < dist_sq; return ( aP - B ).SquaredEuclideanNorm() <= dist_sq;
int dxdy = abs( d.x ) - abs( d.y ); int dxdy = abs( d.x ) - abs( d.y );