public List <Point> GetPoints(PointIterationDirection direction = PointIterationDirection.UpDown) { List <Point> resultList = new List <Point>(); if (direction == PointIterationDirection.UpDown) { for (int x = X; x < X + Width; x++) { for (int y = Y; y < Y + Height; y++) { resultList.Add(new Point(x, y)); } } } else { for (int y = Y; y < Y + Height; y++) { for (int x = X; x < X + Width; x++) { resultList.Add(new Point(x, y)); } } } return(resultList); }
public IEnumerable <Coordinate> GetCoordinates(PointIterationDirection direction = PointIterationDirection.UpDown) { if (direction == PointIterationDirection.UpDown) { for (int c = X; c < X + Width; c++) { for (int r = Y; r < Y + Height; r++) { yield return(new Coordinate(r, c)); } } } else { for (int r = Y; r < Y + Height; r++) { for (int c = X; c < X + Width; c++) { yield return(new Coordinate(r, c)); } } } }
public IEnumerable <Point> GetPoints(PointIterationDirection direction = PointIterationDirection.UpDown) { if (direction == PointIterationDirection.UpDown) { for (int x = X; x < X + Width; x++) { for (int y = Y; y < Y + Height; y++) { yield return(new Point(x, y)); } } } else { for (int y = Y; y < Y + Height; y++) { for (int x = X; x < X + Width; x++) { yield return(new Point(x, y)); } } } }