Midpoint and Linear Interpolation
Understand the use of 'std::midpoint' and 'std::lerp' with an example.
We'll cover the following...
We'll cover the following...
std::midpoint(a, b): calculates the midpoint of integers, floating points, or pointers. Ifaandbare pointers, they have to point to the same array object. The function needs the header<numeric>.std::lerp(a, b, t): calculates the linear interpolation . Whentis outside the range , it calculates the linear extrapolation. The function needs the header<cmath>.
The following program applies both functions.