pub struct GridSamplerCluster {
pub from: (usize, usize),
pub to: (usize, usize),
}
Expand description
Grid sampler that sum fields contained by cluster bounds.
§Note
Weight component of sampling result equals number of sampled fields.
§Example
use psyche_utils::grid::{Grid, GridSamplerCluster};
let grid = Grid::new(2, 2, 1.0);
let sampler = GridSamplerCluster::new((0, 0), (1, 1));
assert_eq!(grid.sample(sampler).unwrap(), (4.0, 4));
Fields§
§from: (usize, usize)
Bounds column and row starting point.
to: (usize, usize)
Bounds number of columns and rows that defines cluster size.
Implementations§
Source§impl GridSamplerCluster
impl GridSamplerCluster
pub fn new(from: (usize, usize), to: (usize, usize)) -> Self
pub fn center(center: (usize, usize), size: (usize, usize)) -> Self
pub fn center_extents(center: (usize, usize), extents: (usize, usize)) -> Self
pub fn valid_from(&self) -> (usize, usize)
pub fn valid_to(&self) -> (usize, usize)
pub fn cells(&self) -> usize
Trait Implementations§
Source§impl Clone for GridSamplerCluster
impl Clone for GridSamplerCluster
Source§fn clone(&self) -> GridSamplerCluster
fn clone(&self) -> GridSamplerCluster
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GridSamplerCluster
impl Debug for GridSamplerCluster
Source§impl<T> GridSampler<T, usize> for GridSamplerCluster
impl<T> GridSampler<T, usize> for GridSamplerCluster
Source§impl PartialEq for GridSamplerCluster
impl PartialEq for GridSamplerCluster
impl Eq for GridSamplerCluster
impl StructuralPartialEq for GridSamplerCluster
Auto Trait Implementations§
impl Freeze for GridSamplerCluster
impl RefUnwindSafe for GridSamplerCluster
impl Send for GridSamplerCluster
impl Sync for GridSamplerCluster
impl Unpin for GridSamplerCluster
impl UnwindSafe for GridSamplerCluster
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