Exemplo n.º 1
0
        public void CreateVectorBetween(char firstLetter, char secondLetter)
        {
            Console.WriteLine("{0} {1}", firstLetter, secondLetter);
            PointOnGrid p1 = null;
            PointOnGrid p2 = null;

            foreach (PointOnGrid p in points)
            {
                if (p != null)
                {
                    if (p.Name.ToLower()[0] == firstLetter)
                    {
                        p1 = p;
                    }
                    if (p.Name.ToLower()[0] == secondLetter)
                    {
                        p2 = p;
                    }
                }
            }
            if (p1 != null && p2 != null)
            {
                RegisterVector(new VectorLine(p1, p2));
            }
        }
Exemplo n.º 2
0
        public void RegisterPoint(PointOnGrid p)
        {
            bool shouldAddPoint = true;

            foreach (PointOnGrid oP in points)
            {
                if (firstPoint)
                {
                    points[pointID] = p;
                    pointID++;
                    firstPoint     = false;
                    shouldAddPoint = false;
                }
                else if (oP != null)
                {
                    for (int i = 0; i < pointID; i++)
                    {
                        if (points[i].X == p.X && points[i].Y == p.Y)
                        {
                            shouldAddPoint = false;
                            break;
                        }
                    }
                }
            }

            if (shouldAddPoint)
            {
                points[pointID] = p;
                pointID++;
            }

            Console.WriteLine(pointID);
            if (pointID == 2)
            {
                RegisterVector(new VectorLine(points[0], points[1]));
            }
        }
Exemplo n.º 3
0
        public PointOnGrid CreatePoint(int x, int y)
        {
            PointOnGrid point = new PointOnGrid(SnapPointOnGrid(x, y), alphabet[pointID].ToString());

            return(point);
        }
Exemplo n.º 4
0
 public VectorLine(PointOnGrid p1, PointOnGrid p2)
 {
     Point1 = p1;
     Point2 = p2;
 }