Browse Source

DRC: fix one of some things that can create false positive.

in bool shapeNeedsUpdate(), if a shape is a rectangle and the other is a polygon,
we need to try to convert the polygon to a rectangle for comparison, because some
transforms ( and especially PCB_SHAPE::Normalize() ) can convert a polygon to a rectangle
So a poly and a rectangle can be in fact the same shape

Partial fix of bug 16075.
newinvert
jean-pierre charras 2 years ago
parent
commit
b564d0713c
  1. 21
      pcbnew/drc/drc_test_provider_library_parity.cpp

21
pcbnew/drc/drc_test_provider_library_parity.cpp

@ -352,6 +352,27 @@ bool padNeedsUpdate( const PAD* a, const PAD* b, REPORTER* aReporter )
bool shapeNeedsUpdate( const PCB_SHAPE* a, const PCB_SHAPE* b )
{
// Preliminary test: if a shape is a rectangle and the other is a polygon,
// try to convert the polygon to a rectangle for comparison, because some transforms
// ( and especially PCB_SHAPE::Normalize() ) can convert a polygon to a rectangle
// So a poly and a rectangle can be in fact the same shape
if( a->GetShape() == SHAPE_T::POLY && b->GetShape() == SHAPE_T::RECTANGLE )
{
PCB_SHAPE rect_test( *a );
rect_test.Normalize();
if( rect_test.GetShape() == SHAPE_T::RECTANGLE )
return shapeNeedsUpdate( &rect_test, b );
}
else if( a->GetShape() == SHAPE_T::RECTANGLE && b->GetShape() == SHAPE_T::POLY )
{
PCB_SHAPE rect_test( *b );
rect_test.Normalize();
if( rect_test.GetShape() == SHAPE_T::RECTANGLE )
return shapeNeedsUpdate( a, &rect_test );
}
REPORTER* aReporter = nullptr;
bool diff = false;

Loading…
Cancel
Save