lineic

Macro static_interpolator

Source
macro_rules! static_interpolator {
    ($(
        $from:literal ..= $to:literal => [$($values_from:expr),+]..[$($values_to:expr),+]
    ),+) => { ... };
}
Expand description

A macro to create a static linear interpolator.
This macro is a convenience wrapper around LinearInterpolator::new_from_raw.

ยงExample

use lineic::{static_interpolator, LinearInterpolator};

const MY_INTERPOLATOR: LinearInterpolator<3, f32, f32> = static_interpolator! {
    0.0..=50.0 => [0.0, 0.0, 0.0]..[1.0, 1.0, 1.0],
    50.0..=100.0 => [1.0, 1.0, 1.0]..[2.0, 2.0, 2.0]
};