Game Development Reference
In-Depth Information
can easily be added to any program. On the Android side of things, there is the
android.gesture package, which contains several libraries that do the same.
For customized gestures, things get a bit hairier. For iOS, really the only option
is to create a custom subclass of UIGestureRecognizer that will go through
the touch events and try to detect the gesture. But in the case of the Android SDK,
a very handy “Gestures Builder” app can be used to create custom gestures.
You could potentially recognize gestures in any number of ways, but one popular
algorithm is the Rubine algorithm , which was outlined in Dean Rubine's 1991
paper “Specifying gestures by example.” Although the Rubine algorithm was ori-
ginally developed for pen-based gestures, it can also be applied to either single-
finger gestures or each finger of a multi-finger gesture.
To utilize the Rubine algorithm, we first must create a library of gestures. The way
this library is created is by drawing the desired gestures in a test program. As the
gesture is drawn, 14 mathematical properties of the gesture, called features , are
calculated. These features include elements such as the total time to draw the ges-
ture, the total distance travelled, the area of the gesture, the midpoint of the ges-
ture, the initial position, and so on. Figure 5.4 illustrates several of the features in
the original Rubine algorithm.
Figure 5.4 Some of the Rubine algorithm features.
Search WWH ::




Custom Search