Use point collision test for zero-length segments

SEG::SquaredDistance( SEG& ) does not do the right thing
for segments with zero length at the moment.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9791
This commit is contained in:
Jon Evans 2021-11-27 09:08:23 -05:00
parent bf3877a399
commit 0570c22732
1 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,9 @@ public:
bool Collide( const SEG& aSeg, int aClearance = 0, int* aActual = nullptr,
VECTOR2I* aLocation = nullptr ) const override
{
if( aSeg.A == aSeg.B )
return Collide( aSeg.A, aClearance, aActual, aLocation );
int min_dist = ( m_width + 1 ) / 2 + aClearance;
ecoord dist_sq = m_seg.SquaredDistance( aSeg );