Don't attempt colinear corner optimization when zones of different nets overlap.

Fixes: lp:1838197
* https://bugs.launchpad.net/kicad/+bug/1838197
This commit is contained in:
Jeff Young 2019-07-28 10:31:26 -06:00
parent 10fcd8eaef
commit 8334cb9a1c
2 changed files with 30 additions and 8 deletions

View File

@ -1167,20 +1167,42 @@ void ZONE_CONTAINER::GetColinearCorners( BOARD* aBoard, std::set<VECTOR2I>& aCor
{
int epsilon = Millimeter2iu( 0.001 );
// Things get messy when zone of different nets intersect. To do it right we'd need to
// run our colinear test with the final filled regions rather than the outline regions.
// However, since there's no order dependance the only way to do that is to iterate
// through successive zone fills until the results are no longer changing -- and that's
// not going to happen. So we punt and ignore any "messy" corners.
std::set<VECTOR2I> colinearCorners;
std::set<VECTOR2I> messyCorners;
for( ZONE_CONTAINER* candidate : aBoard->Zones() )
{
if( candidate != this
&& candidate->GetNetCode() == GetNetCode()
&& candidate->GetLayerSet() == GetLayerSet()
&& candidate->GetIsKeepout() == GetIsKeepout() )
{
if( candidate == this )
continue;
if( candidate->GetLayerSet() != GetLayerSet() )
continue;
if( candidate->GetIsKeepout() != GetIsKeepout() )
continue;
for( auto iter = m_Poly->CIterate(); iter; iter++ )
{
if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
aCorners.insert( VECTOR2I( iter.Get() ) );
{
if( candidate->GetNetCode() == GetNetCode() )
colinearCorners.insert( VECTOR2I( iter.Get() ) );
else
messyCorners.insert( VECTOR2I( iter.Get() ) );
}
}
}
for( VECTOR2I corner : colinearCorners )
{
if( messyCorners.count( corner ) == 0 )
aCorners.insert( corner );
}
}

View File

@ -260,7 +260,7 @@ public:
* merged due to other parameters such as fillet radius. The copper pour will end up
* effectively merged though, so we want to keep the corners of such intersections sharp.
*/
void GetColinearCorners( BOARD* aBoard, std::set<VECTOR2I>& aCorners );
void GetColinearCorners( BOARD* aBoard, std::set<VECTOR2I>& colinearCorners );
/**
* Function TransformSolidAreasShapesToPolygonSet