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

pub struct HGrid<T> { /* fields omitted */ }

A grid based on spacial hashing.

Implementations

impl<T> HGrid<T>[src]

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

Initialize a grid where each cell has the width cell_width.

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

The width of a cell of this spacial grid.

pub fn key(&self, point: &Point<Real>) -> 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<Real>, element: T)[src]

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

pub fn cell_containing_point(&self, point: &Point<Real>) -> 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: Real
) -> 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<Real>,
    maxs: &Point<Real>
) -> impl Iterator<Item = (Point<i64>, &Vec<T>)>
[src]

An iterator through all the cells intersecting the given AABB.

Trait Implementations

impl<T: Clone> Clone for HGrid<T>[src]

impl<T: Debug> Debug for HGrid<T>[src]

impl<T: PartialEq> PartialEq<HGrid<T>> for HGrid<T>[src]

impl<T> StructuralPartialEq for HGrid<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for HGrid<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for HGrid<T> where
    T: Send
[src]

impl<T> Sync for HGrid<T> where
    T: Sync
[src]

impl<T> Unpin for HGrid<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for HGrid<T> where
    T: UnwindSafe
[src]

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