fix issues in DRC and fill zone, related to recent changes in code.
Note also: the actual clearance between 2 pads when < minimal clearance is incorrectly calculated.
This commit is contained in:
parent
bb1afb747a
commit
42296d7eb9
|
@ -305,7 +305,7 @@ void D_PAD::BuildEffectiveShapes() const
|
||||||
if( board )
|
if( board )
|
||||||
maxError = board->GetDesignSettings().m_MaxError;
|
maxError = board->GetDesignSettings().m_MaxError;
|
||||||
|
|
||||||
TransformRoundChamferedRectToPolygon( outline, wxPoint(0,0), GetSize(), m_Orient,
|
TransformRoundChamferedRectToPolygon( outline, shapePos, GetSize(), m_Orient,
|
||||||
GetRoundRectCornerRadius(), GetChamferRectRatio(),
|
GetRoundRectCornerRadius(), GetChamferRectRatio(),
|
||||||
GetChamferPositions(), maxError );
|
GetChamferPositions(), maxError );
|
||||||
|
|
||||||
|
|
|
@ -259,10 +259,12 @@ private:
|
||||||
* @param aRefPad The reference pad to check
|
* @param aRefPad The reference pad to check
|
||||||
* @param aPad Another pad to check against
|
* @param aPad Another pad to check against
|
||||||
* @param aMinClearance is the minimum allowed distance between the pads
|
* @param aMinClearance is the minimum allowed distance between the pads
|
||||||
* @param aActual [out] it the actual distance (only guaranteed to be set for violations)
|
* @param aActualDist [out] it the actual distance
|
||||||
* @return bool - true if clearance between aRefPad and aPad is >= aMinClearance, else false
|
* (only guaranteed to be set for violations)
|
||||||
|
* @return true if clearance between aRefPad and aPad is >= aMinClearance, else false
|
||||||
*/
|
*/
|
||||||
bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance, int* aActual );
|
bool checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad,
|
||||||
|
int aMinClearance, int* aActualDist );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -687,7 +687,7 @@ void DRC::doTrackDrc( BOARD_COMMIT& aCommit, TRACK* aRefSeg, TRACKS::iterator aS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance, int* aActual )
|
bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance, int* aActualDist )
|
||||||
{
|
{
|
||||||
int center2center = KiROUND( EuclideanNorm( aPad->ShapePos() - aRefPad->ShapePos() ) );
|
int center2center = KiROUND( EuclideanNorm( aPad->ShapePos() - aRefPad->ShapePos() ) );
|
||||||
|
|
||||||
|
@ -698,8 +698,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance
|
||||||
// JEY TODO:
|
// JEY TODO:
|
||||||
// TOM TODO: MTV only works as a proxy for actual-distance for convex shapes
|
// TOM TODO: MTV only works as a proxy for actual-distance for convex shapes
|
||||||
|
|
||||||
VECTOR2I mtv;
|
VECTOR2I mtv; // minimum translation vector calculated by Collide()
|
||||||
VECTOR2I maxMtv( 0, 0 );
|
VECTOR2I maxMtv( 0, 0 ); // is the move distance between 2 shapes calculated
|
||||||
|
// by Collide to do not have a collision
|
||||||
|
bool shapes_collide = false;
|
||||||
|
|
||||||
for( const std::shared_ptr<SHAPE>& aShape : aRefPad->GetEffectiveShapes() )
|
for( const std::shared_ptr<SHAPE>& aShape : aRefPad->GetEffectiveShapes() )
|
||||||
{
|
{
|
||||||
|
@ -707,15 +709,20 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance
|
||||||
{
|
{
|
||||||
if( aShape->Collide( bShape.get(), aMinClearance, mtv ) )
|
if( aShape->Collide( bShape.get(), aMinClearance, mtv ) )
|
||||||
{
|
{
|
||||||
|
shapes_collide = true;
|
||||||
|
|
||||||
if( mtv.SquaredEuclideanNorm() > maxMtv.SquaredEuclideanNorm() )
|
if( mtv.SquaredEuclideanNorm() > maxMtv.SquaredEuclideanNorm() )
|
||||||
maxMtv = mtv;
|
maxMtv = mtv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( maxMtv.x > 0 || maxMtv.y > 0 )
|
if( shapes_collide )
|
||||||
{
|
{
|
||||||
*aActual = std::max( 0, aMinClearance - maxMtv.EuclideanNorm() );
|
// returns the actual clearance (clearance < aMinClearance) for diags:
|
||||||
|
if( aActualDist )
|
||||||
|
*aActualDist = std::max( 0, aMinClearance - maxMtv.EuclideanNorm() );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue