47 bool existDuplicates =
_frame.
Hands.GroupBy(h => h.Id).Any(g => g.Count() > 1);
48 Assert.That(existDuplicates, Is.False);
54 Assert.That(hand.
Fingers.Count, Is.EqualTo(5));
63 Assert.That(bone, Is.Not.Null);
73 float actualLength = bone.
Length;
74 Assert.That(actualLength, Is.EqualTo(apparentLength).Within(
TOLERANCE));
82 Bone prevBone =
getBone(hand, fingerType, boneType - 1);
84 Bone nextBone =
getBone(hand, fingerType, boneType + 1);
86 if (prevBone !=
null) {
90 if (nextBone !=
null) {
131 if (boneType < 0 || (
int)boneType >= 4) {
136 if (finger.
Type != fingerType) {
140 return finger.
Bone(boneType);
146 Assert.That(a.
x, Is.EqualTo(b.
x).Within(
TOLERANCE), vectorName +
".x");
147 Assert.That(a.
y, Is.EqualTo(b.
y).Within(
TOLERANCE), vectorName +
".y");
148 Assert.That(a.
z, Is.EqualTo(b.
z).Within(
TOLERANCE), vectorName +
".z");
The Bone class represents a tracked bone.
Vector Direction
The normalized direction of the bone from base to tip.
BoneType
Enumerates the type of bones.
Vector Center
The midpoint of the bone.
Vector PrevJoint
The base of the bone, closest to the wrist. In anatomical terms, this is the proximal end of the bone...
float Length
The estimated length of the bone.
Vector NextJoint
The end of the bone, closest to the finger tip. In anatomical terms, this is the distal end of the bo...
The Finger class represents a tracked finger.
Bone Bone(Bone.BoneType boneIx)
The bone at a given bone index on this finger.
Finger.FingerType Type
The type of this finger.
FingerType
Enumerates the names of the fingers.
The Frame class represents a set of hand and finger tracking data detected in a single frame.
List< Hand > Hands
The list of Hand objects detected in this frame, given in arbitrary order. The list can be empty if n...
The Hand class reports the physical characteristics of a detected hand.
List< Finger > Fingers
The list of Finger objects detected in this frame that are attached to this hand, given in order from...
LeapQuaternion Rotation
The rotation of the hand as a quaternion.
void CenterIsBetweenJoints([ValueSource(typeof(FrameValidator), "_fingers")] Finger.FingerType fingerType, [ValueSource(typeof(FrameValidator), "_bones")] Bone.BoneType boneType)
void BoneLength([ValueSource(typeof(FrameValidator), "_fingers")] Finger.FingerType fingerType, [ValueSource(typeof(FrameValidator), "_bones")] Bone.BoneType boneType)
Bone getBone(Hand hand, Finger.FingerType fingerType, Bone.BoneType boneType)
static Bone.BoneType[] _bones
void FingersHaveFourBones([ValueSource(typeof(FrameValidator), "_fingers")] Finger.FingerType fingerType, [ValueSource(typeof(FrameValidator), "_bones")] Bone.BoneType boneType)
static Finger.FingerType[] _fingers
void HandsHaveFiveFingers()
void DirectionMatchesJoints([ValueSource(typeof(FrameValidator), "_fingers")] Finger.FingerType fingerType, [ValueSource(typeof(FrameValidator), "_bones")] Bone.BoneType boneType)
void assertVectorsEqual(Vector a, Vector b, string vectorName="Vector")
abstract Frame createFrame()
void JointsMatch([ValueSource(typeof(FrameValidator), "_fingers")] Finger.FingerType fingerType, [ValueSource(typeof(FrameValidator), "_bones")] Bone.BoneType boneType)
bool IsValid()
Returns true if all of the quaternion's components are finite. If any component is NaN or infinite,...
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
float DistanceTo(Vector other)
The distance between the point represented by this Vector object and a point represented by the speci...