pub struct HexLattice {
pub w: f64,
pub h: f64,
pub origin: (f64, f64),
}Expand description
A pointy-top hex lattice in data units: points are assigned to the
nearest centre via cube rounding, so bins are fixed by (w, h, origin)
alone — unlike floor-binned rectangles, they don’t move when the data
extent changes.
w/h are the horizontal/vertical centre-to-centre spacing; equal
w == h gives a regular hexagon, independent values stretch it (as
ggplot2’s hexbin does for non-square bin counts).
Fields§
§w: f64§h: f64§origin: (f64, f64)Implementations§
Source§impl HexLattice
impl HexLattice
pub fn new(w: f64, h: f64, origin: (f64, f64)) -> Self
Sourcepub fn centre(&self, q: i64, r: i64) -> (f64, f64)
pub fn centre(&self, q: i64, r: i64) -> (f64, f64)
The centre of cell (q, r) in data units: x = ox + w*(q + r/2),
y = oy + r*h*sqrt(3)/2.
Trait Implementations§
Source§impl Clone for HexLattice
impl Clone for HexLattice
impl Copy for HexLattice
Source§impl Debug for HexLattice
impl Debug for HexLattice
Source§impl PartialEq for HexLattice
impl PartialEq for HexLattice
impl StructuralPartialEq for HexLattice
Auto Trait Implementations§
impl Freeze for HexLattice
impl RefUnwindSafe for HexLattice
impl Send for HexLattice
impl Sync for HexLattice
impl Unpin for HexLattice
impl UnsafeUnpin for HexLattice
impl UnwindSafe for HexLattice
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