[−][src]Trait rstar::RTreeParams
Defines static parameters for an r-tree.
Internally, an r-tree contains several nodes, similar to a b-tree. These parameters change the size of these nodes and can be used to fine tune the tree's performance.
Example
use rstar::{RTreeParams, RTree, RStarInsertionStrategy}; // This example uses an rtree with larger internal nodes. struct LargeNodeParameters; impl RTreeParams for LargeNodeParameters { const MIN_SIZE: usize = 10; const MAX_SIZE: usize = 30; const REINSERTION_COUNT: usize = 5; type DefaultInsertionStrategy = RStarInsertionStrategy; } // Optional but helpful: Define a type alias for the new r-tree type LargeNodeRTree<T> = RTree<T, LargeNodeParameters>; // The only difference from now on is the usage of "new_with_params" instead of "new" let mut large_node_tree: LargeNodeRTree<_> = RTree::new_with_params(); // Using the r-tree should allow inference for the point type large_node_tree.insert([1.0, -1.0f32]); // There is also a bulk load method with parameters: let tree: LargeNodeRTree<_> = RTree::bulk_load_with_params(some_elements);
Associated Types
type DefaultInsertionStrategy: InsertionStrategy
The insertion strategy which is used when calling insert.
Associated Constants
const MIN_SIZE: usize
The minimum size of an internal node. Must be at most half as large as MAX_SIZE
.
Choosing a value around one half or one third of MAX_SIZE
is recommended. Higher
values should yield slightly better tree quality while lower values may benefit
insertion performance.
const MAX_SIZE: usize
The maximum size of an internal node. Larger values will improve insertion performance but increase the average query time.
const REINSERTION_COUNT: usize
The number of nodes that the insertion strategy tries to reinsert sometimes to
maintain a good tree quality. Must be smaller than MAX_SIZE
- MIN_SIZE
.
Larger values will improve query times but increase insertion time.