Finger

Properties:

Methods:

class Leap::Finger

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

Public Type

FingerType enum

Enumerates the names of the fingers.

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

Since
2.0

Values:

  • TYPE_THUMB = = 0 -
  • TYPE_INDEX = = 1 -
  • TYPE_MIDDLE = = 2 -
  • TYPE_RING = = 3 -
  • TYPE_PINKY = = 4 -

    The pinky or little finger.

  • TYPE_UNKNOWN = = -1 -
Public Functions

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
    }
}

Return
The Bone that has the specified bone type.
Since
2.0
Parameters
  • boneIx -

    An index value from the Bone::Type enumeration identifying the bone of interest.

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.

Since
3.0
Parameters
  • frameId -

    The id of the frame this finger appears in.

  • handId -

    The id of the hand this finger belongs to.

  • fingerId -

    The id of this finger (handId + 0-4 for finger position).

  • timeVisible -

    How long this instance of the finger has been visible.

  • tipPosition -

    The position of the finger tip.

  • tipVelocity -

    The velocity of the finger tip.

  • direction -

    The pointing direction of the finger.

  • stabilizedTipPosition -

    The stabilized tip position.

  • width -

    The average width of the finger.

  • length -

    The length of the finger.

  • isExtended -

    Whether the finger is more-or-less straight.

  • type -

    The finger name.

  • metacarpal -

    The first bone of the finger (inside the hand).

  • proximal -

    The second bone of the finger

  • intermediate -

    The third bone of the finger.

  • distal -

    The end bone.

override string ToString()

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

String description = finger.ToString ();

Return
A description of the Finger object as a string.
Since
1.0

Public Members

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.

https://di4564baj7skl.cloudfront.net/documentation/images/Leap_Finger_Model.png

Return
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.

Return
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.

Return
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++;
}

Return
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;

Return
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;

Return
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;

Return
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;

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 velocity = finger.TipVelocity;
float speed = velocity.Magnitude;

Return
The Vector containing the coordinates of the tip velocity.
Since
1.0

Finger.FingerType Type

The name of this finger.

Finger.FingerType fingerType = finger.Type;

Return
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;

Return
The estimated width of this Finger object.
Since
1.0

Extension Functions

public static Finger CopyFrom(this Finger finger, Finger source)

Copies the data from a source finger into this finger. After the operation is complete, the finger will be identical to the source finger.

Parameter: source The source finger that is copied into this finger.

public static Finger Transform(this Finger finger, LeapTransform transform)

Does an in-place, rigid transformation of this Finger.

Parameter: transform A LeapTransform containing the desired translation, rotation, and scale to be applied to this Finger.

public static Finger TransformedCopy(this Finger finger, LeapTransform transform)

Returns a new finger that is a copy of this finger, with an additional rigid transformation applied to it.

Parameter: transform The transformation to be applied to the copied finger.