This was really helpful when coding up my own lerp (linear interpolation) python library and writing a recursive bezier function.
http://acegikmo.com/bezier/
Here's the main lerp algorithm in a python function to start you off:
def lerp(input1, input2, step):
    """ Linearly interpolation between input1 and input2 given
    a value between 0.0 and 1.0.
    Args:
        input1 (int): starting integer to lerp from.
        input2 (int): destination integer to lerp towards.
        step (float): float value between 0.0 and 1.0
    """
    return (1 - step) * input1 + step * input2
 
No comments:
Post a Comment