Exemplo n.º 1
0
        public Hand2d(Hand hand)
        {
            Speed               = hand.PalmVelocity.Magnitude;
            SpeedDirection      = GetVectorDirection(hand.PalmVelocity);
            FloatingAttachPoint = GetFloatingAttachPoint(hand);
            IsFist              = GetIsFist(hand);
            IsFlat              = GetIsFlat(hand);
            SetPalmProperties(hand);
            if (hand.IsLeft)
            {
                Side = HandSide.Left;
            }
            else
            {
                Side = HandSide.Right;
            }

            HandVelocityHistory.AddVelocity(hand.PalmVelocity, palmAttachPoint3d, Side);

            PalmPosition   = LeapCalibrator.ToScaledPoint(hand.PalmPosition);
            PalmPosition3d = hand.PalmPosition;
            // TODO: Calculate Details!!!
            foreach (Finger finger in hand.Fingers)
            {
                Fingers.Add(new Finger2d(finger));
            }
        }
Exemplo n.º 2
0
 public Finger2d(Finger finger)
 {
     DistalPhalange       = GetBone(finger, Bone.BoneType.TYPE_DISTAL);
     IntermediatePhalange = GetBone(finger, Bone.BoneType.TYPE_INTERMEDIATE);
     ProximalPhalange     = GetBone(finger, Bone.BoneType.TYPE_PROXIMAL);
     TipPosition          = LeapCalibrator.ToScaledPoint(finger.TipPosition);
 }
Exemplo n.º 3
0
        // ![](B0D2EA3807AA73CED7E27A1205328BF7.png;;;0.01721,0.01721)
        FingerBone GetBone(Finger finger, Bone.BoneType boneType)
        {
            Bone        bone     = finger.Bone(boneType);
            ScaledPoint centerPt = LeapCalibrator.ToScaledPoint(bone.Center);

            return(new FingerBone(centerPt, bone.Length * centerPt.Scale, new DndCore.Vector(bone.Direction.x, bone.Direction.y)));
        }
Exemplo n.º 4
0
 void SetPalmProperties(Hand hand)
 {
     palmAttachPoint3d       = GetAttachPoint3d(hand);
     fingerTipsAttachPoint3d = GetFingerTipsAttachPoint3d(hand);
     PalmAttachPoint         = LeapCalibrator.ToScaledPoint(palmAttachPoint3d);
     PalmDirection           = GetVectorDirection(hand.PalmNormal);
     FacingForwardOrBack     = GetForwardOrBack(hand.PalmNormal);
     PositionZ = hand.PalmPosition.z;
 }
Exemplo n.º 5
0
 public static ScaledPoint ToScaledPoint(this Vector vector)
 {
     return(LeapCalibrator.ToScaledPoint(vector));
 }
Exemplo n.º 6
0
 public Finger2d(Finger finger)
 {
     TipPosition = LeapCalibrator.ToScaledPoint(finger.TipPosition);
 }