LeapToolΒΆ

LeapTool Class Reference

The LeapTool class represents a tracked tool. More...

Inherits LeapPointable.

Class Methods

(LeapPointable *) + invalid
 Returns an invalid LeapPointable object. More...
 

Properties

LeapVectordirection
 The direction in which this finger or tool is pointing. More...
 
LeapFrameframe
 The LeapFrame associated with this LeapPointable object. More...
 
LeapHandhand
 The LeapHand associated with a finger. More...
 
int32_t id
 A unique ID assigned to this LeapPointable object, whose value remains the same across consecutive frames while the tracked finger or tool remains visible. More...
 
BOOL isExtended
 Whether or not this Pointable is in an extended posture. More...
 
BOOL isFinger
 Whether or not the LeapPointable is classified a finger. More...
 
BOOL isTool
 Whether or not the LeapPointable is classified to be a tool. More...
 
BOOL isValid
 Reports whether this is a valid LeapPointable object. More...
 
float length
 The estimated length of the finger or tool in millimeters. More...
 
LeapVectorstabilizedTipPosition
 The stabilized tip position of this LeapPointable. More...
 
float timeVisible
 The duration of time this Pointable has been visible to the Leap Motion Controller. More...
 
LeapVectortipPosition
 The tip position in millimeters from the Leap origin. More...
 
LeapVectortipVelocity
 The rate of change of the tip position in millimeters/second. More...
 
float touchDistance
 A value proportional to the distance between this LeapPointable object and the adaptive touch plane. More...
 
LeapPointableZone touchZone
 The current touch zone of this LeapPointable object. More...
 
float width
 The estimated width of the finger or tool in millimeters. More...
 

Detailed Description

The LeapTool class represents a tracked tool.

Method Documentation

+ (LeapPointable *) invalid

Returns an invalid LeapPointable object.

Returns
The invalid LeapPointable instance.
Since 1.0

Property Documentation

- (LeapVector*) direction
readnonatomicassigninherited

The direction in which this finger or tool is pointing.

LeapVector *direction = pointable.direction;

The direction is expressed as a unit vector pointing in the same direction as the tip.

Returns
The LeapVector pointing in the same direction as the tip of this LeapPointable object.
Since 1.0
- (LeapFrame*) frame
readnonatomicweakinherited

The LeapFrame associated with this LeapPointable object.

LeapFrame *owningFrame = pointable.frame;

This property is a weak reference to the LeapFrame object so it is only valid during the lifetime of the LeapFrame object – while the LeapFrame object is in the history buffer or while your application maintains its own reference.

Returns
The associated LeapFrame object, if available; otherwise, an invalid LeapFrame object is returned.
Since 1.0
- (LeapHand*) hand
readnonatomicweakinherited

The LeapHand associated with a finger.

LeapHand *owningHand = pointable.hand;

This property is a weak reference to the LeapHand object so it is only valid during the lifetime of that LeapHand object – in other words, while the parent LeapFrame object is valid or while your application maintains its own reference.

As of version 2, tools are not associated with hands, so this property always returns an invalid LeapHand object for tools.

Returns
The associated LeapHand object, if available; otherwise, an invalid LeapHand object is returned.
Since 1.0
- (int32_t) id
readnonatomicassigninherited

A unique ID assigned to this LeapPointable object, whose value remains the same across consecutive frames while the tracked finger or tool remains visible.

If tracking is lost, the Leap may assign a new ID when it detects the entity in a future frame.

int id = pointable.id;

Use the ID value with the [LeapFrame pointable:] function to find this LeapPointable object in future frames.

int idOfInterest = 201;
LeapPointable *pointableOfInterest = [frame pointable:idOfInterest];
Returns
The ID assigned to this LeapPointable object.
Since 1.0
- (BOOL) isExtended
readnonatomicassigninherited

Whether or not this Pointable is in an extended posture.

int extendedCount = 0;
for (LeapPointable *pointable in frame.pointables) {
if (pointable.isExtended) {
extendedCount++;
}
}

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.

Returns
True, if the pointable is extended.
Since 2.0
- (BOOL) isFinger
readnonatomicassigninherited

Whether or not the LeapPointable is classified a finger.

if (pointable.isFinger) {
LeapFinger *finger = (LeapFinger *)pointable;
}
Returns
YES, if this LeapPointable is classified as a LeapFinger.
Since 1.0
- (BOOL) isTool
readnonatomicassigninherited

Whether or not the LeapPointable is classified to be a tool.

if (pointable.isTool) {
LeapTool *tool = (LeapTool *)pointable;
}
Returns
NO
- (BOOL) isValid
readnonatomicassigninherited

Reports whether this is a valid LeapPointable object.

if(pointable.isValid){
//Use the data
}
Returns
YES, if this LeapPointable object contains valid tracking data.
Since 1.0
- (float) length
readnonatomicassigninherited

The estimated length of the finger or tool in millimeters.

The reported length is the visible length of the finger or tool. If the length isn't known, then a value of 0 is returned.

float length = pointable.length;
Returns
The estimated length of this LeapPointable object.
Since 1.0
- (LeapVector*) stabilizedTipPosition
readnonatomicassigninherited

The stabilized tip position of this LeapPointable.

LeapVector *stabilizedPosition = pointable.stabilizedTipPosition;

Smoothing and stabilization is performed in order to make this value more suitable for interaction with 2D content.

Since 1.0
- (float) timeVisible
readnonatomicassigninherited

The duration of time this Pointable has been visible to the Leap Motion Controller.

float lifetime = pointable.timeVisible;
Returns
The duration (in seconds) that this Pointable has been tracked.
Since 1.0
- (LeapVector*) tipPosition
readnonatomicassigninherited

The tip position in millimeters from the Leap origin.

LeapVector *position = pointable.tipPosition;
Returns
The LeapVector containing the coordinates of the tip position.
Since 1.0
- (LeapVector*) tipVelocity
readnonatomicassigninherited

The rate of change of the tip position in millimeters/second.

LeapVector *speed = pointable.tipVelocity;
Returns
The LeapVector containing the coordinates of the tip velocity.
Since 1.0
- (float) touchDistance
readnonatomicassigninherited

A value proportional to the distance between this LeapPointable object and the adaptive touch plane.

float touchDistance = pointable.touchDistance;
- (LeapPointableZone) touchZone
readnonatomicassigninherited

The current touch zone of this LeapPointable object.

LeapPointableZone zone = pointable.touchZone;
- (float) width
readnonatomicassigninherited

The estimated width of the finger or tool in millimeters.

The reported width is the average width of the visible portion of the finger or tool. If the width isn't known, then a value of 0 is returned.

float width = pointable.width;
Returns
The estimated width of this LeapPointable object.
Since 1.0