pub struct GridMap {
pub width: usize,
pub height: usize,
pub resolution: f64,
pub center_x: f64,
pub center_y: f64,
pub data: Vec<NDTGrid>,
}Expand description
A 2D grid map that stores an NDTGrid in each cell.
Fields§
§width: usize§height: usize§resolution: f64§center_x: f64§center_y: f64§data: Vec<NDTGrid>Implementations§
Source§impl GridMap
impl GridMap
pub fn new( width: usize, height: usize, resolution: f64, center_x: f64, center_y: f64, ) -> Self
Sourcepub fn calc_grid_index_from_xy_pos(&self, x: f64, y: f64) -> Option<usize>
pub fn calc_grid_index_from_xy_pos(&self, x: f64, y: f64) -> Option<usize>
Convert (x, y) in world coordinates to a single index in the grid.
Returns None if out of bounds.
Sourcepub fn calc_grid_central_xy_position_from_grid_index(
&self,
idx: usize,
) -> (f64, f64)
pub fn calc_grid_central_xy_position_from_grid_index( &self, idx: usize, ) -> (f64, f64)
Convert a single index to the center-world-coordinates of that grid cell.
Auto Trait Implementations§
impl Freeze for GridMap
impl RefUnwindSafe for GridMap
impl Send for GridMap
impl Sync for GridMap
impl Unpin for GridMap
impl UnsafeUnpin for GridMap
impl UnwindSafe for GridMap
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.