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 4c08cd83c4 - Show all commits

View file

@ -8,8 +8,8 @@ use num::Signed;
use partial_min_max::{max, min};
/// Represents a number that can be used in a hexagonal grid.
pub trait HexNumber: Signed + PartialEq + Copy + PartialOrd {}
impl<T: Signed + PartialEq + Copy + PartialOrd> HexNumber for T {}
pub trait HexNumber: Signed + PartialEq + Copy + PartialOrd + FromPrimitive {}
impl<T: Signed + PartialEq + Copy + PartialOrd + FromPrimitive> HexNumber for T {}
/// Represents a position in a hexagonal grid.
/// We use the axial coordinate system explained in this