pub enum MappingStrategy {
Linear,
Exponential {
exponent: f32,
},
Logarithmic,
Inverted,
}Expand description
Mapping strategy for translating normalized [0,1] values to a parameter range.
Variants§
Linear
Linear mapping: min + value * (max - min)
Exponential
Exponential mapping: min + value^exp * (max - min)
Logarithmic
Logarithmic mapping: min + log(1 + value * (e - 1)) / log(e) * (max - min)
Inverted
Inverted linear mapping: max - value * (max - min)
Implementations§
Source§impl MappingStrategy
impl MappingStrategy
Sourcepub fn map<T: Transcendental>(&self, x: T, min: T, max: T) -> T
pub fn map<T: Transcendental>(&self, x: T, min: T, max: T) -> T
Map a normalized value x in [0,1] to [min, max] using this strategy.
Trait Implementations§
Source§impl Clone for MappingStrategy
impl Clone for MappingStrategy
Source§fn clone(&self) -> MappingStrategy
fn clone(&self) -> MappingStrategy
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 MappingStrategy
impl Debug for MappingStrategy
Source§impl PartialEq for MappingStrategy
impl PartialEq for MappingStrategy
impl Copy for MappingStrategy
impl StructuralPartialEq for MappingStrategy
Auto Trait Implementations§
impl Freeze for MappingStrategy
impl RefUnwindSafe for MappingStrategy
impl Send for MappingStrategy
impl Sync for MappingStrategy
impl Unpin for MappingStrategy
impl UnsafeUnpin for MappingStrategy
impl UnwindSafe for MappingStrategy
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