Add utils for hexagonal grild #50

Merged
tipragot merged 23 commits from hex-utils into main 2024-02-14 17:49:08 +00:00
Showing only changes of commit b6587abea1 - Show all commits

View file

@ -58,7 +58,7 @@ impl<T: HexNumber> HexPosition<T> {
/// let a = HexPosition { q: 0, r: 0 };
/// let b = HexPosition { q: 1, r: 1 };
///
/// assert_eq!(a.distance_to(&b), 2.0);
/// assert_eq!(a.distance_to(&b), 2);
/// ```
pub fn distance_to(&self, other: &Self) -> T {
// dx = |x1 - x2| where x = q