pub struct UniformGrid2 {
pub cell_size: f64,
/* private fields */
}Expand description
Uniform hash-grid indexing points in 2-D by cell coordinate.
Each key is stored under the cell containing its point. Queries inspect only the cells within the requested radius.
Fields§
§cell_size: f64Cell edge length (metres).
Implementations§
Source§impl UniformGrid2
impl UniformGrid2
Sourcepub fn new(cell_size: f64) -> Self
pub fn new(cell_size: f64) -> Self
Construct a grid with the given cell size (metres).
§Panics
Panics if cell_size is not strictly positive.
Sourcepub fn insert_all<I: IntoIterator<Item = (u64, Vec2)>>(&mut self, iter: I)
pub fn insert_all<I: IntoIterator<Item = (u64, Vec2)>>(&mut self, iter: I)
Insert many (key, pos) pairs.
Sourcepub fn query_radius(&self, center: Vec2, radius: f64) -> Vec<u64>
pub fn query_radius(&self, center: Vec2, radius: f64) -> Vec<u64>
Return all keys within Euclidean distance radius of center.
Trait Implementations§
Source§impl Clone for UniformGrid2
impl Clone for UniformGrid2
Source§fn clone(&self) -> UniformGrid2
fn clone(&self) -> UniformGrid2
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UniformGrid2
impl RefUnwindSafe for UniformGrid2
impl Send for UniformGrid2
impl Sync for UniformGrid2
impl Unpin for UniformGrid2
impl UnsafeUnpin for UniformGrid2
impl UnwindSafe for UniformGrid2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more