|
KiCad PCB EDA Suite
|
A spatial index over the triangles of a cached triangulation, used to prune collision tests. More...
#include <shape_poly_tri_index.h>
Public Types | |
| using | TRI = SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI |
Public Member Functions | |
| TRIANGULATION_INDEX (const std::vector< std::unique_ptr< SHAPE_POLY_SET::TRIANGULATED_POLYGON > > &aPolys) | |
| Index every triangle of every polygon. Immutable once constructed. | |
| template<typename VISITOR> | |
| void | Query (const BOX2I &aBox, VISITOR aVisitor) const |
| Visit every triangle whose bounding box overlaps aBox. | |
Private Attributes | |
| KIRTREE::PACKED_RTREE< uint32_t, int, 2 > | m_tree |
| std::vector< const TRI * > | m_tris |
| Not owning: the triangulation outlives us. | |
A spatial index over the triangles of a cached triangulation, used to prune collision tests.
Visitation order is unspecified.
The index does not own the triangles, so whoever owns them must drop it whenever they are rebuilt, discarded or moved.
Definition at line 40 of file shape_poly_tri_index.h.
Definition at line 43 of file shape_poly_tri_index.h.
|
inlineexplicit |
Index every triangle of every polygon. Immutable once constructed.
Definition at line 46 of file shape_poly_tri_index.h.
References KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Add(), KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Build(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_tree, m_tris, and KIRTREE::PACKED_RTREE< DATATYPE, ELEMTYPE, NUMDIMS, FANOUT >::Builder::Reserve().
|
inline |
Visit every triangle whose bounding box overlaps aBox.
aVisitor is called as bool( const TRI* ); returning false stops the search.
Definition at line 82 of file shape_poly_tri_index.h.
References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_tree, and m_tris.
Referenced by VisitTriangleCandidates().
|
private |
Definition at line 100 of file shape_poly_tri_index.h.
Referenced by Query(), and TRIANGULATION_INDEX().
|
private |
Not owning: the triangulation outlives us.
Definition at line 103 of file shape_poly_tri_index.h.
Referenced by Query(), and TRIANGULATION_INDEX().