pub struct SizedGrid { /* private fields */ }Expand description
Regular triangular grids of a specific size.
Implementations§
Trait Implementations§
Source§impl SizedGrid for SizedGrid
impl SizedGrid for SizedGrid
type Coord = Coord
Source§fn circumradius(&self) -> f32
fn circumradius(&self) -> f32
Circumradius of a `Coord in screen space.
Source§fn edge_length(&self) -> f32
fn edge_length(&self) -> f32
Length of an edge of a
Coord in screen space.Source§fn vertices(&self, coord: &Self::Coord) -> Vec<Vec2>
fn vertices(&self, coord: &Self::Coord) -> Vec<Vec2>
Obtain the vertices of the
Coord in screen space.
Will be returned in clockwise order.Source§fn edges(&self, coord: &Self::Coord) -> HashMap<Direction, (Vec2, Vec2)>
fn edges(&self, coord: &Self::Coord) -> HashMap<Direction, (Vec2, Vec2)>
Obtain the edges of the
Coord in screen space.
Currently, each edge maps to a Direction, but this might need
to be revisited in the future. The edges should be exactly the
same as the allowed face directions.Source§fn grid_to_screen(&self, coord: &Self::Coord) -> Vec2
fn grid_to_screen(&self, coord: &Self::Coord) -> Vec2
Convert a
Coord to a point in screen space corresponding
to the center of that coordinate.Source§fn screen_to_grid(&self, point: Vec2) -> Self::Coord
fn screen_to_grid(&self, point: Vec2) -> Self::Coord
Convert a point in screen space to a
Coord.Source§fn screen_rect_to_grid(
&self,
min: Vec2,
max: Vec2,
) -> Option<impl Iterator<Item = Self::Coord>>
fn screen_rect_to_grid( &self, min: Vec2, max: Vec2, ) -> Option<impl Iterator<Item = Self::Coord>>
Given a rectangle defined by two points in screen space,
produce an iterator over the coordinates that intersect
with that rectangle. Read more
impl Copy for SizedGrid
impl StructuralPartialEq for SizedGrid
Auto Trait Implementations§
impl Freeze for SizedGrid
impl RefUnwindSafe for SizedGrid
impl Send for SizedGrid
impl Sync for SizedGrid
impl Unpin for SizedGrid
impl UnsafeUnpin for SizedGrid
impl UnwindSafe for SizedGrid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more