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:Auios.QuadTree.QuadTree`1"></see> class.</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.</param> /// <param name="maxLevel">The max depth level.</param> /// <param name="currentLevel">The current depth level. Leave default if this is the root QuadTree.</param> public QuadTree(float x, float y, float width, float height, IQuadTreeObjectBounds <T> objectBounds, int maxObjects = 10, int maxLevel = 5, int currentLevel = 0) { Area = new QuadTreeRect(x, y, width, height); _objects = new HashSet <T>(); _objectBounds = objectBounds; CurrentLevel = currentLevel; MaxLevel = maxLevel; MaxObjects = maxObjects; _hasChildren = false; }
/// <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(); }
/// <summary> Initializes a new instance of the <see cref="T:UltimateQuadTree.QuadTree`1"></see> class. </summary> /// <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 width, double height, IQuadTreeObjectBounds <T> objectBounds, int maxObjects = 10, int maxLevel = 5) : this(0, 0, width, height, objectBounds, maxObjects, maxLevel) { }
/// <summary>Initializes a new instance of the <see cref="T:Auios.QuadTree.QuadTree`1"></see> class.</summary> /// <param name="size">The size 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.</param> /// <param name="maxLevel">The max depth level.</param> /// <param name="currentLevel">The current depth level. Leave default if this is the root QuadTree.</param> public QuadTree(Vector2 size, IQuadTreeObjectBounds <T> objectBounds, int maxObjects = 10, int maxLevel = 5, int currentLevel = 0) : this(0, 0, size.X, size.Y, objectBounds, maxObjects, maxLevel, currentLevel) { }
/// <summary>Initializes a new instance of the <see cref="T:Auios.QuadTree.QuadTree`1"></see> class.</summary> /// <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.</param> /// <param name="maxLevel">The max depth level.</param> /// <param name="currentLevel">The current depth level. Leave default if this is the root QuadTree.</param> public QuadTree(float width, float height, IQuadTreeObjectBounds <T> objectBounds, int maxObjects = 10, int maxLevel = 5, int currentLevel = 0) : this(0, 0, width, height, objectBounds, maxObjects, maxLevel, currentLevel) { }