[go: up one dir, main page]

enterpolation 0.3.0

A library for creating and computing interpolations, extrapolations and smoothing of generic data points.
Documentation
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 core::ops::{Add, Mul};
use num_traits::real::Real;

/// 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
}