stfu/Source/interp.c

5 lines
138 B
C

float stfu_linear_interpolate(float x0, float y0, float x1, float y1, float n) {
return (y0 * (x1 - n) + y1 * (n - x0)) / (x1 - x0);
}