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: CubicPoint,
action: f64,
) -> ActionFieldSolver<'_, T>
pub fn action_field( &self, start: CubicPoint, action: f64, ) -> ActionFieldSolver<'_, T>
Source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
pub fn points_all(&self) -> GetHexagonPoints<'_, T> ⓘ
pub fn points_mut(&mut self) -> MutGetHexagonPoints<'_, T>
Source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
Sourcepub fn points_count(&self) -> usize
pub fn points_count(&self) -> usize
Count all defined points in the map.
Sourcepub fn points_nearby(&self, source: CubicPoint) -> Vec<CubicPoint>
pub fn points_nearby(&self, source: CubicPoint) -> Vec<CubicPoint>
Find at most 6 points that are exists and adjacent to given point.
Sourcepub fn joints_nearby(&self, source: CubicPoint) -> Vec<Joint>
pub fn joints_nearby(&self, source: CubicPoint) -> Vec<Joint>
Find at most 6 joints that are exists and adjacent to given point.
Sourcepub fn points_around(
&self,
source: CubicPoint,
steps: usize,
) -> GetHexagonAround<'_, T> ⓘ
pub fn points_around( &self, source: CubicPoint, steps: usize, ) -> GetHexagonAround<'_, T> ⓘ
Find all points that are within a certain distance of a point.
Source§impl<T> HexagonMap<T>
impl<T> HexagonMap<T>
Sourcepub fn path_finder(
&self,
start: CubicPoint,
end: CubicPoint,
) -> PathFinder<'_, T>
pub fn path_finder( &self, start: CubicPoint, end: CubicPoint, ) -> 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: CubicPoint) -> Option<&T>
pub fn get_point(&self, point: CubicPoint) -> Option<&T>
Get the value at a point, if it exists.
Sourcepub fn add_point(&mut self, point: CubicPoint, value: T) -> Option<T>
pub fn add_point(&mut self, point: CubicPoint, 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: CubicPoint) -> Option<&mut T>
pub fn mut_point(&mut self, point: CubicPoint) -> Option<&mut T>
Get a mutable reference to a point, if it exists.
Sourcepub fn remove_point(&mut self, point: CubicPoint) -> Option<T>
pub fn remove_point(&mut self, point: CubicPoint) -> Option<T>
Remove a point from the map, if it exists, return the old value.
Auto Trait Implementations§
impl<T> Freeze for HexagonMap<T>
impl<T> RefUnwindSafe for HexagonMap<T>where
T: RefUnwindSafe,
impl<T> Send for HexagonMap<T>where
T: Send,
impl<T> Sync for HexagonMap<T>where
T: Sync,
impl<T> Unpin for HexagonMap<T>
impl<T> UnwindSafe for HexagonMap<T>where
T: RefUnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more