router: fix another corner case in LINE::Walkaround

This commit is contained in:
Tomasz Wlostowski
2022-10-31 11:17:31 +01:00
parent 65507e7186
commit 3e67b42efd
+18 -3
View File
@@ -164,10 +164,9 @@ static int areNeighbours( int x, int y, int max = 0 )
return false;
}
//#ifdef TOM_EXTRA_DEBUG
#ifdef TOM_EXTRA_DEBUG
SHAPE_LINE_CHAIN g_pnew, g_hnew;
//#endif
#endif
bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPath, bool aCw ) const
{
@@ -475,6 +474,9 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat
// we should never reach this part of the code, but who really knows?
if( !v_next )
{
#ifdef TOM_EXTRA_DEBUG
printf("still no v_next\n");
#endif
for( VERTEX* vn : v->neighbours )
{
if( vn->type == ON_EDGE )
@@ -487,6 +489,19 @@ bool LINE::Walkaround( const SHAPE_LINE_CHAIN& aObstacle, SHAPE_LINE_CHAIN& aPat
}
}
if( v_next )
{
for( auto &v : vts )
{
if( v.isHull )
v.visited = false;
}
}
#ifdef TOM_EXTRA_DEBUG
printf("v_next %p\n", v_next);
#endif
// Did we get the next hull point but the end of the line is inside? Instead of walking
// around the hull some more (which will just end up taking us back to the start), lets
// just project the normal of the endpoint onto this next segment and call it quits.