Enum scarlet::colormap::NormalizeMapping
source · pub enum NormalizeMapping {
Linear,
Cbrt,
Generic(fn(_: f64) -> f64),
}
Expand description
A struct that describes different transformations of the numbers between 0 and 1 to themselves, used for controlling the linearity or nonlinearity of gradients.
Variants§
Linear
A normal linear mapping: each number maps to itself.
Cbrt
A cube root mapping: 1/8 would map to 1/2, for example. This has the effect of emphasizing the differences in the low end of the range, which is useful for some data like sound intensity that isn’t perceived linearly.
Generic(fn(_: f64) -> f64)
A generic mapping, taking as a value any function or closure that maps the integers from 0-1 to the same range. This should never fail.
Implementations§
Trait Implementations§
source§impl Clone for NormalizeMapping
impl Clone for NormalizeMapping
source§fn clone(&self) -> NormalizeMapping
fn clone(&self) -> NormalizeMapping
Returns a copy 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 NormalizeMapping
impl Debug for NormalizeMapping
source§impl PartialEq<NormalizeMapping> for NormalizeMapping
impl PartialEq<NormalizeMapping> for NormalizeMapping
source§fn eq(&self, other: &NormalizeMapping) -> bool
fn eq(&self, other: &NormalizeMapping) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for NormalizeMapping
Auto Trait Implementations§
impl RefUnwindSafe for NormalizeMapping
impl Send for NormalizeMapping
impl Sync for NormalizeMapping
impl Unpin for NormalizeMapping
impl UnwindSafe for NormalizeMapping
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.