generated from tipragot/rust
Add utils for hexagonal grild #50
|
@ -4,7 +4,8 @@ use std::collections::HashSet;
|
|||
use std::ops;
|
||||
|
||||
/// Hexagonal position (in a hexagonal grid).
|
||||
/// We are using the axial coordinate system explained in this [documentation](https://www.redblobgames.com/grids/hexagons/#coordinates).
|
||||
/// We are using the axial coordinate system explained in this
|
||||
/// [documentation](https://www.redblobgames.com/grids/hexagons/#coordinates).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct HexPosition {
|
||||
/// Q coordinate
|
||||
|
@ -19,7 +20,8 @@ impl HexPosition {
|
|||
///
|
||||
/// # How does it work ?
|
||||
///
|
||||
/// Hexagonal grid using the [cube](https://www.redblobgames.com/grids/hexagons/#coordinates) coordinate system,
|
||||
/// Hexagonal grid using the
|
||||
/// [cube coordinate system](https://www.redblobgames.com/grids/hexagons/#coordinates),
|
||||
/// is like a cube in 2D space.
|
||||
/// The Manhattan distance between two positions is equal to: the half of
|
||||
/// the sum of abs(dx) + abs(dy) + abs(dz)
|
||||
|
|
Loading…
Reference in a new issue