PNS: Implement HoleHull for VIA

This commit is contained in:
Jon Evans 2022-06-07 19:48:03 -04:00
parent af8deff063
commit 23596812b6
3 changed files with 18 additions and 4 deletions

View File

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

View File

@ -112,12 +112,23 @@ const SHAPE_LINE_CHAIN VIA::Hull( int aClearance, int aWalkaroundThickness, int
int width = m_diameter;
if( !ROUTER::GetInstance()->GetInterface()->IsFlashedOnLayer( this, aLayer ) )
width = m_drill;
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 + 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

@ -143,6 +143,9 @@ public:
const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
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
{
return m_pos;