public List <NamedPoint> GetPointsInArea(Rectangle area) { List <NamedPoint> allPoints = new List <NamedPoint>(); if (this.Bounds.IntersectsWith(area) == false) { return(allPoints); } if (Point != null) { bool pointInArea = Program.PointWithinSquare(area, Point); if (pointInArea == true) { allPoints.Add(Point); } } if (NorthWest == null) { return(allPoints); } allPoints.AddRange(NorthWest.GetPointsInArea(area)); allPoints.AddRange(NorthEast.GetPointsInArea(area)); allPoints.AddRange(SouthWest.GetPointsInArea(area)); allPoints.AddRange(SouthEast.GetPointsInArea(area)); return(allPoints); }
public void GetPointsInArea(Bounding2DBox area, ref List <Point2Int> list) { if (!BoundingBox.DoesBoundaryBoxIntersect(area)) { return; } if (Points != null) { GetLocalPointsInArea(area, ref list); } else { NorthEast.GetPointsInArea(area, ref list); NorthWest.GetPointsInArea(area, ref list); SouthWest.GetPointsInArea(area, ref list); SouthEast.GetPointsInArea(area, ref list); } }