Enum scarlet::colormap::NormalizeMapping
[−]
[src]
pub enum NormalizeMapping { Linear, Cbrt, Generic(fn(_: f64) -> f64), }
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.
Methods
impl NormalizeMapping
[src]
fn normalize(&self, x: f64) -> f64
[src]
Performs the given mapping on an input number, with undefined behavior or panics if the given number is outside of the range (0, 1). Given an input between 0 and 1, should always output another number in the same range.
Trait Implementations
impl Debug for NormalizeMapping
[src]
impl PartialEq for NormalizeMapping
[src]
fn eq(&self, __arg_0: &NormalizeMapping) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &NormalizeMapping) -> bool
[src]
This method tests for !=
.
impl Clone for NormalizeMapping
[src]
fn clone(&self) -> NormalizeMapping
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more