Struct sark_grids::pivot::PivotedPoint
source · 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
impl Clone for PivotedPoint
source§fn clone(&self) -> PivotedPoint
fn clone(&self) -> PivotedPoint
Returns a copy 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 PivotedPoint
impl Debug for PivotedPoint
source§impl GridPoint for PivotedPoint
impl GridPoint for PivotedPoint
fn x(&self) -> i32
fn y(&self) -> i32
fn width(&self) -> i32
fn height(&self) -> i32
fn len(&self) -> usize
fn as_ivec2(&self) -> IVec2
fn as_uvec2(&self) -> UVec2
fn as_vec2(&self) -> Vec2
fn as_array(&self) -> [i32; 2]
source§fn pivot(&self, pivot: Pivot) -> PivotedPoint
fn pivot(&self, pivot: Pivot) -> PivotedPoint
Return a PivotedPoint.
source§fn up(&self, amount: i32) -> IVec2
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
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
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
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
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
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
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<'_> ⓘ
fn adj_8(&self) -> AdjIterator<'_> ⓘ
Returns an iterator over the 8 points adjacent to this one.
source§fn adj_4(&self) -> AdjIterator<'_> ⓘ
fn adj_4(&self) -> AdjIterator<'_> ⓘ
Returns an iterator over the 4 points adjacent to this one.
source§impl PartialEq<PivotedPoint> for PivotedPoint
impl PartialEq<PivotedPoint> for PivotedPoint
source§fn eq(&self, other: &PivotedPoint) -> bool
fn eq(&self, other: &PivotedPoint) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.