7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 23:21:41 +00:00

Check singular arcs connection

Even if there are no other segments in the line chain, we still should
check for arc connections in cases of individual arcs on a line chain
This commit is contained in:
Seth Hillbrand 2024-03-22 10:41:42 -07:00
parent e11cc322fd
commit 6b915049d1
3 changed files with 586 additions and 19 deletions
libs/kimath/src/geometry
qa

View File

@ -361,31 +361,31 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_LINE_CH
}
}
}
}
if( closest_dist > 0 && aActual )
if( (!aActual && !aLocation ) || closest_dist > 0 )
{
std::vector<const SHAPE_LINE_CHAIN*> chains = {
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aA ),
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aB )
};
std::vector<const SHAPE*> shapes = { &aA, &aB };
for( int ii = 0; ii < 2; ii++ )
{
std::vector<const SHAPE_LINE_CHAIN*> chains = {
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aA ),
dynamic_cast<const SHAPE_LINE_CHAIN*>( &aB )
};
const SHAPE_LINE_CHAIN* chain = chains[ii];
const SHAPE* other = shapes[( ii + 1 ) % 2];
std::vector<const SHAPE*> shapes = { &aA, &aB };
if( !chain )
continue;
for( int ii = 0; ii < 2; ii++ )
for( size_t jj = 0; jj < chain->ArcCount(); jj++ )
{
const SHAPE_LINE_CHAIN* chain = chains[ii];
const SHAPE* other = shapes[( ii + 1 ) % 2];
const SHAPE_ARC& arc = chain->Arc( jj );
if( !chain )
continue;
for( size_t jj = 0; jj < chain->ArcCount(); jj++ )
{
const SHAPE_ARC& arc = chain->Arc( jj );
if( arc.Collide( other, aClearance, aActual, aLocation ) )
return true;
}
if( arc.Collide( other, aClearance, aActual, aLocation ) )
return true;
}
}
}

View File

LOADING design file

View File

@ -270,3 +270,32 @@ BOOST_FIXTURE_TEST_CASE( RegressionSliverZoneFillTests, ZONE_FILL_TEST_FIXTURE )
}
}
BOOST_FIXTURE_TEST_CASE( RegressionTeardropFill, ZONE_FILL_TEST_FIXTURE )
{
std::vector<std::pair<wxString,int>> tests = { { "teardrop_issue_JPC2", 5 } // Arcs with teardrops connecting to pads
};
for( auto& [ relPath, count ] : tests )
{
KI_TEST::LoadBoard( m_settingsManager, relPath, m_board );
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
KI_TEST::FillZones( m_board.get() );
int zoneCount = 0;
for( ZONE* zone : m_board->Zones() )
{
if( zone->IsTeardropArea() )
zoneCount++;
}
BOOST_CHECK_MESSAGE( zoneCount == count, "Expected " << count << " teardrop zones in "
<< relPath << ", found "
<< zoneCount );
}
}