@ -1,22 +1,20 @@
/****************************************************/
/* PCB EDITOR: autorouting and "graphics" routines. */
/****************************************************/
/**
* @ file graphpcb . cpp
* @ brief PCB editor autorouting and " graphics " routines .
*/
# include "fctsys.h"
# include "common.h"
# include "pcbnew.h"
# include "autorout.h"
# include "trigo.h"
# include "cell.h"
# include "ar_protos.h"
int ToMatrixCoordinate ( int aPhysicalCoordinate ) ;
void TraceLignePcb ( int x0 ,
int y0 ,
int x1 ,
int y1 ,
int layer ,
int color ) ;
void TracePcbLine ( int x0 , int y0 , int x1 , int y1 , int layer , int color ) ;
void TraceArc ( int ux0 ,
int uy0 ,
int ux1 ,
@ -25,7 +23,7 @@ void TraceArc( int ux0,
int lg ,
int layer ,
int color ,
int op_logique ) ;
int op_logic ) ;
static void DrawSegmentQcq ( int ux0 ,
@ -35,17 +33,18 @@ static void DrawSegmentQcq( int ux0,
int lg ,
int layer ,
int color ,
int op_logique ) ;
int op_logic ) ;
static void TraceFilledCe rcle ( BOARD * Pcb ,
static void TraceFilledCi rcle ( BOARD * Pcb ,
int cx ,
int cy ,
int radius ,
int aLayerMask ,
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 ) ;
int op_logic ) ;
static void TraceCircle ( int ux0 , int uy0 , int ux1 , int uy1 , int lg , int layer ,
int color , int op_logic ) ;
/* Macro call to update cell. */
# define OP_CELL( layer, dy, dx ) \
@ -79,35 +78,24 @@ int ToMatrixCoordinate( int aPhysicalCoordinate )
}
/* Initialize a color value, the cells included in the board edge of the
* pad surface by pt_pad , with the margin reserved for isolation and the
* half width of the runway
* Parameters :
* Pt_pad : pointer to the description of the pad
* color : mask write in cells
* margin : add a value to the radius or half the score pad
* op_logique : type of writing in the cell ( WRITE , OR )
*/
void Place_1_Pad_Board ( BOARD * Pcb ,
D_PAD * pt_pad ,
int color ,
int marge ,
int op_logique )
void PlacePad ( BOARD * Pcb , D_PAD * pt_pad , int color , int marge , int op_logic )
{
int dx , dy ;
wxPoint shape_pos = pt_pad - > ReturnShapePos ( ) ;
dx = pt_pad - > m_Size . x / 2 ; dx + = marge ;
dx = pt_pad - > m_Size . x / 2 ;
dx + = marge ;
if ( pt_pad - > m_PadShape = = PAD_CIRCLE )
{
TraceFilledCe rcle ( Pcb , shape_pos . x , shape_pos . y , dx ,
pt_pad - > m_layerMask , color , op_logique ) ;
TraceFilledCircle ( Pcb , shape_pos . x , shape_pos . y , dx ,
pt_pad - > m_layerMask , color , op_logic ) ;
return ;
}
dy = pt_pad - > m_Size . y / 2 ; dy + = marge ;
dy = pt_pad - > m_Size . y / 2 ;
dy + = marge ;
if ( pt_pad - > m_PadShape = = PAD_TRAPEZOID )
{
@ -126,33 +114,33 @@ void Place_1_Pad_Board( BOARD* Pcb,
TraceFilledRectangle ( Pcb , shape_pos . x - dx , shape_pos . y - dy ,
shape_pos . x + dx , shape_pos . y + dy ,
pt_pad - > m_layerMask , color , op_logique ) ;
pt_pad - > m_layerMask , color , op_logic ) ;
}
else
{
TraceFilledRectangle ( Pcb , shape_pos . x - dx , shape_pos . y - dy ,
shape_pos . x + dx , shape_pos . y + dy ,
( int ) pt_pad - > m_Orient ,
pt_pad - > m_layerMask , color , op_logique ) ;
pt_pad - > m_layerMask , color , op_logic ) ;
}
}
/* Initialize a color value, the cells included in the board rea of the
/* Initialize a color value, the cells included in the board a rea of the
* circle center cx , cy .
* Parameters :
* radius : a value add to the radius or half the score pad
* aLayerMask : layer occupied
* color : mask write in cells
* op_logique : type of writing in the cell ( WRITE , OR )
* op_logic : type of writing in the cell ( WRITE , OR )
*/
void TraceFilledCe rcle ( BOARD * Pcb ,
void TraceFilledCi rcle ( BOARD * Pcb ,
int cx ,
int cy ,
int radius ,
int aLayerMask ,
int color ,
int op_logique )
int op_logic )
{
int row , col ;
int ux0 , uy0 , ux1 , uy1 ;
@ -179,7 +167,7 @@ void TraceFilledCercle( BOARD* Pcb,
if ( trace = = 0 )
return ;
switch ( op_logique )
switch ( op_logic )
{
default :
case WRITE_CELL :
@ -217,23 +205,25 @@ void TraceFilledCercle( BOARD* Pcb,
/* Calculate limit coordinates of cells belonging to the rectangle. */
row_max = uy1 / Board . m_GridRouting ;
col_max = ux1 / Board . m_GridRouting ;
row_min = uy0 / Board . m_GridRouting ; // if (uy0 > row_min*Board.m_GridRouting
// ) row_min++;
col_min = ux0 / Board . m_GridRouting ; // if (ux0 > col_min*Board.m_GridRouting
// ) col_min++;
row_min = uy0 / Board . m_GridRouting ; // if (uy0 > row_min*Board.m_GridRouting) row_min++;
col_min = ux0 / Board . m_GridRouting ; // if (ux0 > col_min*Board.m_GridRouting) col_min++;
if ( row_min < 0 )
row_min = 0 ;
if ( row_max > = ( Nrows - 1 ) )
row_max = Nrows - 1 ;
if ( col_min < 0 )
col_min = 0 ;
if ( col_max > = ( Ncols - 1 ) )
col_max = Ncols - 1 ;
/* Calculate coordinate limits of cell belonging to the rectangle. */
if ( row_min > row_max )
row_max = row_min ;
if ( col_min > col_max )
col_max = col_min ;
@ -243,6 +233,7 @@ void TraceFilledCercle( BOARD* Pcb,
{
fdisty = ( float ) ( cy - ( row * Board . m_GridRouting ) ) ;
fdisty * = fdisty ;
for ( col = col_min ; col < = col_max ; col + + )
{
fdistx = ( float ) ( cx - ( col * Board . m_GridRouting ) ) ;
@ -253,8 +244,10 @@ void TraceFilledCercle( BOARD* Pcb,
if ( trace & 1 )
WriteCell ( row , col , BOTTOM , color ) ;
if ( trace & 2 )
WriteCell ( row , col , TOP , color ) ;
tstwrite = 1 ;
}
}
@ -266,13 +259,13 @@ void TraceFilledCercle( BOARD* Pcb,
* ( Adverse event : pad off grid in the center of the 4 neighboring
* diagonal ) */
distmin = Board . m_GridRouting / 2 + 1 ;
fdistmin = ( ( float ) distmin * distmin ) * 2 ; /* Distance to center point
* diagonally */
fdistmin = ( ( float ) distmin * distmin ) * 2 ; /* Distance to center point diagonally */
for ( row = row_min ; row < = row_max ; row + + )
{
fdisty = ( float ) ( cy - ( row * Board . m_GridRouting ) ) ;
fdisty * = fdisty ;
for ( col = col_min ; col < = col_max ; col + + )
{
fdistx = ( float ) ( cx - ( col * Board . m_GridRouting ) ) ;
@ -283,6 +276,7 @@ void TraceFilledCercle( BOARD* Pcb,
if ( trace & 1 )
WriteCell ( row , col , BOTTOM , color ) ;
if ( trace & 2 )
WriteCell ( row , col , TOP , color ) ;
}
@ -290,18 +284,12 @@ void TraceFilledCercle( BOARD* Pcb,
}
/* Draws a segment of track on the BOARD.
*/
void TraceSegmentPcb ( BOARD * Pcb ,
TRACK * pt_segm ,
int color ,
int marge ,
int op_logique )
void TraceSegmentPcb ( BOARD * Pcb , TRACK * pt_segm , int color , int marge , int op_logic )
{
int demi_largeur ;
int half_width ;
int ux0 , uy0 , ux1 , uy1 ;
demi_largeur = ( pt_segm - > m_Width / 2 ) + marge ;
half_width = ( pt_segm - > m_Width / 2 ) + marge ;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */
ux0 = pt_segm - > m_Start . x - Pcb - > m_BoundaryBox . m_Pos . x ;
@ -313,8 +301,10 @@ void TraceSegmentPcb( BOARD* Pcb,
if ( pt_segm - > Type ( ) = = TYPE_VIA )
{
int mask_layer = 0 ;
if ( pt_segm - > IsOnLayer ( Route_Layer_BOTTOM ) )
mask_layer = 1 < < Route_Layer_BOTTOM ;
if ( pt_segm - > IsOnLayer ( Route_Layer_TOP ) )
{
if ( mask_layer = = 0 )
@ -327,63 +317,52 @@ void TraceSegmentPcb( BOARD* Pcb,
mask_layer = - 1 ;
if ( mask_layer )
TraceFilledCe rcle ( Pcb , pt_segm - > m_Start . x , pt_segm - > m_Start . y ,
demi_largeur , mask_layer , color , op_logique ) ;
TraceFilledCi rcle ( Pcb , pt_segm - > m_Start . x , pt_segm - > m_Start . y ,
half_width , mask_layer , color , op_logic ) ;
return ;
}
int layer = pt_segm - > GetLayer ( ) ;
if ( color = = VIA_IMPOSSIBLE )
layer = - 1 ;
/* The segment is here a straight line or a circle or an arc.: */
if ( pt_segm - > m_Shape = = S_CIRCLE )
{
TraceCercle ( ux0 , uy0 , ux1 , uy1 , demi_largeur , layer , color ,
op_logique ) ;
TraceCircle ( ux0 , uy0 , ux1 , uy1 , half_width , layer , color , op_logic ) ;
return ;
}
if ( pt_segm - > m_Shape = = S_ARC )
{
TraceArc ( ux0 , uy0 , ux1 , uy1 , pt_segm - > m_Param , demi_largeur , layer ,
color , op_logique ) ;
TraceArc ( ux0 , uy0 , ux1 , uy1 , pt_segm - > m_Param , half_width , layer , color , op_logic ) ;
return ;
}
/* The segment is here a line segment. */
if ( ( ux0 ! = ux1 ) & & ( uy0 ! = uy1 ) ) // Segment tilts.
{
DrawSegmentQcq ( ux0 , uy0 , ux1 , uy1 , demi_largeur , layer , color ,
op_logique ) ;
DrawSegmentQcq ( ux0 , uy0 , ux1 , uy1 , half_width , layer , color , op_logic ) ;
return ;
}
// The segment is horizontal or vertical.
// DrawHVSegment(ux0,uy0,ux1,uy1,demi_largeur,layer,color,op_logique);
// F4EXB 051018-01
DrawSegmentQcq ( ux0 , uy0 , ux1 , uy1 , demi_largeur , layer , color ,
op_logique ) ; // F4EXB 051018-01
return ; // F4EXB 051018-01
DrawSegmentQcq ( ux0 , uy0 , ux1 , uy1 , half_width , layer , color , op_logic ) ;
}
/* Draws a line, if layer = -1 on all layers
*/
void TraceLignePcb ( int x0 ,
int y0 ,
int x1 ,
int y1 ,
int layer ,
int color ,
int op_logique )
void TracePcbLine ( int x0 , int y0 , int x1 , int y1 , int layer , int color , int op_logic )
{
int dx , dy , lim ;
int cumul , inc , il , delta ;
void ( * WriteCell ) ( int , int , int , MATRIX_CELL ) ;
switch ( op_logique )
switch ( op_logic )
{
default :
case WRITE_CELL :
@ -406,16 +385,21 @@ void TraceLignePcb( int x0,
{
if ( y1 < y0 )
EXCHG ( y0 , y1 ) ;
dy = y0 / Board . m_GridRouting ;
lim = y1 / Board . m_GridRouting ;
dx = x0 / Board . m_GridRouting ;
/* Clipping limits of board. */
if ( ( dx < 0 ) | | ( dx > = Ncols ) )
return ;
if ( dy < 0 )
dy = 0 ;
if ( lim > = Nrows )
lim = Nrows - 1 ;
for ( ; dy < = lim ; dy + + )
{
OP_CELL ( layer , dy , dx ) ;
@ -428,16 +412,21 @@ void TraceLignePcb( int x0,
{
if ( x1 < x0 )
EXCHG ( x0 , x1 ) ;
dx = x0 / Board . m_GridRouting ;
lim = x1 / Board . m_GridRouting ;
dy = y0 / Board . m_GridRouting ;
/* Clipping limits of board. */
if ( ( dy < 0 ) | | ( dy > = Nrows ) )
return ;
if ( dx < 0 )
dx = 0 ;
if ( lim > = Ncols )
lim = Ncols - 1 ;
for ( ; dx < = lim ; dx + + )
{
OP_CELL ( layer , dy , dx ) ;
@ -457,15 +446,17 @@ void TraceLignePcb( int x0,
dx = x0 / Board . m_GridRouting ;
lim = x1 / Board . m_GridRouting ;
dy = y0 / Board . m_GridRouting ;
inc = 1 ; if ( y1 < y0 )
inc = 1 ;
if ( y1 < y0 )
inc = - 1 ;
il = lim - dx ; cumul = il / 2 ;
delta = abs ( y1 - y0 ) / Board . m_GridRouting ;
for ( ; dx < = lim ; )
{
if ( ( dx > = 0 ) & & ( dy > = 0 )
& & ( dx < Ncols ) & & ( dy < Nrows ) )
if ( ( dx > = 0 ) & & ( dy > = 0 ) & & ( dx < Ncols ) & & ( dy < Nrows ) )
{
OP_CELL ( layer , dy , dx ) ;
}
@ -492,6 +483,7 @@ void TraceLignePcb( int x0,
lim = y1 / Board . m_GridRouting ;
dx = x0 / Board . m_GridRouting ;
inc = 1 ;
if ( x1 < x0 )
inc = - 1 ;
@ -500,8 +492,7 @@ void TraceLignePcb( int x0,
for ( ; dy < = lim ; )
{
if ( ( dx > = 0 ) & & ( dy > = 0 )
& & ( dx < Ncols ) & & ( dy < Nrows ) )
if ( ( dx > = 0 ) & & ( dy > = 0 ) & & ( dx < Ncols ) & & ( dy < Nrows ) )
{
OP_CELL ( layer , dy , dx ) ;
}
@ -519,16 +510,8 @@ void TraceLignePcb( int x0,
}
/* Overloaded functions.
*
* Uses the color value of all cells included in the board coordinate of
* the rectangle ux0 , uy0 ( top left corner )
* A UX1 , UY1 ( bottom right corner )
* The rectangle is horizontal ( or vertical )
* Contact PCBs .
*/
void TraceFilledRectangle ( BOARD * Pcb , int ux0 , int uy0 , int ux1 , int uy1 ,
int aLayerMask , int color , int op_logique )
int aLayerMask , int color , int op_logic )
{
int row , col ;
int row_min , row_max , col_min , col_max ;
@ -545,7 +528,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
if ( trace = = 0 )
return ;
switch ( op_logique )
switch ( op_logic )
{
default :
case WRITE_CELL :
@ -578,18 +561,24 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
row_max = uy1 / Board . m_GridRouting ;
col_max = ux1 / Board . m_GridRouting ;
row_min = uy0 / Board . m_GridRouting ;
if ( uy0 > row_min * Board . m_GridRouting )
row_min + + ;
col_min = ux0 / Board . m_GridRouting ;
if ( ux0 > col_min * Board . m_GridRouting )
col_min + + ;
if ( row_min < 0 )
row_min = 0 ;
if ( row_max > = ( Nrows - 1 ) )
row_max = Nrows - 1 ;
if ( col_min < 0 )
col_min = 0 ;
if ( col_max > = ( Ncols - 1 ) )
col_max = Ncols - 1 ;
@ -599,6 +588,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
{
if ( trace & 1 )
WriteCell ( row , col , BOTTOM , color ) ;
if ( trace & 2 )
WriteCell ( row , col , TOP , color ) ;
}
@ -606,17 +596,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
}
/* Overloaded functions.
*
* Uses the color value of all cells included in the board coordinate of the
* rectangle ux0 , uy0 ( top right corner )
* a UX1 , UY1 ( lower left corner )
* the rectangle is the value of turning angle ( in degrees 0.1 )
* contact PCBs .
*/
void TraceFilledRectangle ( BOARD * Pcb , int ux0 , int uy0 , int ux1 , int uy1 ,
int angle , int aLayerMask , int color ,
int op_logique )
int angle , int aLayerMask , int color , int op_logic )
{
int row , col ;
int cx , cy ; /* Center of rectangle */
@ -631,13 +612,15 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
trace = 1 ; /* Trace on BOTTOM */
if ( aLayerMask & g_TabOneLayerMask [ Route_Layer_TOP ] )
{
if ( Nb_Sides )
trace | = 2 ; /* Trace on TOP */
}
if ( trace = = 0 )
return ;
switch ( op_logique )
switch ( op_logic )
{
default :
case WRITE_CELL :
@ -675,18 +658,24 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
row_max = ( cy + radius ) / Board . m_GridRouting ;
col_max = ( cx + radius ) / Board . m_GridRouting ;
row_min = ( cy - radius ) / Board . m_GridRouting ;
if ( uy0 > row_min * Board . m_GridRouting )
row_min + + ;
col_min = ( cx - radius ) / Board . m_GridRouting ;
if ( ux0 > col_min * Board . m_GridRouting )
col_min + + ;
if ( row_min < 0 )
row_min = 0 ;
if ( row_max > = ( Nrows - 1 ) )
row_max = Nrows - 1 ;
if ( col_min < 0 )
col_min = 0 ;
if ( col_max > = ( Ncols - 1 ) )
col_max = Ncols - 1 ;
@ -697,16 +686,22 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
rotrow = row * Board . m_GridRouting ;
rotcol = col * Board . m_GridRouting ;
RotatePoint ( & rotcol , & rotrow , cx , cy , - angle ) ;
if ( rotrow < = uy0 )
continue ;
if ( rotrow > = uy1 )
continue ;
if ( rotcol < = ux0 )
continue ;
if ( rotcol > = ux1 )
continue ;
if ( trace & 1 )
WriteCell ( row , col , BOTTOM , color ) ;
if ( trace & 2 )
WriteCell ( row , col , TOP , color ) ;
}
@ -720,7 +715,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
* coordinates are in PCB units ( 0.1 mil ) are relative to the Board
*/
void DrawSegmentQcq ( int ux0 , int uy0 , int ux1 , int uy1 , int lg , int layer ,
int color , int op_logique )
int color , int op_logic )
{
int row , col ;
int inc ;
@ -731,7 +726,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int angle ;
int cx , cy , dx , dy ;
switch ( op_logique )
switch ( op_logic )
{
default :
case WRITE_CELL :
@ -764,15 +759,19 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
/* Calculating the incrementing the Y axis */
inc = 1 ;
if ( uy1 < uy0 )
inc = - 1 ;
demi_pas = Board . m_GridRouting / 2 ;
col_min = ( ux0 - lg ) / Board . m_GridRouting ;
if ( col_min < 0 )
col_min = 0 ;
col_max = ( ux1 + lg + demi_pas ) / Board . m_GridRouting ;
if ( col_max > ( Ncols - 1 ) )
col_max = Ncols - 1 ;
@ -789,10 +788,13 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
if ( row_min < 0 )
row_min = 0 ;
if ( row_min > ( Nrows - 1 ) )
row_min = Nrows - 1 ;
if ( row_max < 0 )
row_max = 0 ;
if ( row_max > ( Nrows - 1 ) )
row_max = Nrows - 1 ;
@ -800,24 +802,30 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
dy = uy1 - uy0 ;
if ( dx )
{
angle = ( int ) ( atan2 ( ( double ) dy , ( double ) dx ) * 1800 / M_PI ) ;
}
else
{
angle = 900 ;
if ( dy < 0 )
angle = - 900 ;
}
RotatePoint ( & dx , & dy , angle ) ; /* dx = length, dy = 0 */
for ( col = col_min ; col < = col_max ; col + + )
{
int cxr ;
cxr = ( col * Board . m_GridRouting ) - ux0 ;
for ( row = row_min ; row < = row_max ; row + + )
{
cy = ( row * Board . m_GridRouting ) - uy0 ;
cx = cxr ;
RotatePoint ( & cx , & cy , angle ) ;
if ( abs ( cy ) > lg )
continue ; /* The point is too far on the Y axis. */
@ -829,18 +837,21 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
OP_CELL ( layer , row , col ) ;
continue ;
}
/* Examination of extremities are rounded. */
if ( ( cx < 0 ) & & ( cx > = - lg ) )
{
if ( ( ( cx * cx ) + ( cy * cy ) ) < = ( lg * lg ) )
OP_CELL ( layer , row , col ) ;
continue ;
}
if ( ( cx > dx ) & & ( cx < = ( dx + lg ) ) )
{
if ( ( ( ( cx - dx ) * ( cx - dx ) ) + ( cy * cy ) )
< = ( lg * lg ) )
if ( ( ( ( cx - dx ) * ( cx - dx ) ) + ( cy * cy ) ) < = ( lg * lg ) )
OP_CELL ( layer , row , col ) ;
continue ;
}
}
@ -853,8 +864,8 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
* coord in PCB units ( 0.1 million ) relating to the origin
* pt_pcb - > m_PcbBox . m_Xmin , Y ' s board .
*/
void TraceCe rcle ( int ux0 , int uy0 , int ux1 , int uy1 , int lg , int layer ,
int color , int op_logique )
void TraceCi rcle ( int ux0 , int uy0 , int ux1 , int uy1 , int lg , int layer ,
int color , int op_logic )
{
int radius , nb_segm ;
int x0 , y0 , // Starting point of the current segment trace.
@ -866,36 +877,38 @@ void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
x0 = x1 = radius ;
y0 = y1 = 0 ;
if ( lg < 1 )
lg = 1 ;
nb_segm = ( 2 * radius ) / lg ;
if ( nb_segm < 5 )
nb_segm = 5 ;
if ( nb_segm > 100 )
nb_segm = 100 ;
for ( ii = 1 ; ii < nb_segm ; ii + + )
{
angle = ( 3600 * ii ) / nb_segm ;
x1 = ( int ) ( radius * fcosinus [ angle ] ) ;
y1 = ( int ) ( radius * fsinus [ angle ] ) ;
DrawSegmentQcq ( x0 + ux0 , y0 + uy0 , x1 + ux0 , y1 + uy0 , lg ,
layer , color , op_logique ) ;
x1 = ( int ) ( radius * cos ( DEG2RAD ( ( double ) angle / 10.0 ) ) ) ;
y1 = ( int ) ( radius * sin ( DEG2RAD ( ( double ) angle / 10.0 ) ) ) ;
DrawSegmentQcq ( x0 + ux0 , y0 + uy0 , x1 + ux0 , y1 + uy0 , lg , layer , color , op_logic ) ;
x0 = x1 ;
y0 = y1 ;
}
DrawSegmentQcq ( x1 + ux0 , y1 + uy0 , ux0 + radius , uy0 , lg , layer ,
color , op_logique ) ;
DrawSegmentQcq ( x1 + ux0 , y1 + uy0 , ux0 + radius , uy0 , lg , layer , color , op_logic ) ;
}
/* Fills all cells contained in arc with color , using op_logique.
* half - width lg ux center , starting in ux y0 , y1 is set to color .
* coord in PCB units ( 0.1 mil ) relating to the origin
* of the board .
/* Fills all BOARD cells contained in the arc of "L" angle half-width lg
* ux center , starting in ux y0 , y1 is set to color . Coordinates are in
* PCB units ( 0.1 mil ) relating to the origin pt_pcb - > Pcb_oX , Y ' s board .
*/
void TraceArc ( int ux0 , int uy0 , int ux1 , int uy1 , int ArcAngle , int lg ,
int layer , int color , int op_logique )
int layer , int color , int op_logic )
{
int radius , nb_segm ;
int x0 , y0 , // Starting point of the current segment trace
@ -909,12 +922,16 @@ void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg,
x0 = ux1 - ux0 ;
y0 = uy1 - uy0 ;
StAngle = ArcTangente ( uy1 - uy0 , ux1 - ux0 ) ;
if ( lg < 1 )
lg = 1 ;
nb_segm = ( 2 * radius ) / lg ;
nb_segm = ( nb_segm * abs ( ArcAngle ) ) / 3600 ;
if ( nb_segm < 5 )
nb_segm = 5 ;
if ( nb_segm > 100 )
nb_segm = 100 ;
@ -929,14 +946,10 @@ void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg,
while ( angle < 0 )
angle + = 3600 ;
x1 = ( int ) ( radius * fcosinus [ angle ] ) ;
y1 = ( int ) ( radius * fsinus [ angle ] ) ;
DrawSegmentQcq ( x0 + ux0 , y0 + uy0 , x1 + ux0 , y1 + uy0 , lg , layer ,
color , op_logique ) ;
x1 = ( int ) ( radius * cos ( DEG2RAD ( ( double ) angle / 10.0 ) ) ) ;
y1 = ( int ) ( radius * sin ( DEG2RAD ( ( double ) angle / 10.0 ) ) ) ;
DrawSegmentQcq ( x0 + ux0 , y0 + uy0 , x1 + ux0 , y1 + uy0 , lg , layer , color , op_logic ) ;
x0 = x1 ;
y0 = y1 ;
}
// DrawSegmentQcq(x1+ux0,y1+uy0, ux0+radius, uy0,lg,layer, color,
// op_logique);
}