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

(cherry picked from commit 10c1072479)
This commit is contained in:
Seth Hillbrand 2024-03-29 12:53:15 -07:00
parent 7916e56963
commit 4bf35cbed8
1 changed files with 8 additions and 4 deletions

View File

@ -103,7 +103,6 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
const SHAPE* shapeH = aHead->Shape();
const HOLE* holeH = aHead->Hole();
int lineWidthH = 0;
int clearanceEpsilon = aNode->GetRuleResolver()->ClearanceEpsilon();
bool collisionsFound = false;
if( this == aHead ) // we cannot be self-colliding
@ -212,8 +211,10 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
int actual;
VECTOR2I pos;
if( shapeH->Collide( shapeI, clearance + lineWidthH + lineWidthI - clearanceEpsilon,
&actual, &pos ) )
// 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, &actual, &pos ) )
{
if( checkCastellation && aNode->QueryEdgeExclusions( pos ) )
return false;
@ -241,7 +242,10 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
else
{
// 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 )
{