pub struct Rtree<T: Indexable, Params: SplitParameters = Quadratic> { /* private fields */ }Expand description
A spatial index over Indexable values, parameterised by a split
strategy.
Mirrors boost::geometry::index::rtree<Value, Parameters>
(index/rtree.hpp). The default split is Quadratic; pass
Linear as Params for cheaper inserts.
§Examples
use geometry_cs::Cartesian;
use geometry_model::Point2D;
use geometry_rtree::Rtree;
type P = Point2D<f64, Cartesian>;
let mut tree: Rtree<P> = Rtree::new();
tree.insert(P::new(1.0, 1.0));
tree.insert(P::new(5.0, 5.0));
assert_eq!(tree.len(), 2);Implementations§
Source§impl<T: Indexable, Params: SplitParameters> Rtree<T, Params>
impl<T: Indexable, Params: SplitParameters> Rtree<T, Params>
Sourcepub fn insert(&mut self, value: T)
pub fn insert(&mut self, value: T)
Insert one value.
Descends by least-enlargement to a leaf, inserts, and splits and
propagates upward if a node overflows. Mirrors
visitors/insert.hpp.
Trait Implementations§
Source§impl<T: Indexable, Params: SplitParameters> FromIterator<T> for Rtree<T, Params>
impl<T: Indexable, Params: SplitParameters> FromIterator<T> for Rtree<T, Params>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Bulk-load with Sort-Tile-Recursive packing: sort by x-centroid,
slice into vertical strips, sort each strip by y-centroid, and
pack leaves. Produces a balanced tree in one pass, the analogue of
Boost’s pack_create (index/detail/rtree/pack_create.hpp).
Auto Trait Implementations§
impl<T, Params> Freeze for Rtree<T, Params>
impl<T, Params> RefUnwindSafe for Rtree<T, Params>where
Params: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Params> Send for Rtree<T, Params>
impl<T, Params> Sync for Rtree<T, Params>
impl<T, Params> Unpin for Rtree<T, Params>
impl<T, Params> UnsafeUnpin for Rtree<T, Params>
impl<T, Params> UnwindSafe for Rtree<T, Params>where
Params: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more