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

Describe ratsnest for a single net. More...

#include <ratsnest_data.h>

Classes

class  TRIANGULATOR_STATE
 

Public Member Functions

 RN_NET ()
 
bool IsDirty () const
 Return state of the 'dirty' flag, indicating that ratsnest for a given net is invalid and requires an update.
 
void UpdateNet ()
 Recompute ratsnest for a net.
 
void RemoveInvalidRefs ()
 
void OptimizeRNEdges ()
 Find optimal ends of RNEdges.
 
void Clear ()
 
void AddCluster (std::shared_ptr< CN_CLUSTER > aCluster)
 
unsigned int GetNodeCount () const
 
const std::vector< CN_EDGE > & GetEdges () const
 
std::vector< CN_EDGE > & GetEdges ()
 
bool NearestBicoloredPair (RN_NET *aOtherNet, VECTOR2I &aPos1, VECTOR2I &aPos2) const
 

Protected Member Functions

void compute ()
 < Recompute ratsnest from scratch.
 
void kruskalMST (const std::vector< CN_EDGE > &aEdges)
 

Protected Attributes

std::multiset< std::shared_ptr< CN_ANCHOR >, CN_PTR_CMPm_nodes
 < Vector of nodes
 
std::vector< CN_EDGEm_boardEdges
 Vector of edges that makes ratsnest for a given net.
 
std::vector< CN_EDGEm_rnEdges
 Flag indicating necessity of recalculation of ratsnest for a net.
 
bool m_dirty
 
std::shared_ptr< TRIANGULATOR_STATEm_triangulator
 

Detailed Description

Describe ratsnest for a single net.

Definition at line 62 of file ratsnest_data.h.

Constructor & Destructor Documentation

◆ RN_NET()

RN_NET::RN_NET ( )

Definition at line 282 of file ratsnest_data.cpp.

References m_triangulator.

Member Function Documentation

◆ AddCluster()

void RN_NET::AddCluster ( std::shared_ptr< CN_CLUSTER aCluster)

Definition at line 568 of file ratsnest_data.cpp.

References m_boardEdges, and m_nodes.

Referenced by CONNECTIVITY_DATA::addRatsnestCluster().

◆ Clear()

void RN_NET::Clear ( )

Definition at line 558 of file ratsnest_data.cpp.

References m_boardEdges, m_dirty, m_nodes, and m_rnEdges.

◆ compute()

void RN_NET::compute ( )
protected

< Recompute ratsnest from scratch.

Compute the minimum spanning tree using Kruskal's algorithm

Definition at line 288 of file ratsnest_data.cpp.

References kruskalMST(), m_boardEdges, m_nodes, m_rnEdges, m_triangulator, and PROF_TIMER::Show().

Referenced by UpdateNet().

◆ GetEdges() [1/2]

std::vector< CN_EDGE > & RN_NET::GetEdges ( )
inline

Definition at line 97 of file ratsnest_data.h.

References m_rnEdges.

◆ GetEdges() [2/2]

◆ GetNodeCount()

unsigned int RN_NET::GetNodeCount ( ) const
inline

Definition at line 94 of file ratsnest_data.h.

References m_nodes.

Referenced by CONNECTIVITY_DATA::ComputeLocalRatsnest().

◆ IsDirty()

bool RN_NET::IsDirty ( ) const
inline

Return state of the 'dirty' flag, indicating that ratsnest for a given net is invalid and requires an update.

Returns
True if ratsnest requires recomputation, false otherwise.

Definition at line 73 of file ratsnest_data.h.

References m_dirty.

◆ kruskalMST()

void RN_NET::kruskalMST ( const std::vector< CN_EDGE > &  aEdges)
protected

Definition at line 110 of file ratsnest_data.cpp.

References m_nodes, m_rnEdges, and disjoint_set::unite().

Referenced by compute().

◆ NearestBicoloredPair()

bool RN_NET::NearestBicoloredPair ( RN_NET aOtherNet,
VECTOR2I aPos1,
VECTOR2I aPos2 
) const

Sweep-line algorithm to cut the number of comparisons to find the closest point

Step 1: The outer loop needs to be the subset (selected nodes) as it is a linear search

Step 2: O( log n ) search to identify a close element ordered by x The fwd_it iterator will move forward through the elements while the rev_it iterator will move backward through the same set

As soon as the x distance (primary sort) is larger than the smallest distance, stop checking further elements

Step 3: using the same starting point, check points backwards for closer points

Definition at line 599 of file ratsnest_data.cpp.

References VECTOR2< int32_t >::ECOORD_MAX, m_nodes, SEG::Square(), and VECTOR2< T >::SquaredEuclideanNorm().

Referenced by CONNECTIVITY_DATA::ComputeLocalRatsnest().

◆ OptimizeRNEdges()

void RN_NET::OptimizeRNEdges ( )

Find optimal ends of RNEdges.

The MST will have found the closest anchors, but when zones are involved we might have points closer than the anchors.

Normally called after UpdateNet(), but from a separate multi-threaded loop for safety.

Definition at line 351 of file ratsnest_data.cpp.

References SHAPE_LINE_CHAIN::BBox(), CENTER, SHAPE_LINE_CHAIN::ClosestSegmentsFast(), CN_ITEM::ConnectedItems(), SHAPE_LINE_CHAIN::CPoints(), CN_ITEM::GetBoardLayer(), BOX2< Vec >::GetCenter(), CN_ZONE_LAYER::GetOutline(), and m_rnEdges.

◆ RemoveInvalidRefs()

void RN_NET::RemoveInvalidRefs ( )

Definition at line 548 of file ratsnest_data.cpp.

References m_boardEdges, and m_rnEdges.

◆ UpdateNet()

void RN_NET::UpdateNet ( )

Recompute ratsnest for a net.

Definition at line 540 of file ratsnest_data.cpp.

References compute(), and m_dirty.

Member Data Documentation

◆ m_boardEdges

std::vector<CN_EDGE> RN_NET::m_boardEdges
protected

Vector of edges that makes ratsnest for a given net.

Definition at line 113 of file ratsnest_data.h.

Referenced by AddCluster(), Clear(), compute(), and RemoveInvalidRefs().

◆ m_dirty

bool RN_NET::m_dirty
protected

Definition at line 119 of file ratsnest_data.h.

Referenced by Clear(), IsDirty(), and UpdateNet().

◆ m_nodes

std::multiset<std::shared_ptr<CN_ANCHOR>, CN_PTR_CMP> RN_NET::m_nodes
protected

< Vector of nodes

Vector of edges that make pre-defined connections

Definition at line 110 of file ratsnest_data.h.

Referenced by AddCluster(), Clear(), compute(), GetNodeCount(), kruskalMST(), and NearestBicoloredPair().

◆ m_rnEdges

std::vector<CN_EDGE> RN_NET::m_rnEdges
protected

Flag indicating necessity of recalculation of ratsnest for a net.

Definition at line 116 of file ratsnest_data.h.

Referenced by Clear(), compute(), GetEdges(), kruskalMST(), OptimizeRNEdges(), and RemoveInvalidRefs().

◆ m_triangulator

std::shared_ptr<TRIANGULATOR_STATE> RN_NET::m_triangulator
protected

Definition at line 123 of file ratsnest_data.h.

Referenced by compute(), and RN_NET().


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