Beispiel #1
0
        public Hand TransformedCopy(Matrix trs)
        {
            FingerList transformedFingers = new FingerList(5);

            for (int f = 0; f < this.Fingers.Count; f++)
            {
                transformedFingers.Add(Fingers[f].TransformedCopy(trs));
            }

            float hScale = trs.xBasis.Magnitude;

            return(new Hand(_frameId,
                            _id,
                            _confidence,
                            _grabStrength,
                            _grabAngle,
                            _pinchStrength,
                            _pinchDistance,
                            _palmWidth * hScale,
                            _isLeft,
                            _timeVisible,
                            _arm.TransformedCopy(trs),
                            transformedFingers,
                            trs.TransformPoint(_palmPosition),
                            trs.TransformPoint(_stabilizedPalmPosition),
                            trs.TransformPoint(_palmVelocity),
                            trs.TransformDirection(_palmNormal).Normalized,
                            trs.TransformDirection(_direction).Normalized,
                            trs.TransformPoint(_wristPosition)
                            ));
        }
Beispiel #2
0
        public static Hand MakeTestHand(int frameId, int handId, bool isLeft)
        {
            FingerList fingers = new FingerList(5);

            fingers.Add(MakeThumb(frameId, handId));
            fingers.Add(MakeIndexFinger(frameId, handId));
            fingers.Add(MakeMiddleFinger(frameId, handId));
            fingers.Add(MakeRingFinger(frameId, handId));
            fingers.Add(MakePinky(frameId, handId));

            Vector armWrist = new Vector(-7.05809944059f, 4.0f, 50.0f);
            Vector elbow    = armWrist + 250f * Vector.Backward;
            Matrix armBasis = new Matrix(Vector.Right, Vector.Down, Vector.Forward);
            Arm    arm      = new Arm(elbow, armWrist, (elbow + armWrist) / 2, Vector.Forward, 250f, 41f, Bone.BoneType.TYPE_DISTAL, armBasis);
            Hand   testHand = new Hand(frameId,
                                       handId,
                                       1.0f,
                                       0.0f,
                                       0.0f,
                                       0.0f,
                                       0.0f,
                                       85f,
                                       isLeft,
                                       0.0f,
                                       arm,
                                       fingers,
                                       new Vector(0, 0, 0),
                                       new Vector(0, 0, 0),
                                       new Vector(0, 0, 0),
                                       Vector.Down,
                                       Vector.Backward,
                                       new Vector(-4.36385750984f, 6.5f, 31.0111342526f)
                                       );

            if (isLeft)
            {
                return(testHand);
            }
            else
            {
                Matrix leftToRight = new Matrix(Vector.Right, Vector.Up, Vector.Forward);
                return(testHand.TransformedCopy(leftToRight));
            }
        }
Beispiel #3
0
        public void AddHand(Hand hand)
        {
            if (_hands == null)
            {
                _hands = new HandList(3);
            }

            _hands.Add(hand);
            if (_fingers == null)
            {
                _fingers = new FingerList(15);
            }


            for (int f = 0; f < hand.Fingers.Count; f++)
            {
                _fingers.Add(hand.Fingers [f]);
            }
        }