PNS: Don't clip the line in the middle of an arc - just start again

In shove mode, returning an empty line results in keeping the current
head, which should be okay for now.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
This commit is contained in:
Roberto Fernandez Bautista 2021-11-21 19:39:30 +00:00
parent 572747a3f9
commit bbafce6ab3
1 changed files with 19 additions and 3 deletions

View File

@ -576,10 +576,26 @@ const LINE LINE::ClipToNearestObstacle( NODE* aNode ) const
if( obs )
{
l.RemoveVia();
int p = l.Line().Split( obs->m_ipFirst );
l.Line().Remove( p + 1, -1 );
} else
VECTOR2I collisionPoint = obs->m_ipFirst;
int segIdx = l.Line().NearestSegment( collisionPoint );
if( l.Line().IsArcSegment( segIdx ) )
{
// Don't clip at arcs, start again
l.Line().Clear();
}
else
{
SEG nearestSegment = l.Line().CSegment( segIdx );
VECTOR2I nearestPt = nearestSegment.NearestPoint( collisionPoint );
int p = l.Line().Split( nearestPt );
l.Line().Remove( p + 1, -1 );
}
}
else
{
break;
}
}
if( i == IterationLimit )