KiCad PCB EDA Suite
Loading...
Searching...
No Matches
AR_MATRIX Class Reference

Handle the matrix routing that describes the actual board. More...

#include <ar_matrix.h>

Public Types

enum  CELL_OP {
  WRITE_CELL = 0 , WRITE_OR_CELL = 1 , WRITE_XOR_CELL = 2 , WRITE_AND_CELL = 3 ,
  WRITE_ADD_CELL = 4
}
 
typedef unsigned char MATRIX_CELL
 
typedef int DIST_CELL
 

Public Member Functions

 AR_MATRIX ()
 
 ~AR_MATRIX ()
 
void WriteCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
VECTOR2I GetBrdCoordOrigin ()
 
bool ComputeMatrixSize (const BOX2I &aBoundingBox)
 Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area.
 
int InitRoutingMatrix ()
 Initialize the data structures.
 
void UnInitRoutingMatrix ()
 
void SetCellOperation (CELL_OP aLogicOp)
 
MATRIX_CELL GetCell (int aRow, int aCol, int aSide)
 
void SetCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void OrCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void XorCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void AndCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void AddCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
DIST_CELL GetDist (int aRow, int aCol, int aSide)
 
void SetDist (int aRow, int aCol, int aSide, DIST_CELL)
 
void TraceSegmentPcb (PCB_SHAPE *aShape, int aColor, int aMargin, AR_MATRIX::CELL_OP op_logic)
 
void CreateKeepOutRectangle (int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, LSET aLayerMask)
 Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -marge to x1,y1 + marge are incremented by a decreasing value (aKeepOut ... 0).
 
void PlacePad (PAD *aPad, int color, int marge, AR_MATRIX::CELL_OP op_logic)
 
void TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, double angle, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
 
void TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
 

Public Attributes

MATRIX_CELLm_BoardSide [AR_MAX_ROUTING_LAYERS_COUNT]
 
DIST_CELLm_DistSide [AR_MAX_ROUTING_LAYERS_COUNT]
 
int m_RoutingLayersCount
 
int m_GridRouting
 
BOX2I m_BrdBox
 
int m_Nrows
 
int m_Ncols
 
int m_MemSize
 
int m_RouteCount
 
PCB_LAYER_ID m_routeLayerTop
 
PCB_LAYER_ID m_routeLayerBottom
 

Private Member Functions

void drawSegmentQcq (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, CELL_OP op_logic)
 
void traceCircle (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic)
 
void traceFilledCircle (int cx, int cy, int radius, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic)
 
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)
 

Private Attributes

void(AR_MATRIX::* m_opWriteCell )(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 

Detailed Description

Handle the matrix routing that describes the actual board.

Definition at line 48 of file ar_matrix.h.

Member Typedef Documentation

◆ DIST_CELL

typedef int AR_MATRIX::DIST_CELL

Definition at line 52 of file ar_matrix.h.

◆ MATRIX_CELL

typedef unsigned char AR_MATRIX::MATRIX_CELL

Definition at line 51 of file ar_matrix.h.

Member Enumeration Documentation

◆ CELL_OP

Enumerator
WRITE_CELL 
WRITE_OR_CELL 
WRITE_XOR_CELL 
WRITE_AND_CELL 
WRITE_ADD_CELL 

Definition at line 54 of file ar_matrix.h.

Constructor & Destructor Documentation

◆ AR_MATRIX()

◆ ~AR_MATRIX()

AR_MATRIX::~AR_MATRIX ( )

Definition at line 56 of file ar_matrix.cpp.

Member Function Documentation

◆ AddCell()

void AR_MATRIX::AddCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Definition at line 226 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by SetCellOperation().

◆ AndCell()

void AR_MATRIX::AndCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Definition at line 215 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by SetCellOperation().

◆ ComputeMatrixSize()

bool AR_MATRIX::ComputeMatrixSize ( const BOX2I aBoundingBox)

Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area.

Parameters
aPcbis the physical board.
aUseBoardEdgesOnlyset to true to use board edges only or false to use the full board bounding box (default).

Definition at line 63 of file ar_matrix.cpp.

References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_BrdBox, m_GridRouting, m_Ncols, m_Nrows, BOX2< Vec >::SetEnd(), BOX2< Vec >::SetX(), BOX2< Vec >::SetY(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AR_AUTOPLACER::genPlacementRoutingMatrix().

◆ CreateKeepOutRectangle()

void AR_MATRIX::CreateKeepOutRectangle ( int  ux0,
int  uy0,
int  ux1,
int  uy1,
int  marge,
int  aKeepOut,
LSET  aLayerMask 
)

Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -marge to x1,y1 + marge are incremented by a decreasing value (aKeepOut ... 0).

The decreasing value depends on the distance to the first rectangle Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle

Definition at line 796 of file ar_matrix.cpp.

References AR_SIDE_BOTTOM, AR_SIDE_TOP, GetDist(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_BrdBox, m_GridRouting, m_Ncols, m_Nrows, m_routeLayerBottom, m_routeLayerTop, m_RoutingLayersCount, and SetDist().

Referenced by AR_AUTOPLACER::genModuleOnRoutingMatrix().

◆ drawSegmentQcq()

void AR_MATRIX::drawSegmentQcq ( int  ux0,
int  uy0,
int  ux1,
int  uy1,
int  lg,
int  layer,
int  color,
AR_MATRIX::CELL_OP  op_logic 
)
private

Definition at line 287 of file ar_matrix.cpp.

References m_GridRouting, m_Ncols, m_Nrows, OP_CELL, RotatePoint(), and SetCellOperation().

Referenced by traceArc(), traceCircle(), and TraceSegmentPcb().

◆ GetBrdCoordOrigin()

VECTOR2I AR_MATRIX::GetBrdCoordOrigin ( )
inline
Returns
the board coordinate corresponding to the routing matrix origin ( board coordinate offset ).

Definition at line 75 of file ar_matrix.h.

References BOX2< Vec >::GetOrigin(), and m_BrdBox.

Referenced by AR_AUTOPLACER::fillMatrix(), traceFilledCircle(), TraceFilledRectangle(), and TraceSegmentPcb().

◆ GetCell()

AR_MATRIX::MATRIX_CELL AR_MATRIX::GetCell ( int  aRow,
int  aCol,
int  aSide 
)

Definition at line 171 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by AR_AUTOPLACER::testRectangle().

◆ GetDist()

AR_MATRIX::DIST_CELL AR_MATRIX::GetDist ( int  aRow,
int  aCol,
int  aSide 
)

Definition at line 236 of file ar_matrix.cpp.

References m_DistSide, and m_Ncols.

Referenced by AR_AUTOPLACER::calculateKeepOutArea(), and CreateKeepOutRectangle().

◆ InitRoutingMatrix()

int AR_MATRIX::InitRoutingMatrix ( )

Initialize the data structures.

Returns
the amount of memory used or -1 if default.

Definition at line 93 of file ar_matrix.cpp.

References AR_SIDE_BOTTOM, AR_SIDE_TOP, m_BoardSide, m_DistSide, m_MemSize, m_Ncols, m_Nrows, m_RouteCount, and m_RoutingLayersCount.

Referenced by AR_AUTOPLACER::genPlacementRoutingMatrix().

◆ OrCell()

void AR_MATRIX::OrCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Definition at line 193 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by SetCellOperation().

◆ PlacePad()

◆ SetCell()

void AR_MATRIX::SetCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Definition at line 182 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by AR_AUTOPLACER::fillMatrix(), and SetCellOperation().

◆ SetCellOperation()

◆ SetDist()

void AR_MATRIX::SetDist ( int  aRow,
int  aCol,
int  aSide,
DIST_CELL  x 
)

Definition at line 246 of file ar_matrix.cpp.

References m_DistSide, and m_Ncols.

Referenced by CreateKeepOutRectangle().

◆ traceArc()

void AR_MATRIX::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 
)
private

◆ traceCircle()

void AR_MATRIX::traceCircle ( int  ux0,
int  uy0,
int  ux1,
int  uy1,
int  lg,
int  layer,
int  color,
AR_MATRIX::CELL_OP  op_logic 
)
private

Definition at line 402 of file ar_matrix.cpp.

References ANGLE_360, color, EDA_ANGLE::Cos(), drawSegmentQcq(), KiROUND(), and EDA_ANGLE::Sin().

Referenced by TraceSegmentPcb().

◆ traceFilledCircle()

void AR_MATRIX::traceFilledCircle ( int  cx,
int  cy,
int  radius,
LSET  aLayerMask,
int  color,
AR_MATRIX::CELL_OP  op_logic 
)
private

◆ TraceFilledRectangle() [1/2]

void AR_MATRIX::TraceFilledRectangle ( int  ux0,
int  uy0,
int  ux1,
int  uy1,
double  angle,
LSET  aLayerMask,
int  color,
AR_MATRIX::CELL_OP  op_logic 
)

◆ TraceFilledRectangle() [2/2]

void AR_MATRIX::TraceFilledRectangle ( int  ux0,
int  uy0,
int  ux1,
int  uy1,
LSET  aLayerMask,
int  color,
AR_MATRIX::CELL_OP  op_logic 
)

◆ TraceSegmentPcb()

◆ UnInitRoutingMatrix()

void AR_MATRIX::UnInitRoutingMatrix ( )

◆ WriteCell()

void AR_MATRIX::WriteCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
inline

Definition at line 66 of file ar_matrix.h.

References m_opWriteCell.

Referenced by traceFilledCircle(), and TraceFilledRectangle().

◆ XorCell()

void AR_MATRIX::XorCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Definition at line 204 of file ar_matrix.cpp.

References m_BoardSide, and m_Ncols.

Referenced by SetCellOperation().

Member Data Documentation

◆ m_BoardSide

◆ m_BrdBox

◆ m_DistSide

DIST_CELL* AR_MATRIX::m_DistSide[AR_MAX_ROUTING_LAYERS_COUNT]

Definition at line 140 of file ar_matrix.h.

Referenced by AR_MATRIX(), GetDist(), InitRoutingMatrix(), SetDist(), and UnInitRoutingMatrix().

◆ m_GridRouting

◆ m_MemSize

int AR_MATRIX::m_MemSize

Definition at line 146 of file ar_matrix.h.

Referenced by AR_MATRIX(), and InitRoutingMatrix().

◆ m_Ncols

◆ m_Nrows

◆ m_opWriteCell

void(AR_MATRIX::* AR_MATRIX::m_opWriteCell) (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
private

Definition at line 154 of file ar_matrix.h.

Referenced by AR_MATRIX(), SetCellOperation(), and WriteCell().

◆ m_RouteCount

int AR_MATRIX::m_RouteCount

Definition at line 147 of file ar_matrix.h.

Referenced by AR_MATRIX(), and InitRoutingMatrix().

◆ m_routeLayerBottom

◆ m_routeLayerTop

◆ m_RoutingLayersCount


The documentation for this class was generated from the following files: