Adding custom bezier easing curves to QEasingCurve
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Wed, 2 Nov 2011 11:33:30 +0000 (12:33 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 2 Nov 2011 16:10:00 +0000 (17:10 +0100)
commitb9f0bde16e85161666d5090952955bebacc40f89
tree566c4f9d93a3d8a0cb0f74c04e65a32f1e174059
parent7d560240fae18afa385b868f17121f80f33bfbb2
Adding custom bezier easing curves to QEasingCurve

I added the possibilty to define Bezier/TCB splines and use them
as custom easing curves.

Note:
Splines have a parametric definition. This means we have a
function/polynom of t that evalutes to x and y. x/y = f(t).

For our purpose we actually need the function y = f(x).
So as a first step we have to solve the solution x = f(t) for a given
t and then in a second step we evaluate y = f(t).

f(t) is a cubic polynom so we use cardanos formula to solve this equation
directly.

For the casus irreducibilis we need 3 functions that are a combination of
arcos and cos. Instead of evaluating arcos and cos we approximate these
functions directly.

TCB splines are converted into the corresponding cubic bezier spline.

Change-Id: Id2afc15efac92e494d6358dc2e11f94e8c524da1
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
src/corelib/tools/qeasingcurve.cpp
src/corelib/tools/qeasingcurve.h