Table Of Contents

fromkivy.gestureimportGesture,GestureDatabase# Create a gestureg=Gesture()g.add_stroke(point_list=[(1,1),(3,4),(2,1)])g.normalize()# Add it to the databasegdb=GestureDatabase()gdb.add_gesture(g)# And for the next gesture, try to find it!g2=Gesture()# ...gdb.find(g2)

Warning

You don’t really want to do this: it’s more of an example of how
to construct gestures dynamically. Typically, you would
need a lot more points, so it’s better to record gestures in a file and
reload them to compare later. Look in the examples/gestures directory for
an example of how to do that.

Extract the rotation to apply to a group of points to minimize the
distance to a second group of points. The two groups of points are
assumed to be centered. This is a simple version that just picks
an angle based on the first point of the gesture.