Tanoda
Finger.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9namespace Leap {
10 using System;
11
19 [Serializable]
20 public class Finger {
21 public Bone[] bones = new Bone[4];
22
31 public Finger() {
32 bones[0] = new Bone();
33 bones[1] = new Bone();
34 bones[2] = new Bone();
35 bones[3] = new Bone();
36 }
37
46 public Finger(long frameId,
47 int handId,
48 int fingerId,
49 float timeVisible,
50 Vector tipPosition,
51 Vector direction,
52 float width,
53 float length,
54 bool isExtended,
55 FingerType type,
56 Bone metacarpal,
57 Bone proximal,
58 Bone intermediate,
59 Bone distal) {
60 Type = type;
61 bones[0] = metacarpal;
62 bones[1] = proximal;
63 bones[2] = intermediate;
64 bones[3] = distal;
65 Id = (handId * 10) + fingerId;
66 HandId = handId;
67 TipPosition = tipPosition;
68 Direction = direction;
69 Width = width;
70 Length = length;
71 IsExtended = isExtended;
72 TimeVisible = timeVisible;
73 }
74
79 public Bone Bone(Bone.BoneType boneIx) {
80 return bones[(int)boneIx];
81 }
82
87 public override string ToString() {
88 return Enum.GetName(typeof(FingerType), Type) + " id:" + Id;
89 }
90
96
110 public int Id;
111
116 public int HandId;
117
123
130
135 public float Width;
136
141 public float Length;
142
152 public bool IsExtended;
153
158 public float TimeVisible;
159
167 public enum FingerType {
168 TYPE_THUMB = 0,
169 TYPE_INDEX = 1,
170 TYPE_MIDDLE = 2,
171 TYPE_RING = 3,
172 TYPE_PINKY = 4,
173 TYPE_UNKNOWN = -1
174 }
175 }
176}
The Bone class represents a tracked bone.
Definition: Bone.cs:26
BoneType
Enumerates the type of bones.
Definition: Bone.cs:168
The Finger class represents a tracked finger.
Definition: Finger.cs:20
float Length
The estimated length of the finger.
Definition: Finger.cs:141
bool IsExtended
Whether or not this Finger is in an extended posture.
Definition: Finger.cs:152
override string ToString()
A string containing a brief, human readable description of the Finger object.
Definition: Finger.cs:87
Bone Bone(Bone.BoneType boneIx)
The bone at a given bone index on this finger.
Definition: Finger.cs:79
int Id
A unique ID assigned to this Finger object, whose value remains the same across consecutive frames wh...
Definition: Finger.cs:110
Bone[] bones
Definition: Finger.cs:21
Finger.FingerType Type
The type of this finger.
Definition: Finger.cs:95
float Width
The estimated width of the finger.
Definition: Finger.cs:135
Finger()
Constructs a finger.
Definition: Finger.cs:31
Finger(long frameId, int handId, int fingerId, float timeVisible, Vector tipPosition, Vector direction, float width, float length, bool isExtended, FingerType type, Bone metacarpal, Bone proximal, Bone intermediate, Bone distal)
Constructs a finger.
Definition: Finger.cs:46
Vector TipPosition
The tip position of this Finger.
Definition: Finger.cs:122
Vector Direction
The direction in which this finger or tool is pointing. The direction is expressed as a unit vector p...
Definition: Finger.cs:129
int HandId
The Hand associated with a finger.
Definition: Finger.cs:116
FingerType
Enumerates the names of the fingers.
Definition: Finger.cs:167
float TimeVisible
The duration of time this Finger has been visible to the Leap Motion Controller.
Definition: Finger.cs:158
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
Definition: Vector.cs:36