A few helper functions to make the code below more readable.
| 1149 | |
| 1150 | // A few helper functions to make the code below more readable. |
| 1151 | static double InterpolatePoints(double y1, double y2, double factor, bool logarithmic) |
| 1152 | { |
| 1153 | if(logarithmic) |
| 1154 | // you can use any base you want, it doesn't change the result |
| 1155 | return exp(log(y1) * (1.0 - factor) + log(y2) * factor); |
| 1156 | else |
| 1157 | return y1 * (1.0 - factor) + y2 * factor; |
| 1158 | } |
| 1159 | static double IntegrateInterpolated(double y1, double y2, double time, bool logarithmic) |
| 1160 | { |
| 1161 | // Calculates: integral(interpolate(y1, y2, x), x = 0 .. time) |
no outgoing calls
no test coverage detected