[][src]Trait scales::Scale

pub trait Scale<N> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone
{ pub fn to_relative(&self, absolute: N) -> f64;
pub fn to_absolute(&self, relative: f64) -> N;
pub fn max(&self) -> N;
pub fn min(&self) -> N; pub fn to_clamped_relative(&self, absolute: N) -> f64 { ... }
pub fn to_clamped_absolute(&self, relative: f64) -> N { ... }
pub fn to_relative_delta(&self, absolute_delta: N, relative_pos: f64) -> f64 { ... }
pub fn to_absolute_delta(&self, relative_delta: f64, absolute_pos: N) -> N { ... } }

A scale is a mapping of an arbitrary, not necessarily linear, continuous and monotonically increasing range of numbers to a relative value between 0.0 and 1.0. It's useful for converting corresponding values between different coordinate spaces, for example for processing input from or rendering to a graphical user interface. A typical example would be calculating the position of a slider knob that controls a logarithmically scaled parameter.

Required methods

pub fn to_relative(&self, absolute: N) -> f64[src]

pub fn to_absolute(&self, relative: f64) -> N[src]

pub fn max(&self) -> N[src]

pub fn min(&self) -> N[src]

Loading content...

Provided methods

pub fn to_clamped_relative(&self, absolute: N) -> f64[src]

pub fn to_clamped_absolute(&self, relative: f64) -> N[src]

pub fn to_relative_delta(&self, absolute_delta: N, relative_pos: f64) -> f64[src]

pub fn to_absolute_delta(&self, relative_delta: f64, absolute_pos: N) -> N[src]

Loading content...

Implementations on Foreign Types

impl<N, SN, '_> Scale<N> for &'_ SN where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    SN: Scale<N>, 
[src]

impl<N, SN> Scale<N> for Box<SN> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    SN: Scale<N>, 
[src]

impl<N, SN> Scale<N> for Rc<SN> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    SN: Scale<N>, 
[src]

impl<N, SN> Scale<N> for RefCell<SN> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    SN: Scale<N>, 
[src]

impl<N, SN> Scale<N> for Arc<SN> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    SN: Scale<N>, 
[src]

Loading content...

Implementors

impl<N> Scale<N> for BrokenScale<N> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone
[src]

impl<N> Scale<N> for LinearScale<N> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone
[src]

impl<N> Scale<N> for LogarithmicScale<N> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone
[src]

impl<N, Min, Max> Scale<N> for DynamicLinearScale<N, Min, Max> where
    N: Sub<Output = N> + Add<Output = N> + PartialOrd + FromFloat<f64> + ToFloat<f64> + Clone,
    Min: Fn() -> N,
    Max: Fn() -> N, 
[src]

Loading content...