def clamp(val: float, minimum: float = 0.0, maximum: float = 1.0) -> float:
    """ Fix value between min an max"""
    if val < minimum:
        return minimum
    if val > maximum:
        return maximum
    return val