Struct space_partitioning::quadtree::QuadTree [−][src]
pub struct QuadTree<ElementId = u32> where
ElementId: ElementIdType, { /* fields omitted */ }
Expand description
A QuadTree implementation as described in Efficient Quadtrees.
Remarks
This tree uses integral coordinates only in order to speed up box-box intersection tests.
Implementations
pub fn new(
root_rect: QuadRect,
max_depth: u32,
max_num_elements: u32,
smallest_cell_size: u32
) -> Self
Prunes unused child nodes from the tree.
Remarks
The tree is never pruned automatically for performance reasons. Call this method after all elements were removed or updated.
Returns the set of IDs that occupy space within the specified bounding box.
Arguments
- [
rect
] - The rectangle to test for.
Calls a function for each ID that occupies space within the specified bounding box. The function may be called multiple times for the same ID.
Arguments
- [
rect
] - The rectangle to test for. - [
candidate_fn
] - The function called for each candidate element’s ID.
pub fn intersect_generic<T>(&self, element: &T) -> HashSet<ElementId> where
T: IntersectsWith<AABB>,
pub fn intersect_generic<T>(&self, element: &T) -> HashSet<ElementId> where
T: IntersectsWith<AABB>,
Returns the set of IDs that occupy space within the specified bounding box.
Arguments
- [
element
] - The element to test for.
pub fn intersect_generic_fn<T, F>(&self, element: &T, candidate_fn: F) where
T: IntersectsWith<AABB>,
F: FnMut(ElementId),
pub fn intersect_generic_fn<T, F>(&self, element: &T, candidate_fn: F) where
T: IntersectsWith<AABB>,
F: FnMut(ElementId),
Calls a function for each ID that occupies space within the specified bounding box. The function may be called multiple times for the same ID.
Arguments
- [
element
] - The element to test for. - [
candidate_fn
] - The function called for each candidate element’s ID.