Struct hex_coordinates::CubeCoordinates
source · [−]pub struct CubeCoordinates {
pub q: Immutable<isize>,
pub r: Immutable<isize>,
pub s: Immutable<isize>,
}Expand description
_____
╱ r, s╲
╲__q__╱ _____
_____╱+1,-1╲_____
╱ 0,+1╲__0__╱-1, 0╲
╲_-1__╱ 0, 0╲_+1__╱
╱+1, 0╲__0__╱ 0,-1╲
╲_-1__╱+1,-1╲_+1__╱
╲__0__╱ +s -r
╲ ╱
-q ──╳── +q
╱ ╲
+r -sFields
q: Immutable<isize>r: Immutable<isize>s: Immutable<isize>Implementations
sourceimpl CubeCoordinates
impl CubeCoordinates
sourcepub const fn neighbor(&self, direction: Direction) -> Self
pub const fn neighbor(&self, direction: Direction) -> Self
Returns the neighboring coordinates in a given direction.
sourcepub const fn manhattan_distance(&self, other: Self) -> isize
pub const fn manhattan_distance(&self, other: Self) -> isize
Returns the manhattan distance between 2 coordinates.
Trait Implementations
sourceimpl Add<CubeCoordinates> for CubeCoordinates
impl Add<CubeCoordinates> for CubeCoordinates
type Output = CubeCoordinates
type Output = CubeCoordinates
The resulting type after applying the + operator.
sourceimpl Clone for CubeCoordinates
impl Clone for CubeCoordinates
sourcefn clone(&self) -> CubeCoordinates
fn clone(&self) -> CubeCoordinates
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for CubeCoordinates
impl Debug for CubeCoordinates
sourceimpl From<AxialCoordinates> for CubeCoordinates
impl From<AxialCoordinates> for CubeCoordinates
sourceconst fn from(_: AxialCoordinates) -> Self
const fn from(_: AxialCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<CubeCoordinates> for AxialCoordinates
impl From<CubeCoordinates> for AxialCoordinates
sourceconst fn from(_: CubeCoordinates) -> Self
const fn from(_: CubeCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<Direction> for CubeCoordinates
impl From<Direction> for CubeCoordinates
sourceimpl Sub<CubeCoordinates> for CubeCoordinates
impl Sub<CubeCoordinates> for CubeCoordinates
type Output = CubeCoordinates
type Output = CubeCoordinates
The resulting type after applying the - operator.
impl Copy for CubeCoordinates
Auto Trait Implementations
impl RefUnwindSafe for CubeCoordinates
impl Send for CubeCoordinates
impl Sync for CubeCoordinates
impl Unpin for CubeCoordinates
impl UnwindSafe for CubeCoordinates
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more