pub struct GridSamplerDistance {
pub center: (Scalar, Scalar),
pub range: Scalar,
pub cell_size: (Scalar, Scalar),
}
Expand description
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.
Implementations§
Trait Implementations§
Source§impl Clone for GridSamplerDistance
impl Clone for GridSamplerDistance
Source§fn clone(&self) -> GridSamplerDistance
fn clone(&self) -> GridSamplerDistance
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 GridSamplerDistance
impl Debug for GridSamplerDistance
Source§impl<T> GridSampler<T, f64> for GridSamplerDistance
impl<T> GridSampler<T, f64> for GridSamplerDistance
Source§impl PartialEq for GridSamplerDistance
impl PartialEq for GridSamplerDistance
impl StructuralPartialEq for GridSamplerDistance
Auto Trait Implementations§
impl Freeze for GridSamplerDistance
impl RefUnwindSafe for GridSamplerDistance
impl Send for GridSamplerDistance
impl Sync for GridSamplerDistance
impl Unpin for GridSamplerDistance
impl UnwindSafe for GridSamplerDistance
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