Exemplo n.º 1
0
        /*
         *  Recognize a Mouse_Data type gesture
         */
        public string Recognize(ref Mouse_Data s, bool Consider_Stroke = true)
        {
            Penny_Pincher_Data P = new Penny_Pincher_Data(s);

            s.Label = Recognize(ref P, Consider_Stroke);
            return(s.Label);
        }
Exemplo n.º 2
0
        /*
         * The loading of the collected data from the data file
         */
        public void Construct_From_Stream(BinaryReader sr)
        {
            Loaded = true;
            int cnt = sr.ReadInt32();
            Penny_Pincher_Data s;

            for (int i = 0; i < cnt; i++)
            {
                s = new Penny_Pincher_Data();
                s.Construct_From_Stream(sr);
                Datas.Add(s);
            }
        }
Exemplo n.º 3
0
        /*
         *  Recognize a Penny_Pincher_Data type Gesture
         */

        public string Recognize(ref Penny_Pincher_Data Data, bool Consider_Stroke = true)
        {
            double MaxS = double.MinValue;
            double T;
            string L = "";

            foreach (Penny_Pincher_Data D in Datas)
            {
                if (MaxS < (T = Calculate_Score(Data, D, Consider_Stroke)))
                {
                    MaxS = T;
                    L    = D.Get_Label();
                }
            }
            return(L);
        }
Exemplo n.º 4
0
        private double Calculate_Score(Penny_Pincher_Data G, Penny_Pincher_Data D, bool Consider_Stroke = true)
        {
            double        S = 0;
            List <Vector> V1 = G.Get_Vectors(), V2 = D.Get_Vectors();

            if (V1.Count != 0 && V2.Count != 0 && (!Consider_Stroke || G.Strokes == D.Strokes))
            {
                for (int i = 0; i < MainWindow.DIVISION - 1; i++)
                {
                    S += V1[i] * V2[i];
                }
            }
            else
            {
                return(double.MinValue);
            }
            return(S);
        }