|
KiCad PCB EDA Suite
|
Spatial index over footprint courtyard bounding boxes. More...
#include <footprint_courtyard_index.h>
Public Member Functions | |
| FOOTPRINT_COURTYARD_INDEX (const BOARD *aBoard) | |
| Build the index from the board's footprint courtyards (which DRC has already cached). | |
| void | QueryOverlapping (const BOX2I &aBox, const std::function< bool(FOOTPRINT *)> &aVisitor) const |
| Visit every footprint whose courtyard bounding box overlaps aBox. | |
Private Attributes | |
| KIRTREE::PACKED_RTREE< FOOTPRINT *, int, 2 > | m_tree |
Spatial index over footprint courtyard bounding boxes.
intersectsCourtyard()-style rule predicates otherwise scan every footprint on the board for each item under test, which is O(items x footprints) and dominates DRC on dense boards with courtyard rules. Indexing the courtyards lets those predicates visit only the footprints whose courtyard can actually reach the item, while the precise per-side collision test downstream is unchanged.
Definition at line 40 of file footprint_courtyard_index.h.
|
explicit |
Build the index from the board's footprint courtyards (which DRC has already cached).
Definition at line 25 of file footprint_courtyard_index.cpp.
References KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Add(), B_Cu, SHAPE_POLY_SET::BBox(), KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Build(), F_Cu, BOARD::Footprints(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), m_tree, BOX2< Vec >::Merge(), SHAPE_POLY_SET::OutlineCount(), and KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Reserve().
| void FOOTPRINT_COURTYARD_INDEX::QueryOverlapping | ( | const BOX2I & | aBox, |
| const std::function< bool(FOOTPRINT *)> & | aVisitor ) const |
Visit every footprint whose courtyard bounding box overlaps aBox.
The visitor returns true to keep searching and false to stop early, mirroring a linear scan's short-circuit.
Definition at line 66 of file footprint_courtyard_index.cpp.
References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), and m_tree.
|
private |
Definition at line 52 of file footprint_courtyard_index.h.
Referenced by FOOTPRINT_COURTYARD_INDEX(), and QueryOverlapping().