how to calculate a negative acceleration?

后端 未结 15 2122
既然无缘
既然无缘 2021-02-08 12:11

I\'m implementing the scrolling behaviour of a touch screen UI but I\'m too tired in the moment to wrap my mind around some supposedly trivial piece of math:

y (         


        
15条回答
  •  天命终不由人
    2021-02-08 12:24

    I will add a thought as well. Looks like you don't want a constant (negative) acceleration. That would result in an equation like:

    v(t) = v(0) + a*t,
    

    where a is the negative acceleration, t is the time, and v(t) is velocity at time t. This gives you:

    v(t2) - v(t1) = a(t2-t1),
    

    and that means that for a given Δt the velocity difference is equal to aΔt, a constant.

    What you may be looking for is for a "friction" term, that depends upon the current velocity. Under that assumption, the rate of change of velocity is proportional to the current velocity:

    d v(t) / d t = -b*v(t).
    

    Solving the above is easy, and you get: v(t) = v(0) e−b t.

    Integrating this equation, we get x(t) = v(0)(1−e−b t) / b, where x is the position. The position plot1 for v(0) = 1, b = 0.1 looks like something you could use. Playing with the values of b, and adding a scale factor to the equation might be what you want to do.


    1 http://www.wolframalpha.com/input/?i=plot+%281+-+1+e^%28-0.1+x%29+%29+%2F+0.1+for+x+%3D+0+to+100

提交回复
热议问题