From 5d8e6020d1c926d40ac6394b52e6c909b8c16759 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 30 Dec 2020 20:27:20 +0000 Subject: [PATCH] Improve clarity. --- pcbnew/router/pns_node.cpp | 36 +++++++++++++++++------------------- pcbnew/router/pns_node.h | 8 +++++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index cb839eeff7..c86e6e66c9 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -301,13 +301,13 @@ int NODE::QueryColliding( const ITEM* aItem, NODE::OBSTACLES& aObstacles, int aK } -NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, +NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask, const std::set* aRestrictedSet ) { OBSTACLES obs_list; bool found_isects = false; - const SHAPE_LINE_CHAIN& line = aItem->CLine(); + const SHAPE_LINE_CHAIN& line = aLine->CLine(); obs_list.reserve( 100 ); @@ -315,18 +315,16 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, for( int i = 0; i < line.SegmentCount(); i++ ) { - const SEGMENT s( *aItem, line.CSegment( i ) ); + const SEGMENT s( *aLine, line.CSegment( i ) ); n += QueryColliding( &s, obs_list, aKindMask ); } - if( aItem->EndsWithVia() ) - n += QueryColliding( &aItem->Via(), obs_list, aKindMask ); + if( aLine->EndsWithVia() ) + n += QueryColliding( &aLine->Via(), obs_list, aKindMask ); if( !n ) return OPT_OBSTACLE(); - LINE& aLine = (LINE&) *aItem; - OBSTACLE nearest; nearest.m_item = NULL; nearest.m_distFirst = INT_MAX; @@ -341,22 +339,22 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, std::vector isect_list; - int clearance = GetClearance( obs.m_item, &aLine ); + int clearance = GetClearance( obs.m_item, aLine ); - SHAPE_LINE_CHAIN hull = obs.m_item->Hull( clearance, aItem->Width(), aItem->Layer() ); + SHAPE_LINE_CHAIN obsHull = obs.m_item->Hull( clearance, aLine->Width(), aLine->Layer() ); - if( aLine.EndsWithVia() ) + if( aLine->EndsWithVia() ) { - clearance = GetClearance( obs.m_item, &aLine.Via() ); + clearance = GetClearance( obs.m_item, &aLine->Via() ); - SHAPE_LINE_CHAIN viaHull = aLine.Via().Hull( clearance, aItem->Width() ); + SHAPE_LINE_CHAIN viaHull = aLine->Via().Hull( clearance, aLine->Width() ); - viaHull.Intersect( hull, isect_list ); + viaHull.Intersect( obsHull, isect_list ); for( const SHAPE_LINE_CHAIN::INTERSECTION& isect : isect_list ) { - int dist = aLine.CLine().Length() + - ( isect.p - aLine.Via().Pos() ).EuclideanNorm(); + int dist = aLine->CLine().Length() + + ( isect.p - aLine->Via().Pos() ).EuclideanNorm(); if( dist < nearest.m_distFirst ) { @@ -364,7 +362,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, nearest.m_distFirst = dist; nearest.m_ipFirst = isect.p; nearest.m_item = obs.m_item; - nearest.m_hull = hull; + nearest.m_hull = obsHull; } if( dist > dist_max ) @@ -377,11 +375,11 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, isect_list.clear(); - hull.Intersect( aLine.CLine(), isect_list ); + obsHull.Intersect( aLine->CLine(), isect_list ); for( const SHAPE_LINE_CHAIN::INTERSECTION& isect : isect_list ) { - int dist = aLine.CLine().PathLength( isect.p ); + int dist = aLine->CLine().PathLength( isect.p ); if( dist < nearest.m_distFirst ) { @@ -389,7 +387,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, nearest.m_distFirst = dist; nearest.m_ipFirst = isect.p; nearest.m_item = obs.m_item; - nearest.m_hull = hull; + nearest.m_hull = obsHull; } if( dist > dist_max ) diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index 07624670e1..d827d4a049 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -62,7 +62,9 @@ enum class CONSTRAINT_TYPE CT_LENGTH = 3, CT_WIDTH = 4, CT_VIA_DIAMETER = 5, - CT_VIA_HOLE = 6 + CT_VIA_HOLE = 6, + CT_HOLE_CLEARANCE = 7, + CT_EDGE_CLEARANCE = 8 }; struct CONSTRAINT @@ -243,11 +245,11 @@ public: * * Follows the line in search of an obstacle that is nearest to the starting to the line's starting * point. - * @param aItem the item to find collisions with + * @param aLine the item to find collisions with * @param aKindMask mask of obstacle types to take into account * @return the obstacle, if found, otherwise empty. */ - OPT_OBSTACLE NearestObstacle( const LINE* aItem, + OPT_OBSTACLE NearestObstacle( const LINE* aLine, int aKindMask = ITEM::ANY_T, const std::set* aRestrictedSet = NULL );