|
KiCad PCB EDA Suite
|
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 () |
| const std::vector< CN_EDGE > & | GetUnsortedEdges () const |
| Return the ratsnest edges in no particular order. | |
| int64_t | GetTotalAirlineLength () const |
| Return the total length of the ratsnest airlines (unrouted connections) for this net. | |
| bool | NearestBicoloredPair (RN_NET *aOtherNet, VECTOR2I &aPos1, VECTOR2I &aPos2) const |
Protected Member Functions | |
| void | compute () |
| Recompute ratsnest from scratch. | |
| void | kruskalMST (std::vector< CN_EDGE > &aEdges) |
| Compute the minimum spanning tree using Filter-Kruskal. aEdges is reordered. | |
Protected Attributes | |
| std::multiset< std::shared_ptr< CN_ANCHOR >, CN_PTR_CMP > | m_nodes |
| Vector of nodes. | |
| std::vector< CN_EDGE > | m_boardEdges |
| Vector of edges that make pre-defined connections. | |
| std::vector< CN_EDGE > | m_rnEdges |
| Vector of edges that makes ratsnest for a given net. | |
| bool | m_dirty |
| Flag indicating necessity of recalculation of ratsnest for a net. | |
| std::shared_ptr< TRIANGULATOR_STATE > | m_triangulator |
Describe ratsnest for a single net.
Definition at line 59 of file ratsnest_data.h.
| RN_NET::RN_NET | ( | ) |
Definition at line 271 of file ratsnest_data.cpp.
References m_dirty, and m_triangulator.
Referenced by NearestBicoloredPair().
| void RN_NET::AddCluster | ( | std::shared_ptr< CN_CLUSTER > | aCluster | ) |
Definition at line 565 of file ratsnest_data.cpp.
References m_boardEdges, and m_nodes.
Referenced by CONNECTIVITY_DATA::addRatsnestCluster().
| void RN_NET::Clear | ( | ) |
Definition at line 555 of file ratsnest_data.cpp.
References m_boardEdges, m_dirty, m_nodes, and m_rnEdges.
|
protected |
Recompute ratsnest from scratch.
Definition at line 277 of file ratsnest_data.cpp.
References kruskalMST(), m_boardEdges, m_nodes, m_rnEdges, m_triangulator, PROF_TIMER::Show(), and source.
Referenced by UpdateNet().
|
inline |
Definition at line 106 of file ratsnest_data.h.
References m_rnEdges.
|
inline |
Definition at line 93 of file ratsnest_data.h.
References end, m_rnEdges, and CN_EDGE::StableSortCompare().
Referenced by BOOST_DATA_TEST_CASE(), CONNECTIVITY_DATA::GetRatsnestForComponent(), CONNECTIVITY_DATA::GetRatsnestForItems(), CONNECTIVITY_DATA::GetRatsnestForPad(), PCB_SELECTION_TOOL::grabUnconnected(), ROUTER_TOOL::Init(), ROUTER_TOOL::RouteSelected(), and RATSNEST_SEARCH_HANDLER::Search().
|
inline |
Definition at line 91 of file ratsnest_data.h.
References m_nodes.
Referenced by BOOST_DATA_TEST_CASE(), and CONNECTIVITY_DATA::ComputeLocalRatsnest().
|
inline |
Return the total length of the ratsnest airlines (unrouted connections) for this net.
Unlike GetEdges(), this does not sort the edges, so it is cheap to call repeatedly.
Definition at line 129 of file ratsnest_data.h.
References m_rnEdges.
|
inline |
Return the ratsnest edges in no particular order.
Unlike GetEdges(), this does not sort, so it is cheap to call repeatedly. Use it wherever the order of the edges cannot be observed, such as drawing them.
Definition at line 122 of file ratsnest_data.h.
References m_rnEdges.
Referenced by RATSNEST_VIEW_ITEM::ViewDraw().
|
inline |
Return state of the 'dirty' flag, indicating that ratsnest for a given net is invalid and requires an update.
Definition at line 70 of file ratsnest_data.h.
References m_dirty.
|
protected |
Compute the minimum spanning tree using Filter-Kruskal. aEdges is reordered.
Definition at line 49 of file ratsnest_data.cpp.
References KI_MST::FilterKruskal(), m_nodes, m_rnEdges, source, and KI_UNION_FIND::Unite().
Referenced by compute().
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 596 of file ratsnest_data.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, m_nodes, RN_NET(), SEG::Square(), and VECTOR2< T >::SquaredEuclideanNorm().
Referenced by CONNECTIVITY_DATA::ComputeLocalRatsnest().
| 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 340 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(), m_rnEdges, and source.
| void RN_NET::RemoveInvalidRefs | ( | ) |
Definition at line 537 of file ratsnest_data.cpp.
References m_boardEdges, and m_rnEdges.
| void RN_NET::UpdateNet | ( | ) |
Recompute ratsnest for a net.
Definition at line 529 of file ratsnest_data.cpp.
|
protected |
Vector of edges that make pre-defined connections.
Definition at line 153 of file ratsnest_data.h.
Referenced by AddCluster(), Clear(), compute(), and RemoveInvalidRefs().
|
protected |
Flag indicating necessity of recalculation of ratsnest for a net.
Definition at line 159 of file ratsnest_data.h.
Referenced by Clear(), IsDirty(), RN_NET(), and UpdateNet().
|
protected |
Vector of nodes.
Definition at line 150 of file ratsnest_data.h.
Referenced by AddCluster(), Clear(), compute(), GetNodeCount(), kruskalMST(), and NearestBicoloredPair().
|
protected |
Vector of edges that makes ratsnest for a given net.
Definition at line 156 of file ratsnest_data.h.
Referenced by Clear(), compute(), GetEdges(), GetEdges(), GetTotalAirlineLength(), GetUnsortedEdges(), kruskalMST(), OptimizeRNEdges(), and RemoveInvalidRefs().
|
protected |
Definition at line 163 of file ratsnest_data.h.