HexPoint

Trait HexPoint 

Source
pub trait HexPoint:
    Copy
    + Eq
    + Ord
    + Display
    + Debug {
    // Required methods
    fn as_cubic_point(&self) -> CubicPoint;
    fn as_axial_point(&self) -> AxialPoint;

    // Provided methods
    fn as_joint(&self, direction: Orientation) -> Joint { ... }
    fn go(&self, direction: Orientation) -> CubicPoint { ... }
    fn get_pixel_center(&self, radius: f64) -> (f64, f64) { ... }
    fn get_pixel_corners(&self, radius: f64) -> [(f64, f64); 6] { ... }
    fn taxicab_distance<P>(&self, other: P) -> usize
       where P: HexPoint { ... }
    fn euclidean_distance<P>(&self, other: P, radius: f64) -> f64
       where P: HexPoint { ... }
}

Required Methods§

Source

fn as_cubic_point(&self) -> CubicPoint

Create a new point in cubic coordinates

Source

fn as_axial_point(&self) -> AxialPoint

Create a new point in axial coordinates from pixel coordinates

Provided Methods§

Source

fn as_joint(&self, direction: Orientation) -> Joint

Source

fn go(&self, direction: Orientation) -> CubicPoint

Source

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]

Get the pixel coordinates of the corners of the hexagon

Source

fn taxicab_distance<P>(&self, other: P) -> usize
where P: HexPoint,

Calculate the manhattan distance between two points

Source

fn euclidean_distance<P>(&self, other: P, radius: f64) -> f64
where P: HexPoint,

Calculate the euclidean distance between two points

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§