From 01068e0d416ddc6203d6b9e7f3b9c169f62c3d98 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Thu, 9 Dec 2021 00:35:33 +0100 Subject: [PATCH] geometry: fix SHAPE_ARC/SEG collision The arc2segment collision should at also include the arc endpoint projections on the segment being tested. Not sure it covers all possible cases, though. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9023 --- libs/kimath/src/geometry/shape_arc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/kimath/src/geometry/shape_arc.cpp b/libs/kimath/src/geometry/shape_arc.cpp index d06ce5e02f..90bcde7225 100644 --- a/libs/kimath/src/geometry/shape_arc.cpp +++ b/libs/kimath/src/geometry/shape_arc.cpp @@ -242,6 +242,8 @@ bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance, int* aActual, VECTOR2I std::vector candidatePts = circle.Intersect( aSeg ); candidatePts.push_back( aSeg.NearestPoint( center ) ); + candidatePts.push_back( aSeg.NearestPoint( m_start ) ); + candidatePts.push_back( aSeg.NearestPoint( m_end ) ); candidatePts.push_back( aSeg.A ); candidatePts.push_back( aSeg.B );