pub trait GridPoint: Clone + Copy {
Show 17 methods fn x(&self) -> i32; fn y(&self) -> i32; fn aligned(&self, size: impl Size2d) -> IVec2; fn as_ivec2(&self) -> IVec2 { ... } fn as_uvec2(&self) -> UVec2 { ... } fn as_vec2(&self) -> Vec2 { ... } fn to_array(&self) -> [i32; 2] { ... } fn pivot(&self, pivot: Pivot) -> PivotedPoint { ... } fn up(&self) -> IVec2 { ... } fn up_by(&self, amount: i32) -> IVec2 { ... } fn down(&self) -> IVec2 { ... } fn down_by(&self, amount: i32) -> IVec2 { ... } fn right(&self) -> IVec2 { ... } fn right_by(&self, amount: i32) -> IVec2 { ... } fn left(&self) -> IVec2 { ... } fn left_by(&self, amount: i32) -> IVec2 { ... } fn taxi_dist(self, other: impl GridPoint) -> usize { ... }
}
Expand description

A trait for an integer point on a 2d grid.

Required Methods

Retrieve the point aligned on the grid.

If no pivot has been applied this will simply return the point directly.

Provided Methods

Return a PivotedPoint.

Returns the grid point above this one.

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

Returns the grid point below this one.

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

Returns the grid point to the right of this one.

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

Returns the grid point to the left of this one.

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

The taxicab distance between two grid points.

Implementations on Foreign Types

Returns the point directly - no pivot has been applied.

Returns the point directly - no pivot has been applied.

Returns the point directly - no pivot has been applied.

Returns the point directly - no pivot has been applied.

Implementors