diff options
author | N.N. <nimon@users.sourceforge.net> | 2010-09-07 16:21:33 +0000 |
---|---|---|
committer | N.N. <nimon@users.sourceforge.net> | 2010-09-07 16:21:33 +0000 |
commit | 741b5147f2774523ec152f78f5b40095fb5beb61 (patch) | |
tree | f74de1287281a655e100113ab64626f438c5bcba /msd.h | |
parent | 6cb09178caa3fdd8876432998b0a62a04ffd4872 (diff) |
svn path=/trunk/externals/nusmuk/; revision=13980
Diffstat (limited to 'msd.h')
-rw-r--r-- | msd.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -134,7 +134,13 @@ public: { for(int i = 0; i < N; ++i) { t_float pold = pos[i]; - t_float pnew = force[i] * invM + 2*pold - pos2[i]; // x[n] =Fx[n]/M+2x[n]-x[n-1] + t_float pnew; + if(invM) // if mass is mobile + pnew = force[i] * invM + 2*pold - pos2[i]; // x[n] =Fx[n]/M+2x[n]-x[n-1] + else // if mass is fixed + pnew = pos[i]; + + // check limit if(pnew < limit[i][0]) pnew = limit[i][0]; else if(pnew > limit[i][1]) pnew = limit[i][1]; speed[i] = (pos[i] = pnew) - (pos2[i] = pold); // x[n-2] = x[n-1], x[n-1] = x[n],vx[n] = x[n] - x[n-1] |