158 return p[aRow *
m_Ncols + aCol];
211 return p[aRow *
m_Ncols + aCol];
233#define OP_CELL( layer, dy, dx ) \
235 if( layer == UNDEFINED_LAYER || layer == B_Cu ) \
236 WriteCell( dy, dx, AR_SIDE_BOTTOM, color ); \
238 if( m_RoutingLayersCount > 1 ) \
240 if( layer == UNDEFINED_LAYER || layer == F_Cu ) \
241 WriteCell( dy, dx, AR_SIDE_TOP, color ); \
257 std::swap( ux1, ux0 );
258 std::swap( uy1, uy0 );
276 if( col_max > (
m_Ncols - 1 ) )
282 row_min = std::max( 0, std::min( row_min,
m_Nrows - 1 ) );
283 row_max = std::max( 0, std::min( row_max,
m_Nrows - 1 ) );
292 for(
int col = col_min; col <= col_max; col++ )
296 for(
int row = row_min; row <= row_max; row++ )
307 else if( ( cx >= 0 ) && ( cx <= dx ) )
312 else if( ( cx < 0 ) && ( cx >= -lg ) )
314 if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )
317 else if( ( cx > dx ) && ( cx <= ( dx + lg ) ) )
319 if( ( ( ( cx - dx ) * ( cx - dx ) ) + ( cy * cy ) ) <= ( lg * lg ) )
341 lg = std::max( 1, lg );
343 int nb_segm = ( 2 *
radius ) / lg;
345 nb_segm = std::max( 5, std::min( nb_segm, 100 ) );
347 for(
int ii = 1; ii < nb_segm; ii++ )
353 drawSegmentQcq( x0 + ux0, y0 + uy0, x1 + ux0, y1 + uy0, lg, layer, color, op_logic );
389 row_min = std::max( 0, row_min );
390 row_max = std::min( row_max,
m_Nrows - 1 );
391 col_min = std::max( 0, col_min );
392 col_max = std::min( col_max,
m_Ncols - 1 );
395 if( row_min > row_max )
398 if( col_min > col_max )
401 double fdistmin = (double) distmin * distmin;
403 for(
int row = row_min; row <= row_max; row++ )
408 for(
int col = col_min; col <= col_max; col++ )
413 if( fdistmin <= ( fdistx + fdisty ) )
416 if( aLayerMask[
B_Cu] )
433 fdistmin = ( (double) distmin * distmin ) * 2;
435 for(
int row = row_min; row <= row_max; row++ )
440 for(
int col = col_min; col <= col_max; col++ )
445 if( fdistmin <= ( fdistx + fdisty ) )
448 if( aLayerMask[
B_Cu] )
477 int nb_segm = ( 2 *
radius ) / lg;
479 nb_segm = std::max( 5, std::min( nb_segm, 100 ) );
481 for(
int ii = 1; ii <= nb_segm; ii++ )
483 EDA_ANGLE angle = arcAngle * ii / nb_segm;
490 drawSegmentQcq( x0 + ux0, y0 + uy0, x1 + ux0, y1 + uy0, lg, layer, color, op_logic );
527 row_min = std::max( 0, row_min );
528 row_max = std::min( row_max,
m_Nrows - 1 );
529 col_min = std::max( 0, col_min );
530 col_max = std::min( col_max,
m_Ncols - 1 );
532 for(
int row = row_min; row <= row_max; row++ )
534 for(
int col = col_min; col <= col_max; col++ )
552 if( aLayerMask[
B_Cu] )
588 row_min = std::max( 0, row_min );
589 row_max = std::min( row_max,
m_Nrows - 1 );
590 col_min = std::max( 0, col_min );
591 col_max = std::min( col_max,
m_Ncols - 1 );
593 for(
int row = row_min; row <= row_max; row++ )
595 for(
int col = col_min; col <= col_max; col++ )
597 if( aLayerMask[
B_Cu] )
609 int half_width = ( aShape->
GetWidth() / 2 ) + aMargin;
622 traceCircle( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
624 drawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
633 traceArc( ux0, uy0, ux1, uy1, aShape->
GetArcAngle(), half_width, layer, aColor, op_logic );
649 const LSET& aLayerMask )
681 row_min = std::max( 0, row_min );
682 row_max = std::min( row_max,
m_Nrows - 1 );
683 col_min = std::max( 0, col_min );
684 col_max = std::min( col_max,
m_Ncols - 1 );
686 for(
int row = row_min; row <= row_max; row++ )
690 if( row < cell_margin )
691 lgain = ( 256 * row ) / cell_margin;
692 else if( row > row_max - cell_margin )
693 lgain = ( 256 * ( row_max - row ) ) / cell_margin;
695 for(
int col = col_min; col <= col_max; col++ )
701 LocalKeepOut = aKeepOut;
703 if( col < cell_margin )
704 cgain = ( 256 * col ) / cell_margin;
705 else if( col > col_max - cell_margin )
706 cgain = ( 256 * ( col_max - col ) ) / cell_margin;
708 cgain = ( cgain * lgain ) / 256;
711 LocalKeepOut = ( LocalKeepOut * cgain ) / 256;
713 if( aLayerMask[
B_Cu] )
737 int x = ( aPad->
GetSize( effectivePadLayer ).x / 2 ) + margin;
738 int y = ( aPad->
GetSize( effectivePadLayer ).y / 2 ) + margin;
750 x += abs( aPad->
GetDelta( effectivePadLayer ).
y ) / 2;
751 y += abs( aPad->
GetDelta( effectivePadLayer ).
x ) / 2;
761 { aOutputLayer }, color, op_logic );
#define OP_CELL(layer, dy, dx)
#define AR_MAX_ROUTING_LAYERS_COUNT
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
void UnInitRoutingMatrix()
unsigned char MATRIX_CELL
void AddCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void AndCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void SetCellOperation(CELL_OP aLogicOp)
void(AR_MATRIX::* m_opWriteCell)(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void TracePcbShape(PCB_SHAPE *aShape, int aColor, int aMargin, AR_MATRIX::CELL_OP op_logic)
void SetCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void XorCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void SetDist(int aRow, int aCol, int aSide, DIST_CELL)
int InitRoutingMatrix()
Initialize the data structures.
MATRIX_CELL * m_BoardSide[AR_MAX_ROUTING_LAYERS_COUNT]
void drawSegmentQcq(int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, CELL_OP op_logic)
bool ComputeMatrixSize(const BOX2I &aBoundingBox)
Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation ...
void OrCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void traceCircle(int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic)
DIST_CELL * m_DistSide[AR_MAX_ROUTING_LAYERS_COUNT]
DIST_CELL GetDist(int aRow, int aCol, int aSide)
void CreateKeepOutRectangle(int ux0, int uy0, int ux1, int uy1, int margin, int aKeepOut, const LSET &aLayerMask)
Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,...
MATRIX_CELL GetCell(int aRow, int aCol, int aSide)
void traceArc(int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE &arcAngle, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic)
void TraceFilledRectangle(int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE &angle, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
void traceFilledCircle(int cx, int cy, int radius, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
VECTOR2I GetBrdCoordOrigin()
void WriteCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void PlacePad(PAD *aPad, int color, int margin, AR_MATRIX::CELL_OP op_logic)
EDA_ANGLE GetArcAngle() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
LSET is a set of PCB_LAYER_IDs.
PCB_LAYER_ID EffectiveLayerFor(PCB_LAYER_ID aLayer) const
Determines which geometry layer should be used for the given input layer.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
int GetWidth() const override
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_360
PCB_LAYER_ID
A quick note on layer IDs:
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I