Ejemplo n.º 1
0
 private void GetLocalPointsInArea(Bounding2DBox area, ref List <Point2Int> list)
 {
     for (int i = 0; i < Points.Length; i++)
     {
         if (area.ContainsPoint(Points[i]))
         {
             list.Add(Points[i]);
         }
     }
 }
Ejemplo n.º 2
0
        public QuadTree(Bounding2DBox boundingBox, int maxItems, IQuadTreeDivisionStrategy divisionStrategy)
        {
            if (divisionStrategy == null)
            {
                throw new ArgumentNullException(nameof(divisionStrategy));
            }

            MaxItems         = maxItems;
            DivisionStrategy = divisionStrategy;
            BoundingBox      = boundingBox;
            Points           = new Point2Int[0];
        }
Ejemplo n.º 3
0
        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);
            }
        }