1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Deceleration calculation for moving screen objects

  1. Jun 22, 2009 #1
    Long story short...

    I am having a hard time creating natural deceleration for a VB.NET touchscreen project. I would like to be able to scroll an object and allow it to coast to a stop.

    The starting velocity will be set by the swipe speed of the finger. Lets call it pixels/millisecond. That leaves me with a DISTANCE and TIME to 0 velocity as unknowns.

    My Choices (at least as I see it).

    a) Choose a fixed stopping distance (maybe based on the length of the initial swipe) and then calculate the time needed to reach 0 velocity.

    -or-

    b) Choose a fixed time to reach a 0 velocity and calculate the distance the object will decelerate over. ( I don't like this option at all)..

    -or-

    c) Give the object a mass and friction, then calculate both the time and distance to reach 0 velocity. (appealing because both mass and friction could be adjustable, even set based on the length and speed of the initial finger swipe. I.E. short swipe = higher friction, longer swipe = lower friction).

    I am having trouble applying (and/or understanding) the proper kinametics or inertial formula.

    Here is a "Microsoft Touch" information page would be the ideal model for what I am trying to recreate. This MS Touch functionality is not available on the platform I am developing for (not to mention that I would really like to learn how to figure this out on my own the next time).

    Thanks in advance,

    Bill
     
    Last edited: Jun 22, 2009
  2. jcsd
  3. Jun 22, 2009 #2

    A.T.

    User Avatar
    Science Advisor
    Gold Member

    what is often used is this (iteratively):
    new_speed = old_speed * factor
    with
    0 < factor < 1
    until
    old_speed < small_number (object stopped)

    it is efficient, and gives similar results to realistic friction (option c). but as with (c) its is harder to control for specific value for deceleration time / distance.

    option c) could look like this
    new_speed = old_speed - (old_speed ^ 2 * friction_factor * delta_time)/mass
     
  4. Jun 22, 2009 #3

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Is this supposed to mimic the motion of a thrown ball or are you on a 2d flat surface - like an air-hockey table?
    Normally you use either a linear acceleration where you just pick an amount of speed to subtract in each time interval and make the object stop when the speed reaches zero - this is good for simple thrown objects.
    Or you make the acceleration proportional to the speed, so you reduce the speed to say 0.9 of the previous speed in each time interval - and stop the object when the speed reaches some small value. This looks more realistic for real world objects where there is a lot of drag (friction).
     
  5. Jun 22, 2009 #4
    Wow... fast responses in this forum!

    This is supposed to mimic the motion on a 2D surface (like the air hockey table). The idea is to derive the same type of sliding functionality found in modern touchscreen applications like the iPhone, WindowsMobile 6.1, etc. To be more precise, I was unable to find jukebox software that fits my needs, so I am writing my own (VB.NET) and would like to implement the functionality for browsing through cover art, tracks etc. I also don't like being stumped by a problem, so I have set out to learn what I need to know.

    I will see if I can setup a simualtion using both methods above.

    As for the being stumped...What am I missing with the equation on the MS page? It just does not appear to give me usable results.
     
  6. Jun 22, 2009 #5

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Another tip - don't try and deal with angles. Use the velocity in X and Y separately and use the fractional version ie speed in each time interval is 0.9 (or whatever) the previous one separately in X and Y.
    This will even give the correct rebounds from the walls - just flip the sign of the appropriate velocity
     
  7. Jun 24, 2009 #6
  8. Jun 24, 2009 #7

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    The equation they give is X = Vo t - d t^2
    Is normally written as s = ut + 1/2 a t^2
    Just says that the distance an object moves 's' is the initial speed 'u' * time it was moving for, minus the deceleration * time *time.
    This is true for an object moving at constant acceleration (or decelration) such as a weight falling in vacuum. it isn't true for most everyday cases with friction where the slowing depends on the speed.
    For those cases just making the speed in the next second to be eg. 90% of the speed in the previous second looks more real
     
  9. Jun 25, 2009 #8
    Thanks again. I have implemented the advice given:
    new_speed = old_speed - (old_speed ^ 2 * friction_factor * delta_time)/mass

    It appears to be working very well for my purposes.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook