LeapInteractionBoxΒΆ

Properties:

Methods:

class LeapInteractionBox

The LeapInteractionBox class represents a box-shaped region completely within the field of view of the Leap Motion controller.

The interaction box is an axis-aligned rectangular prism and provides normalized coordinates for hands, fingers, and tools within this box. The InteractionBox class can make it easier to map positions in the Leap Motion coordinate system to 2D or 3D coordinate systems used for application drawing.

https://di4564baj7skl.cloudfront.net/documentation/images/Leap_InteractionBox.png

The LeapInteractionBox region is defined by a center and dimensions along the x, y, and z axes.

LeapInteractionBox *interactionBox = frame.interactionBox;

Since 1.0

Public Functions


- (LeapVector *) denormalizePoint:(const LeapVector *) position

Converts a position defined by normalized LeapInteractionBox coordinates into device coordinates in millimeters.

LeapVector *normalizedPoint =
        [[LeapVector alloc] initWithX:.23 y:.87 z:.67];
LeapVector *leapCoordinates =
        [frame.interactionBox denormalizePoint:normalizedPoint];

This function performs the inverse of [LeapInteractionBox normalizePoint:].

Return
The corresponding denormalized position in device coordinates.
Since 1.0
Parameters


- (BOOL) equals:(const LeapInteractionBox *) other

Reports whether this is a valid LeapInteractionBox object.

[thisBox equals:thatBox];

Return
True, if this LeapInteractionBox object contains valid data.
Since 1.0


- (LeapVector *) normalizePoint:(const LeapVector *) position clamp:(BOOL) clamp

Normalizes the coordinates of a point using the interaction box.

Coordinates from the Leap frame of reference (millimeters) are converted to a range of [0..1] such that the minimum value of the LeapInteractionBox maps to 0 and the maximum value of the LeapInteractionBox maps to 1.

int displayWidth = 680;
int displayHeight = 400;
LeapVector *point =
        [[LeapVector alloc] initWithX:-75 y:234 z:0];

LeapVector *normalized =
        [frame.interactionBox normalizePoint:point clamp:YES];

int displayX = normalized.x * displayWidth;
int displayY = (1 - normalized.y) * displayHeight;

Return
The normalized position.
Since 1.0
Parameters
  • position -

    The input position in device coordinates.

  • clamp -

    Whether or not to limit the output value to the range [0,1] when the input position is outside the LeapInteractionBox. Defaults to true.

Property


- (LeapVector *) center
center

The center of the LeapInteractionBox in device coordinates (millimeters).

This point is equidistant from all sides of the box.

LeapVector *center = interactionBox.center;

Return
The LeapInteractionBox center in device coordinates.
Since 1.0


- (float) depth
depth

The depth of the LeapInteractionBox in millimeters, measured along the z-axis.

float depth = interactionBox.depth;

Return
The LeapInteractionBox depth in millimeters.
Since 1.0


- (float) height
height

The height of the LeapInteractionBox in millimeters, measured along the y-axis.

float height = interactionBox.height;

Return
The LeapInteractionBox height in millimeters.
Since 1.0


- (BOOL) isValid
isValid

Reports whether this is a valid LeapInteractionBox object.

if(interactionBox.isValid){
    //Use the data...
}

Return
True, if this LeapInteractionBox object contains valid data.
Since 1.0


- (float) width
width

The width of the LeapInteractionBox in millimeters, measured along the x-axis.

float width = interactionBox.width;

Return
The LeapInteractionBox width in millimeters.
Since 1.0

Public Static Functions


+ (LeapInteractionBox *) invalid

Returns an invalid LeapInteractionBox object.

LeapInteractionBox *invalidBox = LeapInteractionBox.invalid;

Return
The invalid InteractionBox instance.
Since 1.0