Expand description
Signed-int coordinates
Fields
x: i32y: i32Implementations
sourceimpl CoordVec
impl CoordVec
sourcepub fn quadrant(self) -> u32
pub fn quadrant(self) -> u32
Return the quadrant this coordinate is in.
- 1: +X, +Y
- 2: -X, +Y
- 3: -X, -Y
- 4: +X, -Y
Zeroes are treated as positive.
sourcepub fn to_coord(self) -> Option<Coord>
pub fn to_coord(self) -> Option<Coord>
Try to convert this to a Coord.
Returns None in case any part is negative.
sourcepub fn neighbors4(self) -> [CoordVec; 4]
pub fn neighbors4(self) -> [CoordVec; 4]
Get a list of this coordinate’s orthagonal neighbors.
They are given in clockwise order starting with the neighbor to the north,
as if each of Direction4::DIRECTIONS had been added to them.
sourcepub fn neighbors8(self) -> [CoordVec; 8]
pub fn neighbors8(self) -> [CoordVec; 8]
Get a list of this coordinate’s orthagonal and diagonal neighbors.
They are given in clockwise order starting with the neighbor to the north,
as if each of Direction8::DIRECTIONS had been added to them.
sourcepub fn point9(self) -> Direction9
pub fn point9(self) -> Direction9
Turn this into the closest Direction9 it is pointing in.
This uses the convention that north is positive Y.
Trait Implementations
sourceimpl Add<Direction4> for CoordVec
impl Add<Direction4> for CoordVec
sourceimpl Add<Direction8> for CoordVec
impl Add<Direction8> for CoordVec
sourceimpl AddAssign<CoordVec> for CoordVec
impl AddAssign<CoordVec> for CoordVec
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the += operation. Read more
sourceimpl AddAssign<Direction4> for CoordVec
impl AddAssign<Direction4> for CoordVec
sourcefn add_assign(&mut self, rhs: Direction4)
fn add_assign(&mut self, rhs: Direction4)
Performs the += operation. Read more
sourceimpl AddAssign<Direction8> for CoordVec
impl AddAssign<Direction8> for CoordVec
sourcefn add_assign(&mut self, rhs: Direction8)
fn add_assign(&mut self, rhs: Direction8)
Performs the += operation. Read more
sourceimpl MulAssign<i32> for CoordVec
impl MulAssign<i32> for CoordVec
sourcefn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the *= operation. Read more
sourceimpl SubAssign<CoordVec> for CoordVec
impl SubAssign<CoordVec> for CoordVec
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -= operation. Read more
sourceimpl TryFrom<CoordVec> for Coord
impl TryFrom<CoordVec> for Coord
Try to convert an ICoord to a Coord. Will return Error if the ICoord has any negatives in it.
impl Copy for CoordVec
impl Eq for CoordVec
impl StructuralEq for CoordVec
impl StructuralPartialEq for CoordVec
Auto Trait Implementations
impl RefUnwindSafe for CoordVec
impl Send for CoordVec
impl Sync for CoordVec
impl Unpin for CoordVec
impl UnwindSafe for CoordVec
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