Post-merge cleanup of holes-as-first-class-citizens.

This commit is contained in:
Jeff Young 2023-04-06 12:56:26 +01:00
parent 1532a83330
commit 4cc289c6fb
3 changed files with 0 additions and 186 deletions

View File

@ -505,79 +505,6 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
return rv;
}
#if 0
int PNS_PCBNEW_RULE_RESOLVER::HoleClearance( const PNS::ITEM* aA, const PNS::ITEM* aB,
bool aUseClearanceEpsilon )
{
CLEARANCE_CACHE_KEY key = { aA, aB, aUseClearanceEpsilon };
auto it = m_holeClearanceCache.find( key );
if( it != m_holeClearanceCache.end() )
return it->second;
PNS::CONSTRAINT constraint;
int rv = 0;
int layer;
if( !aA->Layers().IsMultilayer() || !aB || aB->Layers().IsMultilayer() )
layer = aA->Layer();
else
layer = aB->Layer();
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_CLEARANCE, aA, aB, layer, &constraint ) )
rv = constraint.m_Value.Min();
#define HAS_PLATED_HOLE( a ) ( a )->IsRoutable()
// JEY TODO: this is a new test introduced after Tom's brach. How does it fit
// in the new architecture?
if( IsCopperLayer( layer )
&& ( HAS_PLATED_HOLE( aA ) || HAS_PLATED_HOLE( aB ) )
&& QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, layer, &constraint )
&& constraint.m_Value.Min() > rv )
{
rv = constraint.m_Value.Min();
}
if( aUseClearanceEpsilon && rv > 0 )
rv = std::max( 0, rv - m_clearanceEpsilon );
m_holeClearanceCache[ key ] = rv;
return rv;
}
int PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance( const PNS::ITEM* aA, const PNS::ITEM* aB,
bool aUseClearanceEpsilon )
{
CLEARANCE_CACHE_KEY key = { aA, aB, aUseClearanceEpsilon };
auto it = m_holeToHoleClearanceCache.find( key );
if( it != m_holeToHoleClearanceCache.end() )
return it->second;
PNS::CONSTRAINT constraint;
int rv = 0;
int layer;
if( !aA->Layers().IsMultilayer() || !aB || aB->Layers().IsMultilayer() )
layer = aA->Layer();
else
layer = aB->Layer();
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_HOLE_TO_HOLE, aA, aB, layer, &constraint ) )
rv = constraint.m_Value.Min();
if( aUseClearanceEpsilon && rv > 0 )
rv = std::max( 0, rv - m_clearanceEpsilon );
m_holeToHoleClearanceCache[ key ] = rv;
return rv;
}
#endif
bool PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedWidth )
{

View File

@ -337,18 +337,8 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
if( aLine->EndsWithVia() )
{
const VIA& via = aLine->Via();
// JEY TODO: clean up (or re-enable) all this commented-out stuff....
//const HOLE* viaHole = via.Hole();
//int viaHoleRadius = static_cast<const SHAPE_CIRCLE*>( via.Hole() )->GetRadius();
int viaClearance = GetClearance( obstacle.m_item, &via, aOpts.m_useClearanceEpsilon )
+ via.Diameter() / 2;
//int holeClearance = GetClearance( obstacle.m_item, viaHole, aOpts.m_useClearanceEpsilon )
// + viaHoleRadius;
//if( holeClearance > viaClearance )
// viaClearance = holeClearance;
obstacleHull = obstacle.m_item->Hull( viaClearance, 0, layer );
//debugDecorator->AddLine( obstacleHull, 3 );
@ -356,61 +346,9 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine,
intersectingPts.clear();
HullIntersection( obstacleHull, aLine->CLine(), intersectingPts );
// obstacleHull.Intersect( aLine->CLine(), intersectingPts, true );
for( const SHAPE_LINE_CHAIN::INTERSECTION& ip : intersectingPts )
updateNearest( ip, obstacle );
}
#if 0
if( ( m_collisionQueryScope == CQS_ALL_RULES
|| !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( obstacle.m_item,
layer ) )
&& obstacle.m_item->Hole() )
{
clearance = GetHoleClearance( obstacle.m_item, aLine, aOpts.m_useClearanceEpsilon );
int copperClearance = GetClearance( obstacle.m_item, aLine, aOpts.m_useClearanceEpsilon );
clearance = std::max( clearance, copperClearance );
obstacleHull = obstacle.m_item->HoleHull( clearance, aLine->Width(), layer );
intersectingPts.clear();
HullIntersection( obstacleHull, aLine->CLine(), intersectingPts );
for( const SHAPE_LINE_CHAIN::INTERSECTION& ip : intersectingPts )
updateNearest( ip, obstacle.m_item, obstacleHull, true );
if( aLine->EndsWithVia() )
{
const VIA& via = aLine->Via();
// 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, aOpts.m_useClearanceEpsilon )
+ via.Diameter() / 2;
int holeClearance = GetHoleClearance( obstacle.m_item, &via, aOpts.m_useClearanceEpsilon )
+ viaHoleRadius;
int holeToHole =
GetHoleToHoleClearance( obstacle.m_item, &via, aOpts.m_useClearanceEpsilon )
+ viaHoleRadius;
if( holeClearance > viaClearance )
viaClearance = holeClearance;
if( holeToHole > viaClearance )
viaClearance = holeToHole;
obstacleHull = obstacle.m_item->Hull( viaClearance, 0, layer );
//debugDecorator->AddLine( obstacleHull, 5 );
intersectingPts.clear();
HullIntersection( obstacleHull, aLine->CLine(), intersectingPts );
for( const SHAPE_LINE_CHAIN::INTERSECTION& ip : intersectingPts )
updateNearest( ip, obstacle.m_item, obstacleHull, true );
}
}
#endif
}
if( nearest.m_distFirst == INT_MAX )
@ -713,29 +651,6 @@ bool NODE::Add( std::unique_ptr< ARC >&& aArc, bool aAllowRedundant )
}
#if 0 // JEY TODO: clean up
void NODE::Add( std::unique_ptr< ITEM > aItem, bool aAllowRedundant )
{
switch( aItem->Kind() )
{
case ITEM::SOLID_T: Add( ItemCast<SOLID>( std::move( aItem ) ) ); break;
case ITEM::SEGMENT_T: Add( ItemCast<SEGMENT>( std::move( aItem ) ), aAllowRedundant ); break;
case ITEM::VIA_T: Add( ItemCast<VIA>( std::move( aItem ) ) ); break;
case ITEM::HOLE_T:
break; // ignore holes, they don't exist as independent objects
case ITEM::ARC_T:
//todo(snh): Add redundant search
Add( ItemCast<ARC>( std::move( aItem ) ) );
break;
case ITEM::LINE_T:
default:
assert( false );
}
}
#endif
void NODE::AddEdgeExclusion( std::unique_ptr<SHAPE> aShape )
{
m_edgeExclusions.push_back( std::move( aShape ) );

View File

@ -36,22 +36,6 @@ bool VIA::PushoutForce( NODE* aNode, const ITEM* aOther, VECTOR2I& aForce )
VECTOR2I elementForces[4], force;
size_t nf = 0;
#if 0 // JEY TODO: why is this commented out? Needs replacing, or deleting?
if( aNode->GetCollisionQueryScope() == NODE::CQS_ALL_RULES )
{
int holeClearance = aNode->GetHoleClearance( this, aOther );
int hole2holeClearance = aNode->GetHoleToHoleClearance( this, aOther );
if( aOther->Hole() )
{
aOther->Hole()->Collide( Shape(), holeClearance, &elementForces[nf++] );
aOther->Hole()->Collide( Hole(), hole2holeClearance, &elementForces[nf++] );
}
aOther->Shape()->Collide( Hole(), holeClearance, &elementForces[nf++] );
}
#endif
aOther->Shape()->Collide( Shape(), clearance, &elementForces[nf++] );
for( size_t i = 0; i < nf; i++ )
@ -166,18 +150,6 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int
}
#if 0 // JEY TODO: is this no longer needed?
const SHAPE_LINE_CHAIN VIA::HoleHull( int aClearance, int aWalkaroundThickness, int aLayer ) const
{
int cl = ( aClearance + aWalkaroundThickness / 2 );
int width = m_hole->GetRadius() * 2;
// Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon
return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ), VECTOR2I( width, width ), cl,
( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) );
}
#endif
VIA* VIA::Clone() const
{
VIA* v = new VIA();