pub struct Scale { /* private fields */ }
Expand description
Holds mapping between domain and range of the function.
Implementations
sourceimpl 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 RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more