Struct aabb_quadtree::QuadTree
[−]
[src]
pub struct QuadTree<T> { /* fields omitted */ }
The main QuadTree structure. Mainly supports inserting, removing, and querying objects in 3d space.
Methods
impl<T> QuadTree<T>
[src]
fn new(
size: Rect,
allow_duplicates: bool,
min_children: usize,
max_children: usize,
max_depth: usize
) -> QuadTree<T>
[src]
size: Rect,
allow_duplicates: bool,
min_children: usize,
max_children: usize,
max_depth: usize
) -> QuadTree<T>
Constructs a new QuadTree with customizable options.
size
: the enclosing space for the quad-tree.allow_duplicates
: if false, the quadtree will remove objects that have the same bounding box.min_children
: the minimum amount of children that a tree node will have.max_children
: the maximum amount of children that a tree node will have before it gets split.max_depth
: the maximum depth that the tree can grow before it stops.
fn default(size: Rect) -> QuadTree<T>
[src]
Constructs a new QuadTree with customizable options.
size
: the enclosing space for the quad-tree. ### Defautsallow_duplicates
: truemin_children
: 4max_children
: 16max_depth
: 8
fn insert_with_box(&mut self, t: T, aabb: Rect) -> ItemId
[src]
Inserts an element with the provided bounding box.
fn first(&self) -> Option<ItemId>
[src]
Returns an ItemId for the first element that was inserted into the tree.
fn insert(&mut self, t: T) -> ItemId where
T: Spatial,
[src]
T: Spatial,
Inserts an element into the tree.
fn get(&self, id: ItemId) -> Option<&T>
[src]
Retrieves an element by looking it up from the ItemId.
fn query(&self, bounding_box: Rect) -> Vec<(&T, &Rect, ItemId)> where
T: Debug,
[src]
T: Debug,
Returns an iterator of (element, bounding-box, id) for each element
whose bounding box intersects with bounding_box
.
fn remove(&mut self, item_id: ItemId) -> Option<(T, Rect)>
[src]
Attempts to remove the item with id item_id
from the tree. If that
item was present, it returns a tuple of (element, bounding-box)
fn iter(&self) -> Iter<ItemId, (T, Rect)>
[src]
Returns an iterator over all the items in the tree.
fn inspect<F: FnMut(&Rect, usize, bool)>(&self, f: F)
[src]
Calls f
repeatedly for every node in the tree with these arguments
&Rect
: The boudning box of that tree nodeusize
: The current depthbool
: True if the node is a leaf-node, False if the node is a branch node.
fn len(&self) -> usize
[src]
Returns the number of elements in the tree
fn is_empty(&self) -> bool
[src]
Returns true if the tree is empty.
fn bounding_box(&self) -> Rect
[src]
Returns the enclosing bounding-box for the entire tree.