[go: up one dir, main page]

enterpolation 0.1.0

A library for creating and computing interpolations, extrapolations and smoothing of generic data points.
1
2
3
4
5
6
7
8
9
10
11
12
//! Module for different utilities which are used across other modules or to help the user of the library.
use num_traits::real::Real;
use core::ops::{Add,Mul};

/// Linear interpolation of the two values given.
pub fn lerp<T,R>(first: T, second: T, factor: R) -> T
where
    T: Add<Output = T> + Mul<R,Output = T>,
    R: Real
{
    first * (R::one()-factor) + second * factor
}