From 77f2287acc935d8bf8925b0fcfb13ad195d95272 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 18 Mar 2014 17:02:10 +0100 Subject: [PATCH] Break points for zones are not added in the same place as existing points. --- pcbnew/tools/point_editor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 666b385d15..1cfdb0a001 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -648,10 +648,16 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint ) } // Find the point on the closest segment - SEG nearestSide( VECTOR2I( outline->GetPos( nearestIdx ) ), - VECTOR2I( outline->GetPos( nextNearestIdx ) ) ); + VECTOR2I sideOrigin( outline->GetPos( nearestIdx ) ); + VECTOR2I sideEnd( outline->GetPos( nextNearestIdx ) ); + SEG nearestSide( sideOrigin, sideEnd ); VECTOR2I nearestPoint = nearestSide.NearestPoint( aBreakPoint ); + // Do not add points that have the same coordinates as ones that already belong to polygon + // instead, add a point in the middle of the side + if( nearestPoint == sideOrigin || nearestPoint == sideEnd ) + nearestPoint = ( sideOrigin + sideEnd ) / 2; + outline->InsertCorner( nearestIdx, nearestPoint.x, nearestPoint.y ); }