Improvements to the math in mEase

Just a few math improvments to mEase to improve compiler optimization.
Elastic Easing is exponentially decaying sine wave

T: Current Time, b is the beginning value, c is the change in value , d is the duration, a is the amplitude and p is the period.

 

T and d can be in frames or seconds/milliseconds.

 

From: Daniel Buckmaster [mailto:notifications@github.com] 
Sent: Sunday, November 16, 2014 7:54 PM
To: GarageGames/Torque3D
Cc: Vincent Gee
Subject: Re: [Torque3D] Improvements to the math in mEase (#889)

 

In Engine/source/math/mEase.h:

> @@ -278,7 +297,7 @@ inline F32 mEaseOutElastic(F32 t, F32 b, F32 c, F32 d, F32 a, F32 p) {
>       F32 s;
>       if (a < mFabs(c)) { a=c; s=p/4; }
>       else s = p/(2*M_PI_F) * mAsin (c/a);
> -     return a*mPow(2,-10*t) * mSin( (t*d-s)*(2*M_PI_F)/p ) + c + b;
> +     return a*mPow(2,-10*t) * mAsin( (t*d-s)*(2*M_PI_F)/p ) + c + b;

@Winterleaf <https://github.com/Winterleaf>  care to comment?

—
Reply to this email directly or view it on GitHub <https://github.com/GarageGames/Torque3D/pull/889/files#r20415059> .  <https://github.com/notifications/beacon/ACUNZFdl1SJwHz2r8a-SLk7DTzNZyNttks5nOT6NgaJpZM4C2tkQ.gif>