Commit 30da5aff authored by charras's avatar charras

Calculations to create filled areas in a zone modified and uses 2 pass. See changelog

parent a3692751
...@@ -5,6 +5,20 @@ Started 2007-June-11 ...@@ -5,6 +5,20 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Jan-19 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Pcbnew:
Calculations to create filled areas in a zone modified and uses 2 pass:
1 - filled areas are calculated with pads in zone.
2 - If thermal shapes are wanted, they are added (i.e. copper removed after ).
Seen comments in zones_convert_brd_items_to_polygons.cpp
The initial method was calculate filled areas in one pass.
With the 2 pass calculation, the calculation time is more expensive but:
- Kbool seems now works correctly in cases where the one pass way does not work
- Thermal reliefs can have a better shape (todo..) because when calculating them, the filled
areas are known (this was not the case in one pass way)
2009-Jan-08 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-Jan-08 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++Eeschema: ++Eeschema:
......
...@@ -222,7 +222,7 @@ int Propagation( WinEDA_PcbFrame* frame ) ...@@ -222,7 +222,7 @@ int Propagation( WinEDA_PcbFrame* frame )
/********************************************/ /********************************************/
/** Function Propagation() /** Function Propagation()
* An important function to calculate zones * Used now only in autoplace calculations
* Uses the routing matrix to fill the cells within the zone * Uses the routing matrix to fill the cells within the zone
* Search and mark cells within the zone, and agree with DRC options. * Search and mark cells within the zone, and agree with DRC options.
* Requirements: * Requirements:
......
...@@ -79,14 +79,29 @@ double s_Correction; /* mult coeff used to enlarge rounded and oval pads (an ...@@ -79,14 +79,29 @@ double s_Correction; /* mult coeff used to enlarge rounded and oval pads (an
* 3 - Creates a correction using BOOL_CORRECTION operation to shrink the resulting area * 3 - Creates a correction using BOOL_CORRECTION operation to shrink the resulting area
* with m_ZoneMinThickness/2 value. * with m_ZoneMinThickness/2 value.
* The result is areas with a margin of m_ZoneMinThickness/2 * The result is areas with a margin of m_ZoneMinThickness/2
* When drawing outline with segments having a thickness of m_ZoneMinThickness, the outlines wilm * When drawing outline with segments having a thickness of m_ZoneMinThickness, the outlines will
* match exactly the initial outlines * match exactly the initial outlines
* 4 - recreates the same Bool_Engine, with no correction * 4 - recreates the same Bool_Engine, with no correction
* 3 - Add the main outline (zone outline) in group A * 5 - Add the main modified outline (zone outline) in group A
* 4 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + m_ZoneMinThickness/2 * 6 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + m_ZoneMinThickness/2
* 5 - calculates the polygon A - B * 7 - calculates the polygon A - B
* 6 - put resulting list of polygons (filled areas) in m_FilledPolysList * 8 - put resulting list of polygons (filled areas) in m_FilledPolysList
* 7 - Remove insulated copper islands * This zone contains pads with the same net.
* 9 - Remove insulated copper islands
* 10 - If Thermal shapes are wanted, remove copper around pads in zone, in order to create thes thermal shapes
* a - Creates a bool engine and add the last copper areas in group A
* b - Add thermal shapes (non copper ares in group B
* c - Calculates the polygon A - B
* 11 - Remove new insulated copper islands
*/
/* Important note:
* One can add thermal areas in the step 6, with others items to substract.
* It is faster.
* But :
* kbool fails sometimes in this case (see comments in AddThermalReliefPadPolygon )
* The separate step to make thermal shapes allows a more sophisticated algorith (todo)
* like remove thermal copper bridges in thermal shapes that are not connected to an area
*/ */
void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{ {
...@@ -116,7 +131,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -116,7 +131,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
/* First, Add the main polygon (i.e. the filled area using only one outline) /* First, Add the main polygon (i.e. the filled area using only one outline)
* in GroupA in Bool_Engine to do a BOOL_CORRECTION operation * in GroupA in Bool_Engine to do a BOOL_CORRECTION operation
* to reserve a m_ZoneMinThickness/2 margind around the outlines and holes * to reserve a m_ZoneMinThickness/2 margind around the outlines and holes
* the margind will be filled when redraw outilnes with segments having a whidth set to * the margin will be filled when redraw outilnes with segments having a width set to
* m_ZoneMinThickness * m_ZoneMinThickness
* so m_ZoneMinThickness is the min thickness of the filled zones areas * so m_ZoneMinThickness is the min thickness of the filled zones areas
*/ */
...@@ -124,7 +139,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -124,7 +139,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
booleng->SetCorrectionFactor( (double) -m_ZoneMinThickness / 2 ); booleng->SetCorrectionFactor( (double) -m_ZoneMinThickness / 2 );
booleng->Do_Operation( BOOL_CORRECTION ); booleng->Do_Operation( BOOL_CORRECTION );
/* No copy the new outline in m_FilledPolysList */ /* Now copy the new outline in m_FilledPolysList */
m_FilledPolysList.clear(); m_FilledPolysList.clear();
CopyPolygonsFromBoolengineToFilledPolysList( booleng ); CopyPolygonsFromBoolengineToFilledPolysList( booleng );
delete booleng; delete booleng;
...@@ -155,7 +170,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -155,7 +170,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
zone_boundingbox.Inflate( m_ZoneClearance, clearance ); zone_boundingbox.Inflate( m_ZoneClearance, clearance );
/* /*
* First : Add pads * First : Add pads. Note: pads having the same net as zone are left in zone.
* Thermal shapes will be created later if necessary
*/ */
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{ {
...@@ -172,26 +188,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -172,26 +188,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue; continue;
} }
switch( m_PadOption ) if ( (m_PadOption == PAD_NOT_IN_ZONE) || (GetNet() == 0) )
{ {
case PAD_NOT_IN_ZONE:
item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) ) if( item_boundingbox.Intersects( zone_boundingbox ) )
AddPadWithClearancePolygon( booleng, *pad, clearance ); AddPadWithClearancePolygon( booleng, *pad, clearance );
break;
case THERMAL_PAD:
item_boundingbox = pad->GetBoundingBox();
item_boundingbox.Inflate( m_ThermalReliefGapValue, m_ThermalReliefGapValue );
if( item_boundingbox.Intersects( zone_boundingbox ) )
AddThermalReliefPadPolygon( booleng, *pad,
m_ThermalReliefGapValue,
m_ThermalReliefCopperBridgeValue,
m_ZoneMinThickness );
break;
case PAD_IN_ZONE:
break;
} }
} }
} }
...@@ -204,7 +205,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -204,7 +205,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{ {
if( !track->IsOnLayer( GetLayer() ) ) if( !track->IsOnLayer( GetLayer() ) )
continue; continue;
if( track->GetNet() == GetNet() ) if( track->GetNet() == GetNet() && (GetNet() != 0) )
continue; continue;
item_boundingbox = track->GetBoundingBox(); item_boundingbox = track->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) ) if( item_boundingbox.Intersects( zone_boundingbox ) )
...@@ -238,7 +239,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -238,7 +239,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
} }
} }
/* compute copper areas */ /* calculates copper areas */
booleng->Do_Operation( BOOL_A_SUB_B ); booleng->Do_Operation( BOOL_A_SUB_B );
/* put these areas in m_FilledPolysList */ /* put these areas in m_FilledPolysList */
...@@ -246,6 +247,54 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -246,6 +247,54 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
CopyPolygonsFromBoolengineToFilledPolysList( booleng ); CopyPolygonsFromBoolengineToFilledPolysList( booleng );
delete booleng; delete booleng;
// Remove insulated islands:
if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
// Remove thermal symbols
if( m_PadOption == THERMAL_PAD )
{
booleng = new Bool_Engine();
ArmBoolEng( booleng, true );
bool have_poly_to_substract = false;
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
if( !pad->IsOnLayer( GetLayer() ) )
continue;
if( pad->GetNet() != GetNet() )
continue;
item_boundingbox = pad->GetBoundingBox();
item_boundingbox.Inflate( m_ThermalReliefGapValue, m_ThermalReliefGapValue );
if( item_boundingbox.Intersects( zone_boundingbox ) )
{
have_poly_to_substract = true;
AddThermalReliefPadPolygon( booleng, *pad,
m_ThermalReliefGapValue,
m_ThermalReliefCopperBridgeValue,
m_ZoneMinThickness );
}
}
}
if ( have_poly_to_substract )
{
/* Add the main corrected polygon (i.e. the filled area using only one outline)
* in GroupA in Bool_Engine
*/
CopyPolygonsFromFilledPolysListToBoolengine( booleng, GROUP_A );
/* remove thermal areas (non copper areas) */
booleng->Do_Operation( BOOL_A_SUB_B );
/* put these areas in m_FilledPolysList */
m_FilledPolysList.clear();
CopyPolygonsFromBoolengineToFilledPolysList( booleng );
}
delete booleng;
}
// Remove insulated islands: // Remove insulated islands:
if( GetNet() > 0 ) if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb ); Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
...@@ -273,7 +322,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -273,7 +322,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
switch( aPad.m_PadShape ) switch( aPad.m_PadShape )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
dx = (int) (dx * s_Correction); dx = (int) ( dx * s_Correction );
for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ )
{ {
corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 );
...@@ -289,7 +338,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -289,7 +338,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
angle = aPad.m_Orient; angle = aPad.m_Orient;
if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles
{ {
dy = (int) (dy * s_Correction); dy = (int) ( dy * s_Correction );
int angle_pg; // Polygon angle int angle_pg; // Polygon angle
wxPoint shape_offset = wxPoint( 0, (dy - dx) ); wxPoint shape_offset = wxPoint( 0, (dy - dx) );
RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component
...@@ -318,7 +367,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -318,7 +367,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
} }
else //if( dy <= dx ) else //if( dy <= dx )
{ {
dx = (int) (dx * s_Correction); dx = (int) ( dx * s_Correction );
int angle_pg; // Polygon angle int angle_pg; // Polygon angle
wxPoint shape_offset = wxPoint( (dy - dx), 0 ); wxPoint shape_offset = wxPoint( (dy - dx), 0 );
RotatePoint( &shape_offset, angle ); RotatePoint( &shape_offset, angle );
...@@ -348,7 +397,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -348,7 +397,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
case PAD_RECT: // Easy implementation for rectangular cutouts with rounded corners case PAD_RECT: // Easy implementation for rectangular cutouts with rounded corners
angle = aPad.m_Orient; angle = aPad.m_Orient;
int rounding_radius = (int) (aClearanceValue * s_Correction); // Corner rounding radius int rounding_radius = (int) ( aClearanceValue * s_Correction ); // Corner rounding radius
int angle_pg; // Polygon increment angle int angle_pg; // Polygon increment angle
for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ ) for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ )
...@@ -356,37 +405,40 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -356,37 +405,40 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
corner_position = wxPoint( 0, -rounding_radius ); corner_position = wxPoint( 0, -rounding_radius );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.m_Size/2 ; // Rounding vector + Pad corner offset corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset
RotatePoint( &corner_position, angle ); // Rotate according to module orientation RotatePoint( &corner_position, angle ); // Rotate according to module orientation
corner_position += PadShapePos; // Shift origin to position corner_position += PadShapePos; // Shift origin to position
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
} }
for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ ) for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ )
{ {
corner_position = wxPoint( -rounding_radius, 0 ); corner_position = wxPoint( -rounding_radius, 0 );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( aPad.m_Size.x/2, -aPad.m_Size.y/2 ); corner_position -= wxPoint( aPad.m_Size.x / 2, -aPad.m_Size.y / 2 );
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
} }
for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ ) for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ )
{ {
corner_position = wxPoint( 0, rounding_radius ); corner_position = wxPoint( 0, rounding_radius );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position += aPad.m_Size/2 ; corner_position += aPad.m_Size / 2;
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
} }
for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ ) for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ )
{ {
corner_position = wxPoint( rounding_radius, 0 ); corner_position = wxPoint( rounding_radius, 0 );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( -aPad.m_Size.x/2, aPad.m_Size.y/2 ); corner_position -= wxPoint( -aPad.m_Size.x / 2, aPad.m_Size.y / 2 );
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
...@@ -415,15 +467,16 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -415,15 +467,16 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
/* WARNING: /* WARNING:
* When Kbool calculates the filled areas : * When Kbool calculates the filled areas :
* i.e when substarcting holes (thermal shapes) to the full zone area * i.e when substracting holes (thermal shapes) to the full zone area
* under certains circumstances kboll drop some holes. * under certains circumstances kboll drop some holes.
* These circumstances are: * These circumstances are:
* some identical holes (same thermal shape and size) are *exactly* on the same vertical line * some identical holes (same thermal shape and size) are *exactly* on the same vertical line
* And * And
* nothing else between holes * nothing else between holes
* And * And
* angles less than 90 deg between 2 consecutive lines in hole outline * angles less than 90 deg between 2 consecutive lines in hole outline (sometime occurs without this condition)
* And a hole above the identical holes * And
* a hole above the identical holes
* *
* In fact, it is easy to find these conditions in pad arrays. * In fact, it is easy to find these conditions in pad arrays.
* So to avoid this, the workaround is do not use holes outlines that include * So to avoid this, the workaround is do not use holes outlines that include
...@@ -529,6 +582,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, ...@@ -529,6 +582,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
// this seems a bug in kbool polygon (exists in 1.9 kbool version) // this seems a bug in kbool polygon (exists in 1.9 kbool version)
// angle = 450 (45.0 degrees orientation) seems work fine. // angle = 450 (45.0 degrees orientation) seems work fine.
// angle = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances // angle = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances
// Note: with the 2 step build ( thermal shpaes after correr areas build), 0 seems work
angle = 450; angle = 450;
int angle_pad = aPad.m_Orient; // Pad orientation int angle_pad = aPad.m_Orient; // Pad orientation
for( unsigned ihole = 0; ihole < 4; ihole++ ) for( unsigned ihole = 0; ihole < 4; ihole++ )
...@@ -720,7 +774,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, ...@@ -720,7 +774,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -dy ) ); corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -dy ) );
angle = aPad.m_Orient; angle = aPad.m_Orient;
int rounding_radius = (int) (aThermalGap * s_Correction); // Corner rounding radius int rounding_radius = (int) ( aThermalGap * s_Correction ); // Corner rounding radius
int angle_pg; // Polygon increment angle int angle_pg; // Polygon increment angle
for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ ) for( int i = 0; i < s_CircleToSegmentsCount / 4 + 1; i++ )
...@@ -728,7 +782,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, ...@@ -728,7 +782,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
wxPoint corner_position = wxPoint( 0, -rounding_radius ); wxPoint corner_position = wxPoint( 0, -rounding_radius );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.m_Size/2 ; // Rounding vector + Pad corner offset corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) ); corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
} }
...@@ -778,6 +832,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, ...@@ -778,6 +832,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
angle -= 3600; angle -= 3600;
} }
} }
break; break;
} }
} }
...@@ -802,7 +857,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -802,7 +857,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng,
case TYPE_VIA: case TYPE_VIA:
if( aBooleng->StartPolygonAdd( GROUP_B ) ) if( aBooleng->StartPolygonAdd( GROUP_B ) )
{ {
dx = (int) (dx * s_Correction); dx = (int) ( dx * s_Correction );
for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ )
{ {
corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 );
...@@ -948,7 +1003,8 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB ...@@ -948,7 +1003,8 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
/************************************************************************************************************/ /************************************************************************************************************/
/** Function CopyPolygonsFromFilledPolysListToBoolengine /** Function CopyPolygonsFromFilledPolysListToBoolengine
* Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList * Copy (Add) polygons found in m_FilledPolysList to kbool BoolEngine
* m_FilledPolysList may have more than one polygon
* @param aBoolengine = kbool engine * @param aBoolengine = kbool engine
* @param aGroup = group in kbool engine (GROUP_A or GROUP_B only) * @param aGroup = group in kbool engine (GROUP_A or GROUP_B only)
* @return the corner count * @return the corner count
...@@ -958,6 +1014,8 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB ...@@ -958,6 +1014,8 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
int count = 0; int count = 0;
unsigned ic = 0; unsigned ic = 0;
while( ic < corners_count )
{
if( aBoolengine->StartPolygonAdd( aGroup ) ) if( aBoolengine->StartPolygonAdd( aGroup ) )
{ {
for( ; ic < corners_count; ic++ ) for( ; ic < corners_count; ic++ )
...@@ -966,11 +1024,15 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB ...@@ -966,11 +1024,15 @@ int ZONE_CONTAINER::CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aB
aBoolengine->AddPoint( corner->x, corner->y ); aBoolengine->AddPoint( corner->x, corner->y );
count++; count++;
if( corner->end_contour ) if( corner->end_contour )
{
ic++;
break; break;
} }
}
aBoolengine->EndPolygonAdd(); aBoolengine->EndPolygonAdd();
} }
}
return count; return count;
} }
...@@ -996,6 +1058,7 @@ int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aB ...@@ -996,6 +1058,7 @@ int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aB
corner.x = (int) aBoolengine->GetPolygonXPoint(); corner.x = (int) aBoolengine->GetPolygonXPoint();
corner.y = (int) aBoolengine->GetPolygonYPoint(); corner.y = (int) aBoolengine->GetPolygonYPoint();
corner.end_contour = false; corner.end_contour = false;
// Flag this corner if starting a hole connection segment: // Flag this corner if starting a hole connection segment:
corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0; corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
m_FilledPolysList.push_back( corner ); m_FilledPolysList.push_back( corner );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment