pub struct AxialPoint {
pub q: isize,
pub r: isize,
}Expand description
A point in 3D stepped coordinate s = - q - r
Fields§
§q: isizeThe horizontal axis
T: move to rightF: move to left
r: isizeThe right up axis
T: move to right upF: move to left down
Implementations§
Source§impl AxialPoint
impl AxialPoint
Trait Implementations§
Source§impl Clone for AxialPoint
impl Clone for AxialPoint
Source§fn clone(&self) -> AxialPoint
fn clone(&self) -> AxialPoint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AxialPoint
impl Debug for AxialPoint
Source§impl<'de> Deserialize<'de> for AxialPoint
impl<'de> Deserialize<'de> for AxialPoint
Source§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
Source§impl Display for AxialPoint
impl Display for AxialPoint
Source§impl From<AxialPoint> for CubicPoint
impl From<AxialPoint> for CubicPoint
Source§fn from(point: AxialPoint) -> Self
fn from(point: AxialPoint) -> Self
Converts to this type from the input type.
Source§impl From<CubicPoint> for AxialPoint
impl From<CubicPoint> for AxialPoint
Source§fn from(point: CubicPoint) -> Self
fn from(point: CubicPoint) -> Self
Converts to this type from the input type.
Source§impl Hash for AxialPoint
impl Hash for AxialPoint
Source§impl HexPoint for AxialPoint
impl HexPoint for AxialPoint
Source§fn as_cubic_point(&self) -> CubicPoint
fn as_cubic_point(&self) -> CubicPoint
Create a new point in cubic coordinates
Source§fn as_axial_point(&self) -> AxialPoint
fn as_axial_point(&self) -> AxialPoint
Create a new point in axial coordinates from pixel coordinates
fn as_joint(&self, direction: Orientation) -> Joint
fn go(&self, direction: Orientation) -> CubicPoint
Source§fn get_pixel_center(&self, radius: f64) -> (f64, f64)
fn get_pixel_center(&self, radius: f64) -> (f64, f64)
Get the pixel coordinates of the center of the hexagon
Source§fn get_pixel_corners(&self, radius: f64) -> [(f64, f64); 6]
fn get_pixel_corners(&self, radius: f64) -> [(f64, f64); 6]
Get the pixel coordinates of the corners of the hexagon
Source§fn taxicab_distance<P>(&self, other: P) -> usizewhere
P: HexPoint,
fn taxicab_distance<P>(&self, other: P) -> usizewhere
P: HexPoint,
Calculate the manhattan distance between two points
Source§impl Ord for AxialPoint
impl Ord for AxialPoint
Source§fn cmp(&self, other: &AxialPoint) -> Ordering
fn cmp(&self, other: &AxialPoint) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<P> PartialEq<P> for AxialPointwhere
P: HexPoint,
impl<P> PartialEq<P> for AxialPointwhere
P: HexPoint,
Source§impl PartialOrd for AxialPoint
impl PartialOrd for AxialPoint
Source§impl Serialize for AxialPoint
impl Serialize for AxialPoint
impl Copy for AxialPoint
impl Eq for AxialPoint
Auto Trait Implementations§
impl Freeze for AxialPoint
impl RefUnwindSafe for AxialPoint
impl Send for AxialPoint
impl Sync for AxialPoint
impl Unpin for AxialPoint
impl UnwindSafe for AxialPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more