generated from tipragot/rust
Add utils for hexagonal grild #50
|
@ -58,7 +58,7 @@ impl<T: HexNumber> HexPosition<T> {
|
||||||
/// let a = HexPosition { q: 0, r: 0 };
|
/// let a = HexPosition { q: 0, r: 0 };
|
||||||
/// let b = HexPosition { q: 1, r: 1 };
|
/// 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 {
|
pub fn distance_to(&self, other: &Self) -> T {
|
||||||
// dx = |x1 - x2| where x = q
|
// dx = |x1 - x2| where x = q
|
||||||
|
|
Loading…
Reference in a new issue