pub struct Scale { /* private fields */ }
Expand description
Holds mapping between domain and range of the function.
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn linear(&self, x: f32) -> f32
pub fn linear(&self, x: f32) -> f32
Translates value from domain to range scale.
assert_eq!(-0.8, Scale::new(0_f32..10_f32, -1_f32..1_f32).linear(1.0));
Sourcepub fn inv_linear(&self, i: f32) -> f32
pub fn inv_linear(&self, i: f32) -> f32
Translates value from range to domain scale.
assert_eq!(5.5, Scale::new(0_f32..10_f32, -1_f32..1_f32).inv_linear(0.1));
pub fn new(domain: Range<f32>, range: Range<f32>) -> Self
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
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