Struct bevy_sparse_tilemap::GridEdge
source · pub struct GridEdge {
pub origin: Hex,
pub direction: EdgeDirection,
}Expand description
Hexagonal grid orientated edge representation
Fields§
§origin: HexThe coordinate of the edge
direction: EdgeDirectionThe direction the edge points towards
Implementations§
source§impl GridEdge
impl GridEdge
sourcepub fn equivalent(&self, other: &GridEdge) -> bool
pub fn equivalent(&self, other: &GridEdge) -> bool
Edges are equivalent if they have identical or flipped origin or direction
sourcepub const fn destination(&self) -> Hex
pub const fn destination(&self) -> Hex
Returns the coordinate the edge id pointing to
sourcepub const fn vertices(&self) -> [GridVertex; 2]
pub const fn vertices(&self) -> [GridVertex; 2]
Returns the two vertices making this edge in clockwise order
sourcepub const fn flipped(self) -> GridEdge
pub const fn flipped(self) -> GridEdge
Flips the edge, changing its origin to be the destination and
inverting its direction
sourcepub const fn counter_clockwise(self) -> GridEdge
pub const fn counter_clockwise(self) -> GridEdge
Returns the next edge in counter clockwise order
sourcepub const fn rotate_ccw(self, offset: u8) -> GridEdge
pub const fn rotate_ccw(self, offset: u8) -> GridEdge
Rotates self counter clockwise by offset amount.
Trait Implementations§
source§impl<'de> Deserialize<'de> for GridEdge
impl<'de> Deserialize<'de> for GridEdge
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GridEdge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GridEdge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<EdgeDirection> for GridEdge
impl From<EdgeDirection> for GridEdge
source§fn from(direction: EdgeDirection) -> GridEdge
fn from(direction: EdgeDirection) -> GridEdge
Converts to this type from the input type.
source§impl PartialEq for GridEdge
impl PartialEq for GridEdge
source§impl Serialize for GridEdge
impl Serialize for GridEdge
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for GridEdge
impl Eq for GridEdge
impl StructuralPartialEq for GridEdge
Auto Trait Implementations§
impl Freeze for GridEdge
impl RefUnwindSafe for GridEdge
impl Send for GridEdge
impl Sync for GridEdge
impl Unpin for GridEdge
impl UnwindSafe for GridEdge
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.