mraphics_core/math/
math_oper.rs1use std::ops::{Add, Mul, Sub};
2
3pub fn lerp<T>(
4 a: impl Iterator<Item = T>,
5 b: impl Iterator<Item = T>,
6 p: T,
7) -> impl Iterator<Item = T>
8where
9 T: Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + 'static,
10{
11 a.zip(b).map(move |(x, y)| x + (y - x) * p)
12}