[−][src]Struct rustbatch::entities::detection::quadmap::QuadMap
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,
T: RefUnwindSafe,
impl<T> Send for QuadMap<T> where
T: Send,
T: Send,
impl<T> Sync for QuadMap<T> where
T: Sync,
T: Sync,
impl<T> Unpin for QuadMap<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for QuadMap<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,