Add a couple more layers to zone debugging.

This commit is contained in:
Jeff Young 2020-10-24 14:19:37 +01:00
parent d2eca81b8b
commit 317bdc58a8
1 changed files with 24 additions and 12 deletions

View File

@ -932,10 +932,11 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
{ if( m_debugZoneFiller && dumpLayer == b ) \ { if( m_debugZoneFiller && dumpLayer == b ) \
{ \ { \
m_board->SetLayerName( b, c ); \ m_board->SetLayerName( b, c ); \
a.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); \ SHAPE_POLY_SET d = a; \
a.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); \ d.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); \
aRawPolys = a; \ d.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); \
aFinalPolys = a; \ aRawPolys = d; \
aFinalPolys = d; \
return; \ return; \
} \ } \
} }
@ -999,6 +1000,7 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
return; return;
buildCopperItemClearances( aZone, aLayer, clearanceHoles ); buildCopperItemClearances( aZone, aLayer, clearanceHoles );
DUMP_POLYS_TO_COPPER_LAYER( clearanceHoles, In3_Cu, "clearance-holes" );
if( m_progressReporter && m_progressReporter->IsCancelled() ) if( m_progressReporter && m_progressReporter->IsCancelled() )
return; return;
@ -1013,16 +1015,16 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
static const bool USE_BBOX_CACHES = true; static const bool USE_BBOX_CACHES = true;
SHAPE_POLY_SET testAreas = aRawPolys; SHAPE_POLY_SET testAreas = aRawPolys;
testAreas.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST ); testAreas.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST );
DUMP_POLYS_TO_COPPER_LAYER( testAreas, In3_Cu, "minus-clearance-holes" ); DUMP_POLYS_TO_COPPER_LAYER( testAreas, In4_Cu, "minus-clearance-holes" );
// Prune features that don't meet minimum-width criteria // Prune features that don't meet minimum-width criteria
if( half_min_width - epsilon > epsilon ) if( half_min_width - epsilon > epsilon )
{ {
testAreas.Deflate( half_min_width - epsilon, numSegs, fastCornerStrategy ); testAreas.Deflate( half_min_width - epsilon, numSegs, fastCornerStrategy );
DUMP_POLYS_TO_COPPER_LAYER( testAreas, In4_Cu, "spoke-test-deflated" ); DUMP_POLYS_TO_COPPER_LAYER( testAreas, In5_Cu, "spoke-test-deflated" );
testAreas.Inflate( half_min_width - epsilon, numSegs, fastCornerStrategy ); testAreas.Inflate( half_min_width - epsilon, numSegs, fastCornerStrategy );
DUMP_POLYS_TO_COPPER_LAYER( testAreas, In5_Cu, "spoke-test-reinflated" ); DUMP_POLYS_TO_COPPER_LAYER( testAreas, In6_Cu, "spoke-test-reinflated" );
} }
if( m_progressReporter && m_progressReporter->IsCancelled() ) if( m_progressReporter && m_progressReporter->IsCancelled() )
@ -1033,6 +1035,8 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
testAreas.BuildBBoxCaches(); testAreas.BuildBBoxCaches();
int interval = 0; int interval = 0;
SHAPE_POLY_SET debugSpokes;
for( const SHAPE_LINE_CHAIN& spoke : thermalSpokes ) for( const SHAPE_LINE_CHAIN& spoke : thermalSpokes )
{ {
const VECTOR2I& testPt = spoke.CPoint( 3 ); const VECTOR2I& testPt = spoke.CPoint( 3 );
@ -1040,6 +1044,9 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
// Hit-test against zone body // Hit-test against zone body
if( testAreas.Contains( testPt, -1, 1, USE_BBOX_CACHES ) ) if( testAreas.Contains( testPt, -1, 1, USE_BBOX_CACHES ) )
{ {
if( m_debugZoneFiller )
debugSpokes.AddOutline( spoke );
aRawPolys.AddOutline( spoke ); aRawPolys.AddOutline( spoke );
continue; continue;
} }
@ -1057,25 +1064,28 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
{ {
if( &other != &spoke && other.PointInside( testPt, 1, USE_BBOX_CACHES ) ) if( &other != &spoke && other.PointInside( testPt, 1, USE_BBOX_CACHES ) )
{ {
if( m_debugZoneFiller )
debugSpokes.AddOutline( spoke );
aRawPolys.AddOutline( spoke ); aRawPolys.AddOutline( spoke );
break; break;
} }
} }
} }
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In6_Cu, "plus-spokes" ); DUMP_POLYS_TO_COPPER_LAYER( debugSpokes, In7_Cu, "spokes" );
if( m_progressReporter && m_progressReporter->IsCancelled() ) if( m_progressReporter && m_progressReporter->IsCancelled() )
return; return;
aRawPolys.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST ); aRawPolys.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST );
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In7_Cu, "trimmed-spokes" ); DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In8_Cu, "after-spoke-trimming" );
// Prune features that don't meet minimum-width criteria // Prune features that don't meet minimum-width criteria
if( half_min_width - epsilon > epsilon ) if( half_min_width - epsilon > epsilon )
aRawPolys.Deflate( half_min_width - epsilon, numSegs, cornerStrategy ); aRawPolys.Deflate( half_min_width - epsilon, numSegs, cornerStrategy );
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In8_Cu, "deflated" ); DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In9_Cu, "deflated" );
if( m_progressReporter && m_progressReporter->IsCancelled() ) if( m_progressReporter && m_progressReporter->IsCancelled() )
return; return;
@ -1084,7 +1094,7 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN )
addHatchFillTypeOnZone( aZone, aLayer, aRawPolys ); addHatchFillTypeOnZone( aZone, aLayer, aRawPolys );
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In9_Cu, "after-hatching" ); DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In10_Cu, "after-hatching" );
if( m_progressReporter && m_progressReporter->IsCancelled() ) if( m_progressReporter && m_progressReporter->IsCancelled() )
return; return;
@ -1100,12 +1110,14 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, PCB_LAYER_I
aRawPolys.Inflate( half_min_width - epsilon, numSegs, cornerStrategy ); aRawPolys.Inflate( half_min_width - epsilon, numSegs, cornerStrategy );
} }
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In10_Cu, "after-reinflating" ); DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In11_Cu, "after-reinflating" );
// Ensure additive changes (thermal stubs and particularly inflating acute corners) do not // Ensure additive changes (thermal stubs and particularly inflating acute corners) do not
// add copper outside the zone boundary or inside the clearance holes // add copper outside the zone boundary or inside the clearance holes
aRawPolys.BooleanIntersection( aSmoothedOutline, SHAPE_POLY_SET::PM_FAST ); aRawPolys.BooleanIntersection( aSmoothedOutline, SHAPE_POLY_SET::PM_FAST );
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In12_Cu, "after-trim-to-outline" );
aRawPolys.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST ); aRawPolys.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST );
DUMP_POLYS_TO_COPPER_LAYER( aRawPolys, In13_Cu, "after-trim-to-clearance-holes" );
aRawPolys.Fracture( SHAPE_POLY_SET::PM_FAST ); aRawPolys.Fracture( SHAPE_POLY_SET::PM_FAST );