[][src]Struct rustbatch::entities::detection::quadmap::QuadMap

pub struct QuadMap<T: Eq + Hash + Clone + Copy> { /* fields omitted */ }

QuadMap is very similar to QuadTree but there is a trade off. It eliminates recursion so overall performance is better but it has to allocate all memory at once witch can be slow. It also takes ids over pointers because this is rust ofter all.

Implementations

impl<T: Eq + Hash + Clone + Copy> QuadMap<T>[src]

pub fn new(resolution: usize, size: Vect) -> Self[src]

new makes lot of memory allocations and its over all slowest. Do not rebuild QuadMap update it.

pub fn insert(&mut self, shape: Rect, id: T) -> Address[src]

insert inserts shape to quad map and returns address to it. You should store this address and use it when updating or removing your object. This is most efficient way to interact with QuadMap and so it is only one.

pub fn query(&self, shape: Rect, collector: &mut Vec<T>)[src]

query returns ids of all possibly colliding shapes, you have to make collision check your self witch improves memory consumption.

pub fn remove(&mut self, id: &T, address: &Address)[src]

remove removes shape from QuadMap

pub fn update(&mut self, shape: Rect, id: T, address: &Address) -> Address[src]

update updates the shape

pub fn shape_count(&self) -> usize[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for QuadMap<T> where
    T: RefUnwindSafe

impl<T> Send for QuadMap<T> where
    T: Send

impl<T> Sync for QuadMap<T> where
    T: Sync

impl<T> Unpin for QuadMap<T> where
    T: Unpin

impl<T> UnwindSafe for QuadMap<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,