It depends on which way the user will be holding the device.
You don't need the velocity or the distance to figure out which way the device is being swung.
Instead, you can keep a history of the past (say 5) accelerations.
Assuming that the device is held the normal way (portrait, right-side up), you would use the average of the previous x - accelerations to determine the direction.
So basically what I did is in the accelerometer:didAccelerate event:
//prevAccels is an NSMutableArray
float VAL = .75;
int HISTORY_NUMBER = 5;
if (accleration.x>VAL && acceleration.y>VAL){ //if there has been a sudden jerking motion
float avgX;
for (int i = 0; i<[prevAccels count]; i++)
{
UIAcceleration *a = [prevAccels objectAtIndex:i];
avgX += a.x;
}
avgX /= HISTORY_NUMBER; //get the average of the previous accelerations
BOOL flickRight = (avgX<-VAL)?YES:NO;
//[self wave:flickRight]; //do stuff here
}
[prevAccels addObject:acceleration]; //add the acceleration to the history
if ([prevAccels count]>HISTORY_NUMBER) [prevAccels removeObjectAtIndex:0]; //trim the list if it is too large
Hope that helps!