Polygon calculation (zones filling): use fast mode when possible (in fact most of time) and strictly simple polygon option only in critical cases (in fact in plot Gerber functions mainly).
In polygon calculations (combining polygons, fracture) the mode of calculation (fast or strictly simple polygon option) as no more a default value, because choosing the best mode is better to optimize the calculation time.
This commit is contained in:
parent
0caa47e73c
commit
178cf0dc25
|
@ -61,7 +61,7 @@
|
|||
#include <reporter.h>
|
||||
|
||||
|
||||
extern bool useFastModeForPolygons;
|
||||
extern SHAPE_POLY_SET::POLYGON_MODE polygonsCalcMode;
|
||||
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
|
@ -704,7 +704,7 @@ void EDA_3D_CANVAS::buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* a
|
|||
if( bufferPolys.IsEmpty() )
|
||||
continue;
|
||||
|
||||
bufferPolys.Simplify( useFastModeForPolygons );
|
||||
bufferPolys.Simplify( polygonsCalcMode );
|
||||
|
||||
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );
|
||||
|
|
|
@ -64,13 +64,13 @@
|
|||
#include <reporter.h>
|
||||
|
||||
// An option for all operations on polygons:
|
||||
// when useFastModeForPolygons = true, calculations can be *a lot* faster.
|
||||
// when polygonsCalcMode = true, calculations can be *a lot* faster.
|
||||
// but created polygons can be not stricty simple (can share edges)
|
||||
// Although stricty simple are better for glu tesselation functions, I do not see
|
||||
// any issue when allowing not stricty simple polygons.
|
||||
// But I see *very* long calculations when setting useFastMode to false.
|
||||
// So, be careful if changing thie option
|
||||
bool useFastModeForPolygons = true;
|
||||
SHAPE_POLY_SET::POLYGON_MODE polygonsCalcMode = SHAPE_POLY_SET::PM_FAST;
|
||||
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
|
@ -148,7 +148,7 @@ void EDA_3D_CANVAS::buildBoardThroughHolesPolygonList( SHAPE_POLY_SET& allBoardH
|
|||
}
|
||||
}
|
||||
|
||||
allBoardHoles.Simplify( useFastModeForPolygons );
|
||||
allBoardHoles.Simplify( polygonsCalcMode );
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,11 +323,11 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
|||
if( currLayerHoles.OutlineCount() )
|
||||
{
|
||||
currLayerHoles.Append(allLayerHoles);
|
||||
currLayerHoles.Simplify( useFastModeForPolygons );
|
||||
bufferPolys.BooleanSubtract( currLayerHoles, useFastModeForPolygons );
|
||||
currLayerHoles.Simplify( polygonsCalcMode );
|
||||
bufferPolys.BooleanSubtract( currLayerHoles, polygonsCalcMode );
|
||||
}
|
||||
else
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, polygonsCalcMode );
|
||||
|
||||
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );
|
||||
|
@ -423,7 +423,7 @@ void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
|||
zpos += (copper_thickness + epsilon) / 2.0f;
|
||||
board_thickness -= copper_thickness + epsilon;
|
||||
|
||||
bufferPcbOutlines.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
bufferPcbOutlines.BooleanSubtract( allLayerHoles, polygonsCalcMode );
|
||||
|
||||
if( !bufferPcbOutlines.IsEmpty() )
|
||||
{
|
||||
|
@ -583,15 +583,15 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a
|
|||
bufferPolys = bufferPcbOutlines;
|
||||
|
||||
cuts.Append(allLayerHoles);
|
||||
cuts.Simplify( useFastModeForPolygons );
|
||||
cuts.Simplify( polygonsCalcMode );
|
||||
|
||||
bufferPolys.BooleanSubtract( cuts, useFastModeForPolygons );
|
||||
bufferPolys.BooleanSubtract( cuts, polygonsCalcMode );
|
||||
}
|
||||
// Remove holes from Solder paste layers and silkscreen
|
||||
else if( layer == B_Paste || layer == F_Paste
|
||||
|| layer == B_SilkS || layer == F_SilkS )
|
||||
{
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, polygonsCalcMode );
|
||||
}
|
||||
|
||||
int thickness = 0;
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
// include this after shape_poly_set.h to avoid redefinition of min, max ...
|
||||
#include <potracelib.h>
|
||||
#include <auxiliary.h>
|
||||
|
||||
/* free a potrace bitmap */
|
||||
static void bm_free( potrace_bitmap_t* bm )
|
||||
|
@ -493,10 +492,10 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
|
|||
if( paths->next == NULL || paths->next->sign == '+' )
|
||||
{
|
||||
// Substract holes to main polygon:
|
||||
polyset_areas.Simplify();
|
||||
polyset_holes.Simplify();
|
||||
polyset_areas.BooleanSubtract( polyset_holes );
|
||||
polyset_areas.Fracture();
|
||||
polyset_areas.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
polyset_holes.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_FAST );
|
||||
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
// Output current resulting polygon(s)
|
||||
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
|
||||
|
@ -515,6 +514,17 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
|
|||
OuputFileEnd();
|
||||
}
|
||||
|
||||
// a helper function to calculate a square value
|
||||
inline double square( double x )
|
||||
{
|
||||
return x*x;
|
||||
}
|
||||
|
||||
// a helper function to calculate a cube value
|
||||
inline double cube( double x )
|
||||
{
|
||||
return x*x*x;
|
||||
}
|
||||
|
||||
/* render a Bezier curve. */
|
||||
void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
|
||||
|
@ -536,23 +546,23 @@ void BezierToPolyline( std::vector <potrace_dpoint_t>& aCornersBuffer,
|
|||
|
||||
/* let dd = maximal value of 2nd derivative over curve - this must
|
||||
* occur at an endpoint. */
|
||||
dd0 = sq( p1.x - 2 * p2.x + p3.x ) + sq( p1.y - 2 * p2.y + p3.y );
|
||||
dd1 = sq( p2.x - 2 * p3.x + p4.x ) + sq( p2.y - 2 * p3.y + p4.y );
|
||||
dd = 6 * sqrt( max( dd0, dd1 ) );
|
||||
dd0 = square( p1.x - 2 * p2.x + p3.x ) + square( p1.y - 2 * p2.y + p3.y );
|
||||
dd1 = square( p2.x - 2 * p3.x + p4.x ) + square( p2.y - 2 * p3.y + p4.y );
|
||||
dd = 6 * sqrt( std::max( dd0, dd1 ) );
|
||||
e2 = 8 * delta <= dd ? 8 * delta / dd : 1;
|
||||
epsilon = sqrt( e2 ); /* necessary interval size */
|
||||
|
||||
for( t = epsilon; t<1; t += epsilon )
|
||||
{
|
||||
potrace_dpoint_t intermediate_point;
|
||||
intermediate_point.x = p1.x * cu( 1 - t ) +
|
||||
3* p2.x* sq( 1 - t ) * t +
|
||||
3 * p3.x * (1 - t) * sq( t ) +
|
||||
p4.x* cu( t );
|
||||
intermediate_point.x = p1.x * cube( 1 - t ) +
|
||||
3* p2.x* square( 1 - t ) * t +
|
||||
3 * p3.x * (1 - t) * square( t ) +
|
||||
p4.x* cube( t );
|
||||
|
||||
intermediate_point.y = p1.y * cu( 1 - t ) +
|
||||
3* p2.y* sq( 1 - t ) * t +
|
||||
3 * p3.y * (1 - t) * sq( t ) + p4.y* cu( t );
|
||||
intermediate_point.y = p1.y * cube( 1 - t ) +
|
||||
3* p2.y* square( 1 - t ) * t +
|
||||
3 * p3.y * (1 - t) * square( t ) + p4.y* cube( t );
|
||||
|
||||
aCornersBuffer.push_back( intermediate_point );
|
||||
}
|
||||
|
|
|
@ -8,69 +8,71 @@
|
|||
static const unsigned char png[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
|
||||
0xce, 0x00, 0x00, 0x03, 0xe2, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xb5, 0x95, 0x5b, 0x4c, 0x1c,
|
||||
0x55, 0x18, 0xc7, 0x17, 0x86, 0x65, 0x59, 0x96, 0xe5, 0xb6, 0x96, 0x94, 0x70, 0x09, 0x5a, 0x1e,
|
||||
0xec, 0x83, 0x24, 0x0a, 0x18, 0xa5, 0xd4, 0x27, 0x6d, 0xc0, 0x5b, 0x63, 0x43, 0x13, 0x1a, 0x23,
|
||||
0xd1, 0x90, 0xa6, 0x11, 0x1e, 0x2a, 0x0f, 0x5a, 0x48, 0x37, 0xb0, 0x4b, 0x40, 0x36, 0x43, 0x9b,
|
||||
0x46, 0xc1, 0xe0, 0x72, 0xe9, 0x83, 0xc5, 0x18, 0x78, 0x30, 0x36, 0x28, 0x89, 0xed, 0x43, 0xfb,
|
||||
0xd2, 0x9a, 0x1a, 0x74, 0x37, 0x69, 0x6d, 0x61, 0x4b, 0x69, 0xa1, 0x5c, 0xbb, 0x4b, 0x8a, 0x54,
|
||||
0xd7, 0x86, 0x86, 0xfe, 0xfd, 0x9f, 0x99, 0xb3, 0x66, 0x84, 0x96, 0xd4, 0xb8, 0x7b, 0x92, 0x5f,
|
||||
0x32, 0x33, 0x67, 0xe6, 0xfc, 0xce, 0xf9, 0xbe, 0xef, 0x9c, 0x31, 0x99, 0xfe, 0x7b, 0xeb, 0x24,
|
||||
0x35, 0xc4, 0x4e, 0x86, 0xc9, 0x0b, 0xe4, 0x25, 0x79, 0x2d, 0x70, 0x93, 0x78, 0x53, 0x14, 0x9a,
|
||||
0x9f, 0x1c, 0x27, 0x0e, 0x02, 0xf2, 0x26, 0x29, 0x26, 0x5e, 0xc9, 0x6f, 0xa4, 0x2b, 0x56, 0xa2,
|
||||
0x44, 0x92, 0x21, 0x19, 0x20, 0x17, 0x63, 0x25, 0xda, 0x2f, 0xaf, 0x05, 0x2b, 0x64, 0x57, 0x34,
|
||||
0x44, 0x2d, 0x64, 0x51, 0x0a, 0xa7, 0x48, 0x8e, 0x41, 0xb4, 0x4b, 0xde, 0x47, 0xad, 0x7d, 0x40,
|
||||
0x3a, 0x0c, 0x83, 0x3e, 0x47, 0x3c, 0xc4, 0xfc, 0x24, 0x1f, 0xd7, 0x3f, 0xe6, 0xc5, 0x83, 0x86,
|
||||
0x44, 0x3b, 0x49, 0x25, 0x69, 0x95, 0x7d, 0x75, 0x52, 0x9a, 0x46, 0xbe, 0x94, 0xef, 0x08, 0xe9,
|
||||
0xeb, 0x86, 0x6f, 0xde, 0xdb, 0x38, 0x60, 0xd0, 0x6c, 0x36, 0x07, 0x12, 0x12, 0x12, 0x36, 0xc6,
|
||||
0xf7, 0x23, 0x59, 0xb6, 0x33, 0xe4, 0x27, 0xe2, 0x22, 0xb3, 0xb2, 0xef, 0x47, 0xd9, 0xd7, 0x5c,
|
||||
0x58, 0x58, 0x88, 0x92, 0x92, 0x12, 0x11, 0xbe, 0x33, 0x64, 0x9f, 0x7c, 0x3e, 0x46, 0xd6, 0x37,
|
||||
0x89, 0x28, 0x41, 0x5c, 0x5c, 0x1c, 0xd2, 0xd3, 0xd3, 0xbf, 0xe7, 0x7d, 0xa6, 0xa1, 0x6f, 0x9b,
|
||||
0x4c, 0xf2, 0xbb, 0x52, 0xf4, 0x17, 0xf9, 0x8e, 0x2c, 0xc9, 0x01, 0x4f, 0xcd, 0xce, 0xce, 0x62,
|
||||
0x6d, 0x6d, 0x0d, 0x79, 0x79, 0x79, 0x01, 0xf9, 0x8d, 0x42, 0xbe, 0x26, 0x67, 0x37, 0x89, 0xda,
|
||||
0xda, 0xda, 0x71, 0xe2, 0xc4, 0x67, 0xb0, 0xdb, 0xed, 0x48, 0x4a, 0x4a, 0xfa, 0x33, 0x39, 0x39,
|
||||
0xf9, 0xa0, 0xec, 0xeb, 0x26, 0x3e, 0xb9, 0x11, 0x45, 0xe8, 0x3e, 0x97, 0x4c, 0x4b, 0xd1, 0x57,
|
||||
0xe3, 0xe3, 0xe3, 0x58, 0x5d, 0x5d, 0x45, 0x76, 0x76, 0xf6, 0x04, 0xef, 0x2d, 0x64, 0x88, 0x7c,
|
||||
0x4b, 0x92, 0x36, 0x89, 0x3c, 0x1e, 0x15, 0xf7, 0xef, 0x03, 0x93, 0x93, 0x73, 0x38, 0x70, 0xa0,
|
||||
0x46, 0x5b, 0x1d, 0xa5, 0xa2, 0xba, 0x1e, 0x90, 0x57, 0x1f, 0x91, 0xbf, 0x48, 0xe8, 0x3e, 0x76,
|
||||
0x38, 0x1c, 0xc8, 0xcd, 0xcd, 0x15, 0xa1, 0x3b, 0x25, 0xee, 0xc9, 0x43, 0xf2, 0x2b, 0xf9, 0x39,
|
||||
0xf2, 0xf2, 0x4e, 0x72, 0x8c, 0x84, 0x3a, 0x3a, 0x54, 0x84, 0xc3, 0xe0, 0xcc, 0x80, 0xbb, 0x77,
|
||||
0x81, 0xd3, 0xa7, 0xcf, 0xa3, 0xa0, 0x60, 0x07, 0xe2, 0xe3, 0xe3, 0xd7, 0x53, 0x53, 0x53, 0x5b,
|
||||
0x65, 0x38, 0x8c, 0x4d, 0x94, 0xf5, 0xdb, 0xc4, 0x4a, 0x3e, 0x21, 0x47, 0x48, 0x3e, 0x79, 0x59,
|
||||
0x5e, 0x1f, 0x91, 0xcf, 0xf9, 0x34, 0x3f, 0xff, 0x35, 0x9b, 0xcd, 0xe6, 0x57, 0x14, 0xe5, 0xf7,
|
||||
0xf6, 0x76, 0x15, 0xf7, 0xee, 0xe9, 0x92, 0x50, 0x08, 0x58, 0x5a, 0x02, 0xa6, 0xa7, 0x1f, 0xc0,
|
||||
0xe3, 0xf1, 0x22, 0x23, 0xc3, 0x01, 0xca, 0x66, 0x58, 0x30, 0x25, 0x52, 0x62, 0x95, 0xe7, 0xdc,
|
||||
0x33, 0x4f, 0xb4, 0x21, 0x7a, 0x7b, 0x7b, 0x2b, 0xfb, 0xfa, 0xfa, 0x90, 0x92, 0x92, 0x82, 0xb6,
|
||||
0x36, 0x15, 0x2b, 0x2b, 0xc0, 0xf2, 0xb2, 0x2e, 0x99, 0x9f, 0x07, 0x6e, 0xdf, 0x06, 0x6e, 0xde,
|
||||
0x04, 0xc6, 0xc6, 0x42, 0xa8, 0xa9, 0x39, 0x0c, 0x16, 0xcc, 0x43, 0x4e, 0xec, 0x07, 0x7e, 0x3a,
|
||||
0x6f, 0x38, 0x0d, 0xbe, 0x79, 0xc4, 0x6a, 0xff, 0xdd, 0x86, 0x87, 0x87, 0x95, 0xc1, 0xc1, 0xc1,
|
||||
0x54, 0xe6, 0x23, 0xd4, 0xda, 0xaa, 0x6a, 0x92, 0x3b, 0x77, 0x80, 0x85, 0x05, 0x5d, 0x72, 0xeb,
|
||||
0x16, 0x70, 0xe3, 0x06, 0x30, 0x31, 0x01, 0x5c, 0xbd, 0x0a, 0x0c, 0x0d, 0x8d, 0xc1, 0x66, 0xb3,
|
||||
0x63, 0xf7, 0xee, 0x57, 0xe0, 0xf7, 0x4f, 0xe3, 0xe4, 0xc9, 0x51, 0x28, 0x4a, 0x02, 0x4a, 0x4b,
|
||||
0x4b, 0x7d, 0x69, 0x69, 0x69, 0x55, 0xf2, 0x48, 0x7a, 0x6a, 0x2b, 0x67, 0xd0, 0xed, 0x56, 0x11,
|
||||
0x0c, 0xea, 0x12, 0x56, 0x2b, 0xc3, 0xa6, 0x4b, 0x02, 0x01, 0xe0, 0xda, 0x35, 0xe0, 0xf2, 0x65,
|
||||
0x70, 0x70, 0x20, 0x33, 0x33, 0x0b, 0x4e, 0xe7, 0xa7, 0x98, 0x9a, 0x02, 0x7c, 0x3e, 0x70, 0x3b,
|
||||
0x6c, 0x83, 0x61, 0x75, 0x82, 0x3d, 0x5b, 0x8a, 0x5a, 0x5a, 0x54, 0x2c, 0x2e, 0x02, 0x73, 0x73,
|
||||
0xba, 0x44, 0x0c, 0x74, 0xfd, 0xba, 0x2e, 0xb9, 0x72, 0x05, 0xb8, 0x74, 0x29, 0x8c, 0x43, 0x87,
|
||||
0x5c, 0x2c, 0x0e, 0x05, 0x59, 0x59, 0xd9, 0x68, 0x6a, 0xfa, 0x02, 0x7b, 0xf7, 0x7e, 0xa8, 0x55,
|
||||
0x67, 0x63, 0x63, 0x23, 0x98, 0x86, 0x30, 0x81, 0x48, 0x05, 0x19, 0xdc, 0x28, 0x10, 0xb1, 0x4d,
|
||||
0x11, 0xa2, 0xe6, 0x66, 0x55, 0x93, 0xcc, 0xcc, 0xe8, 0x79, 0x11, 0x12, 0x6e, 0x0f, 0x4d, 0xd2,
|
||||
0xd5, 0x35, 0x82, 0x9c, 0x9c, 0xa7, 0x29, 0xc8, 0x42, 0x7d, 0x7d, 0x3d, 0xca, 0xca, 0xca, 0xc4,
|
||||
0xc6, 0xe6, 0xb3, 0x1c, 0xd4, 0xd6, 0xd6, 0x6a, 0x83, 0xf7, 0xf7, 0xf7, 0x5f, 0x24, 0x6f, 0x49,
|
||||
0x9e, 0xdf, 0x28, 0x7a, 0x43, 0x2e, 0x77, 0xd9, 0xe9, 0x54, 0xff, 0x91, 0x4c, 0x4e, 0xea, 0x92,
|
||||
0xd1, 0xd1, 0x00, 0xca, 0xcb, 0x2b, 0x99, 0x07, 0x05, 0x15, 0x15, 0x15, 0xe8, 0xe9, 0xe9, 0x89,
|
||||
0xcc, 0xf8, 0x02, 0x39, 0x27, 0xaf, 0x05, 0x53, 0x64, 0xe7, 0x63, 0xe3, 0xd5, 0xd0, 0xd0, 0xb0,
|
||||
0xa7, 0xae, 0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8a,
|
||||
0x50, 0xae, 0x87, 0xe8, 0x73, 0x32, 0x41, 0x7a, 0x89, 0x8b, 0x3c, 0xef, 0x23, 0x7a, 0x5d, 0xdc,
|
||||
0x07, 0x9c, 0xf7, 0xb8, 0x22, 0x29, 0x2b, 0x22, 0x5f, 0xe8, 0x8b, 0xf2, 0xf3, 0x0a, 0x51, 0x88,
|
||||
0xf1, 0x81, 0x73, 0x7c, 0x26, 0x7f, 0x42, 0x9e, 0x09, 0xb0, 0xe8, 0x87, 0x32, 0x54, 0x82, 0x32,
|
||||
0x92, 0x2b, 0x76, 0x25, 0xfb, 0x3e, 0x96, 0xfd, 0x91, 0xb2, 0x1a, 0xc5, 0x98, 0x34, 0xf2, 0x26,
|
||||
0x69, 0x24, 0x0e, 0xb2, 0xdb, 0x5f, 0xe4, 0x31, 0x99, 0x4c, 0x23, 0x46, 0xa3, 0x31, 0xc7, 0x4f,
|
||||
0x74, 0x50, 0x96, 0xed, 0x38, 0xe9, 0x21, 0x95, 0x22, 0x64, 0xb2, 0xef, 0x17, 0xd2, 0x29, 0xda,
|
||||
0x92, 0x93, 0x93, 0x91, 0x9e, 0x9e, 0x2e, 0x1a, 0x7f, 0x25, 0x3b, 0xe5, 0x1c, 0x91, 0x4f, 0x04,
|
||||
0x12, 0x21, 0x38, 0x38, 0x18, 0x16, 0x8b, 0xe5, 0x34, 0xef, 0x2d, 0x3e, 0x7d, 0x31, 0x64, 0x5e,
|
||||
0x3c, 0x9d, 0x14, 0xdd, 0x91, 0x0b, 0x79, 0xa5, 0xe8, 0x3b, 0xb7, 0xdb, 0x8d, 0xa5, 0xa5, 0x25,
|
||||
0xc4, 0xc7, 0xc7, 0x8f, 0xca, 0x39, 0x06, 0xf2, 0x3d, 0xf9, 0x7d, 0x85, 0xa8, 0xaa, 0xaa, 0x1a,
|
||||
0xc7, 0x8e, 0xd5, 0x23, 0x22, 0x22, 0x02, 0xa1, 0xa1, 0xa1, 0x0b, 0x61, 0x61, 0x61, 0xef, 0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c, 0xd2, 0x91,
|
||||
0x68, 0x6b, 0x6b, 0xcb, 0x6d, 0x6d, 0x6d, 0x45, 0x64, 0x64, 0x24, 0xaa, 0xab, 0x15, 0xcc, 0xce,
|
||||
0x02, 0xb7, 0x6e, 0x69, 0x92, 0xf1, 0x71, 0xe0, 0xc6, 0x0d, 0xe0, 0xda, 0x35, 0xa0, 0xb7, 0x77,
|
||||
0x0a, 0xf9, 0xf9, 0x7b, 0xc1, 0x07, 0xba, 0x4f, 0xa1, 0x93, 0x82, 0xdf, 0x64, 0x78, 0xa6, 0xf5,
|
||||
0xa7, 0x5e, 0x55, 0x54, 0x59, 0x59, 0x69, 0xec, 0xe8, 0xe8, 0xb0, 0xb2, 0xda, 0xbc, 0x55, 0x55,
|
||||
0x8a, 0x2a, 0x99, 0x9c, 0x04, 0x26, 0x26, 0x34, 0x89, 0xcb, 0x25, 0x72, 0x06, 0x0c, 0x0f, 0x03,
|
||||
0x17, 0x2f, 0x02, 0x9d, 0x9d, 0xbd, 0x88, 0x8e, 0xde, 0x84, 0xb4, 0xb4, 0x97, 0x71, 0xe6, 0x4c,
|
||||
0x3f, 0xea, 0xea, 0x5a, 0xd4, 0x4a, 0xcd, 0xce, 0xce, 0x3e, 0x61, 0x30, 0x18, 0xde, 0x91, 0xc5,
|
||||
0x12, 0xbd, 0xda, 0x81, 0xf5, 0x1c, 0x39, 0xa2, 0x60, 0x6a, 0x4a, 0x93, 0x8c, 0x8d, 0x01, 0xd7,
|
||||
0xaf, 0x6b, 0x92, 0xcb, 0x97, 0x81, 0xa1, 0x21, 0xe0, 0xfc, 0x79, 0x60, 0x80, 0xa9, 0x4d, 0x4a,
|
||||
0x7a, 0x09, 0xfb, 0xf7, 0x7f, 0x8a, 0xab, 0x57, 0x81, 0x73, 0xe7, 0x96, 0x58, 0xa1, 0x66, 0xf8,
|
||||
0xbc, 0xeb, 0x04, 0xb9, 0xab, 0x8a, 0x2a, 0x2a, 0x14, 0x78, 0x3c, 0xc0, 0xcd,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1e, 0x45, 0x45, 0xa5, 0x6a, 0x98, 0x52,
|
||||
0x53, 0x53, 0x59, 0xe2, 0xb5, 0xba, 0x60, 0x86, 0x82, 0xbd, 0x9c, 0xac, 0xfe, 0x5c, 0x73, 0xf1,
|
||||
0x67, 0xd9, 0xf6, 0xdc, 0x43, 0xab, 0x8e, 0x03, 0x5f, 0xe4, 0x56, 0x8f, 0xf3, 0x95, 0xb3, 0x58,
|
||||
0x5e, 0xae, 0xa8, 0xc9, 0xaf, 0xaf, 0x3f, 0x89, 0x8d, 0x1b, 0x63, 0xc5, 0x5b, 0x01, 0x85, 0x85,
|
||||
0x85, 0xf0, 0x89, 0xfb, 0x69, 0x56, 0xe8, 0xa6, 0x35, 0xfd, 0xb4, 0xf8, 0x16, 0x43, 0x5e, 0xde,
|
||||
0x07, 0xd8, 0xba, 0x35, 0x47, 0xad, 0x9c, 0xcc, 0xcc, 0x4c, 0xe6, 0xa5, 0x41, 0x17, 0xb8, 0xc8,
|
||||
0xdb, 0x6b, 0x11, 0x04, 0x14, 0x09, 0x41, 0x54, 0x54, 0x14, 0x4a, 0x4a, 0x4a, 0x74, 0xc1, 0x32,
|
||||
0x77, 0xfb, 0xa5, 0xd3, 0xe9, 0x34, 0x3f, 0x89, 0xc4, 0x5f, 0x34, 0x96, 0x91, 0x91, 0xd1, 0xe7,
|
||||
0x70, 0x38, 0x74, 0x49, 0x1f, 0xc3, 0x9a, 0xf1, 0xa4, 0x82, 0x40, 0xa2, 0xcd, 0x22, 0x57, 0x14,
|
||||
0xdc, 0x66, 0xb2, 0x0f, 0x74, 0x75, 0x75, 0x19, 0xd6, 0x4b, 0xb2, 0xe2, 0x3f, 0x03, 0x25, 0x3b,
|
||||
0x29, 0x4b, 0x5c, 0x4f, 0x81, 0xce, 0xbf, 0x65, 0x0b, 0xe0, 0x0d, 0x50, 0x11, 0x6a, 0x52, 0x00,
|
||||
0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
|
|
|
@ -413,9 +413,9 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
|||
// Merge polygons to build the polygon which contains the initial
|
||||
// polygon and its thick outline
|
||||
|
||||
bufferPolybase.BooleanAdd( bufferOutline ); // create the outline which contains thick outline
|
||||
bufferPolybase.Fracture();
|
||||
|
||||
// create the outline which contains thick outline:
|
||||
bufferPolybase.BooleanAdd( bufferOutline, SHAPE_POLY_SET::PM_FAST );
|
||||
bufferPolybase.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
if( bufferPolybase.OutlineCount() < 1 ) // should not happen
|
||||
return;
|
||||
|
|
|
@ -207,11 +207,11 @@ const SHAPE_LINE_CHAIN SHAPE_POLY_SET::convertFromClipper( const Path& aPath )
|
|||
}
|
||||
|
||||
void SHAPE_POLY_SET::booleanOp( ClipType aType, const SHAPE_POLY_SET& aOtherShape,
|
||||
bool aFastMode )
|
||||
POLYGON_MODE aFastMode )
|
||||
{
|
||||
Clipper c;
|
||||
|
||||
if( !aFastMode )
|
||||
if( aFastMode == PM_STRICTLY_SIMPLE )
|
||||
c.StrictlySimple( true );
|
||||
|
||||
BOOST_FOREACH( const POLYGON& poly, m_polys )
|
||||
|
@ -237,11 +237,11 @@ void SHAPE_POLY_SET::booleanOp( ClipType aType, const SHAPE_POLY_SET& aOtherShap
|
|||
void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
|
||||
const SHAPE_POLY_SET& aShape,
|
||||
const SHAPE_POLY_SET& aOtherShape,
|
||||
bool aFastMode )
|
||||
POLYGON_MODE aFastMode )
|
||||
{
|
||||
Clipper c;
|
||||
|
||||
if( !aFastMode )
|
||||
if( aFastMode == PM_STRICTLY_SIMPLE )
|
||||
c.StrictlySimple( true );
|
||||
|
||||
BOOST_FOREACH( const POLYGON& poly, aShape.m_polys )
|
||||
|
@ -264,37 +264,37 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
|
|||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctUnion, b, aFastMode );
|
||||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctDifference, b, aFastMode );
|
||||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctIntersection, b, aFastMode );
|
||||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctUnion, a, b, aFastMode );
|
||||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctDifference, a, b, aFastMode );
|
||||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode )
|
||||
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
|
||||
{
|
||||
booleanOp( ctIntersection, a, b, aFastMode );
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
|||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::Fracture( bool aFastMode )
|
||||
void SHAPE_POLY_SET::Fracture( POLYGON_MODE aFastMode )
|
||||
{
|
||||
Simplify( aFastMode ); // remove overlapping holes/degeneracy
|
||||
|
||||
|
@ -561,7 +561,7 @@ void SHAPE_POLY_SET::Fracture( bool aFastMode )
|
|||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::Simplify( bool aFastMode )
|
||||
void SHAPE_POLY_SET::Simplify( POLYGON_MODE aFastMode )
|
||||
{
|
||||
SHAPE_POLY_SET empty;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public:
|
|||
}
|
||||
|
||||
// Move the fields
|
||||
for( int field_idx = 0; field_idx < m_fields.size(); ++field_idx )
|
||||
for( unsigned field_idx = 0; field_idx < m_fields.size(); ++field_idx )
|
||||
{
|
||||
SCH_FIELD* field = m_fields[field_idx];
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@
|
|||
|
||||
/** @brief Kicad can use case sensitive or case insensitive comparisons for labels
|
||||
* Currently, it uses case insensitive.
|
||||
* Can be changed by defining LABEL_KEEPCASE (uncomment next line).
|
||||
* Can be changed by defining LABEL_CASE_SENSITIVE (uncomment next line).
|
||||
*/
|
||||
//#define LABEL_KEEPCASE
|
||||
//#define LABEL_CASE_SENSITIVE
|
||||
/// Compiler controlled string compare function, either case independent or not:
|
||||
inline int CmpLabel_KEEPCASE( const wxString& aString1, const wxString& aString2 )
|
||||
{
|
||||
#ifdef LABEL_KEEPCASE
|
||||
#ifdef LABEL_CASE_SENSITIVE
|
||||
// case specificity, the normal behavior:
|
||||
return aString1.Cmp( aString2 );
|
||||
#else
|
||||
|
|
|
@ -249,30 +249,45 @@ class SHAPE_POLY_SET : public SHAPE
|
|||
return CIterate( 0, OutlineCount() - 1 );
|
||||
}
|
||||
|
||||
/** operations on polygons use a aFastMode param
|
||||
* if aFastMode is PM_FAST (true) the result can be a weak polygon
|
||||
* if aFastMode is PM_STRICTLY_SIMPLE (false) (default) the result is (theorically) a strictly
|
||||
* simple polygon, but calculations can be really significantly time consuming
|
||||
* Most of time PM_FAST is preferable.
|
||||
* PM_STRICTLY_SIMPLE can be used in critical cases (Gerber output for instance)
|
||||
*/
|
||||
enum POLYGON_MODE
|
||||
{
|
||||
PM_FAST = true,
|
||||
PM_STRICTLY_SIMPLE = false
|
||||
};
|
||||
|
||||
///> Performs boolean polyset union
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanAdd( const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanAdd( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs boolean polyset difference
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanSubtract( const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanSubtract( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs boolean polyset intersection
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanIntersection( const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanIntersection( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs boolean polyset union between a and b, store the result in it self
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
|
||||
POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs boolean polyset difference between a and b, store the result in it self
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
|
||||
POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs boolean polyset intersection between a and b, store the result in it self
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b, bool aFastMode = false );
|
||||
void BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
|
||||
POLYGON_MODE aFastMode );
|
||||
|
||||
///> Performs outline inflation/deflation, using round corners.
|
||||
void Inflate( int aFactor, int aCircleSegmentsCount );
|
||||
|
@ -280,7 +295,7 @@ class SHAPE_POLY_SET : public SHAPE
|
|||
///> Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the outer ring
|
||||
///> to the inner holes
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void Fracture( bool aFastMode = false );
|
||||
void Fracture( POLYGON_MODE aFastMode );
|
||||
|
||||
///> Converts a set of slitted polygons to a set of polygons with holes
|
||||
void Unfracture();
|
||||
|
@ -290,7 +305,7 @@ class SHAPE_POLY_SET : public SHAPE
|
|||
|
||||
///> Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
|
||||
///> For aFastMode meaning, see function booleanOp
|
||||
void Simplify( bool aFastMode = false);
|
||||
void Simplify( POLYGON_MODE aFastMode );
|
||||
|
||||
/// @copydoc SHAPE::Format()
|
||||
const std::string Format() const;
|
||||
|
@ -348,18 +363,18 @@ class SHAPE_POLY_SET : public SHAPE
|
|||
* (AND, OR, ... and polygon simplification (merging overlaping polygons)
|
||||
* @param aType is the transform type ( see ClipperLib::ClipType )
|
||||
* @param aOtherShape is the SHAPE_LINE_CHAIN to combine with me.
|
||||
* @param aFastMode is an option to choos if the result is a weak polygon
|
||||
* @param aFastMode is an option to choose if the result can be a weak polygon
|
||||
* or a stricty simple polygon.
|
||||
* if aFastMode is true the result can be a weak polygon
|
||||
* if aFastMode is false (default) the result is (theorically) a strictly
|
||||
* if aFastMode is PM_FAST the result can be a weak polygon
|
||||
* if aFastMode is PM_STRICTLY_SIMPLE (default) the result is (theorically) a strictly
|
||||
* simple polygon, but calculations can be really significantly time consuming
|
||||
*/
|
||||
void booleanOp( ClipperLib::ClipType aType,
|
||||
const SHAPE_POLY_SET& aOtherShape, bool aFastMode = false );
|
||||
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode );
|
||||
|
||||
void booleanOp( ClipperLib::ClipType aType,
|
||||
const SHAPE_POLY_SET& aShape,
|
||||
const SHAPE_POLY_SET& aOtherShape, bool aFastMode = false );
|
||||
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode );
|
||||
|
||||
bool pointInPolygon( const VECTOR2I& aP, const SHAPE_LINE_CHAIN& aPath ) const;
|
||||
|
||||
|
|
|
@ -1137,9 +1137,9 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
|||
}
|
||||
|
||||
stubs.Append( stub );
|
||||
stubs.Simplify();
|
||||
stubs.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
antipad.BooleanSubtract( stubs );
|
||||
antipad.BooleanSubtract( stubs, SHAPE_POLY_SET::PM_FAST );
|
||||
aCornerBuffer.Append( antipad );
|
||||
|
||||
break;
|
||||
|
|
|
@ -558,7 +558,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
|
|||
outlines.RemoveAllContours();
|
||||
aBoard->ConvertBrdLayerToPolygonalContours( layer, outlines );
|
||||
|
||||
outlines.Simplify();
|
||||
outlines.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
// Plot outlines
|
||||
std::vector< wxPoint > cornerList;
|
||||
|
@ -631,7 +631,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
|
|||
* mask clearance + (min width solder mask /2)
|
||||
* 2 - Merge shapes
|
||||
* 3 - deflate result by (min width solder mask /2)
|
||||
* 4 - oring result by all pad shapes as polygons with a size inflated by
|
||||
* 4 - ORing result by all pad shapes as polygons with a size inflated by
|
||||
* mask clearance only (because deflate sometimes creates shape artifacts)
|
||||
* 5 - draw result as polygons
|
||||
*
|
||||
|
@ -773,13 +773,13 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
|||
zone.SetMinThickness( 0 ); // trace polygons only
|
||||
zone.SetLayer ( layer );
|
||||
|
||||
areas.BooleanAdd( initialPolys );
|
||||
areas.BooleanAdd( initialPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
areas.Inflate( -inflate, circleToSegmentsCount );
|
||||
|
||||
// Combine the current areas to initial areas. This is mandatory because
|
||||
// inflate/deflate transform is not perfect, and we want the initial areas perfectly kept
|
||||
areas.BooleanAdd( initialPolys );
|
||||
areas.Fracture();
|
||||
areas.BooleanAdd( initialPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
zone.AddFilledPolysList( areas );
|
||||
|
||||
|
|
|
@ -112,7 +112,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, 16 );
|
||||
m_FilledPolysList.Fracture();
|
||||
m_FilledPolysList.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
if( m_FillMode ) // if fill mode uses segments, create them:
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
* - shapes are smoothed.
|
||||
*/
|
||||
|
||||
// Polygon calculations can use fast mode or force strickly simple polygons after calculations
|
||||
// Forcing strickly simple polygons is time consuming, and we have not see issues in fast mode
|
||||
// so we use fast mode
|
||||
#define POLY_CALC_MODE SHAPE_POLY_SET::PM_FAST
|
||||
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -429,7 +434,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
|||
SHAPE_POLY_SET solidAreas = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList );
|
||||
|
||||
solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
|
||||
solidAreas.Simplify();
|
||||
solidAreas.Simplify( POLY_CALC_MODE );
|
||||
|
||||
SHAPE_POLY_SET holes;
|
||||
|
||||
|
@ -442,18 +447,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
|||
if(g_DumpZonesWhenFilling)
|
||||
dumper->Write( &holes, "feature-holes" );
|
||||
|
||||
holes.Simplify( true );
|
||||
holes.Simplify( POLY_CALC_MODE );
|
||||
|
||||
if (g_DumpZonesWhenFilling)
|
||||
dumper->Write( &holes, "feature-holes-postsimplify" );
|
||||
|
||||
solidAreas.BooleanSubtract( holes, true );
|
||||
solidAreas.BooleanSubtract( holes, POLY_CALC_MODE );
|
||||
|
||||
if (g_DumpZonesWhenFilling)
|
||||
dumper->Write( &solidAreas, "solid-areas-minus-holes" );
|
||||
|
||||
SHAPE_POLY_SET fractured = solidAreas;
|
||||
fractured.Fracture();
|
||||
fractured.Fracture( POLY_CALC_MODE );
|
||||
|
||||
if (g_DumpZonesWhenFilling)
|
||||
dumper->Write( &fractured, "fractured" );
|
||||
|
@ -475,16 +480,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
|||
// remove copper areas corresponding to not connected stubs
|
||||
if( !thermalHoles.IsEmpty() )
|
||||
{
|
||||
thermalHoles.Simplify();
|
||||
thermalHoles.Simplify( POLY_CALC_MODE );
|
||||
// Remove unconnected stubs
|
||||
solidAreas.BooleanSubtract( thermalHoles );
|
||||
solidAreas.BooleanSubtract( thermalHoles, POLY_CALC_MODE );
|
||||
|
||||
if( g_DumpZonesWhenFilling )
|
||||
dumper->Write( &thermalHoles, "thermal-holes" );
|
||||
|
||||
// put these areas in m_FilledPolysList
|
||||
SHAPE_POLY_SET fractured = solidAreas;
|
||||
fractured.Fracture();
|
||||
fractured.Fracture( POLY_CALC_MODE );
|
||||
|
||||
if( g_DumpZonesWhenFilling )
|
||||
dumper->Write ( &fractured, "fractured" );
|
||||
|
|
|
@ -68,7 +68,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
|
|||
if( clearance )
|
||||
polybuffer.Inflate( clearance, 16 );
|
||||
|
||||
polybuffer.Fracture();
|
||||
polybuffer.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
aCornerBuffer.Append( polybuffer );
|
||||
}
|
||||
|
||||
|
|
|
@ -293,8 +293,8 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_
|
|||
SHAPE_POLY_SET mergedOutlines = ConvertPolyListToPolySet( area_ref->Outline()->m_CornersList );
|
||||
SHAPE_POLY_SET areaToMergePoly = ConvertPolyListToPolySet( area_to_combine->Outline()->m_CornersList );
|
||||
|
||||
mergedOutlines.BooleanAdd( areaToMergePoly );
|
||||
mergedOutlines.Simplify();
|
||||
mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
|
||||
mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
// We should have one polygon with hole
|
||||
// We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* Few parts of this code come from FreePCB, released under the GNU General Public License V2.
|
||||
* (see http://www.freepcb.com/ )
|
||||
*
|
||||
* Copyright (C) 2012-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -122,6 +122,9 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
|
|||
|
||||
// We are expecting only one main outline, but this main outline can have holes
|
||||
// if holes: combine holes and remove them from the main outline.
|
||||
// Note also we are using SHAPE_POLY_SET::PM_STRICTLY_SIMPLE in polygon
|
||||
// calculations, but it is not mandatory. It is used mainly
|
||||
// because there is usually only very few vertices in area outlines
|
||||
SHAPE_POLY_SET::POLYGON& outline = polySet.Polygon( 0 );
|
||||
SHAPE_POLY_SET holesBuffer;
|
||||
|
||||
|
@ -133,13 +136,13 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
|
|||
outline.pop_back();
|
||||
}
|
||||
|
||||
polySet.Simplify();
|
||||
polySet.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE);
|
||||
|
||||
// If any hole, substract it to main outline
|
||||
if( holesBuffer.OutlineCount() )
|
||||
{
|
||||
holesBuffer.Simplify();
|
||||
polySet.BooleanSubtract( holesBuffer );
|
||||
holesBuffer.Simplify( SHAPE_POLY_SET::PM_FAST);
|
||||
polySet.BooleanSubtract( holesBuffer, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
}
|
||||
|
||||
RemoveAllContours();
|
||||
|
|
Loading…
Reference in New Issue