FingerΒΆ

The Finger class represents a tracked finger. More...

Public Types

enum  FingerType
 Enumerates the names of the fingers. More...
 

Public Member Functions

Bone Bone (Bone.BoneType boneIx)
 The bone at a given bone index on this finger. More...
 
 Finger ()
 Constructs a finger. More...
 
 Finger (long frameId, int handId, int fingerId, float timeVisible, Vector tipPosition, Vector tipVelocity, Vector direction, Vector stabilizedTipPosition, float width, float length, bool isExtended, Finger.FingerType type, Bone metacarpal, Bone proximal, Bone intermediate, Bone distal)
 Constructs a finger. More...
 
override string ToString ()
 A string containing a brief, human readable description of the Finger object. More...
 

Public Attributes

Vector Direction
 The direction in which this finger or tool is pointing. More...
 
int HandId
 The Hand associated with a finger. More...
 
int Id
 A unique ID assigned to this Finger object, whose value remains the same across consecutive frames while the tracked finger or tool remains visible. More...
 
bool IsExtended
 Whether or not this Finger is in an extended posture. More...
 
float Length
 The estimated length of the finger or tool in millimeters. More...
 
Vector StabilizedTipPosition
 The stabilized tip position of this Finger. More...
 
float TimeVisible
 The duration of time this Finger has been visible to the Leap Motion Controller. More...
 
Vector TipPosition
 The tip position in millimeters from the Leap Motion origin. More...
 
Vector TipVelocity
 The rate of change of the tip position in millimeters/second. More...
 
Finger.FingerType Type
 The name of this finger. More...
 
float Width
 The estimated width of the finger or tool in millimeters. More...
 

Detailed Description

The Finger class represents a tracked finger.

Fingers are objects that the Leap Motion software has classified as a finger. Get valid Finger objects from a Frame or a Hand object.

Fingers may be permanently associated to a hand. In this case the angular order of the finger IDs will be invariant. As fingers move in and out of view it is possible for the guessed ID of a finger to be incorrect. Consequently, it may be necessary for finger IDs to be exchanged. All tracked properties, such as velocity, will remain continuous in the API. However, quantities that are derived from the API output (such as a history of positions) will be discontinuous unless they have a corresponding ID exchange.

Since
1.0

Member Enumeration Documentation

enum FingerType
strong

Enumerates the names of the fingers.

Members of this enumeration are returned by Finger::type() to identify a Finger object.

Since
2.0
Enumerator
TYPE_PINKY 

The pinky or little finger.

Constructor & Destructor Documentation

Finger ( )

Constructs a finger.

An uninitialized finger is considered invalid. Get valid Finger objects from a Hand object.

Since
3.0
Finger ( long  frameId,
int  handId,
int  fingerId,
float  timeVisible,
Vector  tipPosition,
Vector  tipVelocity,
Vector  direction,
Vector  stabilizedTipPosition,
float  width,
float  length,
bool  isExtended,
Finger.FingerType  type,
Bone  metacarpal,
Bone  proximal,
Bone  intermediate,
Bone  distal 
)

Constructs a finger.

Generally, you should not create your own finger objects. Such objects will not have valid tracking data. Get valid finger objects from a hand in a frame received from the service.

Parameters
frameIdThe id of the frame this finger appears in.
handIdThe id of the hand this finger belongs to.
fingerIdThe id of this finger (handId + 0-4 for finger position).
timeVisibleHow long this instance of the finger has been visible.
tipPositionThe position of the finger tip.
tipVelocityThe velocity of the finger tip.
directionThe pointing direction of the finger.
stabilizedTipPositionThe stabilized tip position.
widthThe average width of the finger.
lengthThe length of the finger.
isExtendedWhether the finger is more-or-less straight.
typeThe finger name.
metacarpalThe first bone of the finger (inside the hand).
proximalThe second bone of the finger
intermediateThe third bone of the finger.
distalThe end bone.
Since
3.0

Member Function Documentation

Bone Bone ( Bone.BoneType  boneIx)

The bone at a given bone index on this finger.

List<Finger> fingers = hand.Fingers;
foreach(Finger finger in fingers){
Bone bone;
foreach (Bone.BoneType boneType in (Bone.BoneType[]) Enum.GetValues(typeof(Bone.BoneType)))
{
bone = finger.Bone(boneType);
// ... Use bone
}
}
Parameters
boneIxAn index value from the Bone::Type enumeration identifying the bone of interest.
Returns
The Bone that has the specified bone type.
Since
2.0
override string ToString ( )

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

String description = finger.ToString ();
Returns
A description of the Finger object as a string.
Since
1.0

Member Data Documentation

Vector Direction

The direction in which this finger or tool is pointing.

Vector direction = finger.Direction;

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

Leap_Finger_Model.png
Returns
The Vector pointing in the same direction as the tip of this Finger object.
Since
1.0
int HandId

The Hand associated with a finger.

Not that in version 2+, tools are not associated with hands. For tools, this function always returns an invalid Hand object.

Returns
The associated Hand object, if available; otherwise, an invalid Hand object is returned.
Since
1.0
int Id

A unique ID assigned to this Finger 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 id = finger.Id;

Use the ID value with the Frame::pointable() function to find this Finger 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.

Returns
The ID assigned to this Finger object.
Since
1.0
bool IsExtended

Whether or not this Finger 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 (int f = 0; f < hand.Fingers.Count; f++) {
Finger digit = hand.Fingers [f];
if (digit.IsExtended)
extendedFingers++;
}
Returns
True, if the pointable is extended.
Since
2.0
float Length

The estimated length of the finger or tool in millimeters.

float length = finger.Length;
Returns
The estimated length of this Finger object.
Since
1.0
Vector StabilizedTipPosition

The stabilized tip position of this Finger.

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 stabilized = finger.StabilizedTipPosition;
Returns
A modified tip position of this Finger object with some additional smoothing and stabilization applied.
Since
1.0
float TimeVisible

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

float lifetime = finger.TimeVisible;
Returns
The duration (in seconds) that this Finger has been tracked.
Since
1.0
Vector TipPosition

The tip position in millimeters from the Leap Motion origin.

Vector currentPosition = finger.TipPosition;
Returns
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 velocity = finger.TipVelocity;
float speed = velocity.Magnitude;
Returns
The Vector containing the coordinates of the tip velocity.
Since
1.0

The name of this finger.

Finger.FingerType fingerType = finger.Type;
Returns
The anatomical type of this finger as a member of the Finger::Type enumeration.
Since
2.0
float Width

The estimated width of the finger or tool in millimeters.

float averageThickness = finger.Width;
Returns
The estimated width of this Finger object.
Since
1.0