Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1.  public static Boolean SwitchGenre()
  2.         {
  3.             Vector2 right = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.ElbowRight);
  4.             Vector2 left = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.ElbowLeft);
  5.             Vector2 hipCenter = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.HipCenter);
  6.             Vector2 hipLeft = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.HipLeft);
  7.             Vector2 head = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.Head);
  8.  
  9.             float distCenter = Math.Abs(right.X - hipCenter.X);
  10.             bool handAtHip = false;
  11.             float tol = 20;
  12.             if (Math.Abs(left.X - hipLeft.X) <= 100 && Math.Abs(left.Y - hipLeft.Y) <= 70 && Math.Abs(hipCenter.Y - right.Y) >= 60)
  13.             {
  14.                 handAtHip = true;
  15.             }
  16.             //Console.WriteLine("left x:" + Math.Abs(left.X - hipLeft.X) + ", left Y:" + Math.Abs(left.Y - hipLeft.Y) + " right hand  y: " + Math.Abs(hipCenter.Y - left.Y));
  17.             // Console.WriteLine("befor" + distCenter);
  18.             if (!swipeParts[0] && handAtHip && distCenter >= 140)
  19.             {
  20.                 //Console.WriteLine("start" + distCenter);
  21.                 swipeParts[0] = true;
  22.                 return false;
  23.             }
  24.             if (swipeParts[0] && !swipeParts[1] && handAtHip && distCenter <= 10)
  25.             {
  26.                 //Console.WriteLine("middle" + distCenter);
  27.                 swipeParts[1] = true;
  28.                 return false;
  29.             }
  30.             if (swipeParts[0] && swipeParts[1] && !swipeParts[2] && handAtHip && distCenter >= 140)
  31.             {
  32.                 swipeParts[2] = true;
  33.                 matrixMode = true;
  34.                 fireSwipe();
  35.                 return true;
  36.             }
  37.             else
  38.             {
  39.                 return false;
  40.             }
  41.  
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement