protected Sector(int level, QuadTreeRect rect, IQuadTreeObjectBounds <T> objectBounds, int maxObjects, int maxLevel) { Level = level; Rect = rect; ObjectBounds = objectBounds; MaxObjects = maxObjects; MaxLevel = maxLevel; }
/// <summary> Initializes a new instance of the <see cref="T:UltimateQuadTree.QuadTree`1"></see> class with initial coordinates. </summary> /// <param name="x">The x-coordinate of the upper-left corner of the boundary rectangle.</param> /// <param name="y">The y-coordinate of the upper-left corner of the boundary rectangle.</param> /// <param name="width">The width of the boundary rectangle.</param> /// <param name="height">The height of the boundary rectangle.</param> /// <param name="objectBounds">The set of methods for getting boundaries of an element.</param> /// <param name="maxObjects">The max number of elements in one rectangle. The default is 10.</param> /// <param name="maxLevel">The max depth level. The default is 5. </param> public QuadTree(double x, double y, double width, double height, IQuadTreeObjectBounds <T> objectBounds, int maxObjects = 10, int maxLevel = 5) { if (objectBounds == null) { throw new ArgumentNullException(nameof(objectBounds)); } MaxObjects = maxObjects; MaxLevel = maxLevel; MainRect = new QuadTreeRect(x, y, width, height); _objectBounds = objectBounds; _rootSector = new LeafSector <T>(0, MainRect, objectBounds, maxObjects, maxLevel); }
public LeafSector(int level, QuadTreeRect rect, IQuadTreeObjectBounds <T> objectBounds, int maxObjects, int maxLevel) : base(level, rect, objectBounds, maxObjects, maxLevel) { }
public NodeSector(int level, QuadTreeRect rect, IQuadTreeObjectBounds <T> objectBounds, int maxObjects, int maxLevel) : base(level, rect, objectBounds, maxObjects, maxLevel) { CreateLeaves(); }