Inherits from NSObject
Declared in LeapObjectiveC.h

Overview

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.

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

Tasks

  • – normalizePoint:clamp:

    Normalizes the coordinates of a point using the interaction box.

  • – denormalizePoint:

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

  • – center

    The center of the LeapInteractionBox in device coordinates (millimeters). This point
    is equidistant from all sides of the box.

  • – width

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

  • – height

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

  • – depth

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

  • – isValid

    Reports whether this is a valid LeapInteractionBox object.

  • – equals:

    Reports whether this is a valid LeapInteractionBox object.

  • + invalid

    Returns an invalid LeapInteractionBox object.

Class Methods

invalid

Returns an invalid LeapInteractionBox object.

+ (LeapInteractionBox *)invalid

Return Value

The invalid InteractionBox instance.

Discussion

Returns an invalid LeapInteractionBox object.

You can use the instance returned by this function in comparisons testing
whether a given LeapInteractionBox instance is valid or invalid. (You can also use the
[LeapInterationBox isValid] function.)

Declared In

LeapObjectiveC.h

Instance Methods

center

The center of the LeapInteractionBox in device coordinates (millimeters). This point
is equidistant from all sides of the box.

- (LeapVector *)center

Return Value

The LeapInteractionBox center in device coordinates.

Discussion

The center of the LeapInteractionBox in device coordinates (millimeters). This point
is equidistant from all sides of the box.

Declared In

LeapObjectiveC.h

denormalizePoint:

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

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

Parameters

normalizedPosition

The input position in LeapInteractionBox coordinates.

Return Value

The corresponding denormalized position in device coordinates.

Discussion

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

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

Declared In

LeapObjectiveC.h

depth

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

- (float)depth

Return Value

The LeapInteractionBox depth in millimeters.

Discussion

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

Declared In

LeapObjectiveC.h

equals:

Reports whether this is a valid LeapInteractionBox object.

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

Return Value

True, if this LeapInteractionBox object contains valid data.

Discussion

Reports whether this is a valid LeapInteractionBox object.

Declared In

LeapObjectiveC.h

height

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

- (float)height

Return Value

The LeapInteractionBox height in millimeters.

Discussion

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

Declared In

LeapObjectiveC.h

isValid

Reports whether this is a valid LeapInteractionBox object.

- (BOOL)isValid

Return Value

True, if this LeapInteractionBox object contains valid data.

Discussion

Reports whether this is a valid LeapInteractionBox object.

Declared In

LeapObjectiveC.h

normalizePoint:clamp:

Normalizes the coordinates of a point using the interaction box.

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

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.

Return Value

The normalized position.

Discussion

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.

Declared In

LeapObjectiveC.h

width

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

- (float)width

Return Value

The LeapInteractionBox width in millimeters.

Discussion

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

Declared In

LeapObjectiveC.h