Predicates¶
Defined in header <ArborX_Predicates.hpp>
A predicate describes what a spatial index query() should look for.
Predicates are not created directly: they are generated by the functions
listed below, and have an unspecified type.
Function |
Kind |
Selects |
|---|---|---|
spatial |
all the values whose indexable intersects a geometry |
|
nearest |
the |
|
|
ordered spatial (experimental) |
all the values whose indexable intersects a geometry, visited by increasing distance from that geometry |
The kind of a predicate determines how the search is performed and which callbacks are valid.
A spatial predicate selects every value that satisfies a spatial relation with a geometry, in no particular order.
A nearest predicate selects a fixed number of values based on their distance to a geometry.
An ordered spatial predicate selects the same values as its spatial counterpart, but the callback is invoked on them by increasing distance from the geometry. Combined with an early exit from the callback, this makes it possible to stop at the first values found, e.g., along a ray. This kind is experimental and its interface may change.
Note
intersects() is currently the only spatial predicate provided.
Other spatial relations could be supported in the future, such as the
contains, within, or covered_by relations found in
Boost.Geometry.
Using predicates¶
A set of predicates is passed to query() through
AccessTraits: the specialization provides the number of
predicates and gets the i-th one.
For the common case where the predicates are derived from a set of geometries,
the pages above document helper functions that generate the whole set at once,
e.g., ArborX::Experimental::make_intersects(geometries).
An equivalent ArborX::Experimental::make_ordered_intersects(geometries)
exists for ordered spatial predicates.