Example #1
0
        public static IEnumerable <Vector2> Enumerate(Int32 radiusX, Int32 radiusY, Boolean filled = false)
        {
            // preliminary check - zero point
            if (radiusX == 0 || radiusY == 0)
            {
                return(Enumerable.Empty <Vector2>());
            }

            // preliminary check - horizontal line
            if (radiusY == 1 || radiusY == -1)
            {
                return(LineRasterizer.EnumerateHorizontalLine(radiusX));
            }

            // preliminary check - vertical line
            if (radiusX == 1 || radiusX == -1)
            {
                return(LineRasterizer.EnumerateVerticalLine(radiusY));
            }

            // potencial problem - negative radius X
            if (radiusX < 0)
            {
                radiusX = -radiusX;
            }

            // potencial problem - negative radius Y
            if (radiusY < 0)
            {
                radiusY = -radiusY;
            }

            // enumerates ellipse
            return(EnumerateEllipse(radiusX, radiusY, filled));
        }