[][src]Struct psyche_utils::grid::GridSamplerCluster

pub struct GridSamplerCluster {
    pub from: (usize, usize),
    pub to: (usize, usize),
}

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.

Methods

impl GridSamplerCluster[src]

pub fn new(from: (usize, usize), to: (usize, usize)) -> Self[src]

pub fn center(center: (usize, usize), size: (usize, usize)) -> Self[src]

pub fn center_extents(center: (usize, usize), extents: (usize, usize)) -> Self[src]

pub fn valid_from(&self) -> (usize, usize)[src]

pub fn valid_to(&self) -> (usize, usize)[src]

pub fn cells(&self) -> usize[src]

Trait Implementations

impl<T> GridSampler<T, usize> for GridSamplerCluster where
    T: GridSampleZeroValue<T> + Add<Output = T> + Clone
[src]

impl Eq for GridSamplerCluster[src]

impl PartialEq<GridSamplerCluster> for GridSamplerCluster[src]

impl Clone for GridSamplerCluster[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for GridSamplerCluster[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]