[][src]Trait pixel_canvas::math::Remap

pub trait Remap where
    Self: Sized
{ fn remap(self, from: Range<Self>, onto: Range<Self>) -> Self; }

Represents a type that can be mapped between two ranges.

Required methods

fn remap(self, from: Range<Self>, onto: Range<Self>) -> Self

Remap a value from one range to another. A value outside the bounds of one range will be similarly outside the bounds of the other.

assert_eq!(5.remap(-10..10, -100..100), 50);
assert_eq!(0.5.remap(0.0..1.0, -1.0..1.0), 0.0);
Loading content...

Implementors

impl<T> Remap for T where
    T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T> + Copy
[src]

Loading content...