PointableΒΆ
The Pointable class reports the physical characteristics of a detected finger or tool.
Both fingers and tools are classified as Pointable objects. Use the Pointable::isFinger() function to determine whether a Pointable object represents a finger. Use the Pointable::isTool() function to determine whether a Pointable object represents a tool. The Leap Motion software classifies a detected entity as a tool when it is thinner, straighter, and longer than a typical finger.
Pointable pointable = frame.pointables().frontmost(); Vector direction = pointable.direction(); float length = pointable.length(); float width = pointable.width(); Vector stabilizedPosition = pointable.stabilizedTipPosition(); Vector position = pointable.tipPosition(); Vector speed = pointable.tipVelocity(); float touchDistance = pointable.touchDistance(); Pointable.Zone zone = pointable.touchZone();To provide touch emulation, the Leap Motion software associates a floating touch plane that adapts to the user’s finger movement and hand posture. The Leap Motion interprets purposeful movements toward this plane as potential touch points. The Pointable class reports touch state with the touchZone and touchDistance values.
Note that Pointable objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical entity. Invalid Pointable objects can be the result of asking for a Pointable object using an ID from an earlier frame when no Pointable objects with that ID exist in the current frame. A Pointable object created from the Pointable constructor is also invalid. Test for validity with the Pointable::isValid() function.
Public Functions
- Since
- 1.0
Public Static FunctionsVector direction()boolean equals(Pointable arg0)Frame frame()Hand hand()int id()A unique ID assigned to this Pointable object, whose value remains the same across consecutive frames while the tracked finger or tool remains visible.
If tracking is lost (for example, when a finger is occluded by another finger or when it is withdrawn from the Leap Motion Controller field of view), the Leap Motion software may assign a new ID when it detects the entity in a future frame.
int theID = pointable.id();Use the ID value with the Frame::pointable() function to find this Pointable object in future frames.
IDs should be from 1 to 100 (inclusive). If more than 100 objects are tracked an IDs of -1 will be used until an ID in the defined range is available.
- Return
- The ID assigned to this Pointable object.
- Since
- 1.0
boolean isExtended()Whether or not this Pointable is in an extended posture.
A finger is considered extended if it is extended straight from the hand as if pointing. A finger is not extended when it is bent down and curled towards the palm. Tools are always extended.
int extendedFingers = 0; for (Finger finger : hand.fingers()) { if(finger.isExtended()) extendedFingers++; }
- Return
- True, if the pointable is extended.
- Since
- 2.0
boolean isFinger()boolean isTool()boolean isValid()float length()The estimated length of the finger or tool in millimeters.
float apparentlength = pointable.length();
- Return
- The estimated length of this Pointable object.
- Since
- 1.0
Pointable()Vector stabilizedTipPosition()The stabilized tip position of this Pointable.
Smoothing and stabilization is performed in order to make this value more suitable for interaction with 2D content. The stabilized position lags behind the tip position by a variable amount, depending primarily on the speed of movement.
Vector stabilizedPosition = pointable.stabilizedTipPosition();
- Return
- A modified tip position of this Pointable object with some additional smoothing and stabilization applied.
- Since
- 1.0
float timeVisible()The duration of time this Pointable has been visible to the Leap Motion Controller.
float lifetime = pointable.timeVisible();
- Return
- The duration (in seconds) that this Pointable has been tracked.
- Since
- 1.0
Vector tipPosition()The tip position in millimeters from the Leap Motion origin.
Vector currentPosition = pointable.tipPosition();
- Return
- The Vector containing the coordinates of the tip position.
- Since
- 1.0
Vector tipVelocity()The rate of change of the tip position in millimeters/second.
Vector currentSpeed = pointable.tipVelocity();
- Return
- The Vector containing the coordinates of the tip velocity.
- Since
- 1.0
String toString()float touchDistance()A value proportional to the distance between this Pointable object and the adaptive touch plane.
The touch distance is a value in the range [-1, 1]. The value 1.0 indicates the Pointable is at the far edge of the hovering zone. The value 0 indicates the Pointable is just entering the touching zone. A value of -1.0 indicates the Pointable is firmly within the touching zone. Values in between are proportional to the distance from the plane. Thus, the touchDistance of 0.5 indicates that the Pointable is halfway into the hovering zone.
float distance = pointable.touchDistance(); if (distance > 0) { //Handle hovering ... } else { //Handle touching ... }You can use the touchDistance value to modulate visual feedback given to the user as their fingers close in on a touch target, such as a button.
- Return
- The normalized touch distance of this Pointable object.
- Since
- 1.0
Pointable.Zone touchZone()The current touch zone of this Pointable object.
The Leap Motion software computes the touch zone based on a floating touch plane that adapts to the user’s finger movement and hand posture. The Leap Motion software interprets purposeful movements toward this plane as potential touch points. When a Pointable moves close to the adaptive touch plane, it enters the “hovering” zone. When a Pointable reaches or passes through the plane, it enters the “touching” zone.
The possible states are present in the Zone enum of this class:
Zone.NONE The Pointable is outside the hovering zone.
Zone.HOVERING The Pointable is close to, but not touching the touch plane.
Zone.TOUCHING The Pointable has penetrated the touch plane.
The touchDistance value provides a normalized indication of the distance to the touch plane when the Pointable is in the hovering or touching zones.
switch (pointable.touchZone()) { case ZONE_NONE: //Handle distant pointable break; case ZONE_HOVERING: //Handle pointable near touch plane break; case ZONE_TOUCHING: //Handle pointable penetrating touch plane break; default: //Handle error cases... break; }
- Return
- The touch zone of this Pointable
- Since
- 1.0
float width()The estimated width of the finger or tool in millimeters.
float averageThickness = pointable.width();
- Return
- The estimated width of this Pointable object.
- Since
- 1.0
Pointable invalid()Returns an invalid Pointable object.
You can use the instance returned by this function in comparisons testing whether a given Pointable instance is valid or invalid. (You can also use the Pointable::isValid() function.)
if(!pointable.equals(Pointable.invalid())) { //Use it... }
- Return
- The invalid Pointable instance.
- Since
- 1.0
class Zone
Defines the values for reporting the state of a Pointable object in relation to an adaptive touch plane.
- Since
- 1.0

