pub struct SpatialHash2D {
pub cell_size: f32,
/* private fields */
}Expand description
A 2D spatial hash grid.
Fields§
§cell_size: f32Implementations§
Source§impl SpatialHash2D
impl SpatialHash2D
pub fn new(cell_size: f32) -> Self
Sourcepub fn query_radius(&self, x: f32, y: f32, radius: f32) -> Vec<usize>
pub fn query_radius(&self, x: f32, y: f32, radius: f32) -> Vec<usize>
Query all point indices in the same or neighboring cells (within radius).
Sourcepub fn query_aabb(&self, min: [f32; 2], max: [f32; 2]) -> Vec<usize>
pub fn query_aabb(&self, min: [f32; 2], max: [f32; 2]) -> Vec<usize>
Query all points in a rectangle.
Sourcepub fn point_count(&self) -> usize
pub fn point_count(&self) -> usize
Number of inserted points.
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Number of non-empty cells.
Trait Implementations§
Source§impl Clone for SpatialHash2D
impl Clone for SpatialHash2D
Source§fn clone(&self) -> SpatialHash2D
fn clone(&self) -> SpatialHash2D
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 SpatialHash2D
impl RefUnwindSafe for SpatialHash2D
impl Send for SpatialHash2D
impl Sync for SpatialHash2D
impl Unpin for SpatialHash2D
impl UnsafeUnpin for SpatialHash2D
impl UnwindSafe for SpatialHash2D
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