Page 1 of 1

Posted: 12 May 2011, 04:23
by 23fx23
id like to get some accelaration coeficient value out of ie a 16 steps array. ive learn that in school but i fail to get it back.
in fact im sampling mouse Y moves every bloc in a buffer array. i make a small array and i mod write position, to rec circular.
so when mouse realase i can ceck the last 16 positions. i dlike to 'guess' next step (for inertia) or get an acceleration coefficient
out of those values.

let"s say i move slowly in ramp up fom 0 to 0,5. the output vould be 0.57 or something like this.

or if i stay at 0 and make a very quick accel from 0 to 1 over 2 blocs, the output would be 2

any help?

Posted: 17 May 2011, 10:39
by senso
if you have the mouse positions
X(t) and X(t-1) X(T-2) , etc at time T, T-1, T-2 and so on

the speed is calculated
S(T) = (X(T)-X(T-1) )
S(T-1) = (X(T-1)-X(T-2))

the acceleration is now calculated
Acc(T) = S(T)-S(T-1)

we suppose that the time is 1 Bloc

Posted: 17 May 2011, 11:21
by 23fx23
Cool. Thanks. I had a system working by sampling all deltas of x( or speed) then computing average of all values gave me an average speed to apply.
But gonna try with deltas substractions to get real accel. Thanks