10using System.Collections.Generic;
21 const float TOLERANCE = 0.01f;
23 Frame frame = TestHandFactory.MakeTestFrame(0, includeLeftHand:
true, includeRightHand:
true, unitType: TestHandFactory.UnitType.UnityUnits);
25 foreach (var hand
in frame.Hands) {
52 Assert.That(result.
IsLeft, Is.EqualTo(hand.IsLeft));
53 Assert.That((result.
PalmPosition - hand.PalmPosition).Magnitude, Is.LessThan(TOLERANCE));
55 foreach (var resultFinger
in result.Fingers) {
56 var finger = hand.Fingers.Single(f => f.Type == resultFinger.Type);
58 for (
int i = 0; i < 4; i++) {
59 Bone resultBone = resultFinger.bones[i];
60 Bone bone = finger.bones[i];
62 Assert.That((resultBone.
NextJoint - bone.
NextJoint).Magnitude, Is.LessThan(TOLERANCE));
63 Assert.That((resultBone.
PrevJoint - bone.
PrevJoint).Magnitude, Is.LessThan(TOLERANCE));
64 Assert.That((resultBone.
Center - bone.
Center).Magnitude, Is.LessThan(TOLERANCE));
The Bone class represents a tracked bone.
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...
Vector NextJoint
The end of the bone, closest to the finger tip. In anatomical terms, this is the distal end of the bo...
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Hand class reports the physical characteristics of a detected hand.
bool IsLeft
Identifies whether this Hand is a left hand.
Vector PalmPosition
The center position of the palm.
A Vector-based encoding of a Leap Hand.
void FillBytes(byte[] bytesToFill, ref int offset)
Fills the provided byte array with a compressed, 86-byte form of this VectorHand, starting at the pro...
int numBytesRequired
The number of bytes required to encode a VectorHand into its byte representation. The byte representa...
void Encode(Hand fromHand)
void ReadBytes(byte[] bytes, int offset=0)
Fills this VectorHand with data read from the provided byte array, starting at the provided offset.
void Decode(Hand intoHand)