Grid

Struct Grid 

Source
pub struct Grid<Data: Copy> { /* private fields */ }

Implementations§

Source§

impl<Data: Copy> Grid<Data>

Source

pub fn with_cell_count( x: Range<f64>, y: Range<f64>, cell_count: (usize, usize), ) -> Grid<Data>

§Arguments
  • x: min_x..max_x defines the area in wich data can be inserted
  • y: min_y..max_y defines the area in wich data can be inserted
  • cell_count: (count_x, count_y) defines how many cell should be present
Source

pub fn cell(&self, indexes: (usize, usize)) -> &Vec<((f64, f64), Data)>

§Arguments
  • indexes: (x,y) cord of the cell

returns: &Vec<((f64, f64), Data), Global> the data stored in the cell

Source

pub fn cell_count(&self) -> (usize, usize)

§Arguments

returns: (usize, usize) the defined cell_count

Source

pub fn cell_size(&self) -> (f64, f64)

§Arguments

returns: (f64, f64) width and height of each cell

Trait Implementations§

Source§

impl<Data: Copy> SpatialPartitioner<Data> for Grid<Data>

Source§

fn new(x: Range<f64>, y: Range<f64>) -> Self

create a Grid with a default size of (100,100). More info here Grid::new()

Source§

fn insert(&mut self, position: (f64, f64), data: Data)

inserts an obj and checks if position is out of bounce Read more
Source§

fn insert_unchecked(&mut self, position: (f64, f64), data: Data)

inserts an obj and DOES NOT check if position is out of bounce Read more
Source§

fn count(&self) -> usize

returns the count of DataValues which are currently stored
Source§

fn clear(&mut self)

Source§

fn in_circle(&self, position: (f64, f64), radius: f64) -> Vec<Data>

gets all DataValues in the given search circle Read more

Auto Trait Implementations§

§

impl<Data> Freeze for Grid<Data>

§

impl<Data> RefUnwindSafe for Grid<Data>
where Data: RefUnwindSafe,

§

impl<Data> Send for Grid<Data>
where Data: Send,

§

impl<Data> Sync for Grid<Data>
where Data: Sync,

§

impl<Data> Unpin for Grid<Data>
where Data: Unpin,

§

impl<Data> UnwindSafe for Grid<Data>
where Data: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.