• vollick@chromium.org's avatar
    Do not clamp y values on internal knots of timing function bezier curves · 6b1d558a
    vollick@chromium.org authored
    Cubic bezier timing functions are based on two knots (x1, y1) and (x2, y2) (the
    other knots are assumed to be (0, 0) and (1, 1)). We require that x1, x2 lie
    within (0, 1) (so that the bezier does not 'fold back' on itself), but y1, and
    y2 should have no such constraint. They currently do. This CL reimplements
    bezier interpolation without this restriction. This interpolation has two steps:
       1) Find the t corresponding to the desired x.
       2) Interpolate y's at the t computed in step 1.
    Step 1 is an iterative minimization. Here I do bisection for simplicity, but I
    could take Newton steps if this turns out to be a bottleneck.
    
    R=ajuma@chromium.org
    BUG=178070
    
    Review URL: https://chromiumcodereview.appspot.com/16112002
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202755 0039d316-1c4b-4281-b951-d872f2087c98
    6b1d558a
timing_function_unittest.cc 3.12 KB