diff --git a/pcbnew/teardrop/teardrop_utils.cpp b/pcbnew/teardrop/teardrop_utils.cpp index e3afe0fefd..2863d38523 100644 --- a/pcbnew/teardrop/teardrop_utils.cpp +++ b/pcbnew/teardrop/teardrop_utils.cpp @@ -216,13 +216,16 @@ PCB_TRACK* TEARDROP_MANAGER::findTouchingTrack( EDA_ITEM_FLAGS& aMatchType, PCB_ if( match ) { - // if faced with a Y junction, stop here + // if faced with a Y junction, choose the track longest segment as candidate matches++; if( matches > 1 ) { - aMatchType = 0; - return nullptr; + double previous_len = candidate->GetLength(); + double curr_len = curr_track->GetLength(); + + if( previous_len >= curr_len ) + continue; } aMatchType = match; @@ -694,6 +697,10 @@ bool TEARDROP_MANAGER::computeTeardropPolygonPoints( TEARDROP_PARAMETERS* aCurrP aFollowTracks, aTrackLookupList ) ) return false; + // The start and end points must be different to calculate a valid polygon shape + if( start == end ) + return false; + VECTOR2D vecT = NormalizeVector(end - start); // find the 2 points on the track, sharp end of the teardrop