Enum hex2d::Direction [] [src]

pub enum Direction {
    YZ,
    XZ,
    XY,
    ZY,
    ZX,
    YX,
}

Direction on a hexagonal map

See Coordinate for graph with directions.

Naming convention: increasing coordinate for a given direction is first decreasing is second. The missing coordinate is unaffected by a move in a given direction.

Variants

+Y -Z

-Z +X

+X -Y

-Y +Z

+Z -X

-X +Y

Methods

impl Direction
[src]

[src]

Static array of all directions

use hex2d::Direction;

assert_eq!(Direction::all().len(), 6);

[src]

Return a vector of an arc including Directions steps away from the original Direction both sides from left to right.

use hex2d::{Direction};
use hex2d::Angle::*;

for &d in Direction::all() {
    assert_eq!(d.arc(0), vec!(d));
    assert_eq!(d.arc(1), vec!(d + Left, d, d + Right));
    assert_eq!(d.arc(2), vec!(d + LeftBack, d + Left, d, d + Right, d + RightBack));
    assert_eq!(d.arc(3), vec!(d + LeftBack, d + Left, d, d + Right, d + RightBack, d + Back));
}

[src]

Create Direction from integer in [0, 6) range

This should probably be internal

[src]

Convert to integer in [0, 6) range

This should probably be internal

Trait Implementations

impl Copy for Direction
[src]

impl Clone for Direction
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Direction
[src]

impl PartialEq for Direction
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Hash for Direction
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for Direction
[src]

[src]

Formats the value using the given formatter.

impl Ord for Direction
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl PartialOrd for Direction
[src]

[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

impl Decodable for Direction
[src]

[src]

Deserialize a value using a Decoder.

impl ToDirection for Direction
[src]

[src]

Convert to Angle part of this data

impl<T: ToDirection> Sub<T> for Direction
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<I: Integer> ToCoordinate<I> for Direction
[src]

[src]

Convert to Coordinate part of this data

impl Neg for Direction
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl Add<Angle> for Direction
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.