diff -r f4e52a4c34b3 -r d40f84d77db4 middleware/src/Tracking/Gestures/JumpDetector.cs --- a/middleware/src/Tracking/Gestures/JumpDetector.cs Thu Mar 15 13:35:25 2012 +0100 +++ b/middleware/src/Tracking/Gestures/JumpDetector.cs Mon Mar 19 10:21:56 2012 +0100 @@ -8,6 +8,8 @@ * * Fonctionnalités : Permet de détecter si l'utilisateur a sauté, en se basant sur * des règles appliquées à la positions des noeuds dans le temps. + * + * P.S : Cette partie est encore en développement. */ using System; @@ -61,13 +63,14 @@ */ //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules. - refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y); + refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y); //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière). int beginIdx = localHistory.Count - indexesToCheck + 1; int middleIdx = localHistory.Count - indexesToCheck / 2; - bool middleOK = true, topOfJump = false; + //bool middleOK = true + bool topOfJump = false; @@ -75,14 +78,14 @@ for (int i = beginIdx ; i < localHistory.Count ; i++) { - if (localHistory[i][handRightID].Position.Y < localHistory[beginIdx][handRightID].Position.Y + refDistance && - localHistory[i - 1][handRightID].Position.Y < localHistory[i][handRightID].Position.Y) + if (localHistory[i][(int)JointType.HandRight].Position.Y < localHistory[beginIdx][(int)JointType.HandRight].Position.Y + refDistance && + localHistory[i - 1][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.HandRight].Position.Y) { topOfJump = true; //Console.Out.WriteLine("TOP"); } - if (localHistory[i - 1][handRightID].Position.Y > localHistory[i][handRightID].Position.Y && !topOfJump) + if (localHistory[i - 1][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HandRight].Position.Y && !topOfJump) return false; //Si la position Y de la main est plus haute que la tête @@ -91,8 +94,8 @@ //OU si la nouvelle position X de la main est plus éloignée de la distance N par rapport à la première position X //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y //Alors la main en question ne fait pas de push. - if (localHistory[i-1][handRightID].Position.Y > localHistory[i][handRightID].Position.Y && - topOfJump || localHistory[i - 1][handRightID].Position.Y < localHistory[i][handRightID].Position.Y && + if (localHistory[i - 1][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HandRight].Position.Y && + topOfJump || localHistory[i - 1][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.HandRight].Position.Y && !topOfJump) return false; } @@ -109,14 +112,10 @@ //OU si la première position calculée de la main droite/gauche est sur le côté gauche/droit du corps //Alors on retourne faux. - //if( - //On supprime l'historique local. - //localHistory.Clear(Math.Abs(localHistory[i-1][handRightID].Position.Y)); - + debug.ExceptionLbl.Background = System.Windows.Media.Brushes.Yellow; - Console.WriteLine("{" + n++ + "}" + "JUMP"); - + return false; } }