pub struct GridMap {
pub width: usize,
pub height: usize,
pub cells: Vec<bool>,
pub cell_size: f32,
pub origin: Vec2,
}Expand description
A 2-D uniform grid map for JPS and flow fields.
Fields§
§width: usize§height: usize§cells: Vec<bool>§cell_size: f32§origin: Vec2Implementations§
Source§impl GridMap
impl GridMap
pub fn new(width: usize, height: usize, cell_size: f32, origin: Vec2) -> Self
pub fn idx(&self, x: usize, y: usize) -> usize
pub fn in_bounds(&self, x: i32, y: i32) -> bool
pub fn walkable(&self, x: i32, y: i32) -> bool
pub fn set_walkable(&mut self, x: usize, y: usize, w: bool)
pub fn node_id(&self, x: usize, y: usize) -> NodeId
pub fn coords(&self, id: NodeId) -> (usize, usize)
pub fn world_pos(&self, x: usize, y: usize) -> Vec2
pub fn grid_coords_for_world(&self, p: Vec2) -> Option<(usize, usize)>
Trait Implementations§
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