Tracking ModelΒΆ

The Leap Motion API defines a class representing each of the primary tracked objects.

LeapFrame LeapHand LeapFinger LeapPointable LeapGesture LeapCircleGesture LeapSwipeGesture LeapKeyTapGesture LeapScreenTapGesture LeapTool LeapBone LeapArm
LeapFrame

The LeapFrame object is essentially the root of the data model and provides access to all the tracked entities. A new LeapFrame is created at each update interval.

The frame contains lists of the hands, fingers, tools, and gestures tracked in that frame. (You can also get the fingers for a specific hand from the relevant LeapHand object.)

LeapController *controller = [[LeapController alloc] init];
// wait until Controller.isConnected() evaluates to true
//...

LeapFrame *frame = [controller frame:0];
NSArray *hands = frame.hands;
NSArray *pointables = frame.pointables;
NSArray *fingers = frame.fingers;
NSArray *tools = frame.tools;

See Frames

LeapHand

The LeapHand object describes the position and orientation of a hand, tracks its motion between frames and contains lists of the fingers associated with that hand.

// hand is a Hand object
NSArray *pointables = [hand pointables];
NSArray *fingers = [hand fingers ];

See Hands

LeapArm LeapArm objects describe the position, direction, and orientation of the arm to which a hand is attached. Arms can only be accessed through the LeapHand object.
LeapPointable, LeapFinger, LeapTool

LeapPointable objects define the basic characteristics common to fingers and tools. The LeapFinger and LeapTool classes extend LeapPointable with additional information specific to those entities.

if (pointable.isTool) {
    LeapTool *tool = (LeapTool*)pointable;
} else {
    LeapFinger *finger = (LeapFinger*)pointable;
}

See Fingers

LeapBone LeapBone object represent the position and orientation of a bone. The tracked bones include the metarcarpals and phalanges of the fingers (and thumb).
LeapGesture

The LeapGesture class and its subclasses represent a snapshot of one of the four gestures recognized by the Leap Motion software.

See Gestures

LeapImage LeapImage objects provide the raw sensor data and calibration grid for the Leap Motion cameras. (Not available through the WebSocket server.)
Lists of Tracked Objects

The LeapFrame and LeapHand objects contain lists of the other tracked objects.

The lists are standard NSArray objects. The |NSArray(HandorPointableList)|_ category provides a few convenience functions for filtering the list members. For example, the frontmost() function returns the item that is the most forward in the Leap Motion controller’s field of view (smallest z value).

Utility Classes

The LeapVector class describes points and directions. The LeapVector class also provides several useful math functions for working with vectors.

Likewise, the LeapMatrix class represents things like rotations and other transforms returned by some functions in the API.

The LeapInteractionBox class provides functions to help map a rectilinear portion of the Leap Motion controller’s field of view to either 2D screen space or 3D space. See Touch Emulation.