private static void BuildKeyIdentify()
        {
            gesture = SingleForm.ChangeCoord(gesture, out double length, out double width);
            var lengthMinRectangle = length / 8;
            var widthMinRectangle  = width / 8;

            for (int i = 0; i < gesture.Count; i++)
            {
                int tempA = (int)Math.Truncate(gesture[i].X / lengthMinRectangle);
                tempA = (tempA != 8) ? tempA : 7;
                int tempB = (int)Math.Truncate(gesture[i].Y / widthMinRectangle);
                tempB = (tempB != 8) ? tempB : 7;
                key.Insert(i, tempA + 8 * tempB);
            }
        }
        /// <summary>
        /// Находит идеальный жест ( из точек упрощенных)
        /// </summary>
        /// <returns> Индекс жеста из списка идеальных жестов</returns>
        public int WhatIsItIndex()
        {
            points = SingleForm.FitIntoSquare(points);
            double minDist = Int32.MaxValue;
            int    index   = -1;

            for (int i = 0; i < PGC.IdealGestures.Count; i++)
            {
                var temp = Distance.DistanceBetweenGesture(PGC.IdealGestures[i].Points, points);
                if (minDist > temp)
                {
                    index   = i;
                    minDist = temp;
                }
            }
            return(index);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Вписать в квадрат идеальный жест
 /// </summary>
 public void FitIntoSquare()
 {
     Points = SingleForm.FitIntoSquare(Points);
 }