コード例 #1
0
ファイル: MainController.cs プロジェクト: hawkingrei/PPKinecT
 public void DoEdgeDetecting()
 {
     if (Status == MainStatus.EdgeDetecting && !edgeCooling)
     {
         if (IsStable(rightHandQueue, EDGE_TOLERANCE, EDGE_COUNT) &&
             IsStable(rightElbowQueue, EDGE_TOLERANCE, EDGE_COUNT))
         {
             SkeletonPoint handPoint = rightHandQueue.Last().Position;
             Vector3f handVec = new Vector3f(handPoint.X, handPoint.Y, handPoint.Z);
             SkeletonPoint elbowPoint = rightElbowQueue.Last().Position;
             Vector3f elbowVec = new Vector3f(elbowPoint.X, elbowPoint.Y, elbowPoint.Z);
             if (kCalibrator.SetScreenPosition(handVec, elbowVec))
             {
                 // all screen position setted
                 mainWindow.textBlock.Text = "Waiting for PPT";
                 Status = MainStatus.PptWaiting;
                 pptDetectTimer.Start();
                 edgeTimer.Stop();
             }
             else
             {
                 mainWindow.textBlock.Text = "Please wait No. " + kCalibrator.ScreenSetted();
     ;
                 // point to another screen edge, using cooling time to prevent pointing to the same point
                 edgeTimer.Start();
                 edgeCooling = true;
             }
             ClearQueue();
         }
     }
 }
コード例 #2
0
ファイル: MainController.cs プロジェクト: hawkingrei/PPKinecT
 /// <summary>
 /// Distance of two SkeletonPoints
 /// </summary>
 /// <param name="point1">Point 1</param>
 /// <param name="point2">Point 2</param>
 /// <returns>Distance of two points</returns>
 private float Distance(SkeletonPoint point1, SkeletonPoint point2)
 {
     Vector3f vector = new Vector3f(point1.X - point2.X,
         point1.Y - point2.Y, point1.Z - point2.Z);
     return vector.Modulus();
 }
コード例 #3
0
ファイル: MainController.cs プロジェクト: hawkingrei/PPKinecT
 private Vector3f JointToVector3f(Joint joint)
 {
     Vector3f vec = new Vector3f();
     vec.X = joint.Position.X;
     vec.Y = joint.Position.Y;
     vec.Z = joint.Position.Z;
     return vec;
 }