added notes to resolve undefined behavior of calculations in tweening

interpolators in future.
This commit is contained in:
ehriche 2015-05-06 00:51:49 +02:00
parent dcc93a33fd
commit fe13c728fd

View file

@ -285,18 +285,18 @@ namespace cubic {
namespace circ { namespace circ {
static real_t in(real_t t, real_t b, real_t c, real_t d) static real_t in(real_t t, real_t b, real_t c, real_t d)
{ {
return -c * (sqrt(1 - (t /= d) * t) - 1) + b; return -c * (sqrt(1 - (t /= d) * t) - 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t out(real_t t, real_t b, real_t c, real_t d) static real_t out(real_t t, real_t b, real_t c, real_t d)
{ {
return c * sqrt(1 - (t = t / d - 1) * t) + b; return c * sqrt(1 - (t = t / d - 1) * t) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t in_out(real_t t, real_t b, real_t c, real_t d) static real_t in_out(real_t t, real_t b, real_t c, real_t d)
{ {
if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b; if ((t /= d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b;
return c / 2 * (sqrt(1 - t * (t -= 2)) + 1) + b; return c / 2 * (sqrt(1 - t * (t -= 2)) + 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t out_in(real_t t, real_t b, real_t c, real_t d) static real_t out_in(real_t t, real_t b, real_t c, real_t d)
@ -364,15 +364,15 @@ namespace back {
static real_t out(real_t t, real_t b, real_t c, real_t d) static real_t out(real_t t, real_t b, real_t c, real_t d)
{ {
float s = 1.70158f; float s = 1.70158f;
return c * ((t = t / d- 1) * t * ((s + 1) * t + s) + 1) + b; return c * ((t = t / d- 1) * t * ((s + 1) * t + s) + 1) + b; // TODO: ehrich: operation with t is undefined
} }
static real_t in_out(real_t t, real_t b, real_t c, real_t d) static real_t in_out(real_t t, real_t b, real_t c, real_t d)
{ {
float s = 1.70158f; float s = 1.70158f;
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b; if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b; // TODO: ehrich: operation with s is undefined
float postFix = t -= 2; float postFix = t -= 2;
return c / 2 * ((postFix) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b; return c / 2 * ((postFix) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b; // TODO: ehrich: operation with s is undefined
} }
static real_t out_in(real_t t, real_t b, real_t c, real_t d) static real_t out_in(real_t t, real_t b, real_t c, real_t d)