Struct hexagon_map::HexagonMap
source · pub struct HexagonMap<T> { /* private fields */ }Expand description
A sparse hexagon map, if your map size will grow, or most areas will be blank, this is a better choice.
Implementations§
source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
sourcepub fn action_field(
&self,
start: AxialPoint,
action: f64
) -> ActionFieldSolver<'_, T>
pub fn action_field( &self, start: AxialPoint, action: f64 ) -> ActionFieldSolver<'_, T>
source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
sourcepub fn path_finder(
&self,
start: &AxialPoint,
end: &AxialPoint
) -> PathFinder<'_, T>
pub fn path_finder( &self, start: &AxialPoint, end: &AxialPoint ) -> PathFinder<'_, T>
source§impl<T: Default> HexagonMap<T>
impl<T: Default> HexagonMap<T>
source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
sourcepub fn get_point(&self, point: AxialPoint) -> Option<&T>
pub fn get_point(&self, point: AxialPoint) -> Option<&T>
Get the value at a point, if it exists.
sourcepub fn add_point(&mut self, point: AxialPoint, value: T) -> Option<T>
pub fn add_point(&mut self, point: AxialPoint, value: T) -> Option<T>
Add a point to the map, if it already exists, return the old value.
sourcepub fn mut_point(&mut self, point: AxialPoint) -> Option<&mut T>
pub fn mut_point(&mut self, point: AxialPoint) -> Option<&mut T>
Get a mutable reference to a point, if it exists.
sourcepub fn remove_point(&mut self, point: AxialPoint) -> Option<T>
pub fn remove_point(&mut self, point: AxialPoint) -> Option<T>
Remove a point from the map, if it exists, return the old value.
sourcepub fn count_points(&self) -> usize
pub fn count_points(&self) -> usize
Count all defined points in the map.
sourcepub fn nearby_points(&self, from: &AxialPoint) -> Vec<AxialPoint>
pub fn nearby_points(&self, from: &AxialPoint) -> Vec<AxialPoint>
Find at most 6 points that are exists and adjacent to a point.
sourcepub fn around_points(
&self,
from: &AxialPoint,
distance: usize
) -> Vec<AxialPoint>
pub fn around_points( &self, from: &AxialPoint, distance: usize ) -> Vec<AxialPoint>
Find all points that are within a certain distance of a point.