Example #1
0
        // This method will be called when the thread is started.
        public void DoWork()
        {
            float shoulderPitch_Right = 0.0f;
            float shoulderRoll_Right  = 0.0f;
            float elbowRoll_Right     = 0.0f;
            float elbowYaw_Right      = 0.0f;

            while (!_shouldStop)
            {
                if (currentSkeleton == null)
                {
                    continue;
                }
                //Hier werden Berechnungen mit CURRENTSKELETON (EVTL PUFFER!!!) getätigt
                //BERECHNE WINKEL a-d
                //updateAngles
                //Sleep
                //Zuverlässigkeit der Joints
                shoulderPitch_Right = AngleCalculation.getShoulderPitch_Right(currentSkeleton);
                shoulderRoll_Right  = AngleCalculation.getShoulderRoll_Right(currentSkeleton);
                elbowRoll_Right     = AngleCalculation.getElbowRoll_Right(currentSkeleton);
                elbowYaw_Right      = AngleCalculation.getElbowYaw_Right(currentSkeleton);

                skeletonAngleHandler.updateAngles(shoulderPitch_Right, shoulderRoll_Right, elbowRoll_Right, elbowYaw_Right);
                Thread.Sleep(50);
            }
            Console.WriteLine("Angle Calculation shutted down");
        }
Example #2
0
        public static float getElbowRoll_Right(Skeleton skeleton)
        {
            // Get fitting joints
            Joint shoulder_j = skeleton.Joints[JointType.ShoulderRight];
            Joint elbow_j    = skeleton.Joints[JointType.ElbowRight];
            Joint hand_j     = skeleton.Joints[JointType.HandRight];

            //Vector of Joints
            Vector3D shoulder = new Vector3D(shoulder_j.Position.X, shoulder_j.Position.Y, shoulder_j.Position.Z);
            Vector3D elbow    = new Vector3D(elbow_j.Position.X, elbow_j.Position.Y, elbow_j.Position.Z);
            Vector3D hand     = new Vector3D(hand_j.Position.X, hand_j.Position.Y, hand_j.Position.Z);

            // Vektorberechnung
            return(AngleCalculation.getAngle(shoulder, elbow, hand));
        }
Example #3
0
        public static float getShoulderRoll_Right(Skeleton skeleton)
        {
            // Get fitting joints
            Joint hip_right_j = skeleton.Joints[JointType.HipRight];
            Joint hip__left_j = skeleton.Joints[JointType.HipLeft];
            Joint shoulder_j  = skeleton.Joints[JointType.ShoulderRight];
            Joint elbow_j     = skeleton.Joints[JointType.ElbowRight];

            //Vector of Joints
            Vector3D hip_right = new Vector3D(hip_right_j.Position.X, hip_right_j.Position.Y, hip_right_j.Position.Z);
            Vector3D hip_left  = new Vector3D(hip__left_j.Position.X, hip__left_j.Position.Y, hip__left_j.Position.Z);
            Vector3D shoulder  = new Vector3D(shoulder_j.Position.X, shoulder_j.Position.Y, shoulder_j.Position.Z);
            Vector3D elbow     = new Vector3D(elbow_j.Position.X, elbow_j.Position.Y, elbow_j.Position.Z);

            // Vektorberechnung
            return(AngleCalculation.getAngle(hip_right, hip_left, shoulder, elbow));
        }