pub struct DeformationField {
pub dx: Vec<f64>,
pub dy: Vec<f64>,
pub cols: u32,
pub rows: u32,
pub cell_size: u32,
}Expand description
A sampled deformation field on a regular grid.
Fields§
§dx: Vec<f64>Horizontal displacement for each grid cell.
dy: Vec<f64>Vertical displacement for each grid cell.
cols: u32Number of grid columns.
rows: u32Number of grid rows.
cell_size: u32Cell size in pixels.
Implementations§
Source§impl DeformationField
impl DeformationField
Sourcepub fn get(&self, cx: u32, cy: u32) -> Option<(f64, f64)>
pub fn get(&self, cx: u32, cy: u32) -> Option<(f64, f64)>
Get displacement at grid cell (cx, cy).
Sourcepub fn set(&mut self, cx: u32, cy: u32, dx: f64, dy: f64)
pub fn set(&mut self, cx: u32, cy: u32, dx: f64, dy: f64)
Set displacement at grid cell (cx, cy).
Sourcepub fn average_displacement(&self) -> f64
pub fn average_displacement(&self) -> f64
Compute the average displacement magnitude across the field.
Sourcepub fn max_displacement(&self) -> f64
pub fn max_displacement(&self) -> f64
Compute maximum displacement magnitude in the field.
Trait Implementations§
Source§impl Clone for DeformationField
impl Clone for DeformationField
Source§fn clone(&self) -> DeformationField
fn clone(&self) -> DeformationField
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeformationField
impl RefUnwindSafe for DeformationField
impl Send for DeformationField
impl Sync for DeformationField
impl Unpin for DeformationField
impl UnsafeUnpin for DeformationField
impl UnwindSafe for DeformationField
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.