Skip to main content

geometry_rtree/
lib.rs

1//! An R-tree spatial index over the geometry kernel.
2//!
3//! Mirrors `boost/geometry/index/rtree.hpp` and the support headers
4//! under `boost/geometry/index/detail/`. Stores any [`Indexable`] value
5//! (a value with an axis-aligned bounding box) and answers spatial
6//! queries — intersects / within / contains — and k-nearest-neighbour
7//! search, pruning the tree with each node's bounding box.
8//!
9//! The split strategy is a type parameter of [`Rtree`]. The default is
10//! [`AsymmetricRStarSplit`] with six-child branches and 12-value
11//! leaves for insertion, and four-child branches/four-value leaves for
12//! bulk packing; symmetric [`RStarSplit`], [`Quadratic`], and [`Linear`]
13//! configurations remain available. Bulk loading via [`FromIterator`] uses
14//! Sort-Tile-Recursive packing for a balanced tree in one pass.
15//! See [`split`] for parameter semantics, validity constraints, tuning
16//! guidance, and the benchmark evidence behind the default.
17//!
18//! Cartesian, 2D, `f64` for v1.
19//!
20//! Module layout:
21//!
22//! * [`bounds`] — the axis-aligned box arithmetic (area, enlargement,
23//!   union, distance) the tree keys on.
24//! * [`indexable`] — the [`Indexable`] trait.
25//! * [`node`] — the leaf / branch [`Node`](node::Node) enum.
26//! * [`split`] — the [`SplitParameters`] strategies.
27//! * [`predicate`] — the query [`Predicate`]s.
28//! * [`rtree`](mod@rtree) — the [`Rtree`] and its insert / query /
29//!   nearest / bulk load.
30//! * [`query_iter`] — [`QueryIter`], the lazy
31//!   spatial-query walk.
32//! * [`nearest_iter`] — [`NearestIter`], the
33//!   unbounded nearest-first stream.
34//! * `search_frontier` / `nearest_bound` (crate-internal) — the nearest
35//!   search's stack-first frontier and k-th-best rank buffer.
36//!
37//! [`Indexable`]: indexable::Indexable
38
39#![cfg_attr(not(feature = "std"), no_std)]
40#![forbid(unsafe_code)]
41
42extern crate alloc;
43
44mod nearest_bound;
45mod search_frontier;
46
47pub mod bounds;
48pub mod indexable;
49pub mod nearest_iter;
50pub mod node;
51pub mod predicate;
52pub mod query_iter;
53pub mod rtree;
54pub mod split;
55
56pub use bounds::Bounds;
57pub use indexable::Indexable;
58pub use nearest_iter::NearestIter;
59pub use predicate::Predicate;
60pub use query_iter::QueryIter;
61pub use rtree::Rtree;
62pub use split::{
63    AsymmetricQuadratic, AsymmetricRStarSplit, Linear, Quadratic, RStarSplit, SplitParameters,
64};