InteractionBoxΒΆ

Properties:

Methods:

struct Leap::InteractionBox

The InteractionBox 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 InteractionBox region is defined by a center and dimensions along the x, y, and z axes.

Get an InteractionBox object from a Frame object.

Since
1.0

Public Functions
Vector DenormalizePoint(Vector normalizedPosition)

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

InteractionBox interactionBox = frame.InteractionBox;
Vector point = new Vector (100, 75, -125);
Vector normalizedCoordinates = interactionBox.NormalizePoint (point);
Vector denormalizedCoordinates = interactionBox.DenormalizePoint (normalizedCoordinates);
// denormalizedCoordinates == point

This function performs the inverse of normalizePoint().

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

    The input position in InteractionBox coordinates.

bool Equals(InteractionBox other)

Compare InteractionBox object equality.

Boolean isBoxEqual = thisBox == thatBox;

Two InteractionBox objects are equal if and only if both InteractionBox objects are the same size, in the same position and both InteractionBoxes are valid.

Since
1.0

InteractionBox(Vector center, Vector size)

Create an interaction box with a specxific size and center position.

Parameters
  • center -

    The midpoint of the box.

  • size -

    The dimensions of the box along each axis.

Vector NormalizePoint(Vector position, bool clamp = true)

Normalizes the coordinates of a point using the interaction box.

Vector normalizedHandPosition = interactionBox.NormalizePoint (hand.PalmPosition);

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

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 InteractionBox. Defaults to true.

override string ToString()

A string containing a brief, human readable description of the InteractionBox object.

Return
A description of the InteractionBox as a string.
Since
1.0

Public Members
Vector Center

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

This point is equidistant from all sides of the box.

Vector boxCenter = interactionBox.Center;

Return
The InteractionBox center in device coordinates.
Since
1.0

Vector Size

The dimensions of the interaction box along each axis.

Property
float Depth

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

float boxDimensionAlongZAxis = interactionBox.Depth;

Return
The InteractionBox depth in millimeters.
Since
1.0

float Height

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

float boxDimensionAlongYAxis = interactionBox.Height;

Return
The InteractionBox height in millimeters.
Since
1.0

bool IsValid

Reports whether this is a valid InteractionBox object.

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

float Width

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

float boxDimensionAlongXAxis = interactionBox.Width;

Return
The InteractionBox width in millimeters.
Since
1.0

<!-- <div class="ribbon">

C# and Unity