Esempio n. 1
0
        protected void DisplayGesturesNew(PXCMHandData.JointData[][] nodes, int numOfHands)
        {
            string handsR = "";
            string handsC = "";

            string info = "";

            // reversed (?)
            bool reversed = false;

            if (numOfHands >= 2)
            {
                PXCMHandData.JointData joint1 = nodes[0][1];
                PXCMHandData.JointData joint2 = nodes[1][1];
                if (joint1 != null && joint2 != null)
                {
                    reversed = joint1.positionImage.x < joint2.positionImage.x;
                }
            }

            if (reversed)
            {
                PXCMHandData.JointData[] hand0 = nodes[0];
                nodes[0] = nodes[1];
                nodes[1] = hand0;
            }

            // joints
            for (int h = 0; h < numOfHands; h++)
            {
                PXCMHandData.JointData joint = nodes[h][0];
                if (joint == null)
                {
                    continue;
                }



                string handInfo = "Hand " + h.ToString() + "\r\n";
                string folded   = GetFolded(nodes[h]);

                handInfo += folded + "\r\n";

                if (folded.Substring(1) == "||__")
                {
                    handInfo += "Victory";
                }
                if (folded == "||__|")
                {
                    form.UpdateKaraoke("*");
                    return;
                }
                if (folded == "|_|__")
                {
                    handInfo += "F**k";
                }


                handsC += GetFoldedCount(nodes[h]);
                handsR += GetRoundFingers(nodes[h]);

                string rounded = GetRoundFingers(nodes[h]);
                handInfo += "\r\n" + GetRoundFingers(nodes[h]);
                handInfo += "\r\n" + getProportions(nodes[h]);

                info += handInfo + "\r\n";
            }

            string letter = "?";

            if (handsC == "41")
            {
                letter = findVovel(nodes, GetTip(nodes[1]));
            }

            if (letter == "?")
            {
                letter = GetLetter(handsR, handsC);
            }

            info = reversed.ToString() + "\tLetter - " + letter + "\r\n" + "Hands - " + handsR + handsC + "\r\n" + info;
            form.UpdateLetter(letter);
            if (letter != "?")
            {
                form.UpdateKaraoke(letter);
            }
            form.UpdateGestureInfo(info);
        }
        protected void DisplayGesturesNew(PXCMHandData.JointData[][] nodes, int numOfHands)
        {
            string handsR = "";
            string handsC = "";

            string info = "";

            // reversed (?)
            bool reversed = false;

            if (numOfHands >= 2)
            {
                PXCMHandData.JointData joint1 = nodes[0][1];
                PXCMHandData.JointData joint2 = nodes[1][1];
                if (joint1 != null && joint2 != null)
                {
                    reversed = joint1.positionImage.x < joint2.positionImage.x;
                }
            }

            if (reversed)
            {
                PXCMHandData.JointData[] hand0 = nodes[0];
                nodes[0] = nodes[1];
                nodes[1] = hand0;
            }

            // joints
            for (int h = 0; h < numOfHands; h++)
            {
                PXCMHandData.JointData joint = nodes[h][0];
                if (joint == null)
                {
                    continue;
                }



                string handInfo = "Hand " + h.ToString() + "\r\n";
                string folded   = GetFolded(nodes[h]);

                handInfo += folded + "\r\n";

                handsC += GetFoldedCount(nodes[h]);
                handsR += GetRoundFingers(nodes[h]);

                string rounded = GetRoundFingers(nodes[h]);
                handInfo += "\r\n" + GetRoundFingers(nodes[h]);
                handInfo += "\r\n" + getProportions(nodes[h]);

                info += handInfo + "\r\n";
            }

            string letter = "?";

            if (handsC == "41")
            {
                letter = findVovel(nodes, GetTip(nodes[1]), handsC);
            }
            if (handsC == "42")
            {
                letter = findVovel(nodes, GetTip(nodes[1]), handsC);
            }
            if (handsC == "43")
            {
                letter = findVovel(nodes, GetTip(nodes[1]), handsC);
            }


            if (letter == "?")
            {
                /*  int leftHandIndexTip = GetTip(nodes[0]);
                 * int rightHandIndexTip = GetTip(nodes[1]);
                 *
                 * PXCMPoint3DF32 leftIndex = nodes[0][5 + 4 * leftHandIndexTip].positionWorld;
                 * PXCMPoint3DF32 rightIndex = nodes[1][5 + 4 * rightHandIndexTip].positionWorld;
                 *
                 * float FDistance = Distance(leftIndex, rightIndex);
                 * bool isF = false;
                 *
                 * if (FDistance < 1000)
                 * {
                 *    isF = true;
                 * }*/

                letter = GetLetter(handsR, handsC);
            }

            info = reversed.ToString() + "\tLetter - " + letter + "\r\n" + "Hands - " + handsR + handsC + "\r\n" + info;
            form.UpdateLetter(letter);
            if (letter != "?")
            {
                form.UpdateKaraoke(letter);
            }
            form.UpdateGestureInfo(info);
        }