pub struct PivotedPoint {
    pub point: IVec2,
    pub pivot: Pivot,
}
Expand description

A 2d point on a rect aligned to a certain Pivot.

Fields§

§point: IVec2§pivot: Pivot

Trait Implementations§

source§

impl Clone for PivotedPoint

source§

fn clone(&self) -> PivotedPoint

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PivotedPoint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl GridPoint for PivotedPoint

source§

fn x(&self) -> i32

source§

fn y(&self) -> i32

source§

fn get_pivot(self) -> Option<Pivot>

Retrieve the pivot-aligned point on the grid. Read more
source§

fn width(&self) -> i32

source§

fn height(&self) -> i32

source§

fn len(&self) -> usize

source§

fn as_ivec2(&self) -> IVec2

source§

fn as_uvec2(&self) -> UVec2

source§

fn as_vec2(&self) -> Vec2

source§

fn as_array(&self) -> [i32; 2]

source§

fn as_index(&self, grid_width: usize) -> usize

Get the grid point’s corresponding 1d index.
source§

fn pivot(&self, pivot: Pivot) -> PivotedPoint

Return a PivotedPoint.
source§

fn up(&self, amount: i32) -> IVec2

Returns the grid point the given number of spaces above this one.
source§

fn down(&self, amount: i32) -> IVec2

Returns the grid point the given number of spaces below this one.
source§

fn right(&self, amount: i32) -> IVec2

Returns the grid point the given number of spaces to the right of this one.
source§

fn left(&self, amount: i32) -> IVec2

Returns the grid point the given number of spaces to the left of this one.
source§

fn offset(&self, xy: impl GridPoint) -> IVec2

Returns the grid point offset by the given amount.
source§

fn taxi_dist(self, other: impl GridPoint) -> usize

The taxicab distance between two grid points.
source§

fn lerp(self, other: impl GridPoint, t: f32) -> IVec2

Linearly interpolate between points a and b by the amount t.
source§

fn adj_8(&self) -> AdjIterator<'_>

Returns an iterator over the 8 points adjacent to this one.
source§

fn adj_4(&self) -> AdjIterator<'_>

Returns an iterator over the 4 points adjacent to this one.
source§

impl PartialEq for PivotedPoint

source§

fn eq(&self, other: &PivotedPoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for PivotedPoint

source§

impl Eq for PivotedPoint

source§

impl StructuralPartialEq for PivotedPoint

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.