drc_clearance_test_functions.cpp: remove a stupid "optimization code" that creates broken tests (sorry to be rude)

Fixes: lp:1831776
https://bugs.launchpad.net/kicad/+bug/1831776
This commit is contained in:
jean-pierre charras 2019-06-06 13:10:24 +02:00
parent ce9b1e3da5
commit f1f26a9197
1 changed files with 20 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -40,8 +40,8 @@
#include <board_commit.h>
/*
* compare 2 convex polygons and return true if distance > aDist
/**
* compare 2 convex polygons and return true if distance > aDist (if no error DRC)
* i.e if for each edge of the first polygon distance from each edge of the other polygon
* is >= aDist
*/
@ -954,15 +954,17 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
{
const SHAPE_LINE_CHAIN& refpoly = polysetref.COutline( 0 );
// And now test polygons:
diag &= !poly2polyDRC( (wxPoint*) &refpoly.CPoint( 0 ), refpoly.PointCount(),
polycompare, 4, dist_min );
if( !poly2polyDRC( (wxPoint*) &refpoly.CPoint( 0 ), refpoly.PointCount(),
polycompare, 4, dist_min ) ) // Therefore error
diag = false;
}
else if( polysetref.OutlineCount() == 0 && polysetcompare.OutlineCount())
{
const SHAPE_LINE_CHAIN& cmppoly = polysetcompare.COutline( 0 );
// And now test polygons:
diag &= !poly2polyDRC( (wxPoint*) &cmppoly.CPoint( 0 ), cmppoly.PointCount(),
polyref, 4, dist_min );
if( !poly2polyDRC( (wxPoint*) &cmppoly.CPoint( 0 ), cmppoly.PointCount(),
polyref, 4, dist_min ) ) // Therefore error
diag = false;
}
else if( polysetref.OutlineCount() && polysetcompare.OutlineCount() )
{
@ -970,13 +972,15 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
const SHAPE_LINE_CHAIN& cmppoly = polysetcompare.COutline( 0 );
// And now test polygons:
diag &= !poly2polyDRC( (wxPoint*) &refpoly.CPoint( 0 ), refpoly.PointCount(),
if( !poly2polyDRC( (wxPoint*) &refpoly.CPoint( 0 ), refpoly.PointCount(),
(wxPoint*) &cmppoly.CPoint( 0 ), cmppoly.PointCount(),
dist_min );
dist_min ) ) // Therefore error
diag = false;
}
else
{
diag &= !poly2polyDRC( polyref, 4, polycompare, 4, dist_min );
if( !poly2polyDRC( polyref, 4, polycompare, 4, dist_min ) ) // Therefore error
diag = false;
}
break;