pub struct GridReachabilityIndex { /* private fields */ }Expand description
Maps each walkable cell to a 4-connected component id for cheap reachability.
Implementations§
Source§impl GridReachabilityIndex
impl GridReachabilityIndex
Sourcepub fn from_grid(grid: &Grid) -> Self
pub fn from_grid(grid: &Grid) -> Self
Flood-fills walkable cells into 4-connected components (same neighbor model as search).
Snapshot of grid at call time; rebuild after walkability edits. Blocked cells
receive no component id.
Sourcepub fn component_id(&self, point: Point) -> Option<u32>
pub fn component_id(&self, point: Point) -> Option<u32>
Returns the component id for a walkable in-bounds cell; blocked and OOB cells return None.
Sourcepub fn is_reachable(&self, start: Point, goal: Point) -> bool
pub fn is_reachable(&self, start: Point, goal: Point) -> bool
Whether start and goal share a walkable 4-connected component.
Returns false if either point is blocked, out of bounds, or the pair
lies in different components. A walkable cell is reachable from itself.
Sourcepub fn component_count(&self) -> u32
pub fn component_count(&self) -> u32
Number of distinct walkable components in the indexed grid.
Trait Implementations§
Source§impl Clone for GridReachabilityIndex
impl Clone for GridReachabilityIndex
Source§fn clone(&self) -> GridReachabilityIndex
fn clone(&self) -> GridReachabilityIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridReachabilityIndex
impl Debug for GridReachabilityIndex
impl Eq for GridReachabilityIndex
Source§impl PartialEq for GridReachabilityIndex
impl PartialEq for GridReachabilityIndex
impl StructuralPartialEq for GridReachabilityIndex
Auto Trait Implementations§
impl Freeze for GridReachabilityIndex
impl RefUnwindSafe for GridReachabilityIndex
impl Send for GridReachabilityIndex
impl Sync for GridReachabilityIndex
impl Unpin for GridReachabilityIndex
impl UnsafeUnpin for GridReachabilityIndex
impl UnwindSafe for GridReachabilityIndex
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