Two resources for the Microsoft Kinect for Windows SDK that may be of use:
http://www.exceptontuesdays.com/gestures-with-microsoft-kinect-for-windows-sdk-v1-5/
Offers a reusable library and links back to an article at the MSDN blogs describing how to construct a gesture.
http://kinecttoolbox.codeplex.com/
Is another reusable library that offers gesture recognition and a few tools to help building new ones.
Both these, as mentioned, are for the official Windows SDK but the concepts can be adapted to OpenNI (which you appear to be interested in, based on your choice of tags). I suggest reading the MSDN blog article from the first link -- it describes in detail (and not specific to a SDK) how a gesture can be constructed from tracking joints.
The short version is that you watch for a certain joint to be at a relative position to other joints. You then watch for it to pass a different joint, or reach another relative position to the same/different joint. You repeat this until the end of gesture you want to capture.
For example, to capture a gesture of a large square you might track for the following points of interest:
- Is the right hand above the shoulder (y-axis) and to the right of the right-shoulder (x-axis)?
- Is the right hand between the shoulder and hip (y-axis) and to the right of the right-shoulder (x-axis)?
- Is the right hand between the shoulder and hip (y-axis) and to the left of the of the hip-center (x-axis)?
- Is the right hand above the shoulder (y-axis) and to the left of the hip-center (x-axis)?
- Is the right hand above the shoulder (y-axis) and to the right of the right-shoulder (x-axis)?
If you follow that path, you can imagine drawing a big square in front of you. Keeping track of all this is a little tricky, but not horrible. Again - both links above offer solutions that could be adapted into the OpenNI structure.