Exemple #1
0
        void steadydetector_NotSteady(object sender, SteadyEventArgs e)
        {
            // System.Console.WriteLine("NotSteday..");
            PointStatus pt = pointCollections[e.ID];

            // if ( pt.is_non_steady==false)
            {
                // pt.nonsteady_counter = 0;
                if (pt.is_clicked == true)
                {
                    pt.SetColor(Brushes.Red);
                }
                else
                {
                    pt.SetColor(Brushes.Green);
                }
                pt.is_non_steady = true;
                pt.is_triggered  = true;
                System.Console.WriteLine("Hand is moving..:");
            }
            //flrouter.ActiveListener = pointCtrl;
            if (is_steady == 1)
            {
                is_push_allow_counter = 0;
                is_push_allow         = 1;
                is_steady             = 0;
            }
        }
Exemple #2
0
        void steadydetector_Steady(object sender, SteadyEventArgs e)
        {
            //   System.Console.WriteLine("Steady Detected..");
            PointStatus      pt  = pointCollections[e.ID];
            HandPointContact hdc = null;

            is_steady = 1;
            for (int i = 0; i < HandPointBuffer.Count; i++)
            {
                hdc = HandPointBuffer[i] as HandPointContact;

                if (hdc.Id == e.ID)
                {
                    break;
                }
            }
            pt.is_non_steady = false;
            pt.SetColor(Brushes.Yellow);
            int     status = 0;
            Point3D hpoint = hdc.RowPoint;

            hpoint.Y = -hpoint.Y;
            Point3D pt3 = depthGen.ConvertRealWorldToProjective(hpoint);

            clipHandFromDepthMap(pt3);
            status = openpalm.isDetected(clipping, pt3);
            if (status == 1)
            {
                Console.WriteLine("OpenHand");
            }
            else if (status == 2)
            {
                Console.WriteLine("Close Hand");
            }
            Multitouch.Contracts.ContactState st = hdc.State;
            if (status == 1 && (st == Multitouch.Contracts.ContactState.Moved || st == Multitouch.Contracts.ContactState.New))
            {
                pt.SetColor(Brushes.Green);
                pt.steady_state = 1;
                pt.is_clicked   = false;

                System.Console.WriteLine("Release...");
                hdc.Update(pt.steady_point.X, pt.steady_point.Y, Multitouch.Contracts.ContactState.Removed);
                inputProvider.EnqueueContact(hdc, Multitouch.Contracts.ContactState.Removed);

                pt.steady_point = pt.Location;
            }
            else if (status == 2 && st == Multitouch.Contracts.ContactState.Removed)
            {
                System.Console.WriteLine("Grab...");
                pt.steady_state = 2;
                pt.is_clicked   = true;
                pt.SetColor(Brushes.Red);
                hdc.Update(pt.steady_point.X, pt.steady_point.Y, Multitouch.Contracts.ContactState.New);
                inputProvider.EnqueueContact(hdc, Multitouch.Contracts.ContactState.New);
                pt.steady_point = pt.Location;
            }
            else
            {
                pt.steady_point = pt.Location;
            }
        }