I am developing a simple mobile application for the iPhone and Android platforms, and I am looking for algorithms that will allow me to trigger certain events (functions) when we detect a specific gesture using an internal accelerometer. I work with Phonegap, which uses HTML5 and javascript, which reads the three coordinates (x, y, and z) from the accelerometer to a preset interval (for example, every 0.04 sec.).
I wrote a simple function that detects jittery movement, and it works pretty well, but it is primitive (it only determines jitter, not direction) - and I want to detect some other gestures, such as: - tilt (left / right) - shake up / down - shake left / right - circular motion - flip upside down - etc.
Does anyone have algorithms (or at least mathematical formulas / functions) that can calculate (detect) this kind of gestures based on the input values i (x, y, z and the time interval for each call)?
I am looking for any code in any programming language (I will rewrite it directly in javascript. Thanks in advance!
source share