public static double lerp ( double x , double x1 , double x2 , double q0 , double q1 ) { return ( ( x2 - x ) / ( x2 - x1 ) ) * q0 + ( ( x - x1 ) / ( x2 - x1 ) ) * q1 ; }
Calculates the value at x using linear interpolation