Fingers and tools — things that can be pointed — are represented by LeapPointable objects. In addition, separate LeapFinger and LeapTool classes specialize the LeapPointable class to provide specific information.
You can get the fingers associated with a particular hand from the LeapHand object. You can also get all detected pointables (fingers and tools) from a LeapFrame object.
LeapPointable objects have many attributes describing the characteristics of the represented finger or tool.
LeapFinger tipPosition and direction vectors provide the positions of the finger tips and the directions in which the fingers are pointing.
The Leap Motion software classifies a detected pointable object as either a finger or a tool. Use the Pointable::isTool() function to determine which one a LeapPointable object represents.
A LeapTool is longer, thinner, and straighter than a finger.
The following example illustrates how to get a pointable object from a frame and access its basic characteristics:
To convert a LeapPointable object to its proper LeapFinger or LeapTool subclass, use the appropriate LeapFinger or LeapTool constructor (one of the few times that you should use the constructor for a Leap class).
LeapFinger objects extend LeapPointable to represent physical fingers. A finger has a type, a direction and a set of bones.
As of version 2.0 of the Leap Motion SDK, all five fingers are are always present in the list of fingers for a hand. The Leap Motion software estimates positions for fingers and bones that it cannot track clearly. Thus subtle movements of fingers against or behind the hand (as seen from the Leap Motion sensor’s point of view) may not be reflected in the data.
Fingers can be identified by type, e.g. the index, thumb, pinky. Finger IDs are assigned based on the hand ID. If a hand has an ID of “5”, then its fingers are assigned IDs 50 to 55, ordered from thumb to pinky.
The LeapPointableList, LeapFingerList, and LeapToolList classes all have a similar structure. They are designed to act like vector-style arrays and support iterators. You cannot remove or alter the member objects of lists received from the Leap API, but you can combine lists of the same object type.
To use an iterator with one of these lists:
The LeapPointableList, LeapFingerList, and LeapToolList classes define additional functions for getting members of the list based on their relative position within the Leap coordinate system. These functions include leftmost(), rightmost(), and frontmost(). The following snippet illustrates a few ways to use these functions:
Objective-C