PNS: Fixup hole clearance to use exact hulls for walkaround

(partially cherry picked from commit 30fb298ed3)
This commit is contained in:
Jon Evans 2022-06-07 19:48:38 -04:00
parent 6253b878a0
commit 895314b639
1 changed files with 15 additions and 8 deletions

View File

@ -359,7 +359,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
for( const auto& ip : intersectingPts )
{
//debugDecorator->AddPoint( ip.p, ip.valid?3:6, 100000, (const char *) wxString::Format("obstacle-isect-point-%d" ).c_str() );
if(ip.valid)
if( ip.valid )
updateNearest( ip, obstacle.m_item, obstacleHull, false );
}
@ -370,8 +370,10 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
int viaHoleRadius = static_cast<const SHAPE_CIRCLE*>( via.Hole() )->GetRadius();
int viaClearance = GetClearance( obstacle.m_item, &via ) + via.Diameter() / 2;
int holeClearance = GetHoleClearance( obstacle.m_item, &via ) + viaHoleRadius;
int viaClearance = GetClearance( obstacle.m_item, &via, aUseClearanceEpsilon )
+ via.Diameter() / 2;
int holeClearance =
GetHoleClearance( obstacle.m_item, &via, aUseClearanceEpsilon ) + viaHoleRadius;
if( holeClearance > viaClearance )
viaClearance = holeClearance;
@ -390,7 +392,8 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
if( obstacle.m_item->Hole() )
{
clearance = GetHoleClearance( obstacle.m_item, aLine ) + aLine->Width() / 2;
clearance = GetHoleClearance( obstacle.m_item, aLine, aUseClearanceEpsilon )
+ aLine->Width() / 2;
obstacleHull = obstacle.m_item->HoleHull( clearance, 0, layer );
//debugDecorator->AddLine( obstacleHull, 4 );
@ -406,9 +409,13 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
// Don't use via.Drill(); it doesn't include the plating thickness
int viaHoleRadius = static_cast<const SHAPE_CIRCLE*>( via.Hole() )->GetRadius();
int viaClearance = GetClearance( obstacle.m_item, &via ) + via.Diameter() / 2;
int holeClearance = GetHoleClearance( obstacle.m_item, &via ) + viaHoleRadius;
int holeToHole = GetHoleToHoleClearance( obstacle.m_item, &via ) + viaHoleRadius;
int viaClearance = GetClearance( obstacle.m_item, &via, aUseClearanceEpsilon )
+ via.Diameter() / 2;
int holeClearance = GetHoleClearance( obstacle.m_item, &via, aUseClearanceEpsilon )
+ viaHoleRadius;
int holeToHole =
GetHoleToHoleClearance( obstacle.m_item, &via, aUseClearanceEpsilon )
+ viaHoleRadius;
if( holeClearance > viaClearance )
viaClearance = holeClearance;
@ -416,7 +423,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask,
if( holeToHole > viaClearance )
viaClearance = holeToHole;
obstacleHull = obstacle.m_item->Hull( viaClearance + PNS_HULL_MARGIN, 0, layer );
obstacleHull = obstacle.m_item->Hull( viaClearance, 0, layer );
//debugDecorator->AddLine( obstacleHull, 5 );
intersectingPts.clear();