router: disable 'limit corner count' optimization for via dragging

It seems to be completely preventing optimization instead of preventing over-optimization in case the head is a dragged via.
To be investigated in more details in V7.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/8665
This commit is contained in:
Tomasz Wlostowski 2021-11-21 22:56:26 +01:00
parent ccf9a72078
commit e60386f028
4 changed files with 16 additions and 1 deletions

View File

@ -650,6 +650,9 @@ bool DRAGGER::dragShove( const VECTOR2I& aP )
{ {
VIA_HANDLE newVia; VIA_HANDLE newVia;
// corner count limiter intended to avoid excessive optimization produces mediocre results for via shoving.
// this is a hack that disables it, before I figure out a more reliable solution
m_shove->DisablePostShoveOptimizations( OPTIMIZER::LIMIT_CORNER_COUNT );
SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, newVia ); SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, newVia );
if( st == SHOVE::SH_OK || st == SHOVE::SH_HEAD_MODIFIED ) if( st == SHOVE::SH_OK || st == SHOVE::SH_HEAD_MODIFIED )

View File

@ -271,6 +271,7 @@ bool CORNER_COUNT_LIMIT_CONSTRAINT::Check( int aVertex1, int aVertex2, const LIN
{ {
LINE newPath( *aOriginLine, aCurrentPath ); LINE newPath( *aOriginLine, aCurrentPath );
newPath.Line().Replace( aVertex1, aVertex2, aReplacement ); newPath.Line().Replace( aVertex1, aVertex2, aReplacement );
newPath.Line().Simplify();
int cc = newPath.CountCorners( m_angleMask ); int cc = newPath.CountCorners( m_angleMask );
if( cc >= m_minCorners && cc <= m_maxCorners ) if( cc >= m_minCorners && cc <= m_maxCorners )

View File

@ -159,6 +159,7 @@ void SHOVE::sanityCheck( LINE* aOld, LINE* aNew )
SHOVE::SHOVE( NODE* aWorld, ROUTER* aRouter ) : SHOVE::SHOVE( NODE* aWorld, ROUTER* aRouter ) :
ALGO_BASE( aRouter ) ALGO_BASE( aRouter )
{ {
m_optFlagDisableMask = 0;
m_forceClearance = -1; m_forceClearance = -1;
m_root = aWorld; m_root = aWorld;
m_currentNode = aWorld; m_currentNode = aWorld;
@ -1759,7 +1760,8 @@ void SHOVE::runOptimizer( NODE* aNode )
if( Settings().SmartPads() ) if( Settings().SmartPads() )
optFlags |= OPTIMIZER::SMART_PADS; optFlags |= OPTIMIZER::SMART_PADS;
optimizer.SetEffortLevel( optFlags );
optimizer.SetEffortLevel( optFlags & ~m_optFlagDisableMask );
optimizer.SetCollisionMask( ITEM::ANY_T ); optimizer.SetCollisionMask( ITEM::ANY_T );
for( int pass = 0; pass < n_passes; pass++ ) for( int pass = 0; pass < n_passes; pass++ )
@ -1873,5 +1875,11 @@ void SHOVE::UnlockSpringbackNode( NODE* aNode )
} }
} }
void SHOVE::DisablePostShoveOptimizations( int aMask )
{
m_optFlagDisableMask = aMask;
}
} }

View File

@ -89,6 +89,7 @@ public:
void UnlockSpringbackNode( NODE* aNode ); void UnlockSpringbackNode( NODE* aNode );
bool RewindSpringbackTo( NODE* aNode ); bool RewindSpringbackTo( NODE* aNode );
bool RewindToLastLockedNode(); bool RewindToLastLockedNode();
void DisablePostShoveOptimizations( int aMask );
private: private:
typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET; typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
@ -180,6 +181,8 @@ private:
int m_iter; int m_iter;
int m_forceClearance; int m_forceClearance;
bool m_multiLineMode; bool m_multiLineMode;
int m_optFlagDisableMask;
}; };
} }