public string JointValueDebug(bool isNormalised, Joint joint)
 {
     if (isNormalised)
     {
         return("BODY:: " +
                Index +
                "  |  TRACKING ID:: " +
                BodyClass.TrackingId +
                "  |  JOINT TYPE:: " +
                joint.JointType +
                "  |  JOINT POSITION:: " +
                NormaliseBodyCoords.Normalise(GetAllJointPositions(), (int)joint.JointType));
     }
     else
     {
         return("BODY:: " +
                Index +
                "  |  TRACKING ID:: " +
                BodyClass.TrackingId +
                "  |  JOINT TYPE:: " +
                joint.JointType +
                "  |  JOINT POSITION:: " +
                GetJointPosition(joint.JointType));
     }
 }
Ejemplo n.º 2
0
        private bool System2(List <Vector3> liveInput, IEnumerable <Vector3> target)
        {
            var i = 0;

            liveInput = NormaliseBodyCoords.Normalise(liveInput);
            foreach (var joint in target)
            {
                // compare x
                // compare y

                // continues going through the list of bones till one is off
                //once it goes through the whole list then it its true
                // or else it returns false

                if (!CheckIfVectorIsApproxEqual(liveInput[i], joint))
                {
                    Debug.Log(false);
                    return(false);
                }
                i++;
            }

            Debug.Log(true);
            return(true);
        }
Ejemplo n.º 3
0
        private void System3(List <Vector3> liveInput, IEnumerable <Vector3> bodyTarget)
        {
            /*
             * Compares each joint within the live input to the corresponding joint within the target body
             * and checks how far close the 2 directions are to each other
             */
            var i = 0;

            liveInput = NormaliseBodyCoords.Normalise(liveInput);
            foreach (var joint in bodyTarget)
            {
                var dirDif = CompareVectorDir(liveInput[i], joint);
                if (dirDif < DirCompareTolerance)
                {
                    Debug.Log(" joint " + (JointType)i + " is off by a direction product of: " + (DirCompareTolerance - dirDif));
                }
                i++;
            }
        }
Ejemplo n.º 4
0
 private Characters?System4(List <Vector3> liveInput, IList <List <Vector3> > targets)
 {
     /* take in an input of a list of Vector3 lists called A and a single vector3 list called B
      * compare each value in B to every value in each list of A
      * by Using the System2 function to say whether the joints are close or not
      *
      * if it is a match return
      */
     liveInput = NormaliseBodyCoords.Normalise(liveInput);
     foreach (var targetBody in targets)
     {
         // ReSharper disable once PossibleMultipleEnumeration
         if (System2(targetBody, liveInput))
         {
             return((Characters)targets.IndexOf(targetBody));
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
        public void GetAndSaveValues()
        {
            var normalizedPositions = new List <Vector3>();
            var positions           = new List <string>();
            var debug = new List <string>();


            if (BodyWrappers == null)
            {
                return;
            }

            foreach (var body in BodyWrappers)
            {
                normalizedPositions.Clear();
                positions.Clear();
                debug.Clear();
                foreach (var joint in body.BodyClass.Joints)
                {
                    normalizedPositions = NormaliseBodyCoords.Normalise(body.GetAllJointPositions());

                    positions.Add(body.GetJointPosition(joint.Key).ToString());
                    // checks between normalised values or normal values.
                    debug.Add(normDebug
                        ? body.JointValueDebug(true, joint.Value)
                        : body.JointValueDebug(false, joint.Value)
                              );
                }

                switch (typeToPrint)
                {
                case TypeToPrint.FullDebug:
                {
                    Print(TypeToPrint.FullDebug, debug);
                    //var readText = File.ReadAllText(dataFile.path + dataFile.debugFileName);
                    //Debug.Log(readText);
                    break;
                }

                case TypeToPrint.Vectors:
                {
                    Print(TypeToPrint.Vectors, positions);
                    //var readText = File.ReadAllText(dataFile.path + dataFile.vectorFileName);
                    //Debug.Log(readText);
                    break;
                }

                case TypeToPrint.VectorsNormalised:
                {
                    Print(TypeToPrint.VectorsNormalised, normalizedPositions);
                    //var readText = File.ReadAllText(dataFile.path + dataFile.normVecFileName);
                    //Debug.Log(readText);
                    break;
                }

                case TypeToPrint.All:
                {
                    Print(TypeToPrint.VectorsNormalised, normalizedPositions);
                    Print(TypeToPrint.Vectors, positions);
                    Print(TypeToPrint.FullDebug, debug);
                    break;
                }

                case TypeToPrint.NewCharacter:


                    Print(TypeToPrint.NewCharacter, normalizedPositions);
                    break;

                default:
                {
                    Debug.LogError("NO PRINT TYPE SET");
                    break;
                }
                }
            }
        }