public QuadTree(RectangleF bounds, int maxLevels, bool isPointData) { this.isPointData = isPointData; this.maxLevels = maxLevels; rootNode = new QTNode(bounds, 0, this); }
private void CreateChildren() { children = new QTNode[4]; children[TL] = new QTNode(RectangleF.FromLTRB(_bounds.Left, _bounds.Top, 0.5f * (_bounds.Left + _bounds.Right), 0.5f * (_bounds.Top + _bounds.Bottom)), Level + 1, tree); children[TR] = new QTNode(RectangleF.FromLTRB(0.5f * (_bounds.Left + _bounds.Right), _bounds.Top, _bounds.Right, 0.5f * (_bounds.Top + _bounds.Bottom)), Level + 1, tree); children[BL] = new QTNode(RectangleF.FromLTRB(_bounds.Left, 0.5f * (_bounds.Top + _bounds.Bottom), 0.5f * (_bounds.Left + _bounds.Right), _bounds.Bottom), Level + 1, tree); children[BR] = new QTNode(RectangleF.FromLTRB(0.5f * (_bounds.Left + _bounds.Right), 0.5f * (_bounds.Top + _bounds.Bottom), _bounds.Right, _bounds.Bottom), Level + 1, tree); }