Properties:
Methods:
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.
LeapInteractionBox *interactionBox = frame.interactionBox;Public Functions
- Since 1.0
PropertyConverts 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
- position -
A normalized position in LeapInteractionBox coordinates.
- (BOOL) equals:(const LeapInteractionBox *) otherReports whether this is a valid LeapInteractionBox object.
[thisBox equals:thatBox];
- Return
- True, if this LeapInteractionBox object contains valid data.
- Since 1.0
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.
Public Static Functionscenter- (LeapVector *) centerThe 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
depth- (float) depthThe depth of the LeapInteractionBox in millimeters, measured along the z-axis.
float depth = interactionBox.depth;
- Return
- The LeapInteractionBox depth in millimeters.
- Since 1.0
height- (float) heightThe height of the LeapInteractionBox in millimeters, measured along the y-axis.
float height = interactionBox.height;
- Return
- The LeapInteractionBox height in millimeters.
- Since 1.0
isValid- (BOOL) isValidReports 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
width- (float) widthThe width of the LeapInteractionBox in millimeters, measured along the x-axis.
float width = interactionBox.width;
- Return
- The LeapInteractionBox width in millimeters.
- Since 1.0
+ (LeapInteractionBox *) invalidReturns an invalid LeapInteractionBox object.
LeapInteractionBox *invalidBox = LeapInteractionBox.invalid;
- Return
- The invalid InteractionBox instance.
- Since 1.0