Exemplo n.º 1
0
        public IShape GetByName(string name)
        {
            Point initialPoint = _stringConverter.GetStartingPoint(name);

            int iX = initialPoint.X;
            int iY = initialPoint.Y;

            if (iX % 2 == 0)
            {
                Ax = (iX / 2) - 1;
                Ay = iY;

                Bx = (iX / 2);
                By = iY;

                Cx = (iX / 2);
                Cy = iY + 1;
            }
            else
            {
                Ax = (iX - 1) / 2;
                Ay = iY;

                Bx = (iX - 1) / 2;
                By = iY + 1;

                Cx = (iX + 1) / 2;
                Cy = iY + 1;
            }

            PointA.X = Ax;
            PointA.Y = Ay;
            PointB.X = Bx;
            PointB.Y = By;
            PointC.X = Cx;
            PointC.Y = Cy;

            List <Point> Points = new List <Point>
            {
                PointA,
                PointB,
                PointC
            };

            Triangle triangle = new Triangle(name)
            {
                Coordinates = Points
            };

            return(triangle);
        }