Struct hexgrid::Coordinate [] [src]

pub struct Coordinate { /* fields omitted */ }

A hex coordinate using a cubic coordinate scheme.

See http://www.redblobgames.com/grids/hexagons/#coordinates for more detail.

All three coordinates must sum to zero.

Methods

impl Coordinate
[src]

Create a new Coordinate at 0, 0, 0.

This returns a Result to match at, but always succeeds.

Create a new Coordinate at the specified location, if that location is valid.

Get the six neighbors of a given Coordinate.

Get the neighbor in direction. Valid directions are in [0, 5].

Get the distance between two coordinates, in grid tiles.

Trait Implementations

impl Debug for Coordinate
[src]

Formats the value using the given formatter.

impl PartialEq for Coordinate
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialOrd for Coordinate
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Clone for Coordinate
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Coordinate
[src]

impl Add for Coordinate
[src]

The resulting type after applying the + operator

The method for the + operator

impl Sub for Coordinate
[src]

The resulting type after applying the - operator

The method for the - operator