| 992 | } |
| 993 | |
| 994 | static double PhysicsComp_YPosAt(int t, float u) { |
| 995 | /* v(t, u) = (4 + u) * (0.98^t) - 4, where u = initial velocity */ |
| 996 | /* x(t, u) = Σv(t, u) from 0 to t (since we work in discrete timesteps) */ |
| 997 | /* plugging into Wolfram Alpha gives 1 equation as */ |
| 998 | /* (0.98^t) * (-49u - 196) - 4t + 50u + 196 */ |
| 999 | double a = Math_Exp2(-0.02914633510256746 * t); /* ~0.98^t */ |
| 1000 | return a * (-49 * u - 196) - 4 * t + 50 * u + 196; |
| 1001 | } |
| 1002 | |
| 1003 | double PhysicsComp_CalcMaxHeight(float u) { |
| 1004 | /* equation below comes from solving diff(x(t, u))= 0 */ |
no test coverage detected