The previous implementation seemed be broken or buggy. As I thought again, my implementation seemed wrong neither.
I will check this on next Monday. ------------------------------------ -Regards, Hermet- -----Original Message----- From: "Tom Hacohen"<[email protected]> To: "Enlightenment developer list"<[email protected]>; Cc: Sent: 2014-12-05 (금) 23:47:37 Subject: Re: [E-devel] [EGIT] [core/efl] master 01/01: ecore/animator: fix the bezier cubic compuation. It was added in afd8a238d199a90e95a826c31a091e9adb11cc1e and if I have to guess, they probably made approximations for performance, though not sure. Haven't looked at the before or after. -- Tom. On 05/12/14 14:20, ChunEon Park wrote: > hermet pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=2e1032e28f0cd704ffaf28cea0b5ad533ae2b6c1 > > commit 2e1032e28f0cd704ffaf28cea0b5ad533ae2b6c1 > Author: ChunEon Park <[email protected]> > Date: Fri Dec 5 23:17:38 2014 +0900 > > ecore/animator: fix the bezier cubic compuation. > > The previous compuation is totally wrong. > Even it doesn't work correctly. > (I have no idea what the orignal author was thinking?) > > Here we just need a simple and clear fomular to get the current progress > frame. > > If i'm wrong, please ping me. > > @fix > --- > src/lib/ecore/ecore_anim.c 65 > +++++----------------------------------------- > 1 file changed, 7 insertions(+), 58 deletions(-) > > diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c > index e248f05..3b8f987 100644 > --- a/src/lib/ecore/ecore_anim.c > +++ b/src/lib/ecore/ecore_anim.c > @@ -308,69 +308,18 @@ _pos_map_spring(double pos, > } > > static double > -_cubic_bezier_a (double a1, double a2) > -{ > - return 1.0 - 3.0 * a2 + 3.0 * a1; > -} > - > -static double > -_cubic_bezier_b (double a1, double a2) > -{ > - return 3.0 * a2 - 6.0 * a1; > -} > - > -static double > -_cubic_bezier_c(double a1) > -{ > - return 3.0 * a1; > -} > - > -static double > -_cubic_bezier_calc(double t, > - double a1, > - double a2) > -{ > - return ((_cubic_bezier_a(a1, a2) * t + > - _cubic_bezier_b(a1, a2)) * t + > - _cubic_bezier_c(a1)) * t; > -} > - > -static double > -_cubic_bezier_slope_get(double t, > - double a1, > - double a2) > -{ > - return 3.0 * _cubic_bezier_a(a1, a2) * t * t + > - 2.0 * _cubic_bezier_b(a1, a2) * t + > - _cubic_bezier_c(a1); > -} > - > -static double > -_cubic_bezier_t_get(double a, > - double x1, > - double x2) > -{ > - double guess_t = a; > - for (int i = 0; i < 4; ++i) > - { > - double current_slope = _cubic_bezier_slope_get(a, x1, x2); > - if (current_slope == 0.0) > - return guess_t; > - double current_x = _cubic_bezier_calc(guess_t, x1, x2) - a; > - guess_t -= current_x / current_slope; > - } > - return guess_t; > -} > - > -static double > _pos_map_cubic_bezier(double pos, > - double x1, > + double x1 EINA_UNUSED, > double y1, > - double x2, > + double x2 EINA_UNUSED, > double y2) > { > if (x1 == y1 && x2 == y2) return pos; > - return _cubic_bezier_calc(_cubic_bezier_t_get(pos, x1, x2), y1, y2); > + > + /* Bezier Cubic formula: > + y(t) = (1 - t)^3 + 3t(1 - t)^2 + 3t^2(1 - t) + t^3 */ > + return (pow((1 - pos), 3) * 0) + (3 * pos * pow((1 - pos), 2) * y1) + > + (3 * pow(pos, 2) * (1 - pos) * y2) + (pow(pos, 3) * 1); > } > > #define DBL_TO(Fp) eina_f32p32_double_to(Fp) > ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
