router: take holes into account when building the restricted items set for collision search

This commit is contained in:
Tomasz Wlostowski 2023-06-23 14:52:34 +02:00
parent 7804c2177c
commit 61391e3984
2 changed files with 11 additions and 4 deletions

View File

@ -332,7 +332,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
for( const OBSTACLE& obstacle : obstacleList )
{
if( aOpts.m_restrictedSet && aOpts.m_restrictedSet->count( obstacle.m_item ) == 0 )
if( aOpts.m_restrictedSet && !aOpts.m_restrictedSet->empty() && aOpts.m_restrictedSet->count( obstacle.m_item ) == 0 )
continue;
int clearance =

View File

@ -68,11 +68,18 @@ NODE::OPT_OBSTACLE WALKAROUND::nearestObstacle( const LINE& aPath )
void WALKAROUND::RestrictToSet( bool aEnabled, const std::set<ITEM*>& aSet )
{
m_restrictedVertices.clear();
m_restrictedSet.clear();
if( aEnabled )
m_restrictedSet = aSet;
else
m_restrictedSet.clear();
{
for( auto item : aSet )
{
m_restrictedSet.insert( item );
if ( item->HasHole() )
m_restrictedSet.insert( item->Hole() );
}
}
for( auto item : aSet )
{