26#include <unordered_set> 
   49                                    const std::vector<BOARD_ITEM*>&       aBe,
 
   50                                    const std::vector<const BOARD_ITEM*>& aDontTestAgainst,
 
   51                                    int                                   aMinGrooveWidth );
 
   69                  const std::vector<BOARD_ITEM*>&       aBoardEdges,
 
   70                  const std::vector<const BOARD_ITEM*>& aIgnoreForTest, 
SHAPE_POLY_SET* aOutline,
 
   71                  const std::pair<bool, bool>& aTestLocalConcavity, 
int aMinGrooveWidth )
 const 
   85        if( !( aOutline->
Contains( midPoint, -1, tolerance )
 
   89        if( 
false && ( aTestLocalConcavity.first || aTestLocalConcavity.second ) )
 
   93            double extendLine = 1000; 
 
   98            double extendPoly = 100; 
 
  109            if( aTestLocalConcavity.first && !aOutline->
Contains( a - dir, -1, 0 ) )
 
  112            if( aTestLocalConcavity.second && !aOutline->
Contains( b + dir, -1, 0 ) )
 
  127                    std::shared_ptr<SHAPE> sh = track->GetEffectiveShape();
 
  131                        SEG segTrack( track->GetStart(), track->GetEnd() );
 
 
 
  177        m_type = CREEP_SHAPE::TYPE::UNDEFINED;
 
 
  192    virtual void ConnectChildren( std::shared_ptr<GRAPH_NODE>& a1, std::shared_ptr<GRAPH_NODE>& a2,
 
  195    std::vector<PATH_CONNECTION> 
ReversePaths( 
const std::vector<PATH_CONNECTION>& aV )
 const 
  197        std::vector<PATH_CONNECTION> r;
 
  198        r.reserve( aV.size() );
 
  200        for( 
const auto& pc : aV )
 
  202            r.emplace_back( pc );
 
  203            std::swap( r.back().a1, r.back().a2 );
 
 
  210                                        double aMaxSquaredWeight )
 const 
  212        std::vector<PATH_CONNECTION> a;
 
 
  217                                                double aMaxSquaredWeight )
 const 
  219        std::vector<PATH_CONNECTION> a;
 
 
  224                                                double aMaxSquaredWeight )
 const 
  226        std::vector<PATH_CONNECTION> a;
 
 
  231                                                double aMaxSquaredWeight )
 const 
  233        std::vector<PATH_CONNECTION> a;
 
 
  238                                                double aMaxSquaredWeight )
 const 
  240        std::vector<PATH_CONNECTION> a;
 
 
  245                                                double aMaxSquaredWeight )
 const 
  247        std::vector<PATH_CONNECTION> a;
 
 
  252                                                double aMaxSquaredWeight )
 const 
  254        std::vector<PATH_CONNECTION> a;
 
 
 
  317                                        double aMaxSquaredWeight ) 
const override;
 
  319                                        double aMaxSquaredWeight ) 
const override;
 
  321                                        double aMaxSquaredWeight ) 
const override;
 
  323                                        double aMaxSquaredWeight ) 
const override;
 
  325                                        double aMaxSquaredWeight ) 
const override;
 
  327                                        double aMaxSquaredWeight ) 
const override;
 
 
  354                                        double aMaxSquaredWeight ) 
const override;
 
  356                                        double aMaxSquaredWeight ) 
const override;
 
  358                                        double aMaxSquaredWeight ) 
const override;
 
  360                                        double aMaxSquaredWeight )
 const override 
 
  366                                        double aMaxSquaredWeight ) 
const override;
 
  368                                        double aMaxSquaredWeight ) 
const override;
 
 
  390        m_type = CREEP_SHAPE::TYPE::ARC;
 
 
  395                                        double aMaxSquaredWeight ) 
const override;
 
  398                                        double aMaxSquaredWeight ) 
const override;
 
  401                                        double aMaxSquaredWeight ) 
const override;
 
  404                                        double aMaxSquaredWeight )
 const override 
 
  410                                        double aMaxSquaredWeight )
 const override 
 
  416                                        double aMaxSquaredWeight ) 
const override;
 
 
  507    void GetShapes( std::vector<PCB_SHAPE>& aShapes );
 
  510    std::shared_ptr<GRAPH_NODE> 
n1;
 
  511    std::shared_ptr<GRAPH_NODE> 
n2;
 
 
  528        m_type = CREEP_SHAPE::TYPE::POINT;
 
 
  532                                        double aMaxSquaredWeight ) 
const override;
 
  535                                        double aMaxSquaredWeight ) 
const override;
 
  538                                        double aMaxSquaredWeight ) 
const override;
 
  541                                        double aMaxSquaredWeight )
 const override 
 
  547                                        double aMaxSquaredWeight )
 const override 
 
  553                                        double aMaxSquaredWeight )
 const override 
 
  559    void ConnectChildren( std::shared_ptr<GRAPH_NODE>& a1, std::shared_ptr<GRAPH_NODE>& a2,
 
 
  575        m_type = CREEP_SHAPE::TYPE::CIRCLE;
 
 
  579                                        double aMaxSquaredWeight )
 const override 
 
  585                                        double aMaxSquaredWeight ) 
const override;
 
  588                                        double aMaxSquaredWeight ) 
const override;
 
  591                                        double aMaxSquaredWeight )
 const override 
 
  597                                        double aMaxSquaredWeight )
 const override 
 
  605    void ConnectChildren( std::shared_ptr<GRAPH_NODE>& a1, std::shared_ptr<GRAPH_NODE>& a2,
 
  608    void ShortenChildDueToGV( std::shared_ptr<GRAPH_NODE>& a1, std::shared_ptr<GRAPH_NODE>& a2,
 
 
  629        m_type = CREEP_SHAPE::TYPE::ARC;
 
 
  632    void ConnectChildren( std::shared_ptr<GRAPH_NODE>& a1, std::shared_ptr<GRAPH_NODE>& a2,
 
  637                                        double aMaxSquaredWeight )
 const override 
 
  642                                        double aMaxSquaredWeight )
 const override 
 
  647                                        double aMaxSquaredWeight ) 
const override;
 
  650                                        double aMaxSquaredWeight )
 const override 
 
  655                                        double aMaxSquaredWeight )
 const override 
 
  660                                        double aMaxSquaredWeight )
 const override 
 
 
  721        for( std::shared_ptr<GRAPH_NODE>& n : 
m_nodes )
 
  725                n->m_node_conns.clear();
 
 
  747    std::shared_ptr<GRAPH_CONNECTION> 
AddConnection( std::shared_ptr<GRAPH_NODE>& aN1,
 
  748                                                     std::shared_ptr<GRAPH_NODE>& aN2,
 
  751    std::shared_ptr<GRAPH_CONNECTION> 
AddConnection( std::shared_ptr<GRAPH_NODE>& aN1,
 
  752                                                     std::shared_ptr<GRAPH_NODE>& aN2 );
 
  757    void RemoveConnection( 
const std::shared_ptr<GRAPH_CONNECTION>&, 
bool aDelete = 
false );
 
  759    void Trim( 
double aWeightLimit );
 
  761    void Addshape( 
const SHAPE& aShape, std::shared_ptr<GRAPH_NODE>& aConnectTo,
 
  764    double Solve( std::shared_ptr<GRAPH_NODE>& aFrom, std::shared_ptr<GRAPH_NODE>& aTo,
 
  765                  std::vector<std::shared_ptr<GRAPH_CONNECTION>>& aResult );
 
  776        std::size_t 
operator()(
const std::shared_ptr<GRAPH_NODE>& node)
 const 
  778            return hash_val(node->m_type, node->m_parent, node->m_pos.x, node->m_pos.y);
 
 
 
  784        bool operator()(
const std::shared_ptr<GRAPH_NODE>& lhs, 
const std::shared_ptr<GRAPH_NODE>& rhs)
 const 
  786            return lhs->m_type == rhs->m_type && lhs->m_parent == rhs->m_parent && lhs->m_pos == rhs->m_pos;
 
 
 
  794    std::vector<std::shared_ptr<GRAPH_NODE>>       
m_nodes;
 
 
Creepage: a board edge arc.
 
std::pair< bool, bool > IsThereATangentPassingThroughPoint(const BE_SHAPE_POINT aPoint) const
 
EDA_ANGLE GetStartAngle() const override
 
int GetRadius() const override
 
BE_SHAPE_ARC(VECTOR2I aPos, int aRadius, EDA_ANGLE aStartAngle, EDA_ANGLE aEndAngle, VECTOR2D aStartPoint, VECTOR2D aEndPoint)
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_ARC &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
VECTOR2I GetStartPoint() const override
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
void ConnectChildren(std::shared_ptr< GRAPH_NODE > &a1, std::shared_ptr< GRAPH_NODE > &a2, CREEPAGE_GRAPH &aG) const override
 
EDA_ANGLE GetEndAngle() const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
VECTOR2I GetEndPoint() const override
 
EDA_ANGLE AngleBetweenStartAndEnd(const VECTOR2I aPoint) const
 
Creepage: a board edge circle.
 
int GetRadius() const override
 
BE_SHAPE_CIRCLE(VECTOR2I aPos=VECTOR2I(0, 0), int aRadius=0)
 
void ShortenChildDueToGV(std::shared_ptr< GRAPH_NODE > &a1, std::shared_ptr< GRAPH_NODE > &a2, CREEPAGE_GRAPH &aG, double aNormalWeight) const
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
void ConnectChildren(std::shared_ptr< GRAPH_NODE > &a1, std::shared_ptr< GRAPH_NODE > &a2, CREEPAGE_GRAPH &aG) const override
 
Creepage: a board edge point.
 
BE_SHAPE_POINT(VECTOR2I aPos)
 
void ConnectChildren(std::shared_ptr< GRAPH_NODE > &a1, std::shared_ptr< GRAPH_NODE > &a2, CREEPAGE_GRAPH &aG) const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_ARC &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
Creepage: a board edge shape.
 
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
 
Information pertinent to a Pcbnew printed circuit board.
 
const TRACKS & Tracks() const
 
A graph with nodes and connections for creepage calculation.
 
std::shared_ptr< GRAPH_NODE > AddNode(GRAPH_NODE::TYPE aType, CREEP_SHAPE *aParent=nullptr, const VECTOR2I &aPos=VECTOR2I())
 
std::shared_ptr< GRAPH_CONNECTION > AddConnection(std::shared_ptr< GRAPH_NODE > &aN1, std::shared_ptr< GRAPH_NODE > &aN2, const PATH_CONNECTION &aPc)
 
void SetTarget(double aTarget)
 
double Solve(std::shared_ptr< GRAPH_NODE > &aFrom, std::shared_ptr< GRAPH_NODE > &aTo, std::vector< std::shared_ptr< GRAPH_CONNECTION > > &aResult)
 
void Addshape(const SHAPE &aShape, std::shared_ptr< GRAPH_NODE > &aConnectTo, BOARD_ITEM *aParent=nullptr)
 
std::vector< CREEP_SHAPE * > m_shapeCollection
 
CREEPAGE_GRAPH(BOARD &aBoard)
 
void TransformEdgeToCreepShapes()
 
std::shared_ptr< GRAPH_NODE > AddNodeVirtual()
 
void TransformCreepShapesToNodes(std::vector< CREEP_SHAPE * > &aShapes)
 
void Trim(double aWeightLimit)
 
SHAPE_POLY_SET * m_boardOutline
 
void RemoveDuplicatedShapes()
 
std::vector< BOARD_ITEM * > m_boardEdge
 
double m_creepageTargetSquared
 
std::unordered_set< std::shared_ptr< GRAPH_NODE >, GraphNodeHash, GraphNodeEqual > m_nodeset
 
void GeneratePaths(double aMaxWeight, PCB_LAYER_ID aLayer)
 
std::vector< std::shared_ptr< GRAPH_NODE > > m_nodes
 
std::vector< std::shared_ptr< GRAPH_CONNECTION > > m_connections
 
std::shared_ptr< GRAPH_NODE > AddNetElements(int aNetCode, PCB_LAYER_ID aLayer, int aMaxCreepage)
 
void RemoveConnection(const std::shared_ptr< GRAPH_CONNECTION > &, bool aDelete=false)
 
std::shared_ptr< GRAPH_NODE > FindNode(GRAPH_NODE::TYPE aType, CREEP_SHAPE *aParent, const VECTOR2I &aPos)
 
A class used to represent the shapes for creepage calculation.
 
virtual VECTOR2I GetStartPoint() const
 
virtual std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
virtual std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_ARC &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
CREEP_SHAPE::TYPE GetType() const
 
std::vector< PATH_CONNECTION > Paths(const CREEP_SHAPE &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
virtual EDA_ANGLE GetEndAngle() const
 
void SetParent(BOARD_ITEM *aParent)
 
virtual std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_ARC &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
virtual std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
virtual int GetRadius() const
 
const BOARD_ITEM * GetParent() const
 
virtual void ConnectChildren(std::shared_ptr< GRAPH_NODE > &a1, std::shared_ptr< GRAPH_NODE > &a2, CREEPAGE_GRAPH &aG) const
 
virtual std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
virtual EDA_ANGLE GetStartAngle() const
 
virtual VECTOR2I GetEndPoint() const
 
virtual std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const
 
std::vector< PATH_CONNECTION > ReversePaths(const std::vector< PATH_CONNECTION > &aV) const
 
Creepage: a conductive arc.
 
VECTOR2I GetStartPoint() const override
 
EDA_ANGLE AngleBetweenStartAndEnd(const VECTOR2I aPoint) const
 
VECTOR2I GetEndPoint() const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_CIRCLE &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
EDA_ANGLE GetStartAngle() const override
 
CU_SHAPE_ARC(VECTOR2I aPos, double aRadius, EDA_ANGLE aStartAngle, EDA_ANGLE aEndAngle, VECTOR2D aStartPoint, VECTOR2D aEndPoint)
 
int GetRadius() const override
 
EDA_ANGLE GetEndAngle() const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
Creepage: a conductive circle.
 
int GetRadius() const override
 
std::vector< PATH_CONNECTION > Paths(const CU_SHAPE_SEGMENT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
CU_SHAPE_CIRCLE(VECTOR2I aPos, double aRadius=0)
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
Creepage: a conductive segment.
 
std::vector< PATH_CONNECTION > Paths(const BE_SHAPE_POINT &aS2, double aMaxWeight, double aMaxSquaredWeight) const override
 
VECTOR2I GetStart() const
 
CU_SHAPE_SEGMENT(VECTOR2I aStart, VECTOR2I aEnd, double aWidth=0)
 
Creepage: a conductive shape.
 
std::shared_ptr< GRAPH_NODE > n2
 
void GetShapes(std::vector< PCB_SHAPE > &aShapes)
 
std::shared_ptr< GRAPH_NODE > n1
 
GRAPH_CONNECTION(std::shared_ptr< GRAPH_NODE > &aN1, std::shared_ptr< GRAPH_NODE > &aN2, const PATH_CONNECTION &aPc)
 
std::set< std::shared_ptr< GRAPH_CONNECTION > > m_node_conns
 
GRAPH_NODE(GRAPH_NODE::TYPE aType, CREEP_SHAPE *aParent, const VECTOR2I &aPos=VECTOR2I())
 
bool Intersects(const SEG &aSeg) const
 
Represent a set of closed polygons.
 
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
 
bool PointOnEdge(const VECTOR2I &aP, int aAccuracy=0) const
Check if point aP lies on an edge or vertex of some of the outlines or holes.
 
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
 
An abstract shape on 2D plane.
 
constexpr extended_type SquaredEuclideanNorm() const
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
 
@ ROUND_ALL_CORNERS
All angles are rounded.
 
bool SegmentIntersectsBoard(const VECTOR2I &aP1, const VECTOR2I &aP2, const std::vector< BOARD_ITEM * > &aBe, const std::vector< const BOARD_ITEM * > &aDontTestAgainst, int aMinGrooveWidth)
 
static constexpr EDA_ANGLE ANGLE_360
 
static constexpr std::size_t hash_val(const Types &... args)
 
PCB_LAYER_ID
A quick note on layer IDs:
 
This file contains miscellaneous commonly used macros and functions.
 
bool operator()(const std::shared_ptr< GRAPH_NODE > &lhs, const std::shared_ptr< GRAPH_NODE > &rhs) const
 
std::size_t operator()(const std::shared_ptr< GRAPH_NODE > &node) const
 
bool m_forceA2concavityCheck
 
bool m_forceA1concavityCheck
 
bool isValid(const BOARD &aBoard, PCB_LAYER_ID aLayer, const std::vector< BOARD_ITEM * > &aBoardEdges, const std::vector< const BOARD_ITEM * > &aIgnoreForTest, SHAPE_POLY_SET *aOutline, const std::pair< bool, bool > &aTestLocalConcavity, int aMinGrooveWidth) const
Test if a path is valid.
 
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D