public bool Contains(RectPoint point) { var bigPoint = GetBigPoint(point); var smallPoint = GetSmallPoint(point); if (bigGrid.Contains(bigPoint)) { return(bigGrid[bigPoint].Contains(smallPoint)); } return(false); }
public static IEnumerable <RectPoint> GetNeighborHood <T>(this RectGrid <T> grid, RectPoint center, int radius) { for (int i = center.X - radius; i <= center.X + radius; i++) { for (int j = center.Y - radius; j <= center.Y + radius; j++) { var neighborhoodPoint = new RectPoint(i, j); if (grid.Contains(neighborhoodPoint)) { yield return(neighborhoodPoint); } } } }