diff --git a/change_log.txt b/change_log.txt index 53f81186c6..efbf21acd8 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,16 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Sep-14 UPDATE Jean-Pierre Charras +================================================================================ ++pcbnew: + Fixed a problem in zone filling algo: due tu differents ways to truncate coordinates + between 2 functions (one round coordinates, and others truncate coordinates), + some start points used to fill zones can be inside the zone outlines, + but placed outside when init matrix parameters when rounding them instead of truncate. + So zone was filled inside and outside when happens. + + 2008-Sep-9 UPDATE Dick Hollenbeck ================================================================================ +eeschema diff --git a/include/build_version.h b/include/build_version.h index 045764e4a1..0cdcb24f61 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion # include "config.h" (wxT(KICAD_SVN_VERSION)) # else - (wxT("(20080825)")) /* main program version */ + (wxT("(20080912)")) /* main program version */ # endif #endif ; @@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion # include "config.h" (wxT(KICAD_ABOUT_VERSION)) # else - (wxT("(20080825-final)")) /* svn date & rev (normally overridden) */ + (wxT("(20080912)")) /* svn date & rev (normally overridden) */ # endif #endif ; diff --git a/pcbnew/graphpcb.cpp b/pcbnew/graphpcb.cpp index f3a7d39f42..d1760ea781 100644 --- a/pcbnew/graphpcb.cpp +++ b/pcbnew/graphpcb.cpp @@ -13,24 +13,24 @@ #include "trigo.h" #include "cell.h" - -/* Routines externes */ - -/* routines internes */ +/* Exported functions */ +int ToMatrixCoordinate ( int aPhysicalCoordinate); void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int color ); -void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, - int color, int op_logique ); -void DrawHVSegment( int ux0, int uy0, int ux1, int uy1, int demi_largeur, int layer, - int color, int op_logique ); - -void TraceFilledCercle( BOARD* Pcb, int cx, int cy, int rayon, int masque_layer, - int color, int op_logique ); -void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, - int color, int op_logique ); - void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg, int layer, int color, int op_logique ); + +/* Local functions */ +static void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, + int color, int op_logique ); +static void DrawHVSegment( int ux0, int uy0, int ux1, int uy1, int demi_largeur, int layer, + int color, int op_logique ); + +static void TraceFilledCercle( BOARD* Pcb, int cx, int cy, int rayon, int masque_layer, + int color, int op_logique ); +static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, + int color, int op_logique ); + /* Macro d'appel de mise a jour de cellules */ #define OP_CELL( layer, dy, dx ) { if( layer < 0 ) \ { \ @@ -46,6 +46,15 @@ void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg, int WriteCell( dy, dx, TOP, color );\ } } +int ToMatrixCoordinate ( int aPhysicalCoordinate) +/** Function ToMatrixCoordinate + * compute the coordinate in the routing matrix from the real (board) value + * @param aPhysicalCoordinate = value to convert + * @return the coordinate relative to the matrix + */ +{ + return aPhysicalCoordinate / g_GridRoutingSize; +} /******************************************************************************/ void Place_1_Pad_Board( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logique ) @@ -349,7 +358,8 @@ void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int color, int op { if( y1 < y0 ) EXCHG( y0, y1 ); - dy = y0 / g_GridRoutingSize; lim = y1 / g_GridRoutingSize; + dy = y0 / g_GridRoutingSize; + lim = y1 / g_GridRoutingSize; dx = x0 / g_GridRoutingSize; /* Clipping aux limites du board */ if( (dx < 0) || (dx >= Ncols) ) @@ -370,7 +380,8 @@ void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int color, int op { if( x1 < x0 ) EXCHG( x0, x1 ); - dx = x0 / g_GridRoutingSize; lim = x1 / g_GridRoutingSize; + dx = x0 / g_GridRoutingSize; + lim = x1 / g_GridRoutingSize; dy = y0 / g_GridRoutingSize; /* Clipping aux limites du board */ if( (dy < 0) || (dy >= Nrows) ) @@ -395,7 +406,8 @@ void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int color, int op EXCHG( x1, x0 ); EXCHG( y1, y0 ); } - dx = x0 / g_GridRoutingSize; lim = x1 / g_GridRoutingSize; + dx = x0 / g_GridRoutingSize; + lim = x1 / g_GridRoutingSize; dy = y0 / g_GridRoutingSize; inc = 1; if( y1 < y0 ) inc = -1; @@ -421,7 +433,8 @@ void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int color, int op EXCHG( x1, x0 ); EXCHG( y1, y0 ); } - dy = y0 / g_GridRoutingSize; lim = y1 / g_GridRoutingSize; + dy = y0 / g_GridRoutingSize; + lim = y1 / g_GridRoutingSize; dx = x0 / g_GridRoutingSize; inc = 1; if( x1 < x0 ) inc = -1; diff --git a/pcbnew/zone_filling_algorithm.cpp b/pcbnew/zone_filling_algorithm.cpp index ed19481e98..480401cee5 100644 --- a/pcbnew/zone_filling_algorithm.cpp +++ b/pcbnew/zone_filling_algorithm.cpp @@ -145,9 +145,9 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose ) if( m_Poly->TestPointInside( pos.x, pos.y ) ) { pos -= Pcb->m_BoundaryBox.m_Pos; - ZoneStartFill.x = ( pos.x + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.x = pos.x / g_GridRoutingSize; - ZoneStartFill.y = ( pos.y + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.y = pos.y / g_GridRoutingSize; BoardCell cell = GetCell( ZoneStartFill.y, ZoneStartFill.x, BOTTOM ); if ( (cell & CELL_is_EDGE) == 0 ) { @@ -167,9 +167,9 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose ) if( m_Poly->TestPointInside( pos.x, pos.y ) ) { pos -= Pcb->m_BoundaryBox.m_Pos; - ZoneStartFill.x = ( pos.x + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.x = pos.x / g_GridRoutingSize; - ZoneStartFill.y = ( pos.y + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.y = pos.y / g_GridRoutingSize; BoardCell cell = GetCell( ZoneStartFill.y, ZoneStartFill.x, BOTTOM ); if ( (cell & CELL_is_EDGE) == 0 ) { @@ -181,9 +181,9 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose ) if( m_Poly->TestPointInside( pos.x, pos.y ) ) { pos -= Pcb->m_BoundaryBox.m_Pos; - ZoneStartFill.x = ( pos.x + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.x = pos.x / g_GridRoutingSize; - ZoneStartFill.y = ( pos.y + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.y = pos.y / g_GridRoutingSize; BoardCell cell = GetCell( ZoneStartFill.y, ZoneStartFill.x, BOTTOM ); if ( (cell & CELL_is_EDGE) == 0 ) { @@ -277,9 +277,9 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose ) if( m_Poly->TestPointInside( pos.x, pos.y ) ) { pos -= Pcb->m_BoundaryBox.m_Pos; - ZoneStartFill.x = ( pos.x + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.x = pos.x / g_GridRoutingSize; - ZoneStartFill.y = ( pos.y + (g_GridRoutingSize / 2) ) / g_GridRoutingSize; + ZoneStartFill.y = pos.y / g_GridRoutingSize; BoardCell cell = GetCell( ZoneStartFill.y, ZoneStartFill.x, BOTTOM ); if ( (cell & CELL_is_EDGE) == 0 ) OrCell( ZoneStartFill.y, ZoneStartFill.x, BOTTOM, CELL_is_ZONE );