Remove duplicated clearanceEpsilon

We already get clearance epsilon in the clearance resolver.  Don't
subtract it twice or we end up getting DRC errors

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16879
This commit is contained in:
Seth Hillbrand 2024-03-29 12:53:15 -07:00
parent 5e850911c5
commit 10c1072479
1 changed files with 8 additions and 7 deletions

View File

@ -103,7 +103,6 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
const SHAPE* shapeH = aHead->Shape(); const SHAPE* shapeH = aHead->Shape();
const HOLE* holeH = aHead->Hole(); const HOLE* holeH = aHead->Hole();
int lineWidthH = 0; int lineWidthH = 0;
int clearanceEpsilon = aNode->GetRuleResolver()->ClearanceEpsilon();
bool collisionsFound = false; bool collisionsFound = false;
if( this == aHead ) // we cannot be self-colliding if( this == aHead ) // we cannot be self-colliding
@ -192,9 +191,6 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
} }
else else
{ {
if( aCtx && !aCtx->options.m_useClearanceEpsilon )
clearanceEpsilon = 0;
clearance = aNode->GetClearance( this, aHead, aCtx ? aCtx->options.m_useClearanceEpsilon clearance = aNode->GetClearance( this, aHead, aCtx ? aCtx->options.m_useClearanceEpsilon
: false ); : false );
} }
@ -215,8 +211,10 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
int actual; int actual;
VECTOR2I pos; VECTOR2I pos;
if( shapeH->Collide( shapeI, clearance + lineWidthH + lineWidthI - clearanceEpsilon, // The extra "1" here is to account for the fact that the hulls are built to exactly
&actual, &pos ) ) // the clearance distance, so we need to allow for no collision when exactly at the
// clearance distance.
if( shapeH->Collide( shapeI, clearance + lineWidthH + lineWidthI - 1, &actual, &pos ) )
{ {
if( checkCastellation && aNode->QueryEdgeExclusions( pos ) ) if( checkCastellation && aNode->QueryEdgeExclusions( pos ) )
return false; return false;
@ -244,7 +242,10 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
else else
{ {
// Fast method // Fast method
if( shapeH->Collide( shapeI, clearance + lineWidthH + lineWidthI - clearanceEpsilon ) ) // The extra "1" here is to account for the fact that the hulls are built to exactly
// the clearance distance, so we need to allow for no collision when exactly at the
// clearance distance.
if( shapeH->Collide( shapeI, clearance + lineWidthH + lineWidthI - 1 ) )
{ {
if( aCtx ) if( aCtx )
{ {