double filter(double a, double b, double filterFactor)

Interpolates a double between a and b according to the filterFactor, which should be in the range of 0.0 to 1.0.

Source

static double filter (double a, double b, double filterFactor) {
    return (a * (1-filterFactor)) + b * filterFactor;
}