PNS: Implement HoleHull for VIA

(cherry picked from commit 23596812b6)
This commit is contained in:
Jon Evans 2022-06-07 19:48:03 -04:00
parent 5855a9ed89
commit 6253b878a0
3 changed files with 18 additions and 4 deletions

View File

@ -118,8 +118,8 @@ public:
return SHAPE_LINE_CHAIN(); return SHAPE_LINE_CHAIN();
} }
virtual const SHAPE_LINE_CHAIN HoleHull( int aClearance, int aWalkaroundThickness, virtual const SHAPE_LINE_CHAIN HoleHull( int aClearance, int aWalkaroundThickness = 0,
int aLayer ) const int aLayer = -1 ) const
{ {
return SHAPE_LINE_CHAIN(); return SHAPE_LINE_CHAIN();
} }

View File

@ -77,12 +77,23 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int
int width = m_diameter; int width = m_diameter;
if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) ) if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
width = m_drill; width = m_hole.GetRadius() * 2;
// Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon // Chamfer = width * ( 1 - sqrt(2)/2 ) for equilateral octagon
return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ), return OctagonalHull( m_pos - VECTOR2I( width / 2, width / 2 ),
VECTOR2I( width, width ), VECTOR2I( width, width ),
cl + 1, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) ); cl, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) );
}
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 ) );
} }

View File

@ -140,6 +140,9 @@ public:
const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0, const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
int aLayer = -1 ) const override; int aLayer = -1 ) const override;
const SHAPE_LINE_CHAIN HoleHull( int aClearance = 0, int aWalkaroundThickness = 0,
int aLayer = -1 ) const override;
virtual VECTOR2I Anchor( int n ) const override virtual VECTOR2I Anchor( int n ) const override
{ {
return m_pos; return m_pos;