pub struct CubicPoint {
pub p: isize,
pub q: isize,
}Expand description
A point in axial coordinates, standard form of a hexagon map
Fields§
§p: isize§q: isizeImplementations§
Trait Implementations§
Source§impl Clone for CubicPoint
impl Clone for CubicPoint
Source§fn clone(&self) -> CubicPoint
fn clone(&self) -> CubicPoint
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 CubicPoint
impl Debug for CubicPoint
Source§impl<'de> Deserialize<'de> for CubicPoint
impl<'de> Deserialize<'de> for CubicPoint
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 CubicPoint
impl Display for CubicPoint
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 From<CubicPoint> for HPoint
impl From<CubicPoint> for HPoint
Source§fn from(point: CubicPoint) -> Self
fn from(point: CubicPoint) -> Self
Converts to this type from the input type.
Source§impl From<CubicPoint> for WPoint
impl From<CubicPoint> for WPoint
Source§fn from(point: CubicPoint) -> Self
fn from(point: CubicPoint) -> Self
Converts to this type from the input type.
Source§impl Hash for CubicPoint
impl Hash for CubicPoint
Source§impl HexPoint for CubicPoint
impl HexPoint for CubicPoint
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 Into<CubicPoint> for HPoint
impl Into<CubicPoint> for HPoint
Source§fn into(self) -> CubicPoint
fn into(self) -> CubicPoint
Converts this type into the (usually inferred) input type.
Source§impl Into<CubicPoint> for WPoint
impl Into<CubicPoint> for WPoint
Source§fn into(self) -> CubicPoint
fn into(self) -> CubicPoint
Converts this type into the (usually inferred) input type.
Source§impl Ord for CubicPoint
impl Ord for CubicPoint
Source§fn cmp(&self, other: &CubicPoint) -> Ordering
fn cmp(&self, other: &CubicPoint) -> 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 CubicPointwhere
P: HexPoint,
impl<P> PartialEq<P> for CubicPointwhere
P: HexPoint,
Source§impl PartialOrd for CubicPoint
impl PartialOrd for CubicPoint
Source§impl Serialize for CubicPoint
impl Serialize for CubicPoint
impl Copy for CubicPoint
impl Eq for CubicPoint
Auto Trait Implementations§
impl Freeze for CubicPoint
impl RefUnwindSafe for CubicPoint
impl Send for CubicPoint
impl Sync for CubicPoint
impl Unpin for CubicPoint
impl UnwindSafe for CubicPoint
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