From e5de56b6cc046e05e2d7de8964d0cf8395fbe198 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 Oct 2022 23:03:29 +0100 Subject: [PATCH] Fix edge case in arc collision. SHAPE_ARC::IntersectLine() fails when one of the arcs start points is on the center point of the other -- in this case we can't extend the line to the arc intersection because one point does not define a line.... Fixes https://gitlab.com/kicad/code/kicad/issues/12609 --- libs/kimath/src/geometry/shape_arc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/kimath/src/geometry/shape_arc.cpp b/libs/kimath/src/geometry/shape_arc.cpp index 58adb3ec45..704c958ec1 100644 --- a/libs/kimath/src/geometry/shape_arc.cpp +++ b/libs/kimath/src/geometry/shape_arc.cpp @@ -272,6 +272,9 @@ bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance, int* aActual, VECTOR2I int SHAPE_ARC::IntersectLine( const SEG& aSeg, std::vector* aIpsBuffer ) const { + if( aSeg.A == aSeg.B ) // One point does not define a line.... + return 0; + CIRCLE circ( GetCenter(), GetRadius() ); std::vector intersections = circ.IntersectLine( aSeg );