175 return p[aRow *
m_Ncols + aCol];
240 return p[aRow *
m_Ncols + aCol];
264#define OP_CELL( layer, dy, dx ) \
266 if( layer == UNDEFINED_LAYER ) \
268 WriteCell( dy, dx, AR_SIDE_BOTTOM, color ); \
269 if( m_RoutingLayersCount > 1 ) \
270 WriteCell( dy, dx, AR_SIDE_TOP, color ); \
274 if( layer == m_routeLayerBottom ) \
275 WriteCell( dy, dx, AR_SIDE_BOTTOM, color ); \
276 if( m_RoutingLayersCount > 1 ) \
277 if( layer == m_routeLayerTop ) \
278 WriteCell( dy, dx, AR_SIDE_TOP, color ); \
291 int64_t row_max, col_max, row_min, col_min;
301 std::swap( ux1, ux0 );
302 std::swap( uy1, uy0 );
320 if( col_max > (
m_Ncols - 1 ) )
337 if( row_min > (
m_Nrows - 1 ) )
343 if( row_max > (
m_Nrows - 1 ) )
353 for( col = col_min; col <= col_max; col++ )
358 for( row = row_min; row <= row_max; row++ )
370 if( ( cx >= 0 ) && ( cx <= dx ) )
377 if( ( cx < 0 ) && ( cx >= -lg ) )
379 if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )
385 if( ( cx > dx ) && ( cx <= ( dx + lg ) ) )
387 if( ( ( ( cx - dx ) * ( cx - dx ) ) + ( cy * cy ) ) <= ( lg * lg ) )
420 nb_segm = ( 2 *
radius ) / lg;
428 for( ii = 1; ii < nb_segm; ii++ )
446 int ux0, uy0, ux1, uy1;
447 int row_max, col_max, row_min, col_min;
449 double fdistmin, fdistx, fdisty;
485 if( row_max >= (
m_Nrows - 1 ) )
491 if( col_max >= (
m_Ncols - 1 ) )
495 if( row_min > row_max )
498 if( col_min > col_max )
501 fdistmin = (double) distmin * distmin;
503 for( row = row_min; row <= row_max; row++ )
508 for( col = col_min; col <= col_max; col++ )
513 if( fdistmin <= ( fdistx + fdisty ) )
533 fdistmin = ( (double) distmin * distmin ) * 2;
535 for( row = row_min; row <= row_max; row++ )
540 for( col = col_min; col <= col_max; col++ )
545 if( fdistmin <= ( fdistx + fdisty ) )
584 nb_segm = ( 2 *
radius ) / lg;
593 for( ii = 1; ii <= nb_segm; ii++ )
595 angle = arcAngle * ii / nb_segm;
615 int row_min, row_max, col_min, col_max;
638 cx = ( ux0 + ux1 ) / 2;
639 cy = ( uy0 + uy1 ) / 2;
660 if( row_max >= (
m_Nrows - 1 ) )
666 if( col_max >= (
m_Ncols - 1 ) )
669 for( row = row_min; row <= row_max; row++ )
671 for( col = col_min; col <= col_max; col++ )
703 int row_min, row_max, col_min, col_max;
738 if( row_max >= (
m_Nrows - 1 ) )
744 if( col_max >= (
m_Ncols - 1 ) )
747 for( row = row_min; row <= row_max; row++ )
749 for( col = col_min; col <= col_max; col++ )
764 int half_width = ( aShape->
GetWidth() / 2 ) + aMargin;
769 if( aShape->
GetShape() == SHAPE_T::CIRCLE || aShape->
GetShape() == SHAPE_T::SEGMENT )
776 if( aShape->
GetShape() == SHAPE_T::CIRCLE )
777 traceCircle( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
779 drawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, aColor, op_logic );
781 else if( aShape->
GetShape() == SHAPE_T::ARC )
788 traceArc( ux0, uy0, ux1, uy1, aShape->
GetArcAngle(), half_width, layer, aColor, op_logic );
804 int aKeepOut,
const LSET& aLayerMask )
807 int row_min, row_max, col_min, col_max, pmarge;
852 if( row_max >= (
m_Nrows - 1 ) )
858 if( col_max >= (
m_Ncols - 1 ) )
861 for( row = row_min; row <= row_max; row++ )
866 lgain = ( 256 * row ) / pmarge;
867 else if( row > row_max - pmarge )
868 lgain = ( 256 * ( row_max - row ) ) / pmarge;
870 for( col = col_min; col <= col_max; col++ )
879 LocalKeepOut = aKeepOut;
882 cgain = ( 256 * col ) / pmarge;
883 else if( col > col_max - pmarge )
884 cgain = ( 256 * ( col_max - col ) ) / pmarge;
886 cgain = ( cgain * lgain ) / 256;
889 LocalKeepOut = ( LocalKeepOut * cgain ) / 256;
900 data = std::max( data, LocalKeepOut );
#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 TraceSegmentPcb(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
constexpr const Vec GetEnd() const
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr size_type GetHeight() const
constexpr void SetX(coord_type val)
constexpr void SetY(coord_type val)
constexpr void SetEnd(coord_type x, coord_type y)
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
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
const VECTOR2I & GetSize(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