171 return p[aRow *
m_Ncols + aCol];
236 return p[aRow *
m_Ncols + aCol];
260#define OP_CELL( layer, dy, dx ) \
262 if( layer == UNDEFINED_LAYER ) \
264 WriteCell( dy, dx, AR_SIDE_BOTTOM, color ); \
265 if( m_RoutingLayersCount > 1 ) \
266 WriteCell( dy, dx, AR_SIDE_TOP, color ); \
270 if( layer == m_routeLayerBottom ) \
271 WriteCell( dy, dx, AR_SIDE_BOTTOM, color ); \
272 if( m_RoutingLayersCount > 1 ) \
273 if( layer == m_routeLayerTop ) \
274 WriteCell( dy, dx, AR_SIDE_TOP, color ); \
287 int64_t row_max, col_max, row_min, col_min;
297 std::swap( ux1, ux0 );
298 std::swap( uy1, uy0 );
316 if( col_max > (
m_Ncols - 1 ) )
333 if( row_min > (
m_Nrows - 1 ) )
339 if( row_max > (
m_Nrows - 1 ) )
349 for( col = col_min; col <= col_max; col++ )
354 for( row = row_min; row <= row_max; row++ )
366 if( ( cx >= 0 ) && ( cx <= dx ) )
373 if( ( cx < 0 ) && ( cx >= -lg ) )
375 if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )
381 if( ( cx > dx ) && ( cx <= ( dx + lg ) ) )
383 if( ( ( ( cx - dx ) * ( cx - dx ) ) + ( cy * cy ) ) <= ( lg * lg ) )
416 nb_segm = ( 2 *
radius ) / lg;
424 for( ii = 1; ii < nb_segm; ii++ )
429 drawSegmentQcq( x0 + ux0, y0 + uy0, x1 + ux0, y1 + uy0, lg, layer, color, op_logic );
442 int ux0, uy0, ux1, uy1;
443 int row_max, col_max, row_min, col_min;
445 double fdistmin, fdistx, fdisty;
481 if( row_max >= (
m_Nrows - 1 ) )
487 if( col_max >= (
m_Ncols - 1 ) )
491 if( row_min > row_max )
494 if( col_min > col_max )
497 fdistmin = (double) distmin * distmin;
499 for( row = row_min; row <= row_max; row++ )
504 for( col = col_min; col <= col_max; col++ )
509 if( fdistmin <= ( fdistx + fdisty ) )
529 fdistmin = ( (double) distmin * distmin ) * 2;
531 for( row = row_min; row <= row_max; row++ )
536 for( col = col_min; col <= col_max; col++ )
541 if( fdistmin <= ( fdistx + fdisty ) )
580 nb_segm = ( 2 *
radius ) / lg;
589 for( ii = 1; ii <= nb_segm; ii++ )
591 angle = arcAngle * ii / nb_segm;
598 drawSegmentQcq( x0 + ux0, y0 + uy0, x1 + ux0, y1 + uy0, lg, layer, color, op_logic );
611 int row_min, row_max, col_min, col_max;
634 cx = ( ux0 + ux1 ) / 2;
635 cy = ( uy0 + uy1 ) / 2;
656 if( row_max >= (
m_Nrows - 1 ) )
662 if( col_max >= (
m_Ncols - 1 ) )
665 for( row = row_min; row <= row_max; row++ )
667 for( col = col_min; col <= col_max; col++ )
699 int row_min, row_max, col_min, col_max;
734 if( row_max >= (
m_Nrows - 1 ) )
740 if( col_max >= (
m_Ncols - 1 ) )
743 for( row = row_min; row <= row_max; row++ )
745 for( col = col_min; col <= col_max; col++ )
759 int half_width = ( aShape->
GetWidth() / 2 ) + aMargin;
772 traceCircle( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
774 drawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
783 traceArc( ux0, uy0, ux1, uy1, aShape->
GetArcAngle(), half_width, layer, aColor, op_logic );
799 int aKeepOut,
const LSET& aLayerMask )
802 int row_min, row_max, col_min, col_max, pmarge;
847 if( row_max >= (
m_Nrows - 1 ) )
853 if( col_max >= (
m_Ncols - 1 ) )
856 for( row = row_min; row <= row_max; row++ )
861 lgain = ( 256 * row ) / pmarge;
862 else if( row > row_max - pmarge )
863 lgain = ( 256 * ( row_max - row ) ) / pmarge;
865 for( col = col_min; col <= col_max; col++ )
874 LocalKeepOut = aKeepOut;
877 cgain = ( 256 * col ) / pmarge;
878 else if( col > col_max - pmarge )
879 cgain = ( 256 * ( col_max - col ) ) / pmarge;
881 cgain = ( cgain * lgain ) / 256;
884 LocalKeepOut = ( LocalKeepOut * cgain ) / 256;
895 data = std::max( data, LocalKeepOut );
937 shape_pos.
y + dy, aPad->
GetLayerSet(), 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 TraceFilledRectangle(int ux0, int uy0, int ux1, int uy1, double angle, const LSET &aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
void AddCell(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
void CreateKeepOutRectangle(int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, const LSET &aLayerMask)
Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,...
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)
PCB_LAYER_ID m_routeLayerBottom
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)
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 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 marge, AR_MATRIX::CELL_OP op_logic)
PCB_LAYER_ID m_routeLayerTop
int AsTenthsOfADegree() const
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.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
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
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
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