Enum hex2d::Direction [−][src]
pub enum Direction { YZ, XZ, XY, ZY, ZX, YX, }
Expand description
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
Implementations
Static array of all directions
use hex2d::Direction; assert_eq!(Direction::all().len(), 6);
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)); }
Create Direction from integer in [0, 6) range
This should probably be internal
Convert to integer in [0, 6) range
This should probably be internal
Convert to angle for pointy-topped map, in radians, grows clockwise, 0.0 points up
Convert to angle for flat-topped map, in radians, grows clockwise, 0.0 points up
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
Auto Trait Implementations
impl RefUnwindSafe for Direction
impl UnwindSafe for Direction
Blanket Implementations
Mutably borrows from an owned value. Read more