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

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FOOTPRINT_COURTYARD_INDEX()

Member Function Documentation

◆ QueryOverlapping()

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.

Member Data Documentation

◆ m_tree

KIRTREE::PACKED_RTREE<FOOTPRINT*, int, 2> FOOTPRINT_COURTYARD_INDEX::m_tree
private

Definition at line 52 of file footprint_courtyard_index.h.

Referenced by FOOTPRINT_COURTYARD_INDEX(), and QueryOverlapping().


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