[][src]Struct psyche_utils::grid::GridSamplerDistance

pub struct GridSamplerDistance {
    pub center: (Scalar, Scalar),
    pub range: Scalar,
    pub cell_size: (Scalar, Scalar),
}

Grid sampler that uses field distance to center and maximum range - each field is scaled by weight produced from that distance-in-range equation.

Note

Weight component of sampling result equals sum of weights of each sampled fields.

Example

use psyche_utils::grid::{Grid, GridSamplerDistance};

let grid = Grid::new(2, 2, 1.0);
let sampler = GridSamplerDistance::new((0.0, 0.0), 1.0, (1.0, 1.0));
assert_eq!(grid.sample(sampler).unwrap(), (1.0, 1.0));

Fields

center: (Scalar, Scalar)

XY scalar position of sampler center.

range: Scalar

Range of sampling.

cell_size: (Scalar, Scalar)

Scale mapping between grid cell and world cell.

Methods

impl GridSamplerDistance[src]

pub fn new(
    center: (Scalar, Scalar),
    range: Scalar,
    cell_size: (Scalar, Scalar)
) -> Self
[src]

Trait Implementations

impl<T> GridSampler<T, f64> for GridSamplerDistance where
    T: GridSampleZeroValue<T> + Add<Output = T> + Clone + Mul<Scalar, Output = T>, 
[src]

impl PartialEq<GridSamplerDistance> for GridSamplerDistance[src]

impl Clone for GridSamplerDistance[src]

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

Performs copy-assignment from source. Read more

impl Debug for GridSamplerDistance[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]