[−][src]Struct chickenwire::coordinate::offset::Offset
Offset
coordinates treat the HexGrid
as a square grid with offsetting
indentations on the rows/columns.
Fields
col: i32
row: i32
Methods
impl Offset
[src]
pub const ORIGIN: Offset
[src]
Offset
coordinate origin of (0, 0).
pub fn from_coords(col: i32, row: i32) -> Self
[src]
Create an Offset
from two i32
values.
Examples
use chickenwire::coordinate::offset::Offset; assert_eq!( Offset::from_coords(1, 2), Offset { col: 1, row: 2 } );
pub fn oflat_to_cube(self) -> Cube
[src]
Converts an Offset
to a Cube
, assuming the HexGrid
has
Parity::Odd
and Tilt::Flat
parameters.
pub fn eflat_to_cube(self) -> Cube
[src]
Converts an Offset
to a Cube
, assuming the HexGrid
has
Parity::Even
and Tilt::Flat
parameters.
pub fn osharp_to_cube(self) -> Cube
[src]
Converts an Offset
to a Cube
, assuming the HexGrid
has
Parity::Odd
and Tilt::Sharp
parameters.
pub fn esharp_to_cube(self) -> Cube
[src]
Converts an Offset
to a Cube
, assuming the HexGrid
has
Parity::Even
and Tilt::Sharp
parameters.
pub fn oflat_neighbors(self) -> Vec<Self>
[src]
Calculates the Offset
coordinates of the hexes surrounding the
calling instance, in the context of a HexGrid
with Parity::Odd
and
Tilt::Flat
parameters.
pub fn eflat_neighbors(self) -> Vec<Self>
[src]
Calculates the Offset
coordinates of the hexes surrounding the
calling instance, in the context of a HexGrid
with Parity::Even
and Tilt::Flat
parameters.
pub fn osharp_neighbors(self) -> Vec<Self>
[src]
Calculates the Offset
coordinates of the hexes surrounding the
calling instance, in the context of a HexGrid
with Parity::Odd
and
Tilt::Sharp
parameters.
pub fn esharp_neighbors(self) -> Vec<Self>
[src]
Calculates the Offset
coordinates of the hexes surrounding the
calling instance, in the context of a HexGrid
with Parity::Even
and Tilt::Sharp
parameters.
pub fn dist(self, other: Self) -> i32
[src]
Calculates the distance between two Offset
coordinates.
Trait Implementations
impl From<(i32, i32)> for Offset
[src]
Create an Offset
from an (i32, i32)
.
impl From<MultiCoord> for Offset
[src]
fn from(coord: MultiCoord) -> Self
[src]
impl From<Offset> for CoordSys
[src]
Creates a CoordSys::Offset
from an Offset
.
impl From<Offset> for MultiCoord
[src]
Creates a MultiCoord
from an Offset
.
impl Ord for Offset
[src]
fn cmp(&self, other: &Offset) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl PartialOrd<Offset> for Offset
[src]
fn partial_cmp(&self, other: &Offset) -> Option<Ordering>
[src]
fn lt(&self, other: &Offset) -> bool
[src]
fn le(&self, other: &Offset) -> bool
[src]
fn gt(&self, other: &Offset) -> bool
[src]
fn ge(&self, other: &Offset) -> bool
[src]
impl PartialEq<Offset> for Offset
[src]
impl Default for Offset
[src]
impl Clone for Offset
[src]
fn clone(&self) -> Offset
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Offset
[src]
impl Copy for Offset
[src]
impl Debug for Offset
[src]
impl Hash for Offset
[src]
Auto Trait Implementations
impl Send for Offset
impl Unpin for Offset
impl Sync for Offset
impl UnwindSafe for Offset
impl RefUnwindSafe for Offset
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<N> NodeTrait for N where
N: Copy + Ord + Hash,
[src]
N: Copy + Ord + Hash,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,