[][src]Struct salva2d::geometry::HGrid

pub struct HGrid<N: RealField, T> { /* fields omitted */ }

A grid based on spacial hashing.

Implementations

impl<N: RealField, T> HGrid<N, T>[src]

pub fn new(cell_width: N) -> Self[src]

Initialize a grid where each cell has the width cell_width.

pub fn cell_width(&self) -> N[src]

The width of a cell of this spacial grid.

pub fn key(&self, point: &Point<N>) -> Point<i64>[src]

Computes the logical grid cell containing point.

pub fn clear(&mut self)[src]

Removes all elements from this grid.

pub fn insert(&mut self, point: &Point<N>, element: T)[src]

Inserts the given element into the cell containing the given point.

pub fn cell_containing_point(&self, point: &Point<N>) -> Option<&Vec<T>>[src]

Returns the element attached to the cell containing the given point.

Returns None if the cell is empty.

pub fn cells(&self) -> impl Iterator<Item = (&Point<i64>, &Vec<T>)>[src]

An iterator through all the non-empty cells of this grid.

The returned tuple include the cell indentifier, and the elements attached to this cell.

pub fn inner_table(&self) -> &HashMap<Point<i64>, Vec<T>, DeterministicState>[src]

The underlying hash map of this spacial grid.

pub fn cell(&self, key: &Point<i64>) -> Option<&Vec<T>>[src]

Get the content of the logical cell identified by key.

pub fn neighbor_cells(
    &self,
    cell: &Point<i64>,
    radius: N
) -> impl Iterator<Item = (Point<i64>, &Vec<T>)>
[src]

An iterator through all the neighbors of the given cell.

The given cell itself will be yielded by this iterator too.

pub fn cells_intersecting_aabb(
    &self,
    mins: &Point<N>,
    maxs: &Point<N>
) -> impl Iterator<Item = (Point<i64>, &Vec<T>)>
[src]

An iterator through all the cells intersecting the given AABB.

Trait Implementations

impl<N: Clone + RealField, T: Clone> Clone for HGrid<N, T>[src]

impl<N: Debug + RealField, T: Debug> Debug for HGrid<N, T>[src]

impl<N: PartialEq + RealField, T: PartialEq> PartialEq<HGrid<N, T>> for HGrid<N, T>[src]

impl<N: RealField, T> StructuralPartialEq for HGrid<N, T>[src]

Auto Trait Implementations

impl<N, T> RefUnwindSafe for HGrid<N, T> where
    N: RefUnwindSafe,
    T: RefUnwindSafe

impl<N, T> Send for HGrid<N, T> where
    T: Send

impl<N, T> Sync for HGrid<N, T> where
    T: Sync

impl<N, T> Unpin for HGrid<N, T> where
    N: Unpin,
    T: Unpin

impl<N, T> UnwindSafe for HGrid<N, T> where
    N: UnwindSafe,
    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> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,