SHAPE_POLY_SET::Inflate(): correct arc approximation for negative offsets (deflation). Control circle->segments count explicitly in all Inflate() calls

This commit is contained in:
Tomasz Wlostowski 2015-07-14 15:05:41 +02:00 committed by Maciej Suminski
parent 41c753b05d
commit 9f18e5a98f
6 changed files with 5 additions and 22 deletions

View File

@ -351,30 +351,13 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
if( bufferPolys.IsEmpty() )
continue;
std::auto_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO( "poly_dump.txt", true ) );
// Use Clipper lib to subtract holes to copper areas
dumper->BeginGroup( "clipper-zone" );
dumper->Write( &bufferPolys, "pre-simplify" );
bufferPolys.Simplify();
dumper->Write( &bufferPolys, "post-simplify" );
currLayerHoles.Simplify();
allLayerHoles.Simplify();
//dumper->Write(&bufferPolys, "pre-sub");
//dumper->Write(&allLayerHoles, "holes");
// Add through holes (created only once) in current polygon holes list
//bufferPolys.BooleanSubtract( currLayerHoles );
//bufferPolys.Simplify();
bufferPolys.BooleanSubtract( allLayerHoles );
//dumper->Write(&bufferPolys, "post-sub");
dumper->EndGroup();
bufferPolys.Fracture();
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );

View File

@ -257,7 +257,7 @@ void SHAPE_POLY_SET::Inflate( int aFactor, int aCircleSegmentsCount )
PolyTree solution;
c.ArcTolerance = (double)aFactor / M_PI / aCircleSegmentsCount;
c.ArcTolerance = (double)fabs( aFactor ) / M_PI / aCircleSegmentsCount;
c.Execute( solution, aFactor );

View File

@ -251,7 +251,7 @@ class SHAPE_POLY_SET : public SHAPE
void BooleanSubtract( const SHAPE_POLY_SET& b );
///> Performs outline inflation/deflation, using round corners.
void Inflate ( int aFactor, int aCircleSegmentsCount = 32 );
void Inflate( int aFactor, int aCircleSegmentsCount );
///> Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the outer ring
///> to the inner holes

View File

@ -111,7 +111,7 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, SHAPE_POLY_SET*
{
int margin = m_ZoneMinThickness / 2;
m_FilledPolysList = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList );
m_FilledPolysList.Inflate( -margin );
m_FilledPolysList.Inflate( -margin, 16 );
m_FilledPolysList.Fracture();
}

View File

@ -426,7 +426,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
SHAPE_POLY_SET solidAreas = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList );
solidAreas.Inflate( -outline_half_thickness );
solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
solidAreas.Simplify();
SHAPE_POLY_SET holes;

View File

@ -65,7 +65,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
// Calculate the polygon with clearance
// holes are linked to the main outline, so only one polygon is created.
if( clearance )
aCornerBuffer.Inflate( clearance );
aCornerBuffer.Inflate( clearance, 16 );
aCornerBuffer.Fracture( );
}