def piecewise_func(parameters, x):
    """
    Defines the piecewise function
    f = { b                 if x < a
        { c*(x - a) + b     if x >= a
    where a, b and c are parameters given by parameters[0], [1] and [2] respectively
    """
    if x < parameters[0]:
        return parameters[1]
    return parameters[2] * (x - parameters[0]) + parameters[1]