public static IEnumerable <Point> EnumeratePointsAtManhattanDistance( this Point source, int distance, bool clockwise, Dir4 startDir = Dir4.N) { if (distance < 0) { throw new ArgumentException("distance must be nonnegative"); } if (!startDir.IsValid(false)) { throw new ArgumentException("startDir must be an orthogonal direction"); } return(source.PointsAtManhattanDistanceInternal(distance, clockwise, startDir)); }
public static IEnumerable <Point> EnumeratePointsByManhattanDistance( this Point source, bool clockwise, Dir4 startDir = Dir4.N) { if (!startDir.IsValid(false)) { throw new ArgumentException("startDir must be an orthogonal direction"); } for (int distance = 0; ; ++distance) { foreach (Point p in source.PointsAtManhattanDistanceInternal(distance, clockwise, startDir)) { yield return(p); } } }