[−][src]Struct fart_aabb::AabbTree
A tree mapping from axis-aligned bounding boxes to T
values.
Methods
impl<T, U, V> AabbTree<T, U, V> where
T: Copy + Num + PartialOrd,
[src]
T: Copy + Num + PartialOrd,
pub fn new() -> AabbTree<T, U, V>
[src]
Construct a new, empty AABB tree.
pub fn insert(&mut self, aabb: Aabb<T, U>, value: V)
[src]
Insert the given value into the AABB tree.
ⓘImportant traits for IterOverlapping<'a, T, U, V>pub fn iter_overlapping(&self, aabb: Aabb<T, U>) -> IterOverlapping<T, U, V>
[src]
ⓘImportant traits for IterOverlapping<'a, T, U, V>
Iterate over each of the AABB keys and associated values that overlap with the given AABB.
Order of iteration is not defined.
use euclid::Point2D; use fart_aabb::{AabbTree, Aabb}; let mut tree = AabbTree::new(); tree.insert(Aabb::new(Point2D::new(0.0, 0.0), Point2D::new(2.0, 2.0)), "Alice"); tree.insert(Aabb::new(Point2D::new(2.0, 2.0), Point2D::new(4.0, 4.0)), "Bob"); tree.insert(Aabb::new(Point2D::new(10.0, 10.0), Point2D::new(20.0, 20.0)), "Zed"); let target = Aabb::new(Point2D::new(1.0, 1.0), Point2D::new(3.0, 3.0)); for (aabb, who) in tree.iter_overlapping(target) { match *who { "Alice" => println!("Found Alice at {:?}", aabb), "Bob" => println!("Found Bob at {:?}", aabb), someone => panic!("Found someone we shouldn't have: {}", someone), } }
pub fn any_overlap(&self, aabb: Aabb<T, U>) -> bool
[src]
Do any of the AABBs in this tree overlap with the give AABB?
Trait Implementations
Auto Trait Implementations
impl<T, U, V> Send for AabbTree<T, U, V> where
T: Send,
U: Send,
V: Send,
T: Send,
U: Send,
V: Send,
impl<T, U, V> Sync for AabbTree<T, U, V> where
T: Sync,
U: Sync,
V: Sync,
T: Sync,
U: Sync,
V: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,