pub struct Hex {
pub q: i32,
pub r: i32,
pub s: i32,
}Fields§
§q: i32§r: i32§s: i32Implementations§
Source§impl Hex
impl Hex
pub const fn new(q: i32, r: i32, s: i32) -> Hex
pub fn screen_pos(&self, layout: &Layout, z: f32) -> Vec<f32>
pub fn length(self) -> i32
pub fn to_fractional_hex(&self) -> FractionalHex
pub fn distance_to(self, other: Hex) -> i32
pub fn neighbor(self, direction: HexDirection) -> Hex
pub fn rotate_left(self) -> Hex
pub fn rotate_right(self) -> Hex
pub fn nudge(self) -> FractionalHex
pub fn in_range(&self, n: &i32) -> Vec<Hex>
pub fn to_offset(self) -> Offset
pub fn corner_offset(&self, layout: &Layout, corner: i32) -> Point
pub fn corners(&self, layout: &Layout) -> [Point; 6]
Trait Implementations§
Source§impl Add<FractionalHex> for Hex
impl Add<FractionalHex> for Hex
Source§type Output = FractionalHex
type Output = FractionalHex
The resulting type after applying the
+ operator.Source§impl Add<Hex> for FractionalHex
impl Add<Hex> for FractionalHex
Source§impl Sub<FractionalHex> for Hex
impl Sub<FractionalHex> for Hex
Source§type Output = FractionalHex
type Output = FractionalHex
The resulting type after applying the
- operator.Source§impl Sub<Hex> for FractionalHex
impl Sub<Hex> for FractionalHex
impl Copy for Hex
impl Eq for Hex
impl StructuralPartialEq for Hex
Auto Trait Implementations§
impl Freeze for Hex
impl RefUnwindSafe for Hex
impl Send for Hex
impl Sync for Hex
impl Unpin for Hex
impl UnwindSafe for Hex
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